{-# 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.Lambda.Types.CodeSigningConfig
-- 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.Lambda.Types.CodeSigningConfig where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types.AllowedPublishers
import Amazonka.Lambda.Types.CodeSigningPolicies
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about a
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-codesigning.html Code signing configuration>.
--
-- /See:/ 'newCodeSigningConfig' smart constructor.
data CodeSigningConfig = CodeSigningConfig'
  { -- | Code signing configuration description.
    CodeSigningConfig -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Unique identifer for the Code signing configuration.
    CodeSigningConfig -> Text
codeSigningConfigId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Code signing configuration.
    CodeSigningConfig -> Text
codeSigningConfigArn :: Prelude.Text,
    -- | List of allowed publishers.
    CodeSigningConfig -> AllowedPublishers
allowedPublishers :: AllowedPublishers,
    -- | The code signing policy controls the validation failure action for
    -- signature mismatch or expiry.
    CodeSigningConfig -> CodeSigningPolicies
codeSigningPolicies :: CodeSigningPolicies,
    -- | The date and time that the Code signing configuration was last modified,
    -- in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
    CodeSigningConfig -> Text
lastModified :: Prelude.Text
  }
  deriving (CodeSigningConfig -> CodeSigningConfig -> Bool
(CodeSigningConfig -> CodeSigningConfig -> Bool)
-> (CodeSigningConfig -> CodeSigningConfig -> Bool)
-> Eq CodeSigningConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeSigningConfig -> CodeSigningConfig -> Bool
$c/= :: CodeSigningConfig -> CodeSigningConfig -> Bool
== :: CodeSigningConfig -> CodeSigningConfig -> Bool
$c== :: CodeSigningConfig -> CodeSigningConfig -> Bool
Prelude.Eq, ReadPrec [CodeSigningConfig]
ReadPrec CodeSigningConfig
Int -> ReadS CodeSigningConfig
ReadS [CodeSigningConfig]
(Int -> ReadS CodeSigningConfig)
-> ReadS [CodeSigningConfig]
-> ReadPrec CodeSigningConfig
-> ReadPrec [CodeSigningConfig]
-> Read CodeSigningConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeSigningConfig]
$creadListPrec :: ReadPrec [CodeSigningConfig]
readPrec :: ReadPrec CodeSigningConfig
$creadPrec :: ReadPrec CodeSigningConfig
readList :: ReadS [CodeSigningConfig]
$creadList :: ReadS [CodeSigningConfig]
readsPrec :: Int -> ReadS CodeSigningConfig
$creadsPrec :: Int -> ReadS CodeSigningConfig
Prelude.Read, Int -> CodeSigningConfig -> ShowS
[CodeSigningConfig] -> ShowS
CodeSigningConfig -> String
(Int -> CodeSigningConfig -> ShowS)
-> (CodeSigningConfig -> String)
-> ([CodeSigningConfig] -> ShowS)
-> Show CodeSigningConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeSigningConfig] -> ShowS
$cshowList :: [CodeSigningConfig] -> ShowS
show :: CodeSigningConfig -> String
$cshow :: CodeSigningConfig -> String
showsPrec :: Int -> CodeSigningConfig -> ShowS
$cshowsPrec :: Int -> CodeSigningConfig -> ShowS
Prelude.Show, (forall x. CodeSigningConfig -> Rep CodeSigningConfig x)
-> (forall x. Rep CodeSigningConfig x -> CodeSigningConfig)
-> Generic CodeSigningConfig
forall x. Rep CodeSigningConfig x -> CodeSigningConfig
forall x. CodeSigningConfig -> Rep CodeSigningConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeSigningConfig x -> CodeSigningConfig
$cfrom :: forall x. CodeSigningConfig -> Rep CodeSigningConfig x
Prelude.Generic)

-- |
-- Create a value of 'CodeSigningConfig' 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:
--
-- 'description', 'codeSigningConfig_description' - Code signing configuration description.
--
-- 'codeSigningConfigId', 'codeSigningConfig_codeSigningConfigId' - Unique identifer for the Code signing configuration.
--
-- 'codeSigningConfigArn', 'codeSigningConfig_codeSigningConfigArn' - The Amazon Resource Name (ARN) of the Code signing configuration.
--
-- 'allowedPublishers', 'codeSigningConfig_allowedPublishers' - List of allowed publishers.
--
-- 'codeSigningPolicies', 'codeSigningConfig_codeSigningPolicies' - The code signing policy controls the validation failure action for
-- signature mismatch or expiry.
--
-- 'lastModified', 'codeSigningConfig_lastModified' - The date and time that the Code signing configuration was last modified,
-- in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
newCodeSigningConfig ::
  -- | 'codeSigningConfigId'
  Prelude.Text ->
  -- | 'codeSigningConfigArn'
  Prelude.Text ->
  -- | 'allowedPublishers'
  AllowedPublishers ->
  -- | 'codeSigningPolicies'
  CodeSigningPolicies ->
  -- | 'lastModified'
  Prelude.Text ->
  CodeSigningConfig
