{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53Domains.Types.DnssecSigningAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Domains.Types.DnssecSigningAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Information about a delegation signer (DS) record that was created in
-- the registry by
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_AssociateDelegationSignerToDomain.html AssociateDelegationSignerToDomain>.
--
-- /See:/ 'newDnssecSigningAttributes' smart constructor.
data DnssecSigningAttributes = DnssecSigningAttributes'
  { -- | Algorithm which was used to generate the digest from the public key.
    DnssecSigningAttributes -> Maybe Int
algorithm :: Prelude.Maybe Prelude.Int,
    -- | Defines the type of key. It can be either a KSK (key-signing-key, value
    -- 257) or ZSK (zone-signing-key, value 256). Using KSK is always
    -- encouraged. Only use ZSK if your DNS provider isn\'t Route 53 and you
    -- don’t have KSK available.
    --
    -- If you have KSK and ZSK keys, always use KSK to create a delegations
    -- signer (DS) record. If you have ZSK keys only – use ZSK to create a DS
    -- record.
    DnssecSigningAttributes -> Maybe Int
flags :: Prelude.Maybe Prelude.Int,
    -- | The base64-encoded public key part of the key pair that is passed to the
    -- registry.
    DnssecSigningAttributes -> Maybe Text
publicKey :: Prelude.Maybe Prelude.Text
  }
  deriving (DnssecSigningAttributes -> DnssecSigningAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnssecSigningAttributes -> DnssecSigningAttributes -> Bool
$c/= :: DnssecSigningAttributes -> DnssecSigningAttributes -> Bool
== :: DnssecSigningAttributes -> DnssecSigningAttributes -> Bool
$c== :: DnssecSigningAttributes -> DnssecSigningAttributes -> Bool
Prelude.Eq, ReadPrec [DnssecSigningAttributes]
ReadPrec DnssecSigningAttributes
Int -> ReadS DnssecSigningAttributes
ReadS [DnssecSigningAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnssecSigningAttributes]
$creadListPrec :: ReadPrec [DnssecSigningAttributes]
readPrec :: ReadPrec DnssecSigningAttributes
$creadPrec :: ReadPrec DnssecSigningAttributes
readList :: ReadS [DnssecSigningAttributes]
$creadList :: ReadS [DnssecSigningAttributes]
readsPrec :: Int -> ReadS DnssecSigningAttributes
$creadsPrec :: Int -> ReadS DnssecSigningAttributes
Prelude.Read, Int -> DnssecSigningAttributes -> ShowS
[DnssecSigningAttributes] -> ShowS
DnssecSigningAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnssecSigningAttributes] -> ShowS
$cshowList :: [DnssecSigningAttributes] -> ShowS
show :: DnssecSigningAttributes -> String
$cshow :: DnssecSigningAttributes -> String
showsPrec :: Int -> DnssecSigningAttributes -> ShowS
$cshowsPrec :: Int -> DnssecSigningAttributes -> ShowS
Prelude.Show, forall x. Rep DnssecSigningAttributes x -> DnssecSigningAttributes
forall x. DnssecSigningAttributes -> Rep DnssecSigningAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DnssecSigningAttributes x -> DnssecSigningAttributes
$cfrom :: forall x. DnssecSigningAttributes -> Rep DnssecSigningAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DnssecSigningAttributes' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'algorithm', 'dnssecSigningAttributes_algorithm' - Algorithm which was used to generate the digest from the public key.
--
-- 'flags', 'dnssecSigningAttributes_flags' - Defines the type of key. It can be either a KSK (key-signing-key, value
-- 257) or ZSK (zone-signing-key, value 256). Using KSK is always
-- encouraged. Only use ZSK if your DNS provider isn\'t Route 53 and you
-- don’t have KSK available.
--
-- If you have KSK and ZSK keys, always use KSK to create a delegations
-- signer (DS) record. If you have ZSK keys only – use ZSK to create a DS
-- record.
--
-- 'publicKey', 'dnssecSigningAttributes_publicKey' - The base64-encoded public key part of the key pair that is passed to the
-- registry.
newDnssecSigningAttributes ::
  DnssecSigningAttributes
newDnssecSigningAttributes :: DnssecSigningAttributes
newDnssecSigningAttributes =
  DnssecSigningAttributes'
    { $sel:algorithm:DnssecSigningAttributes' :: Maybe Int
algorithm =
        forall a. Maybe a
Prelude.Nothing,
      $sel:flags:DnssecSigningAttributes' :: Maybe Int
flags = forall a. Maybe a
Prelude.Nothing,
      $sel:publicKey:DnssecSigningAttributes' :: Maybe Text
publicKey = forall a. Maybe a
Prelude.Nothing
    }

-- | Algorithm which was used to generate the digest from the public key.
dnssecSigningAttributes_algorithm :: Lens.Lens' DnssecSigningAttributes (Prelude.Maybe Prelude.Int)
dnssecSigningAttributes_algorithm :: Lens' DnssecSigningAttributes (Maybe Int)
dnssecSigningAttributes_algorithm = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnssecSigningAttributes' {Maybe Int
algorithm :: Maybe Int
$sel:algorithm:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
algorithm} -> Maybe Int
algorithm) (\s :: DnssecSigningAttributes
s@DnssecSigningAttributes' {} Maybe Int
a -> DnssecSigningAttributes
s {$sel:algorithm:DnssecSigningAttributes' :: Maybe Int
algorithm = Maybe Int
a} :: DnssecSigningAttributes)

