{-# 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.Signer.Types.SigningConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Signer.Types.SigningConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Signer.Types.EncryptionAlgorithmOptions
import Amazonka.Signer.Types.HashAlgorithmOptions

-- | The configuration of a code signing operation.
--
-- /See:/ 'newSigningConfiguration' smart constructor.
data SigningConfiguration = SigningConfiguration'
  { -- | The encryption algorithm options that are available for a code signing
    -- job.
    SigningConfiguration -> EncryptionAlgorithmOptions
encryptionAlgorithmOptions :: EncryptionAlgorithmOptions,
    -- | The hash algorithm options that are available for a code signing job.
    SigningConfiguration -> HashAlgorithmOptions
hashAlgorithmOptions :: HashAlgorithmOptions
  }
  deriving (SigningConfiguration -> SigningConfiguration -> Bool
(SigningConfiguration -> SigningConfiguration -> Bool)
-> (SigningConfiguration -> SigningConfiguration -> Bool)
-> Eq SigningConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigningConfiguration -> SigningConfiguration -> Bool
$c/= :: SigningConfiguration -> SigningConfiguration -> Bool
== :: SigningConfiguration -> SigningConfiguration -> Bool
$c== :: SigningConfiguration -> SigningConfiguration -> Bool
Prelude.Eq, ReadPrec [SigningConfiguration]
ReadPrec SigningConfiguration
Int -> ReadS SigningConfiguration
ReadS [SigningConfiguration]
(Int -> ReadS SigningConfiguration)
-> ReadS [SigningConfiguration]
-> ReadPrec SigningConfiguration
-> ReadPrec [SigningConfiguration]
-> Read SigningConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigningConfiguration]
$creadListPrec :: ReadPrec [SigningConfiguration]
readPrec :: ReadPrec SigningConfiguration
$creadPrec :: ReadPrec SigningConfiguration
readList :: ReadS [SigningConfiguration]
$creadList :: ReadS [SigningConfiguration]
readsPrec :: Int -> ReadS SigningConfiguration
$creadsPrec :: Int -> ReadS SigningConfiguration
Prelude.Read, Int -> SigningConfiguration -> ShowS
[SigningConfiguration] -> ShowS
SigningConfiguration -> String
(Int -> SigningConfiguration -> ShowS)
-> (SigningConfiguration -> String)
-> ([SigningConfiguration] -> ShowS)
-> Show SigningConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigningConfiguration] -> ShowS
$cshowList :: [SigningConfiguration] -> ShowS
show :: SigningConfiguration -> String
$cshow :: SigningConfiguration -> String
showsPrec :: Int -> SigningConfiguration -> ShowS
$cshowsPrec :: Int -> SigningConfiguration -> ShowS
Prelude.Show, (forall x. SigningConfiguration -> Rep SigningConfiguration x)
-> (forall x. Rep SigningConfiguration x -> SigningConfiguration)
-> Generic SigningConfiguration
forall x. Rep SigningConfiguration x -> SigningConfiguration
forall x. SigningConfiguration -> Rep SigningConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SigningConfiguration x -> SigningConfiguration
$cfrom :: forall x. SigningConfiguration -> Rep SigningConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SigningConfiguration' 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:
--
-- 'encryptionAlgorithmOptions', 'signingConfiguration_encryptionAlgorithmOptions' - The encryption algorithm options that are available for a code signing
-- job.
--
-- 'hashAlgorithmOptions', 'signingConfiguration_hashAlgorithmOptions' - The hash algorithm options that are available for a code signing job.
newSigningConfiguration ::
  -- | 'encryptionAlgorithmOptions'
  EncryptionAlgorithmOptions ->
  -- | 'hashAlgorithmOptions'
  HashAlgorithmOptions ->
  SigningConfiguration
newSigningConfiguration :: EncryptionAlgorithmOptions
-> HashAlgorithmOptions -> SigningConfiguration
newSigningConfiguration
  EncryptionAlgorithmOptions
pEncryptionAlgorithmOptions_
  HashAlgorithmOptions
pHashAlgorithmOptions_ =
    SigningConfiguration' :: EncryptionAlgorithmOptions
