module Network.AWS.CloudHSM.CreateLunaClient
(
createLunaClient
, CreateLunaClient
, clcLabel
, clcCertificate
, createLunaClientResponse
, CreateLunaClientResponse
, clcrsClientARN
, clcrsResponseStatus
) where
import Network.AWS.CloudHSM.Types
import Network.AWS.CloudHSM.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateLunaClient = CreateLunaClient'
{ _clcLabel :: !(Maybe Text)
, _clcCertificate :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createLunaClient
:: Text
-> CreateLunaClient
createLunaClient pCertificate_ =
CreateLunaClient'
{ _clcLabel = Nothing
, _clcCertificate = pCertificate_
}
clcLabel :: Lens' CreateLunaClient (Maybe Text)
clcLabel = lens _clcLabel (\ s a -> s{_clcLabel = a});
clcCertificate :: Lens' CreateLunaClient Text
clcCertificate = lens _clcCertificate (\ s a -> s{_clcCertificate = a});
instance AWSRequest CreateLunaClient where
type Rs CreateLunaClient = CreateLunaClientResponse
request = postJSON cloudHSM
response
= receiveJSON
(\ s h x ->
CreateLunaClientResponse' <$>
(x .?> "ClientArn") <*> (pure (fromEnum s)))
instance ToHeaders CreateLunaClient where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CloudHsmFrontendService.CreateLunaClient" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateLunaClient where
toJSON CreateLunaClient'{..}
= object
(catMaybes
[("Label" .=) <$> _clcLabel,
Just ("Certificate" .= _clcCertificate)])
instance ToPath CreateLunaClient where
toPath = const "/"
instance ToQuery CreateLunaClient where
toQuery = const mempty
data CreateLunaClientResponse = CreateLunaClientResponse'
{ _clcrsClientARN :: !(Maybe Text)
, _clcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createLunaClientResponse
:: Int
-> CreateLunaClientResponse
createLunaClientResponse pResponseStatus_ =
CreateLunaClientResponse'
{ _clcrsClientARN = Nothing
, _clcrsResponseStatus = pResponseStatus_
}
clcrsClientARN :: Lens' CreateLunaClientResponse (Maybe Text)
clcrsClientARN = lens _clcrsClientARN (\ s a -> s{_clcrsClientARN = a});
clcrsResponseStatus :: Lens' CreateLunaClientResponse Int
clcrsResponseStatus = lens _clcrsResponseStatus (\ s a -> s{_clcrsResponseStatus = a});