stratosphere-0.4.2: library-gen/Stratosphere/ResourceProperties/CloudFrontDistributionOriginCustomHeader.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html
module Stratosphere.ResourceProperties.CloudFrontDistributionOriginCustomHeader where
import Control.Lens hiding ((.=))
import Data.Aeson
import Data.Maybe (catMaybes)
import Data.Monoid (mempty)
import Data.Text
import Stratosphere.Values
-- | Full data type definition for CloudFrontDistributionOriginCustomHeader.
-- See 'cloudFrontDistributionOriginCustomHeader' for a more convenient
-- constructor.
data CloudFrontDistributionOriginCustomHeader =
CloudFrontDistributionOriginCustomHeader
{ _cloudFrontDistributionOriginCustomHeaderHeaderName :: Val Text
, _cloudFrontDistributionOriginCustomHeaderHeaderValue :: Val Text
} deriving (Show, Eq)
instance ToJSON CloudFrontDistributionOriginCustomHeader where
toJSON CloudFrontDistributionOriginCustomHeader{..} =
object $
catMaybes
[ Just ("HeaderName" .= _cloudFrontDistributionOriginCustomHeaderHeaderName)
, Just ("HeaderValue" .= _cloudFrontDistributionOriginCustomHeaderHeaderValue)
]
instance FromJSON CloudFrontDistributionOriginCustomHeader where
parseJSON (Object obj) =
CloudFrontDistributionOriginCustomHeader <$>
obj .: "HeaderName" <*>
obj .: "HeaderValue"
parseJSON _ = mempty
-- | Constructor for 'CloudFrontDistributionOriginCustomHeader' containing
-- required fields as arguments.
cloudFrontDistributionOriginCustomHeader
:: Val Text -- ^ 'cfdochHeaderName'
-> Val Text -- ^ 'cfdochHeaderValue'
-> CloudFrontDistributionOriginCustomHeader
cloudFrontDistributionOriginCustomHeader headerNamearg headerValuearg =
CloudFrontDistributionOriginCustomHeader
{ _cloudFrontDistributionOriginCustomHeaderHeaderName = headerNamearg
, _cloudFrontDistributionOriginCustomHeaderHeaderValue = headerValuearg
}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html#cfn-cloudfront-origin-origincustomheader-headername
cfdochHeaderName :: Lens' CloudFrontDistributionOriginCustomHeader (Val Text)
cfdochHeaderName = lens _cloudFrontDistributionOriginCustomHeaderHeaderName (\s a -> s { _cloudFrontDistributionOriginCustomHeaderHeaderName = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin-origincustomheader.html#cfn-cloudfront-origin-origincustomheader-headervalue
cfdochHeaderValue :: Lens' CloudFrontDistributionOriginCustomHeader (Val Text)
cfdochHeaderValue = lens _cloudFrontDistributionOriginCustomHeaderHeaderValue (\s a -> s { _cloudFrontDistributionOriginCustomHeaderHeaderValue = a })