{-# 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.DescribeCertificateAuthority
(
DescribeCertificateAuthority (..),
newDescribeCertificateAuthority,
describeCertificateAuthority_certificateAuthorityArn,
DescribeCertificateAuthorityResponse (..),
newDescribeCertificateAuthorityResponse,
describeCertificateAuthorityResponse_certificateAuthority,
describeCertificateAuthorityResponse_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 DescribeCertificateAuthority = DescribeCertificateAuthority'
{
DescribeCertificateAuthority -> Text
certificateAuthorityArn :: Prelude.Text
}
deriving (DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool
(DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool)
-> (DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool)
-> Eq DescribeCertificateAuthority
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool
$c/= :: DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool
== :: DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool
$c== :: DescribeCertificateAuthority
-> DescribeCertificateAuthority -> Bool
Prelude.Eq, ReadPrec [DescribeCertificateAuthority]
ReadPrec DescribeCertificateAuthority
Int -> ReadS DescribeCertificateAuthority
ReadS [DescribeCertificateAuthority]
(Int -> ReadS DescribeCertificateAuthority)
-> ReadS [DescribeCertificateAuthority]
-> ReadPrec DescribeCertificateAuthority
-> ReadPrec [DescribeCertificateAuthority]
-> Read DescribeCertificateAuthority
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCertificateAuthority]
$creadListPrec :: ReadPrec [DescribeCertificateAuthority]
readPrec :: ReadPrec DescribeCertificateAuthority
$creadPrec :: ReadPrec DescribeCertificateAuthority
readList :: ReadS [DescribeCertificateAuthority]
$creadList :: ReadS [DescribeCertificateAuthority]
readsPrec :: Int -> ReadS DescribeCertificateAuthority
$creadsPrec :: Int -> ReadS DescribeCertificateAuthority
Prelude.Read, Int -> DescribeCertificateAuthority -> ShowS
[DescribeCertificateAuthority] -> ShowS
DescribeCertificateAuthority -> String
(Int -> DescribeCertificateAuthority -> ShowS)
-> (DescribeCertificateAuthority -> String)
-> ([DescribeCertificateAuthority] -> ShowS)
-> Show DescribeCertificateAuthority
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCertificateAuthority] -> ShowS
$cshowList :: [DescribeCertificateAuthority] -> ShowS
show :: DescribeCertificateAuthority -> String
$cshow :: DescribeCertificateAuthority -> String
showsPrec :: Int -> DescribeCertificateAuthority -> ShowS
$cshowsPrec :: Int -> DescribeCertificateAuthority -> ShowS
Prelude.Show, (forall x.
DescribeCertificateAuthority -> Rep DescribeCertificateAuthority x)
-> (forall x.
Rep DescribeCertificateAuthority x -> DescribeCertificateAuthority)
-> Generic DescribeCertificateAuthority
forall x.
Rep DescribeCertificateAuthority x -> DescribeCertificateAuthority
forall x.
DescribeCertificateAuthority -> Rep DescribeCertificateAuthority x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCertificateAuthority x -> DescribeCertificateAuthority
$cfrom :: forall x.
DescribeCertificateAuthority -> Rep DescribeCertificateAuthority x
Prelude.Generic)
newDescribeCertificateAuthority ::
Prelude.Text ->
DescribeCertificateAuthority
newDescribeCertificateAuthority :: Text -> DescribeCertificateAuthority
newDescribeCertificateAuthority
Text
pCertificateAuthorityArn_ =
DescribeCertificateAuthority' :: Text -> DescribeCertificateAuthority
DescribeCertificateAuthority'
{ $sel:certificateAuthorityArn:DescribeCertificateAuthority' :: Text
certificateAuthorityArn =
Text
pCertificateAuthorityArn_
}
describeCertificateAuthority_certificateAuthorityArn :: Lens.Lens' DescribeCertificateAuthority Prelude.Text
describeCertificateAuthority_certificateAuthorityArn :: (Text -> f Text)
-> DescribeCertificateAuthority -> f DescribeCertificateAuthority
describeCertificateAuthority_certificateAuthorityArn = (DescribeCertificateAuthority -> Text)
-> (DescribeCertificateAuthority
-> Text -> DescribeCertificateAuthority)
-> Lens
DescribeCertificateAuthority DescribeCertificateAuthority Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificateAuthority' {Text
certificateAuthorityArn :: Text
$sel:certificateAuthorityArn:DescribeCertificateAuthority' :: DescribeCertificateAuthority -> Text
certificateAuthorityArn} -> Text
certificateAuthorityArn) (\s :: DescribeCertificateAuthority
s@DescribeCertificateAuthority' {} Text
a -> DescribeCertificateAuthority
s {$sel:certificateAuthorityArn:DescribeCertificateAuthority' :: Text
certificateAuthorityArn = Text
a} :: DescribeCertificateAuthority)
instance Core.AWSRequest DescribeCertificateAuthority where
type
AWSResponse DescribeCertificateAuthority =
DescribeCertificateAuthorityResponse
request :: DescribeCertificateAuthority
-> Request DescribeCertificateAuthority
request = Service
-> DescribeCertificateAuthority
-> Request DescribeCertificateAuthority
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeCertificateAuthority
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeCertificateAuthority)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeCertificateAuthority))
-> Logger
-> Service
-> Proxy DescribeCertificateAuthority
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeCertificateAuthority)))
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 CertificateAuthority
-> Int -> DescribeCertificateAuthorityResponse
DescribeCertificateAuthorityResponse'
(Maybe CertificateAuthority
-> Int -> DescribeCertificateAuthorityResponse)
-> Either String (Maybe CertificateAuthority)
-> Either String (Int -> DescribeCertificateAuthorityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CertificateAuthority)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CertificateAuthority")
Either String (Int -> DescribeCertificateAuthorityResponse)
-> Either String Int
-> Either String DescribeCertificateAuthorityResponse
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
DescribeCertificateAuthority
instance Prelude.NFData DescribeCertificateAuthority
instance Core.ToHeaders DescribeCertificateAuthority where
toHeaders :: DescribeCertificateAuthority -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeCertificateAuthority -> 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.DescribeCertificateAuthority" ::
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 DescribeCertificateAuthority where
toJSON :: DescribeCertificateAuthority -> Value
toJSON DescribeCertificateAuthority' {Text
certificateAuthorityArn :: Text
$sel:certificateAuthorityArn:DescribeCertificateAuthority' :: DescribeCertificateAuthority -> 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
)
]
)
instance Core.ToPath DescribeCertificateAuthority where
toPath :: DescribeCertificateAuthority -> ByteString
toPath = ByteString -> DescribeCertificateAuthority -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeCertificateAuthority where
toQuery :: DescribeCertificateAuthority -> QueryString
toQuery = QueryString -> DescribeCertificateAuthority -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeCertificateAuthorityResponse = DescribeCertificateAuthorityResponse'
{
DescribeCertificateAuthorityResponse -> Maybe CertificateAuthority
certificateAuthority :: Prelude.Maybe CertificateAuthority,
DescribeCertificateAuthorityResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool
(DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool)
-> (DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool)
-> Eq DescribeCertificateAuthorityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool
$c/= :: DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool
== :: DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool
$c== :: DescribeCertificateAuthorityResponse
-> DescribeCertificateAuthorityResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCertificateAuthorityResponse]
ReadPrec DescribeCertificateAuthorityResponse
Int -> ReadS DescribeCertificateAuthorityResponse
ReadS [DescribeCertificateAuthorityResponse]
(Int -> ReadS DescribeCertificateAuthorityResponse)
-> ReadS [DescribeCertificateAuthorityResponse]
-> ReadPrec DescribeCertificateAuthorityResponse
-> ReadPrec [DescribeCertificateAuthorityResponse]
-> Read DescribeCertificateAuthorityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCertificateAuthorityResponse]
$creadListPrec :: ReadPrec [DescribeCertificateAuthorityResponse]
readPrec :: ReadPrec DescribeCertificateAuthorityResponse
$creadPrec :: ReadPrec DescribeCertificateAuthorityResponse
readList :: ReadS [DescribeCertificateAuthorityResponse]
$creadList :: ReadS [DescribeCertificateAuthorityResponse]
readsPrec :: Int -> ReadS DescribeCertificateAuthorityResponse
$creadsPrec :: Int -> ReadS DescribeCertificateAuthorityResponse
Prelude.Read, Int -> DescribeCertificateAuthorityResponse -> ShowS
[DescribeCertificateAuthorityResponse] -> ShowS
DescribeCertificateAuthorityResponse -> String
(Int -> DescribeCertificateAuthorityResponse -> ShowS)
-> (DescribeCertificateAuthorityResponse -> String)
-> ([DescribeCertificateAuthorityResponse] -> ShowS)
-> Show DescribeCertificateAuthorityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCertificateAuthorityResponse] -> ShowS
$cshowList :: [DescribeCertificateAuthorityResponse] -> ShowS
show :: DescribeCertificateAuthorityResponse -> String
$cshow :: DescribeCertificateAuthorityResponse -> String
showsPrec :: Int -> DescribeCertificateAuthorityResponse -> ShowS
$cshowsPrec :: Int -> DescribeCertificateAuthorityResponse -> ShowS
Prelude.Show, (forall x.
DescribeCertificateAuthorityResponse
-> Rep DescribeCertificateAuthorityResponse x)
-> (forall x.
Rep DescribeCertificateAuthorityResponse x
-> DescribeCertificateAuthorityResponse)
-> Generic DescribeCertificateAuthorityResponse
forall x.
Rep DescribeCertificateAuthorityResponse x
-> DescribeCertificateAuthorityResponse
forall x.
DescribeCertificateAuthorityResponse
-> Rep DescribeCertificateAuthorityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCertificateAuthorityResponse x
-> DescribeCertificateAuthorityResponse
$cfrom :: forall x.
DescribeCertificateAuthorityResponse
-> Rep DescribeCertificateAuthorityResponse x
Prelude.Generic)
newDescribeCertificateAuthorityResponse ::
Prelude.Int ->
DescribeCertificateAuthorityResponse
newDescribeCertificateAuthorityResponse :: Int -> DescribeCertificateAuthorityResponse
newDescribeCertificateAuthorityResponse Int
pHttpStatus_ =
DescribeCertificateAuthorityResponse' :: Maybe CertificateAuthority
-> Int -> DescribeCertificateAuthorityResponse
DescribeCertificateAuthorityResponse'
{ $sel:certificateAuthority:DescribeCertificateAuthorityResponse' :: Maybe CertificateAuthority
certificateAuthority =
Maybe CertificateAuthority
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCertificateAuthorityResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCertificateAuthorityResponse_certificateAuthority :: Lens.Lens' DescribeCertificateAuthorityResponse (Prelude.Maybe CertificateAuthority)
describeCertificateAuthorityResponse_certificateAuthority :: (Maybe CertificateAuthority -> f (Maybe CertificateAuthority))
-> DescribeCertificateAuthorityResponse
-> f DescribeCertificateAuthorityResponse
describeCertificateAuthorityResponse_certificateAuthority = (DescribeCertificateAuthorityResponse
-> Maybe CertificateAuthority)
-> (DescribeCertificateAuthorityResponse
-> Maybe CertificateAuthority
-> DescribeCertificateAuthorityResponse)
-> Lens
DescribeCertificateAuthorityResponse
DescribeCertificateAuthorityResponse
(Maybe CertificateAuthority)
(Maybe CertificateAuthority)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificateAuthorityResponse' {Maybe CertificateAuthority
certificateAuthority :: Maybe CertificateAuthority
$sel:certificateAuthority:DescribeCertificateAuthorityResponse' :: DescribeCertificateAuthorityResponse -> Maybe CertificateAuthority
certificateAuthority} -> Maybe CertificateAuthority
certificateAuthority) (\s :: DescribeCertificateAuthorityResponse
s@DescribeCertificateAuthorityResponse' {} Maybe CertificateAuthority
a -> DescribeCertificateAuthorityResponse
s {$sel:certificateAuthority:DescribeCertificateAuthorityResponse' :: Maybe CertificateAuthority
certificateAuthority = Maybe CertificateAuthority
a} :: DescribeCertificateAuthorityResponse)
describeCertificateAuthorityResponse_httpStatus :: Lens.Lens' DescribeCertificateAuthorityResponse Prelude.Int
describeCertificateAuthorityResponse_httpStatus :: (Int -> f Int)
-> DescribeCertificateAuthorityResponse
-> f DescribeCertificateAuthorityResponse
describeCertificateAuthorityResponse_httpStatus = (DescribeCertificateAuthorityResponse -> Int)
-> (DescribeCertificateAuthorityResponse
-> Int -> DescribeCertificateAuthorityResponse)
-> Lens
DescribeCertificateAuthorityResponse
DescribeCertificateAuthorityResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificateAuthorityResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCertificateAuthorityResponse' :: DescribeCertificateAuthorityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCertificateAuthorityResponse
s@DescribeCertificateAuthorityResponse' {} Int
a -> DescribeCertificateAuthorityResponse
s {$sel:httpStatus:DescribeCertificateAuthorityResponse' :: Int
httpStatus = Int
a} :: DescribeCertificateAuthorityResponse)
instance
Prelude.NFData
DescribeCertificateAuthorityResponse