newCodeSigningConfig :: Text
-> Text
-> AllowedPublishers
-> CodeSigningPolicies
-> Text
-> CodeSigningConfig
newCodeSigningConfig
  Text
pCodeSigningConfigId_
  Text
pCodeSigningConfigArn_
  AllowedPublishers
pAllowedPublishers_
  CodeSigningPolicies
pCodeSigningPolicies_
  Text
pLastModified_ =
    CodeSigningConfig' :: Maybe Text
-> Text
-> Text
-> AllowedPublishers
-> CodeSigningPolicies
-> Text
-> CodeSigningConfig
CodeSigningConfig'
      { $sel:description:CodeSigningConfig' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:codeSigningConfigId:CodeSigningConfig' :: Text
codeSigningConfigId = Text
pCodeSigningConfigId_,
        $sel:codeSigningConfigArn:CodeSigningConfig' :: Text
codeSigningConfigArn = Text
pCodeSigningConfigArn_,
        $sel:allowedPublishers:CodeSigningConfig' :: AllowedPublishers
allowedPublishers = AllowedPublishers
pAllowedPublishers_,
        $sel:codeSigningPolicies:CodeSigningConfig' :: CodeSigningPolicies
codeSigningPolicies = CodeSigningPolicies
pCodeSigningPolicies_,
        $sel:lastModified:CodeSigningConfig' :: Text
lastModified = Text
pLastModified_
      }

-- | Code signing configuration description.
codeSigningConfig_description :: Lens.Lens' CodeSigningConfig (Prelude.Maybe Prelude.Text)
codeSigningConfig_description :: (Maybe Text -> f (Maybe Text))
-> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_description = (CodeSigningConfig -> Maybe Text)
-> (CodeSigningConfig -> Maybe Text -> CodeSigningConfig)
-> Lens
     CodeSigningConfig CodeSigningConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {Maybe Text
description :: Maybe Text
$sel:description:CodeSigningConfig' :: CodeSigningConfig -> Maybe Text
description} -> Maybe Text
description) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} Maybe Text
a -> CodeSigningConfig
s {$sel:description:CodeSigningConfig' :: Maybe Text
description = Maybe Text
a} :: CodeSigningConfig)

-- | Unique identifer for the Code signing configuration.
codeSigningConfig_codeSigningConfigId :: Lens.Lens' CodeSigningConfig Prelude.Text
codeSigningConfig_codeSigningConfigId :: (Text -> f Text) -> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_codeSigningConfigId = (CodeSigningConfig -> Text)
-> (CodeSigningConfig -> Text -> CodeSigningConfig)
-> Lens CodeSigningConfig CodeSigningConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {Text
codeSigningConfigId :: Text
$sel:codeSigningConfigId:CodeSigningConfig' :: CodeSigningConfig -> Text
codeSigningConfigId} -> Text
codeSigningConfigId) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} Text
a -> CodeSigningConfig
s {$sel:codeSigningConfigId:CodeSigningConfig' :: Text
codeSigningConfigId = Text
a} :: CodeSigningConfig)

-- | The Amazon Resource Name (ARN) of the Code signing configuration.
codeSigningConfig_codeSigningConfigArn :: Lens.Lens' CodeSigningConfig Prelude.Text
codeSigningConfig_codeSigningConfigArn :: (Text -> f Text) -> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_codeSigningConfigArn = (CodeSigningConfig -> Text)
-> (CodeSigningConfig -> Text -> CodeSigningConfig)
-> Lens CodeSigningConfig CodeSigningConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {Text
codeSigningConfigArn :: Text
$sel:codeSigningConfigArn:CodeSigningConfig' :: CodeSigningConfig -> Text
codeSigningConfigArn} -> Text
codeSigningConfigArn) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} Text
a -> CodeSigningConfig
s {$sel:codeSigningConfigArn:CodeSigningConfig' :: Text
codeSigningConfigArn = Text
a} :: CodeSigningConfig)

