packages feed

stratosphere-0.3.0: library-gen/Stratosphere/ResourceProperties/CloudFrontDistributionGeoRestriction.hs

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html

module Stratosphere.ResourceProperties.CloudFrontDistributionGeoRestriction where

import Control.Lens
import Data.Aeson
import Data.Aeson.Types
import Data.Text
import GHC.Generics

import Stratosphere.Values


-- | Full data type definition for CloudFrontDistributionGeoRestriction. See
-- | 'cloudFrontDistributionGeoRestriction' for a more convenient constructor.
data CloudFrontDistributionGeoRestriction =
  CloudFrontDistributionGeoRestriction
  { _cloudFrontDistributionGeoRestrictionLocations :: Maybe [Val Text]
  , _cloudFrontDistributionGeoRestrictionRestrictionType :: Val Text
  } deriving (Show, Generic)

instance ToJSON CloudFrontDistributionGeoRestriction where
  toJSON = genericToJSON defaultOptions { fieldLabelModifier = Prelude.drop 37, omitNothingFields = True }

instance FromJSON CloudFrontDistributionGeoRestriction where
  parseJSON = genericParseJSON defaultOptions { fieldLabelModifier = Prelude.drop 37, omitNothingFields = True }

-- | Constructor for 'CloudFrontDistributionGeoRestriction' containing
-- | required fields as arguments.
cloudFrontDistributionGeoRestriction
  :: Val Text -- ^ 'cfdgrRestrictionType'
  -> CloudFrontDistributionGeoRestriction
cloudFrontDistributionGeoRestriction restrictionTypearg =
  CloudFrontDistributionGeoRestriction
  { _cloudFrontDistributionGeoRestrictionLocations = Nothing
  , _cloudFrontDistributionGeoRestrictionRestrictionType = restrictionTypearg
  }

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html#cfn-cloudfront-distributionconfig-restrictions-georestriction-locations
cfdgrLocations :: Lens' CloudFrontDistributionGeoRestriction (Maybe [Val Text])
cfdgrLocations = lens _cloudFrontDistributionGeoRestrictionLocations (\s a -> s { _cloudFrontDistributionGeoRestrictionLocations = a })

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html#cfn-cloudfront-distributionconfig-restrictions-georestriction-restrictiontype
cfdgrRestrictionType :: Lens' CloudFrontDistributionGeoRestriction (Val Text)
cfdgrRestrictionType = lens _cloudFrontDistributionGeoRestrictionRestrictionType (\s a -> s { _cloudFrontDistributionGeoRestrictionRestrictionType = a })