{-# 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.MQ.CreateConfiguration
(
createConfiguration
, CreateConfiguration
, ccEngineVersion
, ccName
, ccEngineType
, createConfigurationResponse
, CreateConfigurationResponse
, ccrsARN
, ccrsLatestRevision
, ccrsName
, ccrsId
, ccrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MQ.Types
import Network.AWS.MQ.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateConfiguration = CreateConfiguration'
{ _ccEngineVersion :: !(Maybe Text)
, _ccName :: !(Maybe Text)
, _ccEngineType :: !(Maybe EngineType)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createConfiguration
:: CreateConfiguration
createConfiguration =
CreateConfiguration'
{_ccEngineVersion = Nothing, _ccName = Nothing, _ccEngineType = Nothing}
ccEngineVersion :: Lens' CreateConfiguration (Maybe Text)
ccEngineVersion = lens _ccEngineVersion (\ s a -> s{_ccEngineVersion = a})
ccName :: Lens' CreateConfiguration (Maybe Text)
ccName = lens _ccName (\ s a -> s{_ccName = a})
ccEngineType :: Lens' CreateConfiguration (Maybe EngineType)
ccEngineType = lens _ccEngineType (\ s a -> s{_ccEngineType = a})
instance AWSRequest CreateConfiguration where
type Rs CreateConfiguration =
CreateConfigurationResponse
request = postJSON mq
response
= receiveJSON
(\ s h x ->
CreateConfigurationResponse' <$>
(x .?> "arn") <*> (x .?> "latestRevision") <*>
(x .?> "name")
<*> (x .?> "id")
<*> (pure (fromEnum s)))
instance Hashable CreateConfiguration where
instance NFData CreateConfiguration where
instance ToHeaders CreateConfiguration where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateConfiguration where
toJSON CreateConfiguration'{..}
= object
(catMaybes
[("engineVersion" .=) <$> _ccEngineVersion,
("name" .=) <$> _ccName,
("engineType" .=) <$> _ccEngineType])
instance ToPath CreateConfiguration where
toPath = const "/v1/configurations"
instance ToQuery CreateConfiguration where
toQuery = const mempty
data CreateConfigurationResponse = CreateConfigurationResponse'
{ _ccrsARN :: !(Maybe Text)
, _ccrsLatestRevision :: !(Maybe ConfigurationRevision)
, _ccrsName :: !(Maybe Text)
, _ccrsId :: !(Maybe Text)
, _ccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createConfigurationResponse
:: Int
-> CreateConfigurationResponse
createConfigurationResponse pResponseStatus_ =
CreateConfigurationResponse'
{ _ccrsARN = Nothing
, _ccrsLatestRevision = Nothing
, _ccrsName = Nothing
, _ccrsId = Nothing
, _ccrsResponseStatus = pResponseStatus_
}
ccrsARN :: Lens' CreateConfigurationResponse (Maybe Text)
ccrsARN = lens _ccrsARN (\ s a -> s{_ccrsARN = a})
ccrsLatestRevision :: Lens' CreateConfigurationResponse (Maybe ConfigurationRevision)
ccrsLatestRevision = lens _ccrsLatestRevision (\ s a -> s{_ccrsLatestRevision = a})
ccrsName :: Lens' CreateConfigurationResponse (Maybe Text)
ccrsName = lens _ccrsName (\ s a -> s{_ccrsName = a})
ccrsId :: Lens' CreateConfigurationResponse (Maybe Text)
ccrsId = lens _ccrsId (\ s a -> s{_ccrsId = a})
ccrsResponseStatus :: Lens' CreateConfigurationResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a})
instance NFData CreateConfigurationResponse where