{-# 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.EncryptionAlgorithmOptions
-- 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.Signer.Types.EncryptionAlgorithmOptions 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.Signer.Types.EncryptionAlgorithm

-- | The encryption algorithm options that are available to a code signing
-- job.
--
-- /See:/ 'newEncryptionAlgorithmOptions' smart constructor.
data EncryptionAlgorithmOptions = EncryptionAlgorithmOptions'
  { -- | The set of accepted encryption algorithms that are allowed in a code
    -- signing job.
    EncryptionAlgorithmOptions -> [EncryptionAlgorithm]
allowedValues :: [EncryptionAlgorithm],
    -- | The default encryption algorithm that is used by a code signing job.
    EncryptionAlgorithmOptions -> EncryptionAlgorithm
defaultValue :: EncryptionAlgorithm
  }
  deriving (EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool
$c/= :: EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool
== :: EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool
$c== :: EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool
Prelude.Eq, ReadPrec [EncryptionAlgorithmOptions]
ReadPrec EncryptionAlgorithmOptions
Int -> ReadS EncryptionAlgorithmOptions
ReadS [EncryptionAlgorithmOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionAlgorithmOptions]
$creadListPrec :: ReadPrec [EncryptionAlgorithmOptions]
readPrec :: ReadPrec EncryptionAlgorithmOptions
$creadPrec :: ReadPrec EncryptionAlgorithmOptions
readList :: ReadS [EncryptionAlgorithmOptions]
$creadList :: ReadS [EncryptionAlgorithmOptions]
readsPrec :: Int -> ReadS EncryptionAlgorithmOptions
$creadsPrec :: Int -> ReadS EncryptionAlgorithmOptions
Prelude.Read, Int -> EncryptionAlgorithmOptions -> ShowS
[EncryptionAlgorithmOptions] -> ShowS
EncryptionAlgorithmOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionAlgorithmOptions] -> ShowS
$cshowList :: [EncryptionAlgorithmOptions] -> ShowS
show :: EncryptionAlgorithmOptions -> String
$cshow :: EncryptionAlgorithmOptions -> String
showsPrec :: Int -> EncryptionAlgorithmOptions -> ShowS
$cshowsPrec :: Int -> EncryptionAlgorithmOptions -> ShowS
Prelude.Show, forall x.
Rep EncryptionAlgorithmOptions x -> EncryptionAlgorithmOptions
forall x.
EncryptionAlgorithmOptions -> Rep EncryptionAlgorithmOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EncryptionAlgorithmOptions x -> EncryptionAlgorithmOptions
$cfrom :: forall x.
EncryptionAlgorithmOptions -> Rep EncryptionAlgorithmOptions x
Prelude.Generic)

-- |
-- Create a value of 'EncryptionAlgorithmOptions' 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:
--
-- 'allowedValues', 'encryptionAlgorithmOptions_allowedValues' - The set of accepted encryption algorithms that are allowed in a code
-- signing job.
--
-- 'defaultValue', 'encryptionAlgorithmOptions_defaultValue' - The default encryption algorithm that is used by a code signing job.
newEncryptionAlgorithmOptions ::
  -- | 'defaultValue'
  EncryptionAlgorithm ->
  EncryptionAlgorithmOptions
newEncryptionAlgorithmOptions :: EncryptionAlgorithm -> EncryptionAlgorithmOptions
newEncryptionAlgorithmOptions EncryptionAlgorithm
pDefaultValue_ =
  EncryptionAlgorithmOptions'
    { $sel:allowedValues:EncryptionAlgorithmOptions' :: [EncryptionAlgorithm]
allowedValues =
        forall a. Monoid a => a
Prelude.mempty,
      $sel:defaultValue:EncryptionAlgorithmOptions' :: EncryptionAlgorithm
defaultValue = EncryptionAlgorithm
pDefaultValue_
    }

-- | The set of accepted encryption algorithms that are allowed in a code
-- signing job.
encryptionAlgorithmOptions_allowedValues :: Lens.Lens' EncryptionAlgorithmOptions [EncryptionAlgorithm]
encryptionAlgorithmOptions_allowedValues :: Lens' EncryptionAlgorithmOptions [EncryptionAlgorithm]
encryptionAlgorithmOptions_allowedValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionAlgorithmOptions' {[EncryptionAlgorithm]
allowedValues :: [EncryptionAlgorithm]
$sel:allowedValues:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> [EncryptionAlgorithm]
allowedValues} -> [EncryptionAlgorithm]
allowedValues) (\s :: EncryptionAlgorithmOptions
s@EncryptionAlgorithmOptions' {} [EncryptionAlgorithm]
a -> EncryptionAlgorithmOptions
s {$sel:allowedValues:EncryptionAlgorithmOptions' :: [EncryptionAlgorithm]
allowedValues = [EncryptionAlgorithm]
a} :: EncryptionAlgorithmOptions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The default encryption algorithm that is used by a code signing job.
encryptionAlgorithmOptions_defaultValue :: Lens.Lens' EncryptionAlgorithmOptions EncryptionAlgorithm
encryptionAlgorithmOptions_defaultValue :: Lens' EncryptionAlgorithmOptions EncryptionAlgorithm
encryptionAlgorithmOptions_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionAlgorithmOptions' {EncryptionAlgorithm
defaultValue :: EncryptionAlgorithm
$sel:defaultValue:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> EncryptionAlgorithm
defaultValue} -> EncryptionAlgorithm
defaultValue) (\s :: EncryptionAlgorithmOptions
s@EncryptionAlgorithmOptions' {} EncryptionAlgorithm
a -> EncryptionAlgorithmOptions
s {$sel:defaultValue:EncryptionAlgorithmOptions' :: EncryptionAlgorithm
defaultValue = EncryptionAlgorithm
a} :: EncryptionAlgorithmOptions)

instance Data.FromJSON EncryptionAlgorithmOptions where
  parseJSON :: Value -> Parser EncryptionAlgorithmOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EncryptionAlgorithmOptions"
      ( \Object
x ->
          [EncryptionAlgorithm]
-> EncryptionAlgorithm -> EncryptionAlgorithmOptions
EncryptionAlgorithmOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"allowedValues" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"defaultValue")
      )

instance Prelude.Hashable EncryptionAlgorithmOptions where
  hashWithSalt :: Int -> EncryptionAlgorithmOptions -> Int
hashWithSalt Int
_salt EncryptionAlgorithmOptions' {[EncryptionAlgorithm]
EncryptionAlgorithm
defaultValue :: EncryptionAlgorithm
allowedValues :: [EncryptionAlgorithm]
$sel:defaultValue:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> EncryptionAlgorithm
$sel:allowedValues:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> [EncryptionAlgorithm]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EncryptionAlgorithm]
allowedValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EncryptionAlgorithm
defaultValue

instance Prelude.NFData EncryptionAlgorithmOptions where
  rnf :: EncryptionAlgorithmOptions -> ()
rnf EncryptionAlgorithmOptions' {[EncryptionAlgorithm]
EncryptionAlgorithm
defaultValue :: EncryptionAlgorithm
allowedValues :: [EncryptionAlgorithm]
$sel:defaultValue:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> EncryptionAlgorithm
$sel:allowedValues:EncryptionAlgorithmOptions' :: EncryptionAlgorithmOptions -> [EncryptionAlgorithm]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [EncryptionAlgorithm]
allowedValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EncryptionAlgorithm
defaultValue