{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.GetCodeSigningConfig
-- 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)
--
-- Returns information about the specified code signing configuration.
module Amazonka.Lambda.GetCodeSigningConfig
  ( -- * Creating a Request
    GetCodeSigningConfig (..),
    newGetCodeSigningConfig,

    -- * Request Lenses
    getCodeSigningConfig_codeSigningConfigArn,

    -- * Destructuring the Response
    GetCodeSigningConfigResponse (..),
    newGetCodeSigningConfigResponse,

    -- * Response Lenses
    getCodeSigningConfigResponse_httpStatus,
    getCodeSigningConfigResponse_codeSigningConfig,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetCodeSigningConfig' smart constructor.
data GetCodeSigningConfig = GetCodeSigningConfig'
  { -- | The The Amazon Resource Name (ARN) of the code signing configuration.
    GetCodeSigningConfig -> Text
codeSigningConfigArn :: Prelude.Text
  }
  deriving (GetCodeSigningConfig -> GetCodeSigningConfig -> Bool
(GetCodeSigningConfig -> GetCodeSigningConfig -> Bool)
-> (GetCodeSigningConfig -> GetCodeSigningConfig -> Bool)
-> Eq GetCodeSigningConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCodeSigningConfig -> GetCodeSigningConfig -> Bool
$c/= :: GetCodeSigningConfig -> GetCodeSigningConfig -> Bool
== :: GetCodeSigningConfig -> GetCodeSigningConfig -> Bool
$c== :: GetCodeSigningConfig -> GetCodeSigningConfig -> Bool
Prelude.Eq, ReadPrec [GetCodeSigningConfig]
ReadPrec GetCodeSigningConfig
Int -> ReadS GetCodeSigningConfig
ReadS [GetCodeSigningConfig]
(Int -> ReadS GetCodeSigningConfig)
-> ReadS [GetCodeSigningConfig]
-> ReadPrec GetCodeSigningConfig
-> ReadPrec [GetCodeSigningConfig]
-> Read GetCodeSigningConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCodeSigningConfig]
$creadListPrec :: ReadPrec [GetCodeSigningConfig]
readPrec :: ReadPrec GetCodeSigningConfig
$creadPrec :: ReadPrec GetCodeSigningConfig
readList :: ReadS [GetCodeSigningConfig]
$creadList :: ReadS [GetCodeSigningConfig]
readsPrec :: Int -> ReadS GetCodeSigningConfig
$creadsPrec :: Int -> ReadS GetCodeSigningConfig
Prelude.Read, Int -> GetCodeSigningConfig -> ShowS
[GetCodeSigningConfig] -> ShowS
GetCodeSigningConfig -> String
(Int -> GetCodeSigningConfig -> ShowS)
-> (GetCodeSigningConfig -> String)
-> ([GetCodeSigningConfig] -> ShowS)
-> Show GetCodeSigningConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCodeSigningConfig] -> ShowS
$cshowList :: [GetCodeSigningConfig] -> ShowS
show :: GetCodeSigningConfig -> String
$cshow :: GetCodeSigningConfig -> String
showsPrec :: Int -> GetCodeSigningConfig -> ShowS
$cshowsPrec :: Int -> GetCodeSigningConfig -> ShowS
Prelude.Show, (forall x. GetCodeSigningConfig -> Rep GetCodeSigningConfig x)
-> (forall x. Rep GetCodeSigningConfig x -> GetCodeSigningConfig)
-> Generic GetCodeSigningConfig
forall x. Rep GetCodeSigningConfig x -> GetCodeSigningConfig
forall x. GetCodeSigningConfig -> Rep GetCodeSigningConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCodeSigningConfig x -> GetCodeSigningConfig
$cfrom :: forall x. GetCodeSigningConfig -> Rep GetCodeSigningConfig x
Prelude.Generic)

-- |
-- Create a value of 'GetCodeSigningConfig' 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:
--
-- 'codeSigningConfigArn', 'getCodeSigningConfig_codeSigningConfigArn' - The The Amazon Resource Name (ARN) of the code signing configuration.
newGetCodeSigningConfig ::
  -- | 'codeSigningConfigArn'
  Prelude.Text ->
  GetCodeSigningConfig
newGetCodeSigningConfig :: Text -> GetCodeSigningConfig
newGetCodeSigningConfig Text
pCodeSigningConfigArn_ =
  GetCodeSigningConfig' :: Text -> GetCodeSigningConfig
GetCodeSigningConfig'
    { $sel:codeSigningConfigArn:GetCodeSigningConfig' :: Text
codeSigningConfigArn =
        Text
pCodeSigningConfigArn_
    }

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

