{-# 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 #-}
module Amazonka.CertificateManagerPCA.GetCertificate
(
GetCertificate (..),
newGetCertificate,
getCertificate_certificateAuthorityArn,
getCertificate_certificateArn,
GetCertificateResponse (..),
newGetCertificateResponse,
getCertificateResponse_certificate,
getCertificateResponse_certificateChain,
getCertificateResponse_httpStatus,
)
where
import Amazonka.CertificateManagerPCA.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCertificate = GetCertificate'
{
GetCertificate -> Text
certificateAuthorityArn :: Prelude.Text,
GetCertificate -> Text
certificateArn :: Prelude.Text
}
deriving (GetCertificate -> GetCertificate -> Bool
(GetCertificate -> GetCertificate -> Bool)
-> (GetCertificate -> GetCertificate -> Bool) -> Eq GetCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCertificate -> GetCertificate -> Bool
$c/= :: GetCertificate -> GetCertificate -> Bool
== :: GetCertificate -> GetCertificate -> Bool
$c== :: GetCertificate -> GetCertificate -> Bool
Prelude.Eq, ReadPrec [GetCertificate]
ReadPrec GetCertificate
Int -> ReadS GetCertificate
ReadS [GetCertificate]
(Int -> ReadS GetCertificate)
-> ReadS [GetCertificate]
-> ReadPrec GetCertificate
-> ReadPrec [GetCertificate]
-> Read GetCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCertificate]
$creadListPrec :: ReadPrec [GetCertificate]
readPrec :: ReadPrec GetCertificate
$creadPrec :: ReadPrec GetCertificate
readList :: ReadS [GetCertificate]
$creadList :: ReadS [GetCertificate]
readsPrec :: Int -> ReadS GetCertificate
$creadsPrec :: Int -> ReadS GetCertificate
Prelude.Read, Int -> GetCertificate -> ShowS
[GetCertificate] -> ShowS
GetCertificate -> String
(Int -> GetCertificate -> ShowS)
-> (GetCertificate -> String)
-> ([GetCertificate] -> ShowS)
-> Show GetCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCertificate] -> ShowS
$cshowList :: [GetCertificate] -> ShowS
show :: GetCertificate -> String
$cshow :: GetCertificate -> String
showsPrec :: Int -> GetCertificate -> ShowS
$cshowsPrec :: Int -> GetCertificate -> ShowS
Prelude.Show, (forall x. GetCertificate -> Rep GetCertificate x)
-> (forall x. Rep GetCertificate x -> GetCertificate)
-> Generic GetCertificate
forall x. Rep GetCertificate x -> GetCertificate
forall x. GetCertificate -> Rep GetCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCertificate x -> GetCertificate
$cfrom :: forall x. GetCertificate -> Rep GetCertificate x
Prelude.Generic)
newGetCertificate ::
Prelude.Text ->
Prelude.Text ->
GetCertificate
newGetCertificate :: Text -> Text -> GetCertificate
newGetCertificate
Text
pCertificateAuthorityArn_
Text
pCertificateArn_ =
GetCertificate' :: Text -> Text -> GetCertificate
GetCertificate'
{ $sel:certificateAuthorityArn:GetCertificate' :: Text
certificateAuthorityArn =
Text
pCertificateAuthorityArn_,
$sel:certificateArn:GetCertificate' :: Text
certificateArn = Text
pCertificateArn_
}
getCertificate_certificateAuthorityArn :: Lens.Lens' GetCertificate Prelude.Text
getCertificate_certificateAuthorityArn :: (Text -> f Text) -> GetCertificate -> f GetCertificate
getCertificate_certificateAuthorityArn = (GetCertificate -> Text)
-> (GetCertificate -> Text -> GetCertificate)
-> Lens GetCertificate GetCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificate' {Text
certificateAuthorityArn :: Text
$sel:certificateAuthorityArn:GetCertificate' :: GetCertificate -> Text
certificateAuthorityArn} -> Text
certificateAuthorityArn) (\s :: GetCertificate
s@GetCertificate' {} Text
a -> GetCertificate
s {$sel:certificateAuthorityArn:GetCertificate' :: Text
certificateAuthorityArn = Text
a} :: GetCertificate)
getCertificate_certificateArn :: Lens.Lens' GetCertificate Prelude.Text
getCertificate_certificateArn :: (Text -> f Text) -> GetCertificate -> f GetCertificate
getCertificate_certificateArn = (GetCertificate -> Text)
-> (GetCertificate -> Text -> GetCertificate)
-> Lens GetCertificate GetCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificate' {Text
certificateArn :: Text
$sel:certificateArn:GetCertificate' :: GetCertificate -> Text
certificateArn} -> Text
certificateArn) (\s :: GetCertificate
s@GetCertificate' {} Text
a -> GetCertificate
s {$sel:certificateArn:GetCertificate' :: Text
certificateArn = Text
a} :: GetCertificate)
instance Core.AWSRequest GetCertificate where
type
AWSResponse GetCertificate =
GetCertificateResponse
request :: GetCertificate -> Request GetCertificate
request = Service -> GetCertificate -> Request GetCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCertificate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCertificate))
-> Logger
-> Service
-> Proxy GetCertificate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCertificate)))
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 ->
Maybe Text -> Maybe Text -> Int -> GetCertificateResponse
GetCertificateResponse'
(Maybe Text -> Maybe Text -> Int -> GetCertificateResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetCertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Certificate")
Either String (Maybe Text -> Int -> GetCertificateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetCertificateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CertificateChain")
Either String (Int -> GetCertificateResponse)
-> Either String Int -> Either String GetCertificateResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetCertificate
instance Prelude.NFData GetCertificate
instance Core.ToHeaders GetCertificate where
toHeaders :: GetCertificate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"ACMPrivateCA.GetCertificate" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetCertificate where
toJSON :: GetCertificate -> Value
toJSON GetCertificate' {Text
certificateArn :: Text
certificateAuthorityArn :: Text
$sel:certificateArn:GetCertificate' :: GetCertificate -> Text
$sel:certificateAuthorityArn:GetCertificate' :: GetCertificate -> 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
"CertificateAuthorityArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateAuthorityArn
),
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)
]
)
instance Core.ToPath GetCertificate where
toPath :: GetCertificate -> ByteString
toPath = ByteString -> GetCertificate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCertificate where
toQuery :: GetCertificate -> QueryString
toQuery = QueryString -> GetCertificate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCertificateResponse = GetCertificateResponse'
{
GetCertificateResponse -> Maybe Text
certificate :: Prelude.Maybe Prelude.Text,
GetCertificateResponse -> Maybe Text
certificateChain :: Prelude.Maybe Prelude.Text,
GetCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCertificateResponse -> GetCertificateResponse -> Bool
(GetCertificateResponse -> GetCertificateResponse -> Bool)
-> (GetCertificateResponse -> GetCertificateResponse -> Bool)
-> Eq GetCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCertificateResponse -> GetCertificateResponse -> Bool
$c/= :: GetCertificateResponse -> GetCertificateResponse -> Bool
== :: GetCertificateResponse -> GetCertificateResponse -> Bool
$c== :: GetCertificateResponse -> GetCertificateResponse -> Bool
Prelude.Eq, ReadPrec [GetCertificateResponse]
ReadPrec GetCertificateResponse
Int -> ReadS GetCertificateResponse
ReadS [GetCertificateResponse]
(Int -> ReadS GetCertificateResponse)
-> ReadS [GetCertificateResponse]
-> ReadPrec GetCertificateResponse
-> ReadPrec [GetCertificateResponse]
-> Read GetCertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCertificateResponse]
$creadListPrec :: ReadPrec [GetCertificateResponse]
readPrec :: ReadPrec GetCertificateResponse
$creadPrec :: ReadPrec GetCertificateResponse
readList :: ReadS [GetCertificateResponse]
$creadList :: ReadS [GetCertificateResponse]
readsPrec :: Int -> ReadS GetCertificateResponse
$creadsPrec :: Int -> ReadS GetCertificateResponse
Prelude.Read, Int -> GetCertificateResponse -> ShowS
[GetCertificateResponse] -> ShowS
GetCertificateResponse -> String
(Int -> GetCertificateResponse -> ShowS)
-> (GetCertificateResponse -> String)
-> ([GetCertificateResponse] -> ShowS)
-> Show GetCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCertificateResponse] -> ShowS
$cshowList :: [GetCertificateResponse] -> ShowS
show :: GetCertificateResponse -> String
$cshow :: GetCertificateResponse -> String
showsPrec :: Int -> GetCertificateResponse -> ShowS
$cshowsPrec :: Int -> GetCertificateResponse -> ShowS
Prelude.Show, (forall x. GetCertificateResponse -> Rep GetCertificateResponse x)
-> (forall x.
Rep GetCertificateResponse x -> GetCertificateResponse)
-> Generic GetCertificateResponse
forall x. Rep GetCertificateResponse x -> GetCertificateResponse
forall x. GetCertificateResponse -> Rep GetCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCertificateResponse x -> GetCertificateResponse
$cfrom :: forall x. GetCertificateResponse -> Rep GetCertificateResponse x
Prelude.Generic)
newGetCertificateResponse ::
Prelude.Int ->
GetCertificateResponse
newGetCertificateResponse :: Int -> GetCertificateResponse
newGetCertificateResponse Int
pHttpStatus_ =
GetCertificateResponse' :: Maybe Text -> Maybe Text -> Int -> GetCertificateResponse
GetCertificateResponse'
{ $sel:certificate:GetCertificateResponse' :: Maybe Text
certificate =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateChain:GetCertificateResponse' :: Maybe Text
certificateChain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCertificateResponse_certificate :: Lens.Lens' GetCertificateResponse (Prelude.Maybe Prelude.Text)
getCertificateResponse_certificate :: (Maybe Text -> f (Maybe Text))
-> GetCertificateResponse -> f GetCertificateResponse
getCertificateResponse_certificate = (GetCertificateResponse -> Maybe Text)
-> (GetCertificateResponse -> Maybe Text -> GetCertificateResponse)
-> Lens
GetCertificateResponse
GetCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificateResponse' {Maybe Text
certificate :: Maybe Text
$sel:certificate:GetCertificateResponse' :: GetCertificateResponse -> Maybe Text
certificate} -> Maybe Text
certificate) (\s :: GetCertificateResponse
s@GetCertificateResponse' {} Maybe Text
a -> GetCertificateResponse
s {$sel:certificate:GetCertificateResponse' :: Maybe Text
certificate = Maybe Text
a} :: GetCertificateResponse)
getCertificateResponse_certificateChain :: Lens.Lens' GetCertificateResponse (Prelude.Maybe Prelude.Text)
getCertificateResponse_certificateChain :: (Maybe Text -> f (Maybe Text))
-> GetCertificateResponse -> f GetCertificateResponse
getCertificateResponse_certificateChain = (GetCertificateResponse -> Maybe Text)
-> (GetCertificateResponse -> Maybe Text -> GetCertificateResponse)
-> Lens
GetCertificateResponse
GetCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificateResponse' {Maybe Text
certificateChain :: Maybe Text
$sel:certificateChain:GetCertificateResponse' :: GetCertificateResponse -> Maybe Text
certificateChain} -> Maybe Text
certificateChain) (\s :: GetCertificateResponse
s@GetCertificateResponse' {} Maybe Text
a -> GetCertificateResponse
s {$sel:certificateChain:GetCertificateResponse' :: Maybe Text
certificateChain = Maybe Text
a} :: GetCertificateResponse)
getCertificateResponse_httpStatus :: Lens.Lens' GetCertificateResponse Prelude.Int
getCertificateResponse_httpStatus :: (Int -> f Int)
-> GetCertificateResponse -> f GetCertificateResponse
getCertificateResponse_httpStatus = (GetCertificateResponse -> Int)
-> (GetCertificateResponse -> Int -> GetCertificateResponse)
-> Lens GetCertificateResponse GetCertificateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCertificateResponse' :: GetCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCertificateResponse
s@GetCertificateResponse' {} Int
a -> GetCertificateResponse
s {$sel:httpStatus:GetCertificateResponse' :: Int
httpStatus = Int
a} :: GetCertificateResponse)
instance Prelude.NFData GetCertificateResponse