{-# 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.CloudHSMv2.CreateHSM
(
createHSM
, CreateHSM
, chIPAddress
, chClusterId
, chAvailabilityZone
, createHSMResponse
, CreateHSMResponse
, chrsHSM
, chrsResponseStatus
) where
import Network.AWS.CloudHSMv2.Types
import Network.AWS.CloudHSMv2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateHSM = CreateHSM'
{ _chIPAddress :: !(Maybe Text)
, _chClusterId :: !Text
, _chAvailabilityZone :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createHSM
:: Text
-> Text
-> CreateHSM
createHSM pClusterId_ pAvailabilityZone_ =
CreateHSM'
{ _chIPAddress = Nothing
, _chClusterId = pClusterId_
, _chAvailabilityZone = pAvailabilityZone_
}
chIPAddress :: Lens' CreateHSM (Maybe Text)
chIPAddress = lens _chIPAddress (\ s a -> s{_chIPAddress = a})
chClusterId :: Lens' CreateHSM Text
chClusterId = lens _chClusterId (\ s a -> s{_chClusterId = a})
chAvailabilityZone :: Lens' CreateHSM Text
chAvailabilityZone = lens _chAvailabilityZone (\ s a -> s{_chAvailabilityZone = a})
instance AWSRequest CreateHSM where
type Rs CreateHSM = CreateHSMResponse
request = postJSON cloudHSMv2
response
= receiveJSON
(\ s h x ->
CreateHSMResponse' <$>
(x .?> "Hsm") <*> (pure (fromEnum s)))
instance Hashable CreateHSM where
instance NFData CreateHSM where
instance ToHeaders CreateHSM where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("BaldrApiService.CreateHsm" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateHSM where
toJSON CreateHSM'{..}
= object
(catMaybes
[("IpAddress" .=) <$> _chIPAddress,
Just ("ClusterId" .= _chClusterId),
Just ("AvailabilityZone" .= _chAvailabilityZone)])
instance ToPath CreateHSM where
toPath = const "/"
instance ToQuery CreateHSM where
toQuery = const mempty
data CreateHSMResponse = CreateHSMResponse'
{ _chrsHSM :: !(Maybe HSM)
, _chrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createHSMResponse
:: Int
-> CreateHSMResponse
createHSMResponse pResponseStatus_ =
CreateHSMResponse'
{_chrsHSM = Nothing, _chrsResponseStatus = pResponseStatus_}
chrsHSM :: Lens' CreateHSMResponse (Maybe HSM)
chrsHSM = lens _chrsHSM (\ s a -> s{_chrsHSM = a})
chrsResponseStatus :: Lens' CreateHSMResponse Int
chrsResponseStatus = lens _chrsResponseStatus (\ s a -> s{_chrsResponseStatus = a})
instance NFData CreateHSMResponse where