Class: AWSCDK::CustomResources::ProviderProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
custom_resources/provider_props.rb

Overview

Initialization properties for the Provider construct.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(on_event_handler:, disable_waiter_state_machine_logging: nil, framework_complete_and_timeout_role: nil, framework_lambda_logging_level: nil, framework_on_event_role: nil, is_complete_handler: nil, log_group: nil, log_retention: nil, provider_function_env_encryption: nil, provider_function_name: nil, query_interval: nil, role: nil, security_groups: nil, total_timeout: nil, vpc: nil, vpc_subnets: nil, waiter_state_machine_log_options: nil) ⇒ ProviderProps

Returns a new instance of ProviderProps.

Parameters:

  • on_event_handler (AWSCDK::Lambda::IFunction)

    The AWS Lambda function to invoke for all resource lifecycle operations (CREATE/UPDATE/DELETE).

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

    Whether logging for the waiter state machine is disabled.

  • framework_complete_and_timeout_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    Lambda execution role for provider framework's isComplete/onTimeout Lambda function.

  • framework_lambda_logging_level (AWSCDK::Lambda::ApplicationLogLevel, nil) (defaults to: nil)

    Log level of the provider framework lambda.

  • framework_on_event_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    Lambda execution role for provider framework's onEvent Lambda function.

  • is_complete_handler (AWSCDK::Lambda::IFunction, nil) (defaults to: nil)

    The AWS Lambda function to invoke in order to determine if the operation is complete.

  • log_group (AWSCDK::Interfaces::AWSLogs::ILogGroupRef, nil) (defaults to: nil)

    The Log Group used for logging of events emitted by the custom resource's lambda function.

  • log_retention (AWSCDK::Logs::RetentionDays, nil) (defaults to: nil)

    The number of days framework log events are kept in CloudWatch Logs.

  • provider_function_env_encryption (AWSCDK::Interfaces::AWSKMS::IKeyRef, nil) (defaults to: nil)

    AWS KMS key used to encrypt provider lambda's environment variables.

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

    Provider Lambda name.

  • query_interval (AWSCDK::Duration, nil) (defaults to: nil)

    Time between calls to the isComplete handler which determines if the resource has been stabilized.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    AWS Lambda execution role.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    Security groups to attach to the provider functions.

  • total_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    Total timeout for the entire operation.

  • vpc (AWSCDK::EC2::IVPC, nil) (defaults to: nil)

    The vpc to provision the lambda functions in.

  • vpc_subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    Which subnets from the VPC to place the lambda functions in.

  • waiter_state_machine_log_options (AWSCDK::CustomResources::LogOptions, nil) (defaults to: nil)

    Defines what execution history events of the waiter state machine are logged and where they are logged.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'custom_resources/provider_props.rb', line 24

