{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CertificateManager.GetCertificate
(
getCertificate
, GetCertificate
, gcCertificateARN
, getCertificateResponse
, GetCertificateResponse
, gcrsCertificate
, gcrsCertificateChain
, gcrsResponseStatus
) where
import Network.AWS.CertificateManager.Types
import Network.AWS.CertificateManager.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetCertificate = GetCertificate'
{ _gcCertificateARN :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCertificate
:: Text
-> GetCertificate
getCertificate pCertificateARN_ =
GetCertificate'
{ _gcCertificateARN = pCertificateARN_
}
gcCertificateARN :: Lens' GetCertificate Text
gcCertificateARN = lens _gcCertificateARN (\ s a -> s{_gcCertificateARN = a});
instance AWSRequest GetCertificate where
type Rs GetCertificate = GetCertificateResponse
request = postJSON certificateManager
response
= receiveJSON
(\ s h x ->
GetCertificateResponse' <$>
(x .?> "Certificate") <*> (x .?> "CertificateChain")
<*> (pure (fromEnum s)))
instance Hashable GetCertificate
instance NFData GetCertificate
instance ToHeaders GetCertificate where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CertificateManager.GetCertificate" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetCertificate where
toJSON GetCertificate'{..}
= object
(catMaybes
[Just ("CertificateArn" .= _gcCertificateARN)])
instance ToPath GetCertificate where
toPath = const "/"
instance ToQuery GetCertificate where
toQuery = const mempty
data GetCertificateResponse = GetCertificateResponse'
{ _gcrsCertificate :: !(Maybe Text)
, _gcrsCertificateChain :: !(Maybe Text)
, _gcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCertificateResponse
:: Int
-> GetCertificateResponse
getCertificateResponse pResponseStatus_ =
GetCertificateResponse'
{ _gcrsCertificate = Nothing
, _gcrsCertificateChain = Nothing
, _gcrsResponseStatus = pResponseStatus_
}
gcrsCertificate :: Lens' GetCertificateResponse (Maybe Text)
gcrsCertificate = lens _gcrsCertificate (\ s a -> s{_gcrsCertificate = a});
gcrsCertificateChain :: Lens' GetCertificateResponse (Maybe Text)
gcrsCertificateChain = lens _gcrsCertificateChain (\ s a -> s{_gcrsCertificateChain = a});
gcrsResponseStatus :: Lens' GetCertificateResponse Int
gcrsResponseStatus = lens _gcrsResponseStatus (\ s a -> s{_gcrsResponseStatus = a});
instance NFData GetCertificateResponse