module Network.AWS.CloudHSM.CreateHsm
(
CreateHsm
, createHsm
, chClientToken
, chEniIp
, chExternalId
, chIamRoleArn
, chSshKey
, chSubnetId
, chSubscriptionType
, chSyslogIp
, CreateHsmResponse
, createHsmResponse
, chrHsmArn
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CloudHSM.Types
import qualified GHC.Exts
data CreateHsm = CreateHsm
{ _chClientToken :: Maybe Text
, _chEniIp :: Maybe Text
, _chExternalId :: Maybe Text
, _chIamRoleArn :: Text
, _chSshKey :: Text
, _chSubnetId :: Text
, _chSubscriptionType :: SubscriptionType
, _chSyslogIp :: Maybe Text
} deriving (Eq, Read, Show)
createHsm :: Text
-> Text
-> Text
-> SubscriptionType
-> CreateHsm
createHsm p1 p2 p3 p4 = CreateHsm
{ _chSubnetId = p1
, _chSshKey = p2
, _chIamRoleArn = p3
, _chSubscriptionType = p4
, _chEniIp = Nothing
, _chExternalId = Nothing
, _chClientToken = Nothing
, _chSyslogIp = Nothing
}
chClientToken :: Lens' CreateHsm (Maybe Text)
chClientToken = lens _chClientToken (\s a -> s { _chClientToken = a })
chEniIp :: Lens' CreateHsm (Maybe Text)
chEniIp = lens _chEniIp (\s a -> s { _chEniIp = a })
chExternalId :: Lens' CreateHsm (Maybe Text)
chExternalId = lens _chExternalId (\s a -> s { _chExternalId = a })
chIamRoleArn :: Lens' CreateHsm Text
chIamRoleArn = lens _chIamRoleArn (\s a -> s { _chIamRoleArn = a })
chSshKey :: Lens' CreateHsm Text
chSshKey = lens _chSshKey (\s a -> s { _chSshKey = a })
chSubnetId :: Lens' CreateHsm Text
chSubnetId = lens _chSubnetId (\s a -> s { _chSubnetId = a })
chSubscriptionType :: Lens' CreateHsm SubscriptionType
chSubscriptionType =
lens _chSubscriptionType (\s a -> s { _chSubscriptionType = a })
chSyslogIp :: Lens' CreateHsm (Maybe Text)
chSyslogIp = lens _chSyslogIp (\s a -> s { _chSyslogIp = a })
newtype CreateHsmResponse = CreateHsmResponse
{ _chrHsmArn :: Maybe Text
} deriving (Eq, Ord, Read, Show, Monoid)
createHsmResponse :: CreateHsmResponse
createHsmResponse = CreateHsmResponse
{ _chrHsmArn = Nothing
}
chrHsmArn :: Lens' CreateHsmResponse (Maybe Text)
chrHsmArn = lens _chrHsmArn (\s a -> s { _chrHsmArn = a })
instance ToPath CreateHsm where
toPath = const "/"
instance ToQuery CreateHsm where
toQuery = const mempty
instance ToHeaders CreateHsm
instance ToJSON CreateHsm where
toJSON CreateHsm{..} = object
[ "SubnetId" .= _chSubnetId
, "SshKey" .= _chSshKey
, "EniIp" .= _chEniIp
, "IamRoleArn" .= _chIamRoleArn
, "ExternalId" .= _chExternalId
, "SubscriptionType" .= _chSubscriptionType
, "ClientToken" .= _chClientToken
, "SyslogIp" .= _chSyslogIp
]
instance AWSRequest CreateHsm where
type Sv CreateHsm = CloudHSM
type Rs CreateHsm = CreateHsmResponse
request = post "CreateHsm"
response = jsonResponse
instance FromJSON CreateHsmResponse where
parseJSON = withObject "CreateHsmResponse" $ \o -> CreateHsmResponse
<$> o .:? "HsmArn"