{-# 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-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.EncryptionAlgorithmOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(EncryptionAlgorithmOptions -> EncryptionAlgorithmOptions -> Bool)
-> (EncryptionAlgorithmOptions
    -> EncryptionAlgorithmOptions -> Bool)
-> Eq EncryptionAlgorithmOptions
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]
(Int -> ReadS EncryptionAlgorithmOptions)
-> ReadS [EncryptionAlgorithmOptions]
-> ReadPrec EncryptionAlgorithmOptions
-> ReadPrec [EncryptionAlgorithmOptions]
-> Read 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
(Int -> EncryptionAlgorithmOptions -> ShowS)
-> (EncryptionAlgorithmOptions -> String)
-> ([EncryptionAlgorithmOptions] -> ShowS)
-> Show EncryptionAlgorithmOptions
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.
 EncryptionAlgorithmOptions -> Rep EncryptionAlgorithmOptions x)
-> (forall x.
    Rep EncryptionAlgorithmOptions x -> EncryptionAlgorithmOptions)
-> Generic EncryptionAlgorithmOptions
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' :: [EncryptionAlgorithm]
-> EncryptionAlgorithm -> EncryptionAlgorithmOptions
EncryptionAlgorithmOptions'
    { $sel:allowedValues:EncryptionAlgorithmOptions' :: [EncryptionAlgorithm]
allowedValues =
        [EncryptionAlgorithm]
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 :: ([EncryptionAlgorithm] -> f [EncryptionAlgorithm])
-> EncryptionAlgorithmOptions -> f EncryptionAlgorithmOptions
encryptionAlgorithmOptions_allowedValues = (EncryptionAlgorithmOptions -> [EncryptionAlgorithm])
-> (EncryptionAlgorithmOptions
    -> [EncryptionAlgorithm] -> EncryptionAlgorithmOptions)
-> Lens
     EncryptionAlgorithmOptions
     EncryptionAlgorithmOptions
     [EncryptionAlgorithm]
     [EncryptionAlgorithm]
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) (([EncryptionAlgorithm] -> f [EncryptionAlgorithm])
 -> EncryptionAlgorithmOptions -> f EncryptionAlgorithmOptions)
-> (([EncryptionAlgorithm] -> f [EncryptionAlgorithm])
    -> [EncryptionAlgorithm] -> f [EncryptionAlgorithm])
-> ([EncryptionAlgorithm] -> f [EncryptionAlgorithm])
-> EncryptionAlgorithmOptions
-> f EncryptionAlgorithmOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EncryptionAlgorithm] -> f [EncryptionAlgorithm])
-> [EncryptionAlgorithm] -> f [EncryptionAlgorithm]
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 :: (EncryptionAlgorithm -> f EncryptionAlgorithm)
-> EncryptionAlgorithmOptions -> f EncryptionAlgorithmOptions
encryptionAlgorithmOptions_defaultValue = (EncryptionAlgorithmOptions -> EncryptionAlgorithm)
-> (EncryptionAlgorithmOptions
    -> EncryptionAlgorithm -> EncryptionAlgorithmOptions)
-> Lens
     EncryptionAlgorithmOptions
     EncryptionAlgorithmOptions
     EncryptionAlgorithm
     EncryptionAlgorithm
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 Core.FromJSON EncryptionAlgorithmOptions where
  parseJSON :: Value -> Parser EncryptionAlgorithmOptions
parseJSON =
    String
-> (Object -> Parser EncryptionAlgorithmOptions)
-> Value
-> Parser EncryptionAlgorithmOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EncryptionAlgorithmOptions"
      ( \Object
x ->
          [EncryptionAlgorithm]
-> EncryptionAlgorithm -> EncryptionAlgorithmOptions
EncryptionAlgorithmOptions'
            ([EncryptionAlgorithm]
 -> EncryptionAlgorithm -> EncryptionAlgorithmOptions)
-> Parser [EncryptionAlgorithm]
-> Parser (EncryptionAlgorithm -> EncryptionAlgorithmOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe [EncryptionAlgorithm])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"allowedValues" Parser (Maybe [EncryptionAlgorithm])
-> [EncryptionAlgorithm] -> Parser [EncryptionAlgorithm]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [EncryptionAlgorithm]
forall a. Monoid a => a
Prelude.mempty)
            Parser (EncryptionAlgorithm -> EncryptionAlgorithmOptions)
-> Parser EncryptionAlgorithm -> Parser EncryptionAlgorithmOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EncryptionAlgorithm
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"defaultValue")
      )

instance Prelude.Hashable EncryptionAlgorithmOptions

instance Prelude.NFData EncryptionAlgorithmOptions