instance Core.AWSRequest GetCodeSigningConfig where
  type
    AWSResponse GetCodeSigningConfig =
      GetCodeSigningConfigResponse
  request :: GetCodeSigningConfig -> Request GetCodeSigningConfig
request = Service -> GetCodeSigningConfig -> Request GetCodeSigningConfig
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCodeSigningConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCodeSigningConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCodeSigningConfig))
-> Logger
-> Service
-> Proxy GetCodeSigningConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCodeSigningConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> CodeSigningConfig -> GetCodeSigningConfigResponse
GetCodeSigningConfigResponse'
            (Int -> CodeSigningConfig -> GetCodeSigningConfigResponse)
-> Either String Int
-> Either
     String (CodeSigningConfig -> GetCodeSigningConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (CodeSigningConfig -> GetCodeSigningConfigResponse)
-> Either String CodeSigningConfig
-> Either String GetCodeSigningConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String CodeSigningConfig
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"CodeSigningConfig")
      )

instance Prelude.Hashable GetCodeSigningConfig

instance Prelude.NFData GetCodeSigningConfig

instance Core.ToHeaders GetCodeSigningConfig where
  toHeaders :: GetCodeSigningConfig -> ResponseHeaders
toHeaders = ResponseHeaders -> GetCodeSigningConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath GetCodeSigningConfig where
  toPath :: GetCodeSigningConfig -> ByteString
toPath GetCodeSigningConfig' {Text
codeSigningConfigArn :: Text
$sel:codeSigningConfigArn:GetCodeSigningConfig' :: GetCodeSigningConfig -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-04-22/code-signing-configs/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
codeSigningConfigArn
      ]

instance Core.ToQuery GetCodeSigningConfig where
  toQuery :: GetCodeSigningConfig -> QueryString
toQuery = QueryString -> GetCodeSigningConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetCodeSigningConfigResponse' smart constructor.
data GetCodeSigningConfigResponse = GetCodeSigningConfigResponse'
  { -- | The response's http status code.
    GetCodeSigningConfigResponse -> Int
httpStatus :: Prelude.Int,
    -- | The code signing configuration
    GetCodeSigningConfigResponse -> CodeSigningConfig
codeSigningConfig :: CodeSigningConfig
  }
  deriving (GetCodeSigningConfigResponse
-> GetCodeSigningConfigResponse -> Bool
(GetCodeSigningConfigResponse
 -> GetCodeSigningConfigResponse -> Bool)
-> (GetCodeSigningConfigResponse
    -> GetCodeSigningConfigResponse -> Bool)
-> Eq GetCodeSigningConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCodeSigningConfigResponse
-> GetCodeSigningConfigResponse -> Bool
$c/= :: GetCodeSigningConfigResponse
-> GetCodeSigningConfigResponse -> Bool
== :: GetCodeSigningConfigResponse
-> GetCodeSigningConfigResponse -> Bool
$c== :: GetCodeSigningConfigResponse
-> GetCodeSigningConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetCodeSigningConfigResponse]
ReadPrec GetCodeSigningConfigResponse
Int -> ReadS GetCodeSigningConfigResponse
ReadS [GetCodeSigningConfigResponse]
(Int -> ReadS GetCodeSigningConfigResponse)
-> ReadS [GetCodeSigningConfigResponse]
-> ReadPrec GetCodeSigningConfigResponse
-> ReadPrec [GetCodeSigningConfigResponse]
-> Read GetCodeSigningConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCodeSigningConfigResponse]
$creadListPrec :: ReadPrec [GetCodeSigningConfigResponse]
readPrec :: ReadPrec GetCodeSigningConfigResponse
$creadPrec :: ReadPrec GetCodeSigningConfigResponse
readList :: ReadS [GetCodeSigningConfigResponse]
$creadList :: ReadS [GetCodeSigningConfigResponse]
readsPrec :: Int -> ReadS GetCodeSigningConfigResponse
$creadsPrec :: Int -> ReadS GetCodeSigningConfigResponse
Prelude.Read, Int -> GetCodeSigningConfigResponse -> ShowS
[GetCodeSigningConfigResponse] -> ShowS
GetCodeSigningConfigResponse -> String
(Int -> GetCodeSigningConfigResponse -> ShowS)
-> (GetCodeSigningConfigResponse -> String)
-> ([GetCodeSigningConfigResponse] -> ShowS)
-> Show GetCodeSigningConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCodeSigningConfigResponse] -> ShowS
$cshowList :: [GetCodeSigningConfigResponse] -> ShowS
show :: GetCodeSigningConfigResponse -> String
$cshow :: GetCodeSigningConfigResponse -> String
showsPrec :: Int -> GetCodeSigningConfigResponse -> ShowS
$cshowsPrec :: Int -> GetCodeSigningConfigResponse -> ShowS
Prelude.Show, (forall x.
 GetCodeSigningConfigResponse -> Rep GetCodeSigningConfigResponse x)
