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

-- | 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
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]
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
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. 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' {$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 :: Lens' SigningMaterial Text
signingMaterial_certificateArn = 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 Data.FromJSON SigningMaterial where
  parseJSON :: Value -> Parser SigningMaterial
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SigningMaterial"
      ( \Object
x ->
          Text -> SigningMaterial
SigningMaterial'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"certificateArn")
      )

instance Prelude.Hashable SigningMaterial where
  hashWithSalt :: Int -> SigningMaterial -> Int
hashWithSalt Int
_salt SigningMaterial' {Text
certificateArn :: Text
$sel:certificateArn:SigningMaterial' :: SigningMaterial -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateArn

instance Prelude.NFData SigningMaterial where
  rnf :: SigningMaterial -> ()
rnf SigningMaterial' {Text
certificateArn :: Text
$sel:certificateArn:SigningMaterial' :: SigningMaterial -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
certificateArn

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