{-# 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.ElastiCache.CreateCacheSubnetGroup
(
createCacheSubnetGroup
, CreateCacheSubnetGroup
, ccsgCacheSubnetGroupName
, ccsgCacheSubnetGroupDescription
, ccsgSubnetIds
, createCacheSubnetGroupResponse
, CreateCacheSubnetGroupResponse
, crsCacheSubnetGroup
, crsResponseStatus
) where
import Network.AWS.ElastiCache.Types
import Network.AWS.ElastiCache.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateCacheSubnetGroup = CreateCacheSubnetGroup'
{ _ccsgCacheSubnetGroupName :: !Text
, _ccsgCacheSubnetGroupDescription :: !Text
, _ccsgSubnetIds :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCacheSubnetGroup
:: Text
-> Text
-> CreateCacheSubnetGroup
createCacheSubnetGroup pCacheSubnetGroupName_ pCacheSubnetGroupDescription_ =
CreateCacheSubnetGroup'
{ _ccsgCacheSubnetGroupName = pCacheSubnetGroupName_
, _ccsgCacheSubnetGroupDescription = pCacheSubnetGroupDescription_
, _ccsgSubnetIds = mempty
}
ccsgCacheSubnetGroupName :: Lens' CreateCacheSubnetGroup Text
ccsgCacheSubnetGroupName = lens _ccsgCacheSubnetGroupName (\ s a -> s{_ccsgCacheSubnetGroupName = a})
ccsgCacheSubnetGroupDescription :: Lens' CreateCacheSubnetGroup Text
ccsgCacheSubnetGroupDescription = lens _ccsgCacheSubnetGroupDescription (\ s a -> s{_ccsgCacheSubnetGroupDescription = a})
ccsgSubnetIds :: Lens' CreateCacheSubnetGroup [Text]
ccsgSubnetIds = lens _ccsgSubnetIds (\ s a -> s{_ccsgSubnetIds = a}) . _Coerce
instance AWSRequest CreateCacheSubnetGroup where
type Rs CreateCacheSubnetGroup =
CreateCacheSubnetGroupResponse
request = postQuery elastiCache
response
= receiveXMLWrapper "CreateCacheSubnetGroupResult"
(\ s h x ->
CreateCacheSubnetGroupResponse' <$>
(x .@? "CacheSubnetGroup") <*> (pure (fromEnum s)))
instance Hashable CreateCacheSubnetGroup where
instance NFData CreateCacheSubnetGroup where
instance ToHeaders CreateCacheSubnetGroup where
toHeaders = const mempty
instance ToPath CreateCacheSubnetGroup where
toPath = const "/"
instance ToQuery CreateCacheSubnetGroup where
toQuery CreateCacheSubnetGroup'{..}
= mconcat
["Action" =:
("CreateCacheSubnetGroup" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheSubnetGroupName" =: _ccsgCacheSubnetGroupName,
"CacheSubnetGroupDescription" =:
_ccsgCacheSubnetGroupDescription,
"SubnetIds" =:
toQueryList "SubnetIdentifier" _ccsgSubnetIds]
data CreateCacheSubnetGroupResponse = CreateCacheSubnetGroupResponse'
{ _crsCacheSubnetGroup :: !(Maybe CacheSubnetGroup)
, _crsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCacheSubnetGroupResponse
:: Int
-> CreateCacheSubnetGroupResponse
createCacheSubnetGroupResponse pResponseStatus_ =
CreateCacheSubnetGroupResponse'
{_crsCacheSubnetGroup = Nothing, _crsResponseStatus = pResponseStatus_}
crsCacheSubnetGroup :: Lens' CreateCacheSubnetGroupResponse (Maybe CacheSubnetGroup)
crsCacheSubnetGroup = lens _crsCacheSubnetGroup (\ s a -> s{_crsCacheSubnetGroup = a})
crsResponseStatus :: Lens' CreateCacheSubnetGroupResponse Int
crsResponseStatus = lens _crsResponseStatus (\ s a -> s{_crsResponseStatus = a})
instance NFData CreateCacheSubnetGroupResponse where