-- | List of allowed publishers.
codeSigningConfig_allowedPublishers :: Lens.Lens' CodeSigningConfig AllowedPublishers
codeSigningConfig_allowedPublishers :: (AllowedPublishers -> f AllowedPublishers)
-> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_allowedPublishers = (CodeSigningConfig -> AllowedPublishers)
-> (CodeSigningConfig -> AllowedPublishers -> CodeSigningConfig)
-> Lens
     CodeSigningConfig
     CodeSigningConfig
     AllowedPublishers
     AllowedPublishers
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {AllowedPublishers
allowedPublishers :: AllowedPublishers
$sel:allowedPublishers:CodeSigningConfig' :: CodeSigningConfig -> AllowedPublishers
allowedPublishers} -> AllowedPublishers
allowedPublishers) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} AllowedPublishers
a -> CodeSigningConfig
s {$sel:allowedPublishers:CodeSigningConfig' :: AllowedPublishers
allowedPublishers = AllowedPublishers
a} :: CodeSigningConfig)

-- | The code signing policy controls the validation failure action for
-- signature mismatch or expiry.
codeSigningConfig_codeSigningPolicies :: Lens.Lens' CodeSigningConfig CodeSigningPolicies
codeSigningConfig_codeSigningPolicies :: (CodeSigningPolicies -> f CodeSigningPolicies)
-> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_codeSigningPolicies = (CodeSigningConfig -> CodeSigningPolicies)
-> (CodeSigningConfig -> CodeSigningPolicies -> CodeSigningConfig)
-> Lens
     CodeSigningConfig
     CodeSigningConfig
     CodeSigningPolicies
     CodeSigningPolicies
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {CodeSigningPolicies
codeSigningPolicies :: CodeSigningPolicies
$sel:codeSigningPolicies:CodeSigningConfig' :: CodeSigningConfig -> CodeSigningPolicies
codeSigningPolicies} -> CodeSigningPolicies
codeSigningPolicies) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} CodeSigningPolicies
a -> CodeSigningConfig
s {$sel:codeSigningPolicies:CodeSigningConfig' :: CodeSigningPolicies
codeSigningPolicies = CodeSigningPolicies
a} :: CodeSigningConfig)

-- | The date and time that the Code signing configuration was last modified,
-- in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
codeSigningConfig_lastModified :: Lens.Lens' CodeSigningConfig Prelude.Text
codeSigningConfig_lastModified :: (Text -> f Text) -> CodeSigningConfig -> f CodeSigningConfig
codeSigningConfig_lastModified = (CodeSigningConfig -> Text)
-> (CodeSigningConfig -> Text -> CodeSigningConfig)
-> Lens CodeSigningConfig CodeSigningConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeSigningConfig' {Text
lastModified :: Text
$sel:lastModified:CodeSigningConfig' :: CodeSigningConfig -> Text
lastModified} -> Text
lastModified) (\s :: CodeSigningConfig
s@CodeSigningConfig' {} Text
a -> CodeSigningConfig
s {$sel:lastModified:CodeSigningConfig' :: Text
lastModified = Text
a} :: CodeSigningConfig)

instance Core.FromJSON CodeSigningConfig where
  parseJSON :: Value -> Parser CodeSigningConfig
parseJSON =
    String
-> (Object -> Parser CodeSigningConfig)
-> Value
-> Parser CodeSigningConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CodeSigningConfig"
      ( \Object
x ->
          Maybe Text
-> Text
-> Text
-> AllowedPublishers
-> CodeSigningPolicies
-> Text
-> CodeSigningConfig
CodeSigningConfig'
            (Maybe Text
 -> Text
 -> Text
 -> AllowedPublishers
 -> CodeSigningPolicies
 -> Text
 -> CodeSigningConfig)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Text
      -> AllowedPublishers
      -> CodeSigningPolicies
      -> Text
      -> CodeSigningConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser
  (Text
   -> Text
   -> AllowedPublishers
   -> CodeSigningPolicies
   -> Text
   -> CodeSigningConfig)
-> Parser Text
-> Parser
     (Text
      -> AllowedPublishers
      -> CodeSigningPolicies
      -> Text
      -> CodeSigningConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CodeSigningConfigId")
            Parser
  (Text
   -> AllowedPublishers
   -> CodeSigningPolicies
   -> Text
   -> CodeSigningConfig)
-> Parser Text
-> Parser
     (AllowedPublishers
      -> CodeSigningPolicies -> Text -> CodeSigningConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CodeSigningConfigArn")
            Parser
  (AllowedPublishers
   -> CodeSigningPolicies -> Text -> CodeSigningConfig)
-> Parser AllowedPublishers
-> Parser (CodeSigningPolicies -> Text -> CodeSigningConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AllowedPublishers
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AllowedPublishers")
            Parser (CodeSigningPolicies -> Text -> CodeSigningConfig)
-> Parser CodeSigningPolicies -> Parser (Text -> CodeSigningConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser CodeSigningPolicies
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CodeSigningPolicies")
            Parser (Text -> CodeSigningConfig)
-> Parser Text -> Parser CodeSigningConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LastModified")
      )

instance Prelude.Hashable CodeSigningConfig

instance Prelude.NFData CodeSigningConfig