packages feed

stratosphere-0.15.2: library-gen/Stratosphere/Resources/EC2VPNGateway.hs

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html

module Stratosphere.Resources.EC2VPNGateway where

import Stratosphere.ResourceImports
import Stratosphere.ResourceProperties.Tag

-- | Full data type definition for EC2VPNGateway. See 'ec2VPNGateway' for a
-- more convenient constructor.
data EC2VPNGateway =
  EC2VPNGateway
  { _eC2VPNGatewayAmazonSideAsn :: Maybe (Val Integer)
  , _eC2VPNGatewayTags :: Maybe [Tag]
  , _eC2VPNGatewayType :: Val Text
  } deriving (Show, Eq)

instance ToJSON EC2VPNGateway where
  toJSON EC2VPNGateway{..} =
    object $
    catMaybes
    [ fmap (("AmazonSideAsn",) . toJSON . fmap Integer') _eC2VPNGatewayAmazonSideAsn
    , fmap (("Tags",) . toJSON) _eC2VPNGatewayTags
    , (Just . ("Type",) . toJSON) _eC2VPNGatewayType
    ]

instance FromJSON EC2VPNGateway where
  parseJSON (Object obj) =
    EC2VPNGateway <$>
      fmap (fmap (fmap unInteger')) (obj .:? "AmazonSideAsn") <*>
      (obj .:? "Tags") <*>
      (obj .: "Type")
  parseJSON _ = mempty

-- | Constructor for 'EC2VPNGateway' containing required fields as arguments.
ec2VPNGateway
  :: Val Text -- ^ 'ecvpngType'
  -> EC2VPNGateway
ec2VPNGateway typearg =
  EC2VPNGateway
  { _eC2VPNGatewayAmazonSideAsn = Nothing
  , _eC2VPNGatewayTags = Nothing
  , _eC2VPNGatewayType = typearg
  }

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-amazonsideasn
ecvpngAmazonSideAsn :: Lens' EC2VPNGateway (Maybe (Val Integer))
ecvpngAmazonSideAsn = lens _eC2VPNGatewayAmazonSideAsn (\s a -> s { _eC2VPNGatewayAmazonSideAsn = a })

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-tags
ecvpngTags :: Lens' EC2VPNGateway (Maybe [Tag])
ecvpngTags = lens _eC2VPNGatewayTags (\s a -> s { _eC2VPNGatewayTags = a })

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-type
ecvpngType :: Lens' EC2VPNGateway (Val Text)
ecvpngType = lens _eC2VPNGatewayType (\s a -> s { _eC2VPNGatewayType = a })