{-# 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.SESV2.Types.DkimSigningAttributes
-- 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.SESV2.Types.DkimSigningAttributes 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
import Amazonka.SESV2.Types.DkimSigningKeyLength

-- | An object that contains configuration for Bring Your Own DKIM (BYODKIM),
-- or, for Easy DKIM
--
-- /See:/ 'newDkimSigningAttributes' smart constructor.
data DkimSigningAttributes = DkimSigningAttributes'
  { -- | [Bring Your Own DKIM] A private key that\'s used to generate a DKIM
    -- signature.
    --
    -- The private key must use 1024 or 2048-bit RSA encryption, and must be
    -- encoded using base64 encoding.
    DkimSigningAttributes -> Maybe (Sensitive Text)
domainSigningPrivateKey :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | [Bring Your Own DKIM] A string that\'s used to identify a public key in
    -- the DNS configuration for a domain.
    DkimSigningAttributes -> Maybe Text
domainSigningSelector :: Prelude.Maybe Prelude.Text,
    -- | [Easy DKIM] The key length of the future DKIM key pair to be generated.
    -- This can be changed at most once per day.
    DkimSigningAttributes -> Maybe DkimSigningKeyLength
nextSigningKeyLength :: Prelude.Maybe DkimSigningKeyLength
  }
  deriving (DkimSigningAttributes -> DkimSigningAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DkimSigningAttributes -> DkimSigningAttributes -> Bool
$c/= :: DkimSigningAttributes -> DkimSigningAttributes -> Bool
== :: DkimSigningAttributes -> DkimSigningAttributes -> Bool
$c== :: DkimSigningAttributes -> DkimSigningAttributes -> Bool
Prelude.Eq, Int -> DkimSigningAttributes -> ShowS
[DkimSigningAttributes] -> ShowS
DkimSigningAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DkimSigningAttributes] -> ShowS
$cshowList :: [DkimSigningAttributes] -> ShowS
show :: DkimSigningAttributes -> String
$cshow :: DkimSigningAttributes -> String
showsPrec :: Int -> DkimSigningAttributes -> ShowS
$cshowsPrec :: Int -> DkimSigningAttributes -> ShowS
Prelude.Show, forall x. Rep DkimSigningAttributes x -> DkimSigningAttributes
forall x. DkimSigningAttributes -> Rep DkimSigningAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DkimSigningAttributes x -> DkimSigningAttributes
$cfrom :: forall x. DkimSigningAttributes -> Rep DkimSigningAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DkimSigningAttributes' 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:
--
-- 'domainSigningPrivateKey', 'dkimSigningAttributes_domainSigningPrivateKey' - [Bring Your Own DKIM] A private key that\'s used to generate a DKIM
-- signature.
--
-- The private key must use 1024 or 2048-bit RSA encryption, and must be
-- encoded using base64 encoding.
--
-- 'domainSigningSelector', 'dkimSigningAttributes_domainSigningSelector' - [Bring Your Own DKIM] A string that\'s used to identify a public key in
-- the DNS configuration for a domain.
--
-- 'nextSigningKeyLength', 'dkimSigningAttributes_nextSigningKeyLength' - [Easy DKIM] The key length of the future DKIM key pair to be generated.
-- This can be changed at most once per day.
newDkimSigningAttributes ::
  DkimSigningAttributes
newDkimSigningAttributes :: DkimSigningAttributes
newDkimSigningAttributes =
  DkimSigningAttributes'
    { $sel:domainSigningPrivateKey:DkimSigningAttributes' :: Maybe (Sensitive Text)
domainSigningPrivateKey =
        forall a. Maybe a
Prelude.Nothing,
      $sel:domainSigningSelector:DkimSigningAttributes' :: Maybe Text
domainSigningSelector = forall a. Maybe a
Prelude.Nothing,
      $sel:nextSigningKeyLength:DkimSigningAttributes' :: Maybe DkimSigningKeyLength
nextSigningKeyLength = forall a. Maybe a
Prelude.Nothing
    }

-- | [Bring Your Own DKIM] A private key that\'s used to generate a DKIM
-- signature.
--
-- The private key must use 1024 or 2048-bit RSA encryption, and must be
-- encoded using base64 encoding.
dkimSigningAttributes_domainSigningPrivateKey :: Lens.Lens' DkimSigningAttributes (Prelude.Maybe Prelude.Text)
dkimSigningAttributes_domainSigningPrivateKey :: Lens' DkimSigningAttributes (Maybe Text)
dkimSigningAttributes_domainSigningPrivateKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DkimSigningAttributes' {Maybe (Sensitive Text)
domainSigningPrivateKey :: Maybe (Sensitive Text)
$sel:domainSigningPrivateKey:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe (Sensitive Text)
domainSigningPrivateKey} -> Maybe (Sensitive Text)
domainSigningPrivateKey) (\s :: DkimSigningAttributes
s@DkimSigningAttributes' {} Maybe (Sensitive Text)
a -> DkimSigningAttributes
s {$sel:domainSigningPrivateKey:DkimSigningAttributes' :: Maybe (Sensitive Text)
domainSigningPrivateKey = Maybe (Sensitive Text)
a} :: DkimSigningAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | [Bring Your Own DKIM] A string that\'s used to identify a public key in
-- the DNS configuration for a domain.
dkimSigningAttributes_domainSigningSelector :: Lens.Lens' DkimSigningAttributes (Prelude.Maybe Prelude.Text)
dkimSigningAttributes_domainSigningSelector :: Lens' DkimSigningAttributes (Maybe Text)
dkimSigningAttributes_domainSigningSelector = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DkimSigningAttributes' {Maybe Text
domainSigningSelector :: Maybe Text
$sel:domainSigningSelector:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe Text
domainSigningSelector} -> Maybe Text
domainSigningSelector) (\s :: DkimSigningAttributes
s@DkimSigningAttributes' {} Maybe Text
a -> DkimSigningAttributes
s {$sel:domainSigningSelector:DkimSigningAttributes' :: Maybe Text
domainSigningSelector = Maybe Text
a} :: DkimSigningAttributes)

