{-# 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.IAM.GetServerCertificate
(
GetServerCertificate (..),
newGetServerCertificate,
getServerCertificate_serverCertificateName,
GetServerCertificateResponse (..),
newGetServerCertificateResponse,
getServerCertificateResponse_httpStatus,
getServerCertificateResponse_serverCertificate,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.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 GetServerCertificate = GetServerCertificate'
{
GetServerCertificate -> Text
serverCertificateName :: Prelude.Text
}
deriving (GetServerCertificate -> GetServerCertificate -> Bool
(GetServerCertificate -> GetServerCertificate -> Bool)
-> (GetServerCertificate -> GetServerCertificate -> Bool)
-> Eq GetServerCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServerCertificate -> GetServerCertificate -> Bool
$c/= :: GetServerCertificate -> GetServerCertificate -> Bool
== :: GetServerCertificate -> GetServerCertificate -> Bool
$c== :: GetServerCertificate -> GetServerCertificate -> Bool
Prelude.Eq, ReadPrec [GetServerCertificate]
ReadPrec GetServerCertificate
Int -> ReadS GetServerCertificate
ReadS [GetServerCertificate]
(Int -> ReadS GetServerCertificate)
-> ReadS [GetServerCertificate]
-> ReadPrec GetServerCertificate
-> ReadPrec [GetServerCertificate]
-> Read GetServerCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServerCertificate]
$creadListPrec :: ReadPrec [GetServerCertificate]
readPrec :: ReadPrec GetServerCertificate
$creadPrec :: ReadPrec GetServerCertificate
readList :: ReadS [GetServerCertificate]
$creadList :: ReadS [GetServerCertificate]
readsPrec :: Int -> ReadS GetServerCertificate
$creadsPrec :: Int -> ReadS GetServerCertificate
Prelude.Read, Int -> GetServerCertificate -> ShowS
[GetServerCertificate] -> ShowS
GetServerCertificate -> String
(Int -> GetServerCertificate -> ShowS)
-> (GetServerCertificate -> String)
-> ([GetServerCertificate] -> ShowS)
-> Show GetServerCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServerCertificate] -> ShowS
$cshowList :: [GetServerCertificate] -> ShowS
show :: GetServerCertificate -> String
$cshow :: GetServerCertificate -> String
showsPrec :: Int -> GetServerCertificate -> ShowS
$cshowsPrec :: Int -> GetServerCertificate -> ShowS
Prelude.Show, (forall x. GetServerCertificate -> Rep GetServerCertificate x)
-> (forall x. Rep GetServerCertificate x -> GetServerCertificate)
-> Generic GetServerCertificate
forall x. Rep GetServerCertificate x -> GetServerCertificate
forall x. GetServerCertificate -> Rep GetServerCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServerCertificate x -> GetServerCertificate
$cfrom :: forall x. GetServerCertificate -> Rep GetServerCertificate x
Prelude.Generic)
newGetServerCertificate ::
Prelude.Text ->
GetServerCertificate
newGetServerCertificate :: Text -> GetServerCertificate
newGetServerCertificate Text
pServerCertificateName_ =
GetServerCertificate' :: Text -> GetServerCertificate
GetServerCertificate'
{ $sel:serverCertificateName:GetServerCertificate' :: Text
serverCertificateName =
Text
pServerCertificateName_
}
getServerCertificate_serverCertificateName :: Lens.Lens' GetServerCertificate Prelude.Text
getServerCertificate_serverCertificateName :: (Text -> f Text) -> GetServerCertificate -> f GetServerCertificate
getServerCertificate_serverCertificateName = (GetServerCertificate -> Text)
-> (GetServerCertificate -> Text -> GetServerCertificate)
-> Lens GetServerCertificate GetServerCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServerCertificate' {Text
serverCertificateName :: Text
$sel:serverCertificateName:GetServerCertificate' :: GetServerCertificate -> Text
serverCertificateName} -> Text
serverCertificateName) (\s :: GetServerCertificate
s@GetServerCertificate' {} Text
a -> GetServerCertificate
s {$sel:serverCertificateName:GetServerCertificate' :: Text
serverCertificateName = Text
a} :: GetServerCertificate)
instance Core.AWSRequest GetServerCertificate where
type
AWSResponse GetServerCertificate =
GetServerCertificateResponse
request :: GetServerCertificate -> Request GetServerCertificate
request = Service -> GetServerCertificate -> Request GetServerCertificate
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetServerCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServerCertificate)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetServerCertificate))
-> Logger
-> Service
-> Proxy GetServerCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServerCertificate)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetServerCertificateResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> ServerCertificate -> GetServerCertificateResponse
GetServerCertificateResponse'
(Int -> ServerCertificate -> GetServerCertificateResponse)
-> Either String Int
-> Either
String (ServerCertificate -> GetServerCertificateResponse)
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 (ServerCertificate -> GetServerCertificateResponse)
-> Either String ServerCertificate
-> Either String GetServerCertificateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ServerCertificate
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ServerCertificate")
)
instance Prelude.Hashable GetServerCertificate
instance Prelude.NFData GetServerCertificate
instance Core.ToHeaders GetServerCertificate where
toHeaders :: GetServerCertificate -> ResponseHeaders
toHeaders = ResponseHeaders -> GetServerCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetServerCertificate where
toPath :: GetServerCertificate -> ByteString
toPath = ByteString -> GetServerCertificate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetServerCertificate where
toQuery :: GetServerCertificate -> QueryString
toQuery GetServerCertificate' {Text
serverCertificateName :: Text
$sel:serverCertificateName:GetServerCertificate' :: GetServerCertificate -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetServerCertificate" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"ServerCertificateName"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
serverCertificateName
]
data GetServerCertificateResponse = GetServerCertificateResponse'
{
GetServerCertificateResponse -> Int
httpStatus :: Prelude.Int,
GetServerCertificateResponse -> ServerCertificate
serverCertificate :: ServerCertificate
}
deriving (GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool
(GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool)
-> (GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool)
-> Eq GetServerCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool
$c/= :: GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool
== :: GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool
$c== :: GetServerCertificateResponse
-> GetServerCertificateResponse -> Bool
Prelude.Eq, ReadPrec [GetServerCertificateResponse]
ReadPrec GetServerCertificateResponse
Int -> ReadS GetServerCertificateResponse
ReadS [GetServerCertificateResponse]
(Int -> ReadS GetServerCertificateResponse)
-> ReadS [GetServerCertificateResponse]
-> ReadPrec GetServerCertificateResponse
-> ReadPrec [GetServerCertificateResponse]
-> Read GetServerCertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServerCertificateResponse]
$creadListPrec :: ReadPrec [GetServerCertificateResponse]
readPrec :: ReadPrec GetServerCertificateResponse
$creadPrec :: ReadPrec GetServerCertificateResponse
readList :: ReadS [GetServerCertificateResponse]
$creadList :: ReadS [GetServerCertificateResponse]
readsPrec :: Int -> ReadS GetServerCertificateResponse
$creadsPrec :: Int -> ReadS GetServerCertificateResponse
Prelude.Read, Int -> GetServerCertificateResponse -> ShowS
[GetServerCertificateResponse] -> ShowS
GetServerCertificateResponse -> String
(Int -> GetServerCertificateResponse -> ShowS)
-> (GetServerCertificateResponse -> String)
-> ([GetServerCertificateResponse] -> ShowS)
-> Show GetServerCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServerCertificateResponse] -> ShowS
$cshowList :: [GetServerCertificateResponse] -> ShowS
show :: GetServerCertificateResponse -> String
$cshow :: GetServerCertificateResponse -> String
showsPrec :: Int -> GetServerCertificateResponse -> ShowS
$cshowsPrec :: Int -> GetServerCertificateResponse -> ShowS
Prelude.Show, (forall x.
GetServerCertificateResponse -> Rep GetServerCertificateResponse x)
-> (forall x.
Rep GetServerCertificateResponse x -> GetServerCertificateResponse)
-> Generic GetServerCertificateResponse
forall x.
Rep GetServerCertificateResponse x -> GetServerCertificateResponse
forall x.
GetServerCertificateResponse -> Rep GetServerCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServerCertificateResponse x -> GetServerCertificateResponse
$cfrom :: forall x.
GetServerCertificateResponse -> Rep GetServerCertificateResponse x
Prelude.Generic)
newGetServerCertificateResponse ::
Prelude.Int ->
ServerCertificate ->
GetServerCertificateResponse
newGetServerCertificateResponse :: Int -> ServerCertificate -> GetServerCertificateResponse
newGetServerCertificateResponse
Int
pHttpStatus_
ServerCertificate
pServerCertificate_ =
GetServerCertificateResponse' :: Int -> ServerCertificate -> GetServerCertificateResponse
GetServerCertificateResponse'
{ $sel:httpStatus:GetServerCertificateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:serverCertificate:GetServerCertificateResponse' :: ServerCertificate
serverCertificate = ServerCertificate
pServerCertificate_
}
getServerCertificateResponse_httpStatus :: Lens.Lens' GetServerCertificateResponse Prelude.Int
getServerCertificateResponse_httpStatus :: (Int -> f Int)
-> GetServerCertificateResponse -> f GetServerCertificateResponse
getServerCertificateResponse_httpStatus = (GetServerCertificateResponse -> Int)
-> (GetServerCertificateResponse
-> Int -> GetServerCertificateResponse)
-> Lens
GetServerCertificateResponse GetServerCertificateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServerCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServerCertificateResponse' :: GetServerCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServerCertificateResponse
s@GetServerCertificateResponse' {} Int
a -> GetServerCertificateResponse
s {$sel:httpStatus:GetServerCertificateResponse' :: Int
httpStatus = Int
a} :: GetServerCertificateResponse)
getServerCertificateResponse_serverCertificate :: Lens.Lens' GetServerCertificateResponse ServerCertificate
getServerCertificateResponse_serverCertificate :: (ServerCertificate -> f ServerCertificate)
-> GetServerCertificateResponse -> f GetServerCertificateResponse
getServerCertificateResponse_serverCertificate = (GetServerCertificateResponse -> ServerCertificate)
-> (GetServerCertificateResponse
-> ServerCertificate -> GetServerCertificateResponse)
-> Lens
GetServerCertificateResponse
GetServerCertificateResponse
ServerCertificate
ServerCertificate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServerCertificateResponse' {ServerCertificate
serverCertificate :: ServerCertificate
$sel:serverCertificate:GetServerCertificateResponse' :: GetServerCertificateResponse -> ServerCertificate
serverCertificate} -> ServerCertificate
serverCertificate) (\s :: GetServerCertificateResponse
s@GetServerCertificateResponse' {} ServerCertificate
a -> GetServerCertificateResponse
s {$sel:serverCertificate:GetServerCertificateResponse' :: ServerCertificate
serverCertificate = ServerCertificate
a} :: GetServerCertificateResponse)
instance Prelude.NFData GetServerCertificateResponse