module Stratosphere.CloudFront.Function ( module Exports, Function(..), mkFunction ) where import qualified Data.Aeson as JSON import qualified Stratosphere.Prelude as Prelude import Stratosphere.Property import {-# SOURCE #-} Stratosphere.CloudFront.Function.FunctionConfigProperty as Exports import {-# SOURCE #-} Stratosphere.CloudFront.Function.FunctionMetadataProperty as Exports import Stratosphere.ResourceProperties import Stratosphere.Value data Function = -- | See: Function {haddock_workaround_ :: (), -- | See: autoPublish :: (Prelude.Maybe (Value Prelude.Bool)), -- | See: functionCode :: (Value Prelude.Text), -- | See: functionConfig :: FunctionConfigProperty, -- | See: functionMetadata :: (Prelude.Maybe FunctionMetadataProperty), -- | See: name :: (Value Prelude.Text)} deriving stock (Prelude.Eq, Prelude.Show) mkFunction :: Value Prelude.Text -> FunctionConfigProperty -> Value Prelude.Text -> Function mkFunction functionCode functionConfig name = Function {haddock_workaround_ = (), functionCode = functionCode, functionConfig = functionConfig, name = name, autoPublish = Prelude.Nothing, functionMetadata = Prelude.Nothing} instance ToResourceProperties Function where toResourceProperties Function {..} = ResourceProperties {awsType = "AWS::CloudFront::Function", supportsTags = Prelude.False, properties = Prelude.fromList ((Prelude.<>) ["FunctionCode" JSON..= functionCode, "FunctionConfig" JSON..= functionConfig, "Name" JSON..= name] (Prelude.catMaybes [(JSON..=) "AutoPublish" Prelude.<$> autoPublish, (JSON..=) "FunctionMetadata" Prelude.<$> functionMetadata]))} instance JSON.ToJSON Function where toJSON Function {..} = JSON.object (Prelude.fromList ((Prelude.<>) ["FunctionCode" JSON..= functionCode, "FunctionConfig" JSON..= functionConfig, "Name" JSON..= name] (Prelude.catMaybes [(JSON..=) "AutoPublish" Prelude.<$> autoPublish, (JSON..=) "FunctionMetadata" Prelude.<$> functionMetadata]))) instance Property "AutoPublish" Function where type PropertyType "AutoPublish" Function = Value Prelude.Bool set newValue Function {..} = Function {autoPublish = Prelude.pure newValue, ..} instance Property "FunctionCode" Function where type PropertyType "FunctionCode" Function = Value Prelude.Text set newValue Function {..} = Function {functionCode = newValue, ..} instance Property "FunctionConfig" Function where type PropertyType "FunctionConfig" Function = FunctionConfigProperty set newValue Function {..} = Function {functionConfig = newValue, ..} instance Property "FunctionMetadata" Function where type PropertyType "FunctionMetadata" Function = FunctionMetadataProperty set newValue Function {..} = Function {functionMetadata = Prelude.pure newValue, ..} instance Property "Name" Function where type PropertyType "Name" Function = Value Prelude.Text set newValue Function {..} = Function {name = newValue, ..}