-- | Defines the type of key. It can be either a KSK (key-signing-key, value
-- 257) or ZSK (zone-signing-key, value 256). Using KSK is always
-- encouraged. Only use ZSK if your DNS provider isn\'t Route 53 and you
-- don’t have KSK available.
--
-- If you have KSK and ZSK keys, always use KSK to create a delegations
-- signer (DS) record. If you have ZSK keys only – use ZSK to create a DS
-- record.
dnssecSigningAttributes_flags :: Lens.Lens' DnssecSigningAttributes (Prelude.Maybe Prelude.Int)
dnssecSigningAttributes_flags :: Lens' DnssecSigningAttributes (Maybe Int)
dnssecSigningAttributes_flags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnssecSigningAttributes' {Maybe Int
flags :: Maybe Int
$sel:flags:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
flags} -> Maybe Int
flags) (\s :: DnssecSigningAttributes
s@DnssecSigningAttributes' {} Maybe Int
a -> DnssecSigningAttributes
s {$sel:flags:DnssecSigningAttributes' :: Maybe Int
flags = Maybe Int
a} :: DnssecSigningAttributes)

-- | The base64-encoded public key part of the key pair that is passed to the
-- registry.
dnssecSigningAttributes_publicKey :: Lens.Lens' DnssecSigningAttributes (Prelude.Maybe Prelude.Text)
dnssecSigningAttributes_publicKey :: Lens' DnssecSigningAttributes (Maybe Text)
dnssecSigningAttributes_publicKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnssecSigningAttributes' {Maybe Text
publicKey :: Maybe Text
$sel:publicKey:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Text
publicKey} -> Maybe Text
publicKey) (\s :: DnssecSigningAttributes
s@DnssecSigningAttributes' {} Maybe Text
a -> DnssecSigningAttributes
s {$sel:publicKey:DnssecSigningAttributes' :: Maybe Text
publicKey = Maybe Text
a} :: DnssecSigningAttributes)

instance Prelude.Hashable DnssecSigningAttributes where
  hashWithSalt :: Int -> DnssecSigningAttributes -> Int
hashWithSalt Int
_salt DnssecSigningAttributes' {Maybe Int
Maybe Text
publicKey :: Maybe Text
flags :: Maybe Int
algorithm :: Maybe Int
$sel:publicKey:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Text
$sel:flags:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
$sel:algorithm:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
algorithm
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
flags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicKey

instance Prelude.NFData DnssecSigningAttributes where
  rnf :: DnssecSigningAttributes -> ()
rnf DnssecSigningAttributes' {Maybe Int
Maybe Text
publicKey :: Maybe Text
flags :: Maybe Int
algorithm :: Maybe Int
$sel:publicKey:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Text
$sel:flags:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
$sel:algorithm:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
algorithm
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
flags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicKey

instance Data.ToJSON DnssecSigningAttributes where
  toJSON :: DnssecSigningAttributes -> Value
toJSON DnssecSigningAttributes' {Maybe Int
Maybe Text
publicKey :: Maybe Text
flags :: Maybe Int
algorithm :: Maybe Int
$sel:publicKey:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Text
$sel:flags:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
$sel:algorithm:DnssecSigningAttributes' :: DnssecSigningAttributes -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Algorithm" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
algorithm,
            (Key
"Flags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
flags,
            (Key
"PublicKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
publicKey
          ]
      )