-> (forall x.
    Rep GetCodeSigningConfigResponse x -> GetCodeSigningConfigResponse)
-> Generic GetCodeSigningConfigResponse
forall x.
Rep GetCodeSigningConfigResponse x -> GetCodeSigningConfigResponse
forall x.
GetCodeSigningConfigResponse -> Rep GetCodeSigningConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCodeSigningConfigResponse x -> GetCodeSigningConfigResponse
$cfrom :: forall x.
GetCodeSigningConfigResponse -> Rep GetCodeSigningConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCodeSigningConfigResponse' 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:
--
-- 'httpStatus', 'getCodeSigningConfigResponse_httpStatus' - The response's http status code.
--
-- 'codeSigningConfig', 'getCodeSigningConfigResponse_codeSigningConfig' - The code signing configuration
newGetCodeSigningConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'codeSigningConfig'
  CodeSigningConfig ->
  GetCodeSigningConfigResponse
newGetCodeSigningConfigResponse :: Int -> CodeSigningConfig -> GetCodeSigningConfigResponse
newGetCodeSigningConfigResponse
  Int
pHttpStatus_
  CodeSigningConfig
pCodeSigningConfig_ =
    GetCodeSigningConfigResponse' :: Int -> CodeSigningConfig -> GetCodeSigningConfigResponse
GetCodeSigningConfigResponse'
      { $sel:httpStatus:GetCodeSigningConfigResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:codeSigningConfig:GetCodeSigningConfigResponse' :: CodeSigningConfig
codeSigningConfig = CodeSigningConfig
pCodeSigningConfig_
      }

-- | The response's http status code.
getCodeSigningConfigResponse_httpStatus :: Lens.Lens' GetCodeSigningConfigResponse Prelude.Int
getCodeSigningConfigResponse_httpStatus :: (Int -> f Int)
-> GetCodeSigningConfigResponse -> f GetCodeSigningConfigResponse
getCodeSigningConfigResponse_httpStatus = (GetCodeSigningConfigResponse -> Int)
-> (GetCodeSigningConfigResponse
    -> Int -> GetCodeSigningConfigResponse)
-> Lens
     GetCodeSigningConfigResponse GetCodeSigningConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCodeSigningConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCodeSigningConfigResponse' :: GetCodeSigningConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCodeSigningConfigResponse
s@GetCodeSigningConfigResponse' {} Int
a -> GetCodeSigningConfigResponse
s {$sel:httpStatus:GetCodeSigningConfigResponse' :: Int
httpStatus = Int
a} :: GetCodeSigningConfigResponse)

-- | The code signing configuration
getCodeSigningConfigResponse_codeSigningConfig :: Lens.Lens' GetCodeSigningConfigResponse CodeSigningConfig
getCodeSigningConfigResponse_codeSigningConfig :: (CodeSigningConfig -> f CodeSigningConfig)
-> GetCodeSigningConfigResponse -> f GetCodeSigningConfigResponse
getCodeSigningConfigResponse_codeSigningConfig = (GetCodeSigningConfigResponse -> CodeSigningConfig)
-> (GetCodeSigningConfigResponse
    -> CodeSigningConfig -> GetCodeSigningConfigResponse)
-> Lens
     GetCodeSigningConfigResponse
     GetCodeSigningConfigResponse
     CodeSigningConfig
     CodeSigningConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCodeSigningConfigResponse' {CodeSigningConfig
codeSigningConfig :: CodeSigningConfig
$sel:codeSigningConfig:GetCodeSigningConfigResponse' :: GetCodeSigningConfigResponse -> CodeSigningConfig
codeSigningConfig} -> CodeSigningConfig
codeSigningConfig) (\s :: GetCodeSigningConfigResponse
s@GetCodeSigningConfigResponse' {} CodeSigningConfig
a -> GetCodeSigningConfigResponse
s {$sel:codeSigningConfig:GetCodeSigningConfigResponse' :: CodeSigningConfig
codeSigningConfig = CodeSigningConfig
a} :: GetCodeSigningConfigResponse)

instance Prelude.NFData GetCodeSigningConfigResponse