Class: AWSCDK::CloudFront::FunctionProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/function_props.rb

Overview

Properties for creating a CloudFront Function.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, auto_publish: nil, comment: nil, function_name: nil, key_value_store: nil, runtime: nil) ⇒ FunctionProps

Returns a new instance of FunctionProps.

Parameters:

  • code (AWSCDK::CloudFront::FunctionCode)

    The source code of the function.

  • auto_publish (Boolean, nil) (defaults to: nil)

    A flag that determines whether to automatically publish the function to the LIVE stage when it’s created.

  • comment (String, nil) (defaults to: nil)

    A comment to describe the function.

  • function_name (String, nil) (defaults to: nil)

    A name to identify the function.

  • key_value_store (AWSCDK::Interfaces::AWSCloudfront::IKeyValueStoreRef, nil) (defaults to: nil)

    The Key Value Store to associate with this function.

  • runtime (AWSCDK::CloudFront::FunctionRuntime, nil) (defaults to: nil)

    The runtime environment for the function.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'cloud_front/function_props.rb', line 13

def initialize(code:, auto_publish: nil, comment: nil, function_name: nil, key_value_store: nil, runtime: nil)
  @code = code
  Jsii::Type.check_type(@code, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5GdW5jdGlvbkNvZGUifQ==")), "code")
  @auto_publish = auto_publish
  Jsii::Type.check_type(@auto_publish, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "autoPublish") unless @auto_publish.nil?
  @comment = comment
  Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil?
  @function_name = function_name
  Jsii::Type.check_type(@function_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "functionName") unless @function_name.nil?
  @key_value_store = key_value_store
  Jsii::Type.check_type(@key_value_store, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZGZyb250LklLZXlWYWx1ZVN0b3JlUmVmIn0=")), "keyValueStore") unless @key_value_store.nil?
  @runtime = runtime
  Jsii::Type.check_type(@runtime, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5GdW5jdGlvblJ1bnRpbWUifQ==")), "runtime") unless @runtime.nil?
end

Instance Attribute Details

#auto_publishBoolean? (readonly)

Note:

Default: - true

A flag that determines whether to automatically publish the function to the LIVE stage when it’s created.

Returns:

  • (Boolean, nil)


36
37
38
# File 'cloud_front/function_props.rb', line 36

def auto_publish
  @auto_publish
end

#codeAWSCDK::CloudFront::FunctionCode (readonly)

The source code of the function.



31
32
33
# File 'cloud_front/function_props.rb', line 31

def code
  @code
end

#commentString? (readonly)

Note:

Default: - same as functionName

A comment to describe the function.

Returns:

  • (String, nil)


41
42
43
# File 'cloud_front/function_props.rb', line 41

def comment
  @comment
end

#function_nameString? (readonly)

Note:

Default: - generated from the id

A name to identify the function.

Returns:

  • (String, nil)


46
47
48
# File 'cloud_front/function_props.rb', line 46

def function_name
  @function_name
end

#key_value_storeAWSCDK::Interfaces::AWSCloudfront::IKeyValueStoreRef? (readonly)

Note:

Default: - no key value store is associated

The Key Value Store to associate with this function.

In order to associate a Key Value Store, the runtime must be cloudfront-js-2.0 or newer.



54
55
56
# File 'cloud_front/function_props.rb', line 54

def key_value_store
  @key_value_store
end

#runtimeAWSCDK::CloudFront::FunctionRuntime? (readonly)

Note:

Default: FunctionRuntime.JS_1_0 (unless keyValueStore is specified, then FunctionRuntime.JS_2_0)

The runtime environment for the function.



59
60
61
# File 'cloud_front/function_props.rb', line 59

def runtime
  @runtime
end

Class Method Details

.jsii_propertiesObject



61
62
63
64
65
66
67
68
69
70
# File 'cloud_front/function_props.rb', line 61

def self.jsii_properties
  {
    :code => "code",
    :auto_publish => "autoPublish",
    :comment => "comment",
    :function_name => "functionName",
    :key_value_store => "keyValueStore",
    :runtime => "runtime",
  }
end

Instance Method Details

#to_jsiiObject



72
73
74
75
76
77
78
79
80
81
82
83
# File 'cloud_front/function_props.rb', line 72

def to_jsii
  result = {}
  result.merge!({
    "code" => @code,
    "autoPublish" => @auto_publish,
    "comment" => @comment,
    "functionName" => @function_name,
    "keyValueStore" => @key_value_store,
    "runtime" => @runtime,
  })
  result.compact
end