Class: AWSCDK::CustomResources::AWSCustomResourceProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CustomResources::AWSCustomResourceProps
- Defined in:
- custom_resources/aws_custom_resource_props.rb
Overview
Properties for AwsCustomResource.
Note that at least onCreate, onUpdate or onDelete must be specified.
Instance Attribute Summary collapse
-
#function_name ⇒ String?
readonly
A name for the singleton Lambda function implementing this custom resource.
-
#install_latest_aws_sdk ⇒ Boolean?
readonly
Whether to install the latest AWS SDK v3.
-
#log_group ⇒ AWSCDK::Interfaces::AWSLogs::ILogGroupRef?
readonly
The Log Group used for logging of events emitted by the custom resource's lambda function.
-
#log_retention ⇒ AWSCDK::Logs::RetentionDays?
readonly
The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.
-
#memory_size ⇒ Numeric?
readonly
The memory size for the singleton Lambda function implementing this custom resource.
-
#on_create ⇒ AWSCDK::CustomResources::AWSSdkCall?
readonly
The AWS SDK call to make when the resource is created.
-
#on_delete ⇒ AWSCDK::CustomResources::AWSSdkCall?
readonly
The AWS SDK call to make when the resource is deleted.
-
#on_update ⇒ AWSCDK::CustomResources::AWSSdkCall?
readonly
The AWS SDK call to make when the resource is updated.
-
#policy ⇒ AWSCDK::CustomResources::AWSCustomResourcePolicy?
readonly
The policy that will be added to the execution role of the Lambda function implementing this custom resource provider.
-
#removal_policy ⇒ AWSCDK::RemovalPolicy?
readonly
The policy to apply when this resource is removed from the application.
-
#resource_type ⇒ String?
readonly
Cloudformation Resource type.
-
#role ⇒ AWSCDK::IAM::IRole?
readonly
The execution role for the singleton Lambda function implementing this custom resource provider.
-
#service_timeout ⇒ AWSCDK::Duration?
readonly
The maximum time that can elapse before a custom resource operation times out.
-
#timeout ⇒ AWSCDK::Duration?
readonly
The timeout for the singleton Lambda function implementing this custom resource.
-
#vpc ⇒ AWSCDK::EC2::IVPC?
readonly
The vpc to provision the lambda function in.
-
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection?
readonly
Which subnets from the VPC to place the lambda function in.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(function_name: nil, install_latest_aws_sdk: nil, log_group: nil, log_retention: nil, memory_size: nil, on_create: nil, on_delete: nil, on_update: nil, policy: nil, removal_policy: nil, resource_type: nil, role: nil, service_timeout: nil, timeout: nil, vpc: nil, vpc_subnets: nil) ⇒ AWSCustomResourceProps
constructor
A new instance of AWSCustomResourceProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(function_name: nil, install_latest_aws_sdk: nil, log_group: nil, log_retention: nil, memory_size: nil, on_create: nil, on_delete: nil, on_update: nil, policy: nil, removal_policy: nil, resource_type: nil, role: nil, service_timeout: nil, timeout: nil, vpc: nil, vpc_subnets: nil) ⇒ AWSCustomResourceProps
Returns a new instance of AWSCustomResourceProps.
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 |
# File 'custom_resources/aws_custom_resource_props.rb', line 25 def initialize(function_name: nil, install_latest_aws_sdk: nil, log_group: nil, log_retention: nil, memory_size: nil, on_create: nil, on_delete: nil, on_update: nil, policy: nil, removal_policy: nil, resource_type: nil, role: nil, service_timeout: nil, timeout: nil, vpc: nil, vpc_subnets: nil) @function_name = function_name Jsii::Type.check_type(@function_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "functionName") unless @function_name.nil? @install_latest_aws_sdk = install_latest_aws_sdk Jsii::Type.check_type(@install_latest_aws_sdk, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "installLatestAwsSdk") unless @install_latest_aws_sdk.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? @memory_size = memory_size Jsii::Type.check_type(@memory_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memorySize") unless @memory_size.nil? @on_create = on_create.is_a?(Hash) ? ::AWSCDK::CustomResources::AWSSdkCall.new(**on_create.transform_keys(&:to_sym)) : on_create Jsii::Type.check_type(@on_create, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkF3c1Nka0NhbGwifQ==")), "onCreate") unless @on_create.nil? @on_delete = on_delete.is_a?(Hash) ? ::AWSCDK::CustomResources::AWSSdkCall.new(**on_delete.transform_keys(&:to_sym)) : on_delete Jsii::Type.check_type(@on_delete, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkF3c1Nka0NhbGwifQ==")), "onDelete") unless @on_delete.nil? @on_update = on_update.is_a?(Hash) ? ::AWSCDK::CustomResources::AWSSdkCall.new(**on_update.transform_keys(&:to_sym)) : on_update Jsii::Type.check_type(@on_update, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkF3c1Nka0NhbGwifQ==")), "onUpdate") unless @on_update.nil? @policy = policy Jsii::Type.check_type(@policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkF3c0N1c3RvbVJlc291cmNlUG9saWN5In0=")), "policy") unless @policy.nil? @removal_policy = removal_policy Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil? @resource_type = resource_type Jsii::Type.check_type(@resource_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceType") unless @resource_type.nil? @role = role Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil? @service_timeout = service_timeout Jsii::Type.check_type(@service_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "serviceTimeout") unless @service_timeout.nil? @timeout = timeout Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @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? end |
Instance Attribute Details
#function_name ⇒ String? (readonly)
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
A name for the singleton Lambda function implementing this custom resource.
The function name will remain the same after the first AwsCustomResource is created in a stack.
66 67 68 |
# File 'custom_resources/aws_custom_resource_props.rb', line 66 def function_name @function_name end |
#install_latest_aws_sdk ⇒ Boolean? (readonly)
Default: - The value of @aws-cdk/customresources:installLatestAwsSdkDefault, otherwise true
Whether to install the latest AWS SDK v3.
If not specified, this uses whatever JavaScript SDK version is the default in AWS Lambda at the time of execution.
Otherwise, installs the latest version from 'npmjs.com'. The installation takes around 60 seconds and requires internet connectivity.
The default can be controlled using the context key
@aws-cdk/customresources:installLatestAwsSdkDefault is.
80 81 82 |
# File 'custom_resources/aws_custom_resource_props.rb', line 80 def install_latest_aws_sdk @install_latest_aws_sdk end |
#log_group ⇒ AWSCDK::Interfaces::AWSLogs::ILogGroupRef? (readonly)
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.
88 89 90 |
# File 'custom_resources/aws_custom_resource_props.rb', line 88 def log_group @log_group end |
#log_retention ⇒ AWSCDK::Logs::RetentionDays? (readonly)
Default: logs.RetentionDays.INFINITE
The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.
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.
96 97 98 |
# File 'custom_resources/aws_custom_resource_props.rb', line 96 def log_retention @log_retention end |
#memory_size ⇒ Numeric? (readonly)
Default: 512 mega in case if installLatestAwsSdk is false.
The memory size for the singleton Lambda function implementing this custom resource.
101 102 103 |
# File 'custom_resources/aws_custom_resource_props.rb', line 101 def memory_size @memory_size end |
#on_create ⇒ AWSCDK::CustomResources::AWSSdkCall? (readonly)
Default: - the call when the resource is updated
The AWS SDK call to make when the resource is created.
106 107 108 |
# File 'custom_resources/aws_custom_resource_props.rb', line 106 def on_create @on_create end |
#on_delete ⇒ AWSCDK::CustomResources::AWSSdkCall? (readonly)
Default: - no call
The AWS SDK call to make when the resource is deleted.
111 112 113 |
# File 'custom_resources/aws_custom_resource_props.rb', line 111 def on_delete @on_delete end |
#on_update ⇒ AWSCDK::CustomResources::AWSSdkCall? (readonly)
Default: - no call
The AWS SDK call to make when the resource is updated.
116 117 118 |
# File 'custom_resources/aws_custom_resource_props.rb', line 116 def on_update @on_update end |
#policy ⇒ AWSCDK::CustomResources::AWSCustomResourcePolicy? (readonly)
Default: - no policy added
The policy that will be added to the execution role of the Lambda function implementing this custom resource provider.
The custom resource also implements iam.IGrantable, making it possible
to use the grant_xxx() methods.
As this custom resource uses a singleton Lambda function, it's important to note the that function's role will eventually accumulate the permissions/grants from all resources.
Note that a policy must be specified if role is not provided, as
by default a new role is created which requires policy changes to access
resources.
133 134 135 |
# File 'custom_resources/aws_custom_resource_props.rb', line 133 def policy @policy end |
#removal_policy ⇒ AWSCDK::RemovalPolicy? (readonly)
Default: cdk.RemovalPolicy.Destroy
The policy to apply when this resource is removed from the application.
138 139 140 |
# File 'custom_resources/aws_custom_resource_props.rb', line 138 def removal_policy @removal_policy end |
#resource_type ⇒ String? (readonly)
Default: - Custom::AWS
Cloudformation Resource type.
143 144 145 |
# File 'custom_resources/aws_custom_resource_props.rb', line 143 def resource_type @resource_type end |
#role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - a new role is created
The execution role for the singleton Lambda function implementing this custom resource provider.
This role will apply to all AwsCustomResource
instances in the stack. The role must be assumable by the
lambda.amazonaws.com service principal.
152 153 154 |
# File 'custom_resources/aws_custom_resource_props.rb', line 152 def role @role end |
#service_timeout ⇒ AWSCDK::Duration? (readonly)
Default: Duration.seconds(3600)
The maximum time that can elapse before a custom resource operation times out.
You should not need to set this property. It is intended to allow quick turnaround
even if the implementor of the custom resource forgets to include a try/catch.
We have included the try/catch, and AWS service calls usually do not take an hour
to complete.
The value must be between 1 second and 3600 seconds.
164 165 166 |
# File 'custom_resources/aws_custom_resource_props.rb', line 164 def service_timeout @service_timeout end |
#timeout ⇒ AWSCDK::Duration? (readonly)
Default: Duration.minutes(2)
The timeout for the singleton Lambda function implementing this custom resource.
169 170 171 |
# File 'custom_resources/aws_custom_resource_props.rb', line 169 def timeout @timeout end |
#vpc ⇒ AWSCDK::EC2::IVPC? (readonly)
Default: - the function is not provisioned inside a vpc.
The vpc to provision the lambda function in.
174 175 176 |
# File 'custom_resources/aws_custom_resource_props.rb', line 174 def vpc @vpc end |
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: - the Vpc default strategy if not specified
Which subnets from the VPC to place the lambda function in.
Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.
182 183 184 |
# File 'custom_resources/aws_custom_resource_props.rb', line 182 def vpc_subnets @vpc_subnets end |
Class Method Details
.jsii_properties ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'custom_resources/aws_custom_resource_props.rb', line 184 def self.jsii_properties { :function_name => "functionName", :install_latest_aws_sdk => "installLatestAwsSdk", :log_group => "logGroup", :log_retention => "logRetention", :memory_size => "memorySize", :on_create => "onCreate", :on_delete => "onDelete", :on_update => "onUpdate", :policy => "policy", :removal_policy => "removalPolicy", :resource_type => "resourceType", :role => "role", :service_timeout => "serviceTimeout", :timeout => "timeout", :vpc => "vpc", :vpc_subnets => "vpcSubnets", } end |
Instance Method Details
#to_jsii ⇒ Object
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'custom_resources/aws_custom_resource_props.rb', line 205 def to_jsii result = {} result.merge!({ "functionName" => @function_name, "installLatestAwsSdk" => @install_latest_aws_sdk, "logGroup" => @log_group, "logRetention" => @log_retention, "memorySize" => @memory_size, "onCreate" => @on_create, "onDelete" => @on_delete, "onUpdate" => @on_update, "policy" => @policy, "removalPolicy" => @removal_policy, "resourceType" => @resource_type, "role" => @role, "serviceTimeout" => @service_timeout, "timeout" => @timeout, "vpc" => @vpc, "vpcSubnets" => @vpc_subnets, }) result.compact end |