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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The ACM certificate that is used to sign your code.
--
-- /See:/ 'newSigningMaterial' smart constructor.
data SigningMaterial = SigningMaterial'
  { -- | The Amazon Resource Name (ARN) of the certificates that is used to sign
    -- your code.
    SigningMaterial -> Text
certificateArn :: Prelude.Text
  }
  deriving (SigningMaterial -> SigningMaterial -> Bool
(SigningMaterial -> SigningMaterial -> Bool)
-> (SigningMaterial -> SigningMaterial -> Bool)
-> Eq SigningMaterial
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigningMaterial -> SigningMaterial -> Bool
$c/= :: SigningMaterial -> SigningMaterial -> Bool
== :: SigningMaterial -> SigningMaterial -> Bool
$c== :: SigningMaterial -> SigningMaterial -> Bool
Prelude.Eq, ReadPrec [SigningMaterial]
ReadPrec SigningMaterial
Int -> ReadS SigningMaterial
ReadS [SigningMaterial]
(Int -> ReadS SigningMaterial)
-> ReadS [SigningMaterial]
-> ReadPrec SigningMaterial
-> ReadPrec [SigningMaterial]
-> Read SigningMaterial
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigningMaterial]
$creadListPrec :: ReadPrec [SigningMaterial]
readPrec :: ReadPrec SigningMaterial
$creadPrec :: ReadPrec SigningMaterial
readList :: ReadS [SigningMaterial]
$creadList :: ReadS [SigningMaterial]
readsPrec :: Int -> ReadS SigningMaterial
$creadsPrec :: Int -> ReadS SigningMaterial
Prelude.Read, Int -> SigningMaterial -> ShowS
[SigningMaterial] -> ShowS
SigningMaterial -> String
(Int -> SigningMaterial -> ShowS)
-> (SigningMaterial -> String)
-> ([SigningMaterial] -> ShowS)
-> Show SigningMaterial
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigningMaterial] -> ShowS
$cshowList :: [SigningMaterial] -> ShowS
show :: SigningMaterial -> String
$cshow :: SigningMaterial -> String
showsPrec :: Int -> SigningMaterial -> ShowS
$cshowsPrec :: Int -> SigningMaterial -> ShowS
Prelude.Show, (forall x. SigningMaterial -> Rep SigningMaterial x)
-> (forall x. Rep SigningMaterial x -> SigningMaterial)
-> Generic SigningMaterial
forall x. Rep SigningMaterial x -> SigningMaterial
forall x. SigningMaterial -> Rep SigningMaterial x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SigningMaterial x -> SigningMaterial
$cfrom :: forall x. SigningMaterial -> Rep SigningMaterial x
Prelude.Generic)

-- |
-- Create a value of 'SigningMaterial' 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:
--
-- 'certificateArn', 'signingMaterial_certificateArn' - The Amazon Resource Name (ARN) of the certificates that is used to sign
-- your code.
newSigningMaterial ::
  -- | 'certificateArn'
  Prelude.Text ->
  SigningMaterial
newSigningMaterial :: Text -> SigningMaterial
newSigningMaterial Text
pCertificateArn_ =
  SigningMaterial' :: Text -> SigningMaterial
SigningMaterial' {$sel:certificateArn:SigningMaterial' :: Text
certificateArn = Text
pCertificateArn_}

-- | The Amazon Resource Name (ARN) of the certificates that is used to sign
-- your code.
signingMaterial_certificateArn :: Lens.Lens' SigningMaterial Prelude.Text
signingMaterial_certificateArn :: (Text -> f Text) -> SigningMaterial -> f SigningMaterial
signingMaterial_certificateArn = (SigningMaterial -> Text)
-> (SigningMaterial -> Text -> SigningMaterial)
-> Lens SigningMaterial SigningMaterial Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningMaterial' {Text
certificateArn :: Text
$sel:certificateArn:SigningMaterial' :: SigningMaterial -> Text
certificateArn} -> Text
certificateArn) (\s :: SigningMaterial
s@SigningMaterial' {} Text
a -> SigningMaterial
s {$sel:certificateArn:SigningMaterial' :: Text
certificateArn = Text
a} :: SigningMaterial)

instance Core.FromJSON SigningMaterial where
  parseJSON :: Value -> Parser SigningMaterial
parseJSON =
    String
-> (Object -> Parser SigningMaterial)
-> Value
-> Parser SigningMaterial
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigningMaterial"
      ( \Object
x ->
          Text -> SigningMaterial
SigningMaterial'
            (Text -> SigningMaterial) -> Parser Text -> Parser SigningMaterial
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"certificateArn")
      )

instance Prelude.Hashable SigningMaterial

instance Prelude.NFData SigningMaterial

instance Core.ToJSON SigningMaterial where
  toJSON :: SigningMaterial -> Value
toJSON SigningMaterial' {Text
certificateArn :: Text
$sel:certificateArn:SigningMaterial' :: SigningMaterial -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"certificateArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateArn)
          ]
      )