-- | [Easy DKIM] The key length of the future DKIM key pair to be generated.
-- This can be changed at most once per day.
dkimSigningAttributes_nextSigningKeyLength :: Lens.Lens' DkimSigningAttributes (Prelude.Maybe DkimSigningKeyLength)
dkimSigningAttributes_nextSigningKeyLength :: Lens' DkimSigningAttributes (Maybe DkimSigningKeyLength)
dkimSigningAttributes_nextSigningKeyLength = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DkimSigningAttributes' {Maybe DkimSigningKeyLength
nextSigningKeyLength :: Maybe DkimSigningKeyLength
$sel:nextSigningKeyLength:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe DkimSigningKeyLength
nextSigningKeyLength} -> Maybe DkimSigningKeyLength
nextSigningKeyLength) (\s :: DkimSigningAttributes
s@DkimSigningAttributes' {} Maybe DkimSigningKeyLength
a -> DkimSigningAttributes
s {$sel:nextSigningKeyLength:DkimSigningAttributes' :: Maybe DkimSigningKeyLength
nextSigningKeyLength = Maybe DkimSigningKeyLength
a} :: DkimSigningAttributes)

instance Prelude.Hashable DkimSigningAttributes where
  hashWithSalt :: Int -> DkimSigningAttributes -> Int
hashWithSalt Int
_salt DkimSigningAttributes' {Maybe Text
Maybe (Sensitive Text)
Maybe DkimSigningKeyLength
nextSigningKeyLength :: Maybe DkimSigningKeyLength
domainSigningSelector :: Maybe Text
domainSigningPrivateKey :: Maybe (Sensitive Text)
$sel:nextSigningKeyLength:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe DkimSigningKeyLength
$sel:domainSigningSelector:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe Text
$sel:domainSigningPrivateKey:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
domainSigningPrivateKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainSigningSelector
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DkimSigningKeyLength
nextSigningKeyLength

instance Prelude.NFData DkimSigningAttributes where
  rnf :: DkimSigningAttributes -> ()
rnf DkimSigningAttributes' {Maybe Text
Maybe (Sensitive Text)
Maybe DkimSigningKeyLength
nextSigningKeyLength :: Maybe DkimSigningKeyLength
domainSigningSelector :: Maybe Text
domainSigningPrivateKey :: Maybe (Sensitive Text)
$sel:nextSigningKeyLength:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe DkimSigningKeyLength
$sel:domainSigningSelector:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe Text
$sel:domainSigningPrivateKey:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
domainSigningPrivateKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainSigningSelector
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DkimSigningKeyLength
nextSigningKeyLength

instance Data.ToJSON DkimSigningAttributes where
  toJSON :: DkimSigningAttributes -> Value
toJSON DkimSigningAttributes' {Maybe Text
Maybe (Sensitive Text)
Maybe DkimSigningKeyLength
nextSigningKeyLength :: Maybe DkimSigningKeyLength
domainSigningSelector :: Maybe Text
domainSigningPrivateKey :: Maybe (Sensitive Text)
$sel:nextSigningKeyLength:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe DkimSigningKeyLength
$sel:domainSigningSelector:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe Text
$sel:domainSigningPrivateKey:DkimSigningAttributes' :: DkimSigningAttributes -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DomainSigningPrivateKey" 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 (Sensitive Text)
domainSigningPrivateKey,
            (Key
"DomainSigningSelector" 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
domainSigningSelector,
            (Key
"NextSigningKeyLength" 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 DkimSigningKeyLength
nextSigningKeyLength
          ]
      )