{-# 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.IoT.DescribeCertificate
(
DescribeCertificate (..),
newDescribeCertificate,
describeCertificate_certificateId,
DescribeCertificateResponse (..),
newDescribeCertificateResponse,
describeCertificateResponse_certificateDescription,
describeCertificateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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
data DescribeCertificate = DescribeCertificate'
{
DescribeCertificate -> Text
certificateId :: Prelude.Text
}
deriving (DescribeCertificate -> DescribeCertificate -> Bool
(DescribeCertificate -> DescribeCertificate -> Bool)
-> (DescribeCertificate -> DescribeCertificate -> Bool)
-> Eq DescribeCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCertificate -> DescribeCertificate -> Bool
$c/= :: DescribeCertificate -> DescribeCertificate -> Bool
== :: DescribeCertificate -> DescribeCertificate -> Bool
$c== :: DescribeCertificate -> DescribeCertificate -> Bool
Prelude.Eq, ReadPrec [DescribeCertificate]
ReadPrec DescribeCertificate
Int -> ReadS DescribeCertificate
ReadS [DescribeCertificate]
(Int -> ReadS DescribeCertificate)
-> ReadS [DescribeCertificate]
-> ReadPrec DescribeCertificate
-> ReadPrec [DescribeCertificate]
-> Read DescribeCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCertificate]
$creadListPrec :: ReadPrec [DescribeCertificate]
readPrec :: ReadPrec DescribeCertificate
$creadPrec :: ReadPrec DescribeCertificate
readList :: ReadS [DescribeCertificate]
$creadList :: ReadS [DescribeCertificate]
readsPrec :: Int -> ReadS DescribeCertificate
$creadsPrec :: Int -> ReadS DescribeCertificate
Prelude.Read, Int -> DescribeCertificate -> ShowS
[DescribeCertificate] -> ShowS
DescribeCertificate -> String
(Int -> DescribeCertificate -> ShowS)
-> (DescribeCertificate -> String)
-> ([DescribeCertificate] -> ShowS)
-> Show DescribeCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCertificate] -> ShowS
$cshowList :: [DescribeCertificate] -> ShowS
show :: DescribeCertificate -> String
$cshow :: DescribeCertificate -> String
showsPrec :: Int -> DescribeCertificate -> ShowS
$cshowsPrec :: Int -> DescribeCertificate -> ShowS
Prelude.Show, (forall x. DescribeCertificate -> Rep DescribeCertificate x)
-> (forall x. Rep DescribeCertificate x -> DescribeCertificate)
-> Generic DescribeCertificate
forall x. Rep DescribeCertificate x -> DescribeCertificate
forall x. DescribeCertificate -> Rep DescribeCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCertificate x -> DescribeCertificate
$cfrom :: forall x. DescribeCertificate -> Rep DescribeCertificate x
Prelude.Generic)
newDescribeCertificate ::
Prelude.Text ->
DescribeCertificate
newDescribeCertificate :: Text -> DescribeCertificate
newDescribeCertificate Text
pCertificateId_ =
DescribeCertificate' :: Text -> DescribeCertificate
DescribeCertificate'
{ $sel:certificateId:DescribeCertificate' :: Text
certificateId =
Text
pCertificateId_
}
describeCertificate_certificateId :: Lens.Lens' DescribeCertificate Prelude.Text
describeCertificate_certificateId :: (Text -> f Text) -> DescribeCertificate -> f DescribeCertificate
describeCertificate_certificateId = (DescribeCertificate -> Text)
-> (DescribeCertificate -> Text -> DescribeCertificate)
-> Lens DescribeCertificate DescribeCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificate' {Text
certificateId :: Text
$sel:certificateId:DescribeCertificate' :: DescribeCertificate -> Text
certificateId} -> Text
certificateId) (\s :: DescribeCertificate
s@DescribeCertificate' {} Text
a -> DescribeCertificate
s {$sel:certificateId:DescribeCertificate' :: Text
certificateId = Text
a} :: DescribeCertificate)
instance Core.AWSRequest DescribeCertificate where
type
AWSResponse DescribeCertificate =
DescribeCertificateResponse
request :: DescribeCertificate -> Request DescribeCertificate
request = Service -> DescribeCertificate -> Request DescribeCertificate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeCertificate))
-> Logger
-> Service
-> Proxy DescribeCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeCertificate)))
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 CertificateDescription -> Int -> DescribeCertificateResponse
DescribeCertificateResponse'
(Maybe CertificateDescription
-> Int -> DescribeCertificateResponse)
-> Either String (Maybe CertificateDescription)
-> Either String (Int -> DescribeCertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CertificateDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"certificateDescription")
Either String (Int -> DescribeCertificateResponse)
-> Either String Int -> Either String DescribeCertificateResponse
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 DescribeCertificate
instance Prelude.NFData DescribeCertificate
instance Core.ToHeaders DescribeCertificate where
toHeaders :: DescribeCertificate -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeCertificate where
toPath :: DescribeCertificate -> ByteString
toPath DescribeCertificate' {Text
certificateId :: Text
$sel:certificateId:DescribeCertificate' :: DescribeCertificate -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/certificates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
certificateId]
instance Core.ToQuery DescribeCertificate where
toQuery :: DescribeCertificate -> QueryString
toQuery = QueryString -> DescribeCertificate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeCertificateResponse = DescribeCertificateResponse'
{
DescribeCertificateResponse -> Maybe CertificateDescription
certificateDescription :: Prelude.Maybe CertificateDescription,
DescribeCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCertificateResponse -> DescribeCertificateResponse -> Bool
(DescribeCertificateResponse
-> DescribeCertificateResponse -> Bool)
-> (DescribeCertificateResponse
-> DescribeCertificateResponse -> Bool)
-> Eq DescribeCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCertificateResponse -> DescribeCertificateResponse -> Bool
$c/= :: DescribeCertificateResponse -> DescribeCertificateResponse -> Bool
== :: DescribeCertificateResponse -> DescribeCertificateResponse -> Bool
$c== :: DescribeCertificateResponse -> DescribeCertificateResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCertificateResponse]
ReadPrec DescribeCertificateResponse
Int -> ReadS DescribeCertificateResponse
ReadS [DescribeCertificateResponse]
(Int -> ReadS DescribeCertificateResponse)
-> ReadS [DescribeCertificateResponse]
-> ReadPrec DescribeCertificateResponse
-> ReadPrec [DescribeCertificateResponse]
-> Read DescribeCertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCertificateResponse]
$creadListPrec :: ReadPrec [DescribeCertificateResponse]
readPrec :: ReadPrec DescribeCertificateResponse
$creadPrec :: ReadPrec DescribeCertificateResponse
readList :: ReadS [DescribeCertificateResponse]
$creadList :: ReadS [DescribeCertificateResponse]
readsPrec :: Int -> ReadS DescribeCertificateResponse
$creadsPrec :: Int -> ReadS DescribeCertificateResponse
Prelude.Read, Int -> DescribeCertificateResponse -> ShowS
[DescribeCertificateResponse] -> ShowS
DescribeCertificateResponse -> String
(Int -> DescribeCertificateResponse -> ShowS)
-> (DescribeCertificateResponse -> String)
-> ([DescribeCertificateResponse] -> ShowS)
-> Show DescribeCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCertificateResponse] -> ShowS
$cshowList :: [DescribeCertificateResponse] -> ShowS
show :: DescribeCertificateResponse -> String
$cshow :: DescribeCertificateResponse -> String
showsPrec :: Int -> DescribeCertificateResponse -> ShowS
$cshowsPrec :: Int -> DescribeCertificateResponse -> ShowS
Prelude.Show, (forall x.
DescribeCertificateResponse -> Rep DescribeCertificateResponse x)
-> (forall x.
Rep DescribeCertificateResponse x -> DescribeCertificateResponse)
-> Generic DescribeCertificateResponse
forall x.
Rep DescribeCertificateResponse x -> DescribeCertificateResponse
forall x.
DescribeCertificateResponse -> Rep DescribeCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCertificateResponse x -> DescribeCertificateResponse
$cfrom :: forall x.
DescribeCertificateResponse -> Rep DescribeCertificateResponse x
Prelude.Generic)
newDescribeCertificateResponse ::
Prelude.Int ->
DescribeCertificateResponse
newDescribeCertificateResponse :: Int -> DescribeCertificateResponse
newDescribeCertificateResponse Int
pHttpStatus_ =
DescribeCertificateResponse' :: Maybe CertificateDescription -> Int -> DescribeCertificateResponse
DescribeCertificateResponse'
{ $sel:certificateDescription:DescribeCertificateResponse' :: Maybe CertificateDescription
certificateDescription =
Maybe CertificateDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCertificateResponse_certificateDescription :: Lens.Lens' DescribeCertificateResponse (Prelude.Maybe CertificateDescription)
describeCertificateResponse_certificateDescription :: (Maybe CertificateDescription -> f (Maybe CertificateDescription))
-> DescribeCertificateResponse -> f DescribeCertificateResponse
describeCertificateResponse_certificateDescription = (DescribeCertificateResponse -> Maybe CertificateDescription)
-> (DescribeCertificateResponse
-> Maybe CertificateDescription -> DescribeCertificateResponse)
-> Lens
DescribeCertificateResponse
DescribeCertificateResponse
(Maybe CertificateDescription)
(Maybe CertificateDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificateResponse' {Maybe CertificateDescription
certificateDescription :: Maybe CertificateDescription
$sel:certificateDescription:DescribeCertificateResponse' :: DescribeCertificateResponse -> Maybe CertificateDescription
certificateDescription} -> Maybe CertificateDescription
certificateDescription) (\s :: DescribeCertificateResponse
s@DescribeCertificateResponse' {} Maybe CertificateDescription
a -> DescribeCertificateResponse
s {$sel:certificateDescription:DescribeCertificateResponse' :: Maybe CertificateDescription
certificateDescription = Maybe CertificateDescription
a} :: DescribeCertificateResponse)
describeCertificateResponse_httpStatus :: Lens.Lens' DescribeCertificateResponse Prelude.Int
describeCertificateResponse_httpStatus :: (Int -> f Int)
-> DescribeCertificateResponse -> f DescribeCertificateResponse
describeCertificateResponse_httpStatus = (DescribeCertificateResponse -> Int)
-> (DescribeCertificateResponse
-> Int -> DescribeCertificateResponse)
-> Lens
DescribeCertificateResponse DescribeCertificateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCertificateResponse' :: DescribeCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCertificateResponse
s@DescribeCertificateResponse' {} Int
a -> DescribeCertificateResponse
s {$sel:httpStatus:DescribeCertificateResponse' :: Int
httpStatus = Int
a} :: DescribeCertificateResponse)
instance Prelude.NFData DescribeCertificateResponse