def initialize(on_event_handler:, disable_waiter_state_machine_logging: nil, framework_complete_and_timeout_role: nil, framework_lambda_logging_level: nil, framework_on_event_role: nil, is_complete_handler: nil, log_group: nil, log_retention: nil, provider_function_env_encryption: nil, provider_function_name: nil, query_interval: nil, role: nil, security_groups: nil, total_timeout: nil, vpc: nil, vpc_subnets: nil, waiter_state_machine_log_options: nil)
  @on_event_handler = on_event_handler
  Jsii::Type.check_type(@on_event_handler, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "onEventHandler")
  @disable_waiter_state_machine_logging = disable_waiter_state_machine_logging
  Jsii::Type.check_type(@disable_waiter_state_machine_logging, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableWaiterStateMachineLogging") unless @disable_waiter_state_machine_logging.nil?
  @framework_complete_and_timeout_role = framework_complete_and_timeout_role
  Jsii::Type.check_type(@framework_complete_and_timeout_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "frameworkCompleteAndTimeoutRole") unless @framework_complete_and_timeout_role.nil?
  @framework_lambda_logging_level = framework_lambda_logging_level
  Jsii::Type.check_type(@framework_lambda_logging_level, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkFwcGxpY2F0aW9uTG9nTGV2ZWwifQ==")), "frameworkLambdaLoggingLevel") unless @framework_lambda_logging_level.nil?
  @framework_on_event_role = framework_on_event_role
  Jsii::Type.check_type(@framework_on_event_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "frameworkOnEventRole") unless @framework_on_event_role.nil?
  @is_complete_handler = is_complete_handler
  Jsii::Type.check_type(@is_complete_handler, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "isCompleteHandler") unless @is_complete_handler.nil?
  @log_group = log_group
  Jsii::Type.check_type(@log_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19sb2dzLklMb2dHcm91cFJlZiJ9")), "logGroup") unless @log_group.nil?
  @log_retention = log_retention
  Jsii::Type.check_type(@log_retention, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5SZXRlbnRpb25EYXlzIn0=")), "logRetention") unless @log_retention.nil?
  @provider_function_env_encryption = provider_function_env_encryption
  Jsii::Type.check_type(@provider_function_env_encryption, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19rbXMuSUtleVJlZiJ9")), "providerFunctionEnvEncryption") unless @provider_function_env_encryption.nil?
  @provider_function_name = provider_function_name
  Jsii::Type.check_type(@provider_function_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "providerFunctionName") unless @provider_function_name.nil?
  @query_interval = query_interval
  Jsii::Type.check_type(@query_interval, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "queryInterval") unless @query_interval.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @total_timeout = total_timeout
  Jsii::Type.check_type(@total_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "totalTimeout") unless @total_timeout.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
  @waiter_state_machine_log_options = waiter_state_machine_log_options.is_a?(Hash) ? ::AWSCDK::CustomResources::LogOptions.new(**waiter_state_machine_log_options.transform_keys(&:to_sym)) : waiter_state_machine_log_options
  Jsii::Type.check_type(@waiter_state_machine_log_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkxvZ09wdGlvbnMifQ==")), "waiterStateMachineLogOptions") unless @waiter_state_machine_log_options.nil?
end

Instance Attribute Details

#disable_waiter_state_machine_loggingBoolean? (readonly)

Note:

Default: - true

Whether logging for the waiter state machine is disabled.

Returns:

  • (Boolean, nil)


74
75
76
# File 'custom_resources/provider_props.rb', line 74

def disable_waiter_state_machine_logging
  @disable_waiter_state_machine_logging
end

#framework_complete_and_timeout_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A default role will be created.

Lambda execution role for provider framework's isComplete/onTimeout Lambda function.

Note that this role must be assumed by the 'lambda.amazonaws.com' service principal. To prevent circular dependency problem in the provider framework, please ensure you specify a different IAM Role for 'frameworkCompleteAndTimeoutRole' from 'frameworkOnEventRole'.

This property cannot be used with 'role' property

Returns:



86
87
88
# File 'custom_resources/provider_props.rb', line 86

def framework_complete_and_timeout_role
  @framework_complete_and_timeout_role
end

#framework_lambda_logging_levelAWSCDK::Lambda::ApplicationLogLevel? (readonly)

Note:

Default: true - Logging is disabled by default

Log level of the provider framework lambda.



91
92
93
# File 'custom_resources/provider_props.rb', line 91

def framework_lambda_logging_level
  @framework_lambda_logging_level
end

#framework_on_event_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A default role will be created.

Lambda execution role for provider framework's onEvent Lambda function.

Note that this role must be assumed by the 'lambda.amazonaws.com' service principal.

This property cannot be used with 'role' property

Returns:



101
102
103
# File 'custom_resources/provider_props.rb', line 101

def framework_on_event_role
  @framework_on_event_role
end

#is_complete_handlerAWSCDK::Lambda::IFunction? (readonly)

Note:

Default: - provider is synchronous. This means that the onEvent handler is expected to finish all lifecycle operations within the initial invocation.

The AWS Lambda function to invoke in order to determine if the operation is complete.

This function will be called immediately after on_event and then periodically based on the configured query interval as long as it returns false. If the function still returns false and the alloted timeout has passed, the operation will fail.

Returns:



111
112
113
# File 'custom_resources/provider_props.rb', line 111

def is_complete_handler
  @is_complete_handler
end

#log_groupAWSCDK::Interfaces::AWSLogs::ILogGroupRef? (readonly)

Note:

Default: - a default log group created by AWS Lambda

The Log Group used for logging of events emitted by the custom resource's lambda function.

Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.



119
120
121
# File 'custom_resources/provider_props.rb', line 119

def log_group
  @log_group
end

#log_retentionAWSCDK::Logs::RetentionDays? (readonly)

Note:

Default: logs.RetentionDays.INFINITE

The number of days framework log events are kept in CloudWatch Logs.

When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to INFINITE.

This is a legacy API and we strongly recommend you migrate to log_group if you can. log_group allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

Returns:



131
132
133
# File 'custom_resources/provider_props.rb', line 131

def log_retention
  @log_retention
end

#on_event_handlerAWSCDK::Lambda::IFunction (readonly)

The AWS Lambda function to invoke for all resource lifecycle operations (CREATE/UPDATE/DELETE).

This function is responsible to begin the requested resource operation (CREATE/UPDATE/DELETE) and return any additional properties to add to the event, which will later be passed to is_complete. The PhysicalResourceId property must be included in the response.



69
70
71
# File 'custom_resources/provider_props.rb', line 69

def on_event_handler
  @on_event_handler
end

#provider_function_env_encryptionAWSCDK::Interfaces::AWSKMS::IKeyRef? (readonly)

Note:

Default: - AWS Lambda creates and uses an AWS managed customer master key (CMK)

AWS KMS key used to encrypt provider lambda's environment variables.



136
137
138
# File 'custom_resources/provider_props.rb', line 136

def provider_function_env_encryption
  @provider_function_env_encryption
end

#provider_function_nameString? (readonly)

Note:

Default: - CloudFormation default name from unique physical ID

Provider Lambda name.

The provider lambda function name.

Returns:

  • (String, nil)


143
144
145
# File 'custom_resources/provider_props.rb', line 143

def provider_function_name
  @provider_function_name
end

#query_intervalAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(5)

Time between calls to the isComplete handler which determines if the resource has been stabilized.

The first is_complete will be called immediately after handler and then every query_interval seconds, and until timeout has been reached or until is_complete returns true.

Returns:



152
153
154
# File 'custom_resources/provider_props.rb', line 152

def query_interval
  @query_interval
end

#roleAWSCDK::IAM::IRole? (readonly)

Deprecated.
  • Use frameworkOnEventRole, frameworkCompleteAndTimeoutRole
Note:

Default: - A default role will be created.

AWS Lambda execution role.

The role is shared by provider framework's onEvent, isComplete lambda, and onTimeout Lambda functions. This role will be assumed by the AWS Lambda, so it must be assumable by the 'lambda.amazonaws.com' service principal.

Returns:



162
163
164
# File 'custom_resources/provider_props.rb', line 162

def role
  @role
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: - If vpc is not supplied, no security groups are attached. Otherwise, a dedicated security group is created for each function.

Security groups to attach to the provider functions.

Only used if 'vpc' is supplied

Returns:



169
170
171
# File 'custom_resources/provider_props.rb', line 169

def security_groups
  @security_groups
end

#total_timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(30)

Total timeout for the entire operation.

The maximum timeout is 1 hour (yes, it can exceed the AWS Lambda 15 minutes)

Returns:



176
177
178
# File 'custom_resources/provider_props.rb', line 176

def total_timeout
  @total_timeout
end

#vpcAWSCDK::EC2::IVPC? (readonly)

Note:

Default: - functions are not provisioned inside a vpc.

The vpc to provision the lambda functions in.

Returns:



181
182
183
# File 'custom_resources/provider_props.rb', line 181

def vpc
  @vpc
end

#vpc_subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - the Vpc default strategy if not specified

Which subnets from the VPC to place the lambda functions in.

Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.



189
190
191
# File 'custom_resources/provider_props.rb', line 189

def vpc_subnets
  @vpc_subnets
end

#waiter_state_machine_log_optionsAWSCDK::CustomResources::LogOptions? (readonly)

Note:

Default: - A default log group will be created if logging for the waiter state machine is enabled.

Defines what execution history events of the waiter state machine are logged and where they are logged.



194
195
196
# File 'custom_resources/provider_props.rb', line 194

def waiter_state_machine_log_options
  @waiter_state_machine_log_options
end

Class Method Details

.jsii_propertiesObject



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'custom_resources/provider_props.rb', line 196

def self.jsii_properties
  {
    :on_event_handler => "onEventHandler",
    :disable_waiter_state_machine_logging => "disableWaiterStateMachineLogging",
    :framework_complete_and_timeout_role => "frameworkCompleteAndTimeoutRole",
    :framework_lambda_logging_level => "frameworkLambdaLoggingLevel",
    :framework_on_event_role => "frameworkOnEventRole",
    :is_complete_handler => "isCompleteHandler",
    :log_group => "logGroup",
    :log_retention => "logRetention",
    :provider_function_env_encryption => "providerFunctionEnvEncryption",
    :provider_function_name => "providerFunctionName",
    :query_interval => "queryInterval",
    :role => "role",
    :security_groups => "securityGroups",
    :total_timeout => "totalTimeout",
    :vpc => "vpc",
    :vpc_subnets => "vpcSubnets",
    :waiter_state_machine_log_options => "waiterStateMachineLogOptions",
  }
end

Instance Method Details

#to_jsiiObject



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'custom_resources/provider_props.rb', line 218

def to_jsii
  result = {}
  result.merge!({
    "onEventHandler" => @on_event_handler,
    "disableWaiterStateMachineLogging" => @disable_waiter_state_machine_logging,
    "frameworkCompleteAndTimeoutRole" => @framework_complete_and_timeout_role,
    "frameworkLambdaLoggingLevel" => @framework_lambda_logging_level,
    "frameworkOnEventRole" => @framework_on_event_role,
    "isCompleteHandler" => @is_complete_handler,
    "logGroup" => @log_group,
    "logRetention" => @log_retention,
    "providerFunctionEnvEncryption" => @provider_function_env_encryption,
    "providerFunctionName" => @provider_function_name,
    "queryInterval" => @query_interval,
    "role" => @role,
    "securityGroups" => @security_groups,
    "totalTimeout" => @total_timeout,
    "vpc" => @vpc,
    "vpcSubnets" => @vpc_subnets,
    "waiterStateMachineLogOptions" => @waiter_state_machine_log_options,
  })
  result.compact
end