{-# 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.DAX.CreateSubnetGroup
(
createSubnetGroup
, CreateSubnetGroup
, csgDescription
, csgSubnetGroupName
, csgSubnetIds
, createSubnetGroupResponse
, CreateSubnetGroupResponse
, csgrsSubnetGroup
, csgrsResponseStatus
) where
import Network.AWS.DAX.Types
import Network.AWS.DAX.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateSubnetGroup = CreateSubnetGroup'
{ _csgDescription :: !(Maybe Text)
, _csgSubnetGroupName :: !Text
, _csgSubnetIds :: ![Text]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSubnetGroup
:: Text
-> CreateSubnetGroup
createSubnetGroup pSubnetGroupName_ =
CreateSubnetGroup'
{ _csgDescription = Nothing
, _csgSubnetGroupName = pSubnetGroupName_
, _csgSubnetIds = mempty
}
csgDescription :: Lens' CreateSubnetGroup (Maybe Text)
csgDescription = lens _csgDescription (\ s a -> s{_csgDescription = a})
csgSubnetGroupName :: Lens' CreateSubnetGroup Text
csgSubnetGroupName = lens _csgSubnetGroupName (\ s a -> s{_csgSubnetGroupName = a})
csgSubnetIds :: Lens' CreateSubnetGroup [Text]
csgSubnetIds = lens _csgSubnetIds (\ s a -> s{_csgSubnetIds = a}) . _Coerce
instance AWSRequest CreateSubnetGroup where
type Rs CreateSubnetGroup = CreateSubnetGroupResponse
request = postJSON dax
response
= receiveJSON
(\ s h x ->
CreateSubnetGroupResponse' <$>
(x .?> "SubnetGroup") <*> (pure (fromEnum s)))
instance Hashable CreateSubnetGroup where
instance NFData CreateSubnetGroup where
instance ToHeaders CreateSubnetGroup where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonDAXV3.CreateSubnetGroup" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateSubnetGroup where
toJSON CreateSubnetGroup'{..}
= object
(catMaybes
[("Description" .=) <$> _csgDescription,
Just ("SubnetGroupName" .= _csgSubnetGroupName),
Just ("SubnetIds" .= _csgSubnetIds)])
instance ToPath CreateSubnetGroup where
toPath = const "/"
instance ToQuery CreateSubnetGroup where
toQuery = const mempty
data CreateSubnetGroupResponse = CreateSubnetGroupResponse'
{ _csgrsSubnetGroup :: !(Maybe SubnetGroup)
, _csgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSubnetGroupResponse
:: Int
-> CreateSubnetGroupResponse
createSubnetGroupResponse pResponseStatus_ =
CreateSubnetGroupResponse'
{_csgrsSubnetGroup = Nothing, _csgrsResponseStatus = pResponseStatus_}
csgrsSubnetGroup :: Lens' CreateSubnetGroupResponse (Maybe SubnetGroup)
csgrsSubnetGroup = lens _csgrsSubnetGroup (\ s a -> s{_csgrsSubnetGroup = a})
csgrsResponseStatus :: Lens' CreateSubnetGroupResponse Int
csgrsResponseStatus = lens _csgrsResponseStatus (\ s a -> s{_csgrsResponseStatus = a})
instance NFData CreateSubnetGroupResponse where