{-# 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.CloudHSM.CreateHSM
(
createHSM
, CreateHSM
, chClientToken
, chSyslogIP
, chExternalId
, chEniIP
, chSubnetId
, chSSHKey
, chIAMRoleARN
, chSubscriptionType
, createHSMResponse
, CreateHSMResponse
, chrsHSMARN
, chrsResponseStatus
) where
import Network.AWS.CloudHSM.Types
import Network.AWS.CloudHSM.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateHSM = CreateHSM'
{ _chClientToken :: !(Maybe Text)
, _chSyslogIP :: !(Maybe Text)
, _chExternalId :: !(Maybe Text)
, _chEniIP :: !(Maybe Text)
, _chSubnetId :: !Text
, _chSSHKey :: !Text
, _chIAMRoleARN :: !Text
, _chSubscriptionType :: !SubscriptionType
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createHSM
:: Text
-> Text
-> Text
-> SubscriptionType
-> CreateHSM
createHSM pSubnetId_ pSSHKey_ pIAMRoleARN_ pSubscriptionType_ =
CreateHSM'
{ _chClientToken = Nothing
, _chSyslogIP = Nothing
, _chExternalId = Nothing
, _chEniIP = Nothing
, _chSubnetId = pSubnetId_
, _chSSHKey = pSSHKey_
, _chIAMRoleARN = pIAMRoleARN_
, _chSubscriptionType = pSubscriptionType_
}
chClientToken :: Lens' CreateHSM (Maybe Text)
chClientToken = lens _chClientToken (\ s a -> s{_chClientToken = a});
chSyslogIP :: Lens' CreateHSM (Maybe Text)
chSyslogIP = lens _chSyslogIP (\ s a -> s{_chSyslogIP = a});
chExternalId :: Lens' CreateHSM (Maybe Text)
chExternalId = lens _chExternalId (\ s a -> s{_chExternalId = a});
chEniIP :: Lens' CreateHSM (Maybe Text)
chEniIP = lens _chEniIP (\ s a -> s{_chEniIP = a});
chSubnetId :: Lens' CreateHSM Text
chSubnetId = lens _chSubnetId (\ s a -> s{_chSubnetId = a});
chSSHKey :: Lens' CreateHSM Text
chSSHKey = lens _chSSHKey (\ s a -> s{_chSSHKey = a});
chIAMRoleARN :: Lens' CreateHSM Text
chIAMRoleARN = lens _chIAMRoleARN (\ s a -> s{_chIAMRoleARN = a});
chSubscriptionType :: Lens' CreateHSM SubscriptionType
chSubscriptionType = lens _chSubscriptionType (\ s a -> s{_chSubscriptionType = a});
instance AWSRequest CreateHSM where
type Rs CreateHSM = CreateHSMResponse
request = postJSON cloudHSM
response
= receiveJSON
(\ s h x ->
CreateHSMResponse' <$>
(x .?> "HsmArn") <*> (pure (fromEnum s)))
instance Hashable CreateHSM
instance NFData CreateHSM
instance ToHeaders CreateHSM where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CloudHsmFrontendService.CreateHsm" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateHSM where
toJSON CreateHSM'{..}
= object
(catMaybes
[("ClientToken" .=) <$> _chClientToken,
("SyslogIp" .=) <$> _chSyslogIP,
("ExternalId" .=) <$> _chExternalId,
("EniIp" .=) <$> _chEniIP,
Just ("SubnetId" .= _chSubnetId),
Just ("SshKey" .= _chSSHKey),
Just ("IamRoleArn" .= _chIAMRoleARN),
Just ("SubscriptionType" .= _chSubscriptionType)])
instance ToPath CreateHSM where
toPath = const "/"
instance ToQuery CreateHSM where
toQuery = const mempty
data CreateHSMResponse = CreateHSMResponse'
{ _chrsHSMARN :: !(Maybe Text)
, _chrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createHSMResponse
:: Int
-> CreateHSMResponse
createHSMResponse pResponseStatus_ =
CreateHSMResponse'
{ _chrsHSMARN = Nothing
, _chrsResponseStatus = pResponseStatus_
}
chrsHSMARN :: Lens' CreateHSMResponse (Maybe Text)
chrsHSMARN = lens _chrsHSMARN (\ s a -> s{_chrsHSMARN = a});
chrsResponseStatus :: Lens' CreateHSMResponse Int
chrsResponseStatus = lens _chrsResponseStatus (\ s a -> s{_chrsResponseStatus = a});
instance NFData CreateHSMResponse