module Network.AWS.CloudHSM.GetConfig
(
getConfig
, GetConfig
, gcClientARN
, gcClientVersion
, gcHAPGList
, getConfigResponse
, GetConfigResponse
, gcrsConfigFile
, gcrsConfigCred
, gcrsConfigType
, gcrsResponseStatus
) 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 GetConfig = GetConfig'
{ _gcClientARN :: !Text
, _gcClientVersion :: !ClientVersion
, _gcHAPGList :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getConfig
:: Text
-> ClientVersion
-> GetConfig
getConfig pClientARN_ pClientVersion_ =
GetConfig'
{ _gcClientARN = pClientARN_
, _gcClientVersion = pClientVersion_
, _gcHAPGList = mempty
}
gcClientARN :: Lens' GetConfig Text
gcClientARN = lens _gcClientARN (\ s a -> s{_gcClientARN = a});
gcClientVersion :: Lens' GetConfig ClientVersion
gcClientVersion = lens _gcClientVersion (\ s a -> s{_gcClientVersion = a});
gcHAPGList :: Lens' GetConfig [Text]
gcHAPGList = lens _gcHAPGList (\ s a -> s{_gcHAPGList = a}) . _Coerce;
instance AWSRequest GetConfig where
type Rs GetConfig = GetConfigResponse
request = postJSON cloudHSM
response
= receiveJSON
(\ s h x ->
GetConfigResponse' <$>
(x .?> "ConfigFile") <*> (x .?> "ConfigCred") <*>
(x .?> "ConfigType")
<*> (pure (fromEnum s)))
instance ToHeaders GetConfig where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CloudHsmFrontendService.GetConfig" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetConfig where
toJSON GetConfig'{..}
= object
(catMaybes
[Just ("ClientArn" .= _gcClientARN),
Just ("ClientVersion" .= _gcClientVersion),
Just ("HapgList" .= _gcHAPGList)])
instance ToPath GetConfig where
toPath = const "/"
instance ToQuery GetConfig where
toQuery = const mempty
data GetConfigResponse = GetConfigResponse'
{ _gcrsConfigFile :: !(Maybe Text)
, _gcrsConfigCred :: !(Maybe Text)
, _gcrsConfigType :: !(Maybe Text)
, _gcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getConfigResponse
:: Int
-> GetConfigResponse
getConfigResponse pResponseStatus_ =
GetConfigResponse'
{ _gcrsConfigFile = Nothing
, _gcrsConfigCred = Nothing
, _gcrsConfigType = Nothing
, _gcrsResponseStatus = pResponseStatus_
}
gcrsConfigFile :: Lens' GetConfigResponse (Maybe Text)
gcrsConfigFile = lens _gcrsConfigFile (\ s a -> s{_gcrsConfigFile = a});
gcrsConfigCred :: Lens' GetConfigResponse (Maybe Text)
gcrsConfigCred = lens _gcrsConfigCred (\ s a -> s{_gcrsConfigCred = a});
gcrsConfigType :: Lens' GetConfigResponse (Maybe Text)
gcrsConfigType = lens _gcrsConfigType (\ s a -> s{_gcrsConfigType = a});
gcrsResponseStatus :: Lens' GetConfigResponse Int
gcrsResponseStatus = lens _gcrsResponseStatus (\ s a -> s{_gcrsResponseStatus = a});