Module: AWSCDK::Lambda::IAlias
- Includes:
- Interfaces::AWSLambda::IAliasRef, IFunction
- Included in:
- Alias
- Defined in:
- lambda/i_alias.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#add_event_source(source) ⇒ void
Adds an event source to this function.
-
#add_event_source_mapping(id, options) ⇒ AWSCDK::Lambda::EventSourceMapping
Adds an event source that maps to this AWS Lambda function.
-
#add_function_url(options = nil) ⇒ AWSCDK::Lambda::FunctionURL
Adds a url to this lambda function.
-
#add_permission(id, permission) ⇒ void
Adds a permission to the Lambda resource policy.
-
#add_to_role_policy(statement) ⇒ void
Adds a statement to the IAM role assumed by the instance.
-
#alias_name ⇒ String
Name of this alias.
-
#alias_ref ⇒ AWSCDK::Interfaces::AWSLambda::AliasReference
A reference to a Alias resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#architecture ⇒ AWSCDK::Lambda::Architecture
The system architectures compatible with this lambda function.
-
#configure_async_invoke(options) ⇒ void
Configures options for asynchronous invocation.
-
#connections ⇒ AWSCDK::EC2::Connections
The network connections associated with this resource.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#function_arn ⇒ String
The ARN of the function.
-
#function_name ⇒ String
The name of the function.
-
#function_ref ⇒ AWSCDK::Interfaces::AWSLambda::FunctionReference
A reference to a Function resource.
-
#grant_invoke(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke this Lambda.
-
#grant_invoke_composite_principal(composite_principal) ⇒ Array<AWSCDK::IAM::Grant>
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
-
#grant_invoke_latest_version(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.
-
#grant_invoke_url(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke this Lambda Function URL.
-
#grant_invoke_version(identity, version) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke the given version of this Lambda.
-
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
-
#is_bound_to_vpc ⇒ Boolean
Whether or not this Lambda function was bound to a VPC.
-
#latest_version ⇒ AWSCDK::Lambda::IVersion
The
$LATESTversion of this function. -
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
Return the given named metric for this Lambda Return the given named metric for this Function.
-
#metric_duration(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Metric for the Duration of this Lambda How long execution of this Lambda takes.
-
#metric_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric
How many invocations of this Lambda fail.
-
#metric_invocations(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Metric for the number of invocations of this Lambda How often this Lambda is invoked.
-
#metric_throttles(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.
-
#node ⇒ Constructs::Node
The tree node.
-
#permissions_node ⇒ Constructs::Node
The construct node where permissions are attached.
-
#resource_arns_for_grant_invoke ⇒ Array<String>
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
-
#role ⇒ AWSCDK::IAM::IRole?
The IAM role associated with this function.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#tenancy_config ⇒ AWSCDK::Lambda::TenancyConfig?
The tenancy configuration for this function.
-
#version ⇒ AWSCDK::Lambda::IVersion
The underlying Lambda function version.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Class Method Details
.jsii_overridable_methods ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lambda/i_alias.rb', line 367 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :connections => { kind: :property, name: "connections", is_optional: false }, :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false }, :function_ref => { kind: :property, name: "functionRef", is_optional: false }, :architecture => { kind: :property, name: "architecture", is_optional: false }, :function_arn => { kind: :property, name: "functionArn", is_optional: false }, :function_name => { kind: :property, name: "functionName", is_optional: false }, :is_bound_to_vpc => { kind: :property, name: "isBoundToVpc", is_optional: false }, :latest_version => { kind: :property, name: "latestVersion", is_optional: false }, :permissions_node => { kind: :property, name: "permissionsNode", is_optional: false }, :resource_arns_for_grant_invoke => { kind: :property, name: "resourceArnsForGrantInvoke", is_optional: false }, :role => { kind: :property, name: "role", is_optional: true }, :tenancy_config => { kind: :property, name: "tenancyConfig", is_optional: true }, :alias_ref => { kind: :property, name: "aliasRef", is_optional: false }, :alias_name => { kind: :property, name: "aliasName", is_optional: false }, :version => { kind: :property, name: "version", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :add_event_source => { kind: :method, name: "addEventSource", is_optional: false }, :add_event_source_mapping => { kind: :method, name: "addEventSourceMapping", is_optional: false }, :add_function_url => { kind: :method, name: "addFunctionUrl", is_optional: false }, :add_permission => { kind: :method, name: "addPermission", is_optional: false }, :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false }, :configure_async_invoke => { kind: :method, name: "configureAsyncInvoke", is_optional: false }, :grant_invoke => { kind: :method, name: "grantInvoke", is_optional: false }, :grant_invoke_composite_principal => { kind: :method, name: "grantInvokeCompositePrincipal", is_optional: false }, :grant_invoke_latest_version => { kind: :method, name: "grantInvokeLatestVersion", is_optional: false }, :grant_invoke_url => { kind: :method, name: "grantInvokeUrl", is_optional: false }, :grant_invoke_version => { kind: :method, name: "grantInvokeVersion", is_optional: false }, :metric => { kind: :method, name: "metric", is_optional: false }, :metric_duration => { kind: :method, name: "metricDuration", is_optional: false }, :metric_errors => { kind: :method, name: "metricErrors", is_optional: false }, :metric_invocations => { kind: :method, name: "metricInvocations", is_optional: false }, :metric_throttles => { kind: :method, name: "metricThrottles", is_optional: false }, } end |
Instance Method Details
#add_event_source(source) ⇒ void
This method returns an undefined value.
Adds an event source to this function.
Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.
The following example adds an SQS Queue as an event source:
import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));
198 199 200 201 |
# File 'lambda/i_alias.rb', line 198 def add_event_source(source) Jsii::Type.check_type(source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklFdmVudFNvdXJjZSJ9")), "source") jsii_call_method("addEventSource", [source]) end |
#add_event_source_mapping(id, options) ⇒ AWSCDK::Lambda::EventSourceMapping
Adds an event source that maps to this AWS Lambda function.
208 209 210 211 212 213 |
# File 'lambda/i_alias.rb', line 208 def add_event_source_mapping(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Lambda::EventSourceMappingOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkV2ZW50U291cmNlTWFwcGluZ09wdGlvbnMifQ==")), "options") jsii_call_method("addEventSourceMapping", [id, ]) end |
#add_function_url(options = nil) ⇒ AWSCDK::Lambda::FunctionURL
Adds a url to this lambda function.
219 220 221 222 223 |
# File 'lambda/i_alias.rb', line 219 def add_function_url( = nil) = .is_a?(Hash) ? ::AWSCDK::Lambda::FunctionURLOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkZ1bmN0aW9uVXJsT3B0aW9ucyJ9")), "options") unless .nil? jsii_call_method("addFunctionUrl", []) end |
#add_permission(id, permission) ⇒ void
This method returns an undefined value.
Adds a permission to the Lambda resource policy.
231 232 233 234 235 236 |
# File 'lambda/i_alias.rb', line 231 def (id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Lambda::Permission.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlBlcm1pc3Npb24ifQ==")), "permission") jsii_call_method("addPermission", [id, ]) end |
#add_to_role_policy(statement) ⇒ void
This method returns an undefined value.
Adds a statement to the IAM role assumed by the instance.
242 243 244 245 |
# File 'lambda/i_alias.rb', line 242 def add_to_role_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToRolePolicy", [statement]) end |
#alias_name ⇒ String
Name of this alias.
143 144 145 |
# File 'lambda/i_alias.rb', line 143 def alias_name() jsii_get_property("aliasName") end |
#alias_ref ⇒ AWSCDK::Interfaces::AWSLambda::AliasReference
A reference to a Alias resource.
136 137 138 |
# File 'lambda/i_alias.rb', line 136 def alias_ref() jsii_get_property("aliasRef") end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
180 181 182 183 |
# File 'lambda/i_alias.rb', line 180 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#architecture ⇒ AWSCDK::Lambda::Architecture
The system architectures compatible with this lambda function.
61 62 63 |
# File 'lambda/i_alias.rb', line 61 def architecture() jsii_get_property("architecture") end |
#configure_async_invoke(options) ⇒ void
This method returns an undefined value.
Configures options for asynchronous invocation.
251 252 253 254 255 |
# File 'lambda/i_alias.rb', line 251 def configure_async_invoke() = .is_a?(Hash) ? ::AWSCDK::Lambda::EventInvokeConfigOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkV2ZW50SW52b2tlQ29uZmlnT3B0aW9ucyJ9")), "options") jsii_call_method("configureAsyncInvoke", []) end |
#connections ⇒ AWSCDK::EC2::Connections
The network connections associated with this resource.
40 41 42 |
# File 'lambda/i_alias.rb', line 40 def connections() jsii_get_property("connections") end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
26 27 28 |
# File 'lambda/i_alias.rb', line 26 def env() jsii_get_property("env") end |
#function_arn ⇒ String
The ARN of the function.
68 69 70 |
# File 'lambda/i_alias.rb', line 68 def function_arn() jsii_get_property("functionArn") end |
#function_name ⇒ String
The name of the function.
75 76 77 |
# File 'lambda/i_alias.rb', line 75 def function_name() jsii_get_property("functionName") end |
#function_ref ⇒ AWSCDK::Interfaces::AWSLambda::FunctionReference
A reference to a Function resource.
54 55 56 |
# File 'lambda/i_alias.rb', line 54 def function_ref() jsii_get_property("functionRef") end |
#grant_invoke(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke this Lambda.
261 262 263 264 |
# File 'lambda/i_alias.rb', line 261 def grant_invoke(identity) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") jsii_call_method("grantInvoke", [identity]) end |
#grant_invoke_composite_principal(composite_principal) ⇒ Array<AWSCDK::IAM::Grant>
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
270 271 272 273 |
# File 'lambda/i_alias.rb', line 270 def grant_invoke_composite_principal(composite_principal) Jsii::Type.check_type(composite_principal, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLkNvbXBvc2l0ZVByaW5jaXBhbCJ9")), "compositePrincipal") jsii_call_method("grantInvokeCompositePrincipal", [composite_principal]) end |
#grant_invoke_latest_version(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.
279 280 281 282 |
# File 'lambda/i_alias.rb', line 279 def grant_invoke_latest_version(identity) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") jsii_call_method("grantInvokeLatestVersion", [identity]) end |
#grant_invoke_url(identity) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke this Lambda Function URL.
288 289 290 291 |
# File 'lambda/i_alias.rb', line 288 def grant_invoke_url(identity) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") jsii_call_method("grantInvokeUrl", [identity]) end |
#grant_invoke_version(identity, version) ⇒ AWSCDK::IAM::Grant
Grant the given identity permissions to invoke the given version of this Lambda.
298 299 300 301 302 |
# File 'lambda/i_alias.rb', line 298 def grant_invoke_version(identity, version) Jsii::Type.check_type(identity, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "identity") Jsii::Type.check_type(version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklWZXJzaW9uIn0=")), "version") jsii_call_method("grantInvokeVersion", [identity, version]) end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
47 48 49 |
# File 'lambda/i_alias.rb', line 47 def grant_principal() jsii_get_property("grantPrincipal") end |
#is_bound_to_vpc ⇒ Boolean
Whether or not this Lambda function was bound to a VPC.
If this is false, trying to access the connections object will fail.
84 85 86 |
# File 'lambda/i_alias.rb', line 84 def is_bound_to_vpc() jsii_get_property("isBoundToVpc") end |
#latest_version ⇒ AWSCDK::Lambda::IVersion
The $LATEST version of this function.
Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.
To obtain a reference to an explicit version which references the current
function configuration, use lambdaFunction.currentVersion instead.
98 99 100 |
# File 'lambda/i_alias.rb', line 98 def latest_version() jsii_get_property("latestVersion") end |
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
Return the given named metric for this Lambda Return the given named metric for this Function.
309 310 311 312 313 314 |
# File 'lambda/i_alias.rb', line 309 def metric(metric_name, props = nil) Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metric", [metric_name, props]) end |
#metric_duration(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
Metric for the Duration of this Lambda How long execution of this Lambda takes.
Average over 5 minutes
323 324 325 326 327 |
# File 'lambda/i_alias.rb', line 323 def metric_duration(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricDuration", [props]) end |
#metric_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric
How many invocations of this Lambda fail.
Sum over 5 minutes
335 336 337 338 339 |
# File 'lambda/i_alias.rb', line 335 def metric_errors(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricErrors", [props]) end |
#metric_invocations(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: sum over 5 minutes
Metric for the number of invocations of this Lambda How often this Lambda is invoked.
Sum over 5 minutes
348 349 350 351 352 |
# File 'lambda/i_alias.rb', line 348 def metric_invocations(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricInvocations", [props]) end |
#metric_throttles(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: sum over 5 minutes
Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.
Sum over 5 minutes
361 362 363 364 365 |
# File 'lambda/i_alias.rb', line 361 def metric_throttles(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricThrottles", [props]) end |
#node ⇒ Constructs::Node
The tree node.
11 12 13 |
# File 'lambda/i_alias.rb', line 11 def node() jsii_get_property("node") end |
#permissions_node ⇒ Constructs::Node
The construct node where permissions are attached.
105 106 107 |
# File 'lambda/i_alias.rb', line 105 def () jsii_get_property("permissionsNode") end |
#resource_arns_for_grant_invoke ⇒ Array<String>
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
This property is for cdk modules to consume only. You should not need to use this property. Instead, use grantInvoke() directly.
115 116 117 |
# File 'lambda/i_alias.rb', line 115 def resource_arns_for_grant_invoke() jsii_get_property("resourceArnsForGrantInvoke") end |
#role ⇒ AWSCDK::IAM::IRole?
The IAM role associated with this function.
122 123 124 |
# File 'lambda/i_alias.rb', line 122 def role() jsii_get_property("role") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
33 34 35 |
# File 'lambda/i_alias.rb', line 33 def stack() jsii_get_property("stack") end |
#tenancy_config ⇒ AWSCDK::Lambda::TenancyConfig?
The tenancy configuration for this function.
129 130 131 |
# File 'lambda/i_alias.rb', line 129 def tenancy_config() jsii_get_property("tenancyConfig") end |
#version ⇒ AWSCDK::Lambda::IVersion
The underlying Lambda function version.
150 151 152 |
# File 'lambda/i_alias.rb', line 150 def version() jsii_get_property("version") end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.
161 162 163 164 165 166 |
# File 'lambda/i_alias.rb', line 161 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |