Class: AWSCDK::Lambda::FunctionAttributes

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lambda/function_attributes.rb

Overview

Represents a Lambda function defined outside of this stack.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_arn:, architecture: nil, role: nil, same_environment: nil, security_group: nil, skip_permissions: nil, tenancy_config: nil) ⇒ FunctionAttributes

Returns a new instance of FunctionAttributes.

Parameters:

  • function_arn (String)

    The ARN of the Lambda function.

  • architecture (AWSCDK::Lambda::Architecture, nil) (defaults to: nil)

    The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).

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

    The IAM execution role associated with this function.

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

    Setting this property informs the CDK that the imported function is in the same environment as the stack.

  • security_group (AWSCDK::EC2::ISecurityGroup, nil) (defaults to: nil)

    The security group of this Lambda, if in a VPC.

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

    Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do.

  • tenancy_config (AWSCDK::Lambda::TenancyConfig, nil) (defaults to: nil)

    The tenancy configuration of this Lambda Function.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lambda/function_attributes.rb', line 14

def initialize(function_arn:, architecture: nil, role: nil, same_environment: nil, security_group: nil, skip_permissions: nil, tenancy_config: nil)
  @function_arn = function_arn
  Jsii::Type.check_type(@function_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "functionArn")
  @architecture = architecture
  Jsii::Type.check_type(@architecture, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkFyY2hpdGVjdHVyZSJ9")), "architecture") unless @architecture.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @same_environment = same_environment
  Jsii::Type.check_type(@same_environment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sameEnvironment") unless @same_environment.nil?
  @security_group = security_group
  Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil?
  @skip_permissions = skip_permissions
  Jsii::Type.check_type(@skip_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "skipPermissions") unless @skip_permissions.nil?
  @tenancy_config = tenancy_config
  Jsii::Type.check_type(@tenancy_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlRlbmFuY3lDb25maWcifQ==")), "tenancyConfig") unless @tenancy_config.nil?
end

Instance Attribute Details

#architectureAWSCDK::Lambda::Architecture? (readonly)

Note:

Default: - Architecture.X86_64

The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).



41
42
43
# File 'lambda/function_attributes.rb', line 41

def architecture
  @architecture
end

#function_arnString (readonly)

The ARN of the Lambda function.

Format: arn::lambda:::function:

Returns:

  • (String)


36
37
38
# File 'lambda/function_attributes.rb', line 36

def function_arn
  @function_arn
end

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

The IAM execution role associated with this function.

If the role is not specified, any role-related operations will no-op.

Returns:



47
48
49
# File 'lambda/function_attributes.rb', line 47

def role
  @role
end

#same_environmentBoolean? (readonly)

Note:

Default: - depends: true, if the Stack is configured with an explicit env (account and region) and the account is the same as this function. For environment-agnostic stacks this will default to false.

Setting this property informs the CDK that the imported function is in the same environment as the stack.

This affects certain behaviours such as, whether this function's permission can be modified. When not configured, the CDK attempts to auto-determine this. For environment agnostic stacks, i.e., stacks where the account is not specified with the env property, this is determined to be false.

Set this to property ONLY IF the imported function is in the same account as the stack it's imported in.

Returns:

  • (Boolean, nil)


59
60
61
# File 'lambda/function_attributes.rb', line 59

def same_environment
  @same_environment
end

#security_groupAWSCDK::EC2::ISecurityGroup? (readonly)

The security group of this Lambda, if in a VPC.

This needs to be given in order to support allowing connections to this Lambda.

Returns:



66
67
68
# File 'lambda/function_attributes.rb', line 66

def security_group
  @security_group
end

#skip_permissionsBoolean? (readonly)

Note:

Default: false

Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do.

When not configured, the CDK attempts to auto-determine whether or not additional permissions are necessary on the function when grant APIs are used. If the CDK tried to add permissions on an imported lambda, it will fail.

Set this property ONLY IF you are committing to manage the imported function's permissions outside of CDK. You are acknowledging that your CDK code alone will have insufficient permissions to access the imported function.

Returns:

  • (Boolean, nil)


79
80
81
# File 'lambda/function_attributes.rb', line 79

def skip_permissions
  @skip_permissions
end

#tenancy_configAWSCDK::Lambda::TenancyConfig? (readonly)

Note:

Default: - Tenant isolation is not enabled

The tenancy configuration of this Lambda Function.



84
85
86
# File 'lambda/function_attributes.rb', line 84

def tenancy_config
  @tenancy_config
end

Class Method Details

.jsii_propertiesObject



86
87
88
89
90
91
92
93
94
95
96
# File 'lambda/function_attributes.rb', line 86

def self.jsii_properties
  {
    :function_arn => "functionArn",
    :architecture => "architecture",
    :role => "role",
    :same_environment => "sameEnvironment",
    :security_group => "securityGroup",
    :skip_permissions => "skipPermissions",
    :tenancy_config => "tenancyConfig",
  }
end

Instance Method Details

#to_jsiiObject



98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lambda/function_attributes.rb', line 98

def to_jsii
  result = {}
  result.merge!({
    "functionArn" => @function_arn,
    "architecture" => @architecture,
    "role" => @role,
    "sameEnvironment" => @same_environment,
    "securityGroup" => @security_group,
    "skipPermissions" => @skip_permissions,
    "tenancyConfig" => @tenancy_config,
  })
  result.compact
end