-> HashAlgorithmOptions -> SigningConfiguration
SigningConfiguration'
      { $sel:encryptionAlgorithmOptions:SigningConfiguration' :: EncryptionAlgorithmOptions
encryptionAlgorithmOptions =
          EncryptionAlgorithmOptions
pEncryptionAlgorithmOptions_,
        $sel:hashAlgorithmOptions:SigningConfiguration' :: HashAlgorithmOptions
hashAlgorithmOptions = HashAlgorithmOptions
pHashAlgorithmOptions_
      }

-- | The encryption algorithm options that are available for a code signing
-- job.
signingConfiguration_encryptionAlgorithmOptions :: Lens.Lens' SigningConfiguration EncryptionAlgorithmOptions
signingConfiguration_encryptionAlgorithmOptions :: (EncryptionAlgorithmOptions -> f EncryptionAlgorithmOptions)
-> SigningConfiguration -> f SigningConfiguration
signingConfiguration_encryptionAlgorithmOptions = (SigningConfiguration -> EncryptionAlgorithmOptions)
-> (SigningConfiguration
    -> EncryptionAlgorithmOptions -> SigningConfiguration)
-> Lens
     SigningConfiguration
     SigningConfiguration
     EncryptionAlgorithmOptions
     EncryptionAlgorithmOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningConfiguration' {EncryptionAlgorithmOptions
encryptionAlgorithmOptions :: EncryptionAlgorithmOptions
$sel:encryptionAlgorithmOptions:SigningConfiguration' :: SigningConfiguration -> EncryptionAlgorithmOptions
encryptionAlgorithmOptions} -> EncryptionAlgorithmOptions
encryptionAlgorithmOptions) (\s :: SigningConfiguration
s@SigningConfiguration' {} EncryptionAlgorithmOptions
a -> SigningConfiguration
s {$sel:encryptionAlgorithmOptions:SigningConfiguration' :: EncryptionAlgorithmOptions
encryptionAlgorithmOptions = EncryptionAlgorithmOptions
a} :: SigningConfiguration)

-- | The hash algorithm options that are available for a code signing job.
signingConfiguration_hashAlgorithmOptions :: Lens.Lens' SigningConfiguration HashAlgorithmOptions
signingConfiguration_hashAlgorithmOptions :: (HashAlgorithmOptions -> f HashAlgorithmOptions)
-> SigningConfiguration -> f SigningConfiguration
signingConfiguration_hashAlgorithmOptions = (SigningConfiguration -> HashAlgorithmOptions)
-> (SigningConfiguration
    -> HashAlgorithmOptions -> SigningConfiguration)
-> Lens
     SigningConfiguration
     SigningConfiguration
     HashAlgorithmOptions
     HashAlgorithmOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningConfiguration' {HashAlgorithmOptions
hashAlgorithmOptions :: HashAlgorithmOptions
$sel:hashAlgorithmOptions:SigningConfiguration' :: SigningConfiguration -> HashAlgorithmOptions
hashAlgorithmOptions} -> HashAlgorithmOptions
hashAlgorithmOptions) (\s :: SigningConfiguration
s@SigningConfiguration' {} HashAlgorithmOptions
a -> SigningConfiguration
s {$sel:hashAlgorithmOptions:SigningConfiguration' :: HashAlgorithmOptions
hashAlgorithmOptions = HashAlgorithmOptions
a} :: SigningConfiguration)

instance Core.FromJSON SigningConfiguration where
  parseJSON :: Value -> Parser SigningConfiguration
parseJSON =
    String
-> (Object -> Parser SigningConfiguration)
-> Value
-> Parser SigningConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigningConfiguration"
      ( \Object
x ->
          EncryptionAlgorithmOptions
-> HashAlgorithmOptions -> SigningConfiguration
SigningConfiguration'
            (EncryptionAlgorithmOptions
 -> HashAlgorithmOptions -> SigningConfiguration)
-> Parser EncryptionAlgorithmOptions
-> Parser (HashAlgorithmOptions -> SigningConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser EncryptionAlgorithmOptions
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"encryptionAlgorithmOptions")
            Parser (HashAlgorithmOptions -> SigningConfiguration)
-> Parser HashAlgorithmOptions -> Parser SigningConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HashAlgorithmOptions
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"hashAlgorithmOptions")
      )

instance Prelude.Hashable SigningConfiguration

instance Prelude.NFData SigningConfiguration