stratosphere-0.6.0: library-gen/Stratosphere/Resources/RDSDBSubnetGroup.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html
module Stratosphere.Resources.RDSDBSubnetGroup where
import Control.Lens hiding ((.=))
import Data.Aeson
import Data.Maybe (catMaybes)
import Data.Monoid (mempty)
import Data.Text
import Stratosphere.Values
import Stratosphere.ResourceProperties.Tag
-- | Full data type definition for RDSDBSubnetGroup. See 'rdsdbSubnetGroup'
-- for a more convenient constructor.
data RDSDBSubnetGroup =
RDSDBSubnetGroup
{ _rDSDBSubnetGroupDBSubnetGroupDescription :: Val Text
, _rDSDBSubnetGroupSubnetIds :: ValList Text
, _rDSDBSubnetGroupTags :: Maybe [Tag]
} deriving (Show, Eq)
instance ToJSON RDSDBSubnetGroup where
toJSON RDSDBSubnetGroup{..} =
object $
catMaybes
[ (Just . ("DBSubnetGroupDescription",) . toJSON) _rDSDBSubnetGroupDBSubnetGroupDescription
, (Just . ("SubnetIds",) . toJSON) _rDSDBSubnetGroupSubnetIds
, fmap (("Tags",) . toJSON) _rDSDBSubnetGroupTags
]
instance FromJSON RDSDBSubnetGroup where
parseJSON (Object obj) =
RDSDBSubnetGroup <$>
(obj .: "DBSubnetGroupDescription") <*>
(obj .: "SubnetIds") <*>
(obj .:? "Tags")
parseJSON _ = mempty
-- | Constructor for 'RDSDBSubnetGroup' containing required fields as
-- arguments.
rdsdbSubnetGroup
:: Val Text -- ^ 'rdsdbsugDBSubnetGroupDescription'
-> ValList Text -- ^ 'rdsdbsugSubnetIds'
-> RDSDBSubnetGroup
rdsdbSubnetGroup dBSubnetGroupDescriptionarg subnetIdsarg =
RDSDBSubnetGroup
{ _rDSDBSubnetGroupDBSubnetGroupDescription = dBSubnetGroupDescriptionarg
, _rDSDBSubnetGroupSubnetIds = subnetIdsarg
, _rDSDBSubnetGroupTags = Nothing
}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-dbsubnetgroupdescription
rdsdbsugDBSubnetGroupDescription :: Lens' RDSDBSubnetGroup (Val Text)
rdsdbsugDBSubnetGroupDescription = lens _rDSDBSubnetGroupDBSubnetGroupDescription (\s a -> s { _rDSDBSubnetGroupDBSubnetGroupDescription = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-subnetids
rdsdbsugSubnetIds :: Lens' RDSDBSubnetGroup (ValList Text)
rdsdbsugSubnetIds = lens _rDSDBSubnetGroupSubnetIds (\s a -> s { _rDSDBSubnetGroupSubnetIds = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-tags
rdsdbsugTags :: Lens' RDSDBSubnetGroup (Maybe [Tag])
rdsdbsugTags = lens _rDSDBSubnetGroupTags (\s a -> s { _rDSDBSubnetGroupTags = a })