Class: AWSCDK::CustomResources::AWSSdkCall
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CustomResources::AWSSdkCall
- Defined in:
- custom_resources/aws_sdk_call.rb
Overview
An AWS SDK call.
Instance Attribute Summary collapse
-
#action ⇒ String
readonly
The service action to call.
-
#api_version ⇒ String?
readonly
API version to use for the service.
-
#assumed_role_arn ⇒ String?
readonly
Used for running the SDK calls in underlying lambda with a different role.
-
#external_id ⇒ String?
readonly
External ID to use when assuming the role for cross-account requests.
-
#ignore_error_codes_matching ⇒ String?
readonly
The regex pattern to use to catch API errors.
-
#logging ⇒ AWSCDK::CustomResources::Logging?
readonly
A property used to configure logging during lambda function execution.
-
#output_paths ⇒ Array<String>?
readonly
Restrict the data returned by the custom resource to specific paths in the API response.
-
#parameters ⇒ Object?
readonly
The parameters for the service action.
-
#physical_resource_id ⇒ AWSCDK::CustomResources::PhysicalResourceId?
readonly
The physical resource id of the custom resource for this call.
-
#region ⇒ String?
readonly
The region to send service requests to.
-
#service ⇒ String
readonly
The service to call.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(action:, service:, api_version: nil, assumed_role_arn: nil, external_id: nil, ignore_error_codes_matching: nil, logging: nil, output_paths: nil, parameters: nil, physical_resource_id: nil, region: nil) ⇒ AWSSdkCall
constructor
A new instance of AWSSdkCall.
- #to_jsii ⇒ Object
Constructor Details
#initialize(action:, service:, api_version: nil, assumed_role_arn: nil, external_id: nil, ignore_error_codes_matching: nil, logging: nil, output_paths: nil, parameters: nil, physical_resource_id: nil, region: nil) ⇒ AWSSdkCall
Returns a new instance of AWSSdkCall.
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_sdk_call.rb', line 35 def initialize(action:, service:, api_version: nil, assumed_role_arn: nil, external_id: nil, ignore_error_codes_matching: nil, logging: nil, output_paths: nil, parameters: nil, physical_resource_id: nil, region: nil) @action = action Jsii::Type.check_type(@action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "action") @service = service Jsii::Type.check_type(@service, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "service") @api_version = api_version Jsii::Type.check_type(@api_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "apiVersion") unless @api_version.nil? @assumed_role_arn = assumed_role_arn Jsii::Type.check_type(@assumed_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assumedRoleArn") unless @assumed_role_arn.nil? @external_id = external_id Jsii::Type.check_type(@external_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "externalId") unless @external_id.nil? @ignore_error_codes_matching = ignore_error_codes_matching Jsii::Type.check_type(@ignore_error_codes_matching, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ignoreErrorCodesMatching") unless @ignore_error_codes_matching.nil? @logging = logging Jsii::Type.check_type(@logging, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLkxvZ2dpbmcifQ==")), "logging") unless @logging.nil? @output_paths = output_paths Jsii::Type.check_type(@output_paths, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "outputPaths") unless @output_paths.nil? @parameters = parameters Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "parameters") unless @parameters.nil? @physical_resource_id = physical_resource_id Jsii::Type.check_type(@physical_resource_id, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jdXN0b21fcmVzb3VyY2VzLlBoeXNpY2FsUmVzb3VyY2VJZCJ9")), "physicalResourceId") unless @physical_resource_id.nil? @region = region Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil? end |
Instance Attribute Details
#action ⇒ String (readonly)
The service action to call.
This is the name of an AWS API call, in one of the following forms:
- An API call name as found in the API Reference documentation (
GetObject) - The API call name starting with a lowercase letter (
get_object) - The AWS SDK for JavaScript v3 command class name (
GetObjectCommand)
70 71 72 |
# File 'custom_resources/aws_sdk_call.rb', line 70 def action @action end |
#api_version ⇒ String? (readonly)
Default: - use latest available API version
API version to use for the service.
88 89 90 |
# File 'custom_resources/aws_sdk_call.rb', line 88 def api_version @api_version end |
#assumed_role_arn ⇒ String? (readonly)
Default: - run without assuming role
Used for running the SDK calls in underlying lambda with a different role.
Can be used primarily for cross-account requests to for example connect hostedzone with a shared vpc. Region controls where assumeRole call is made.
Example for Route53 / associateVPCWithHostedZone
99 100 101 |
# File 'custom_resources/aws_sdk_call.rb', line 99 def assumed_role_arn @assumed_role_arn end |
#external_id ⇒ String? (readonly)
Default: - no external ID
External ID to use when assuming the role for cross-account requests.
This is an additional security measure that helps prevent the "confused deputy" problem where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to perform the action.
The external ID must be provided by the third-party service and should not be generated by you. This value should be unique among the third-party service's customers.
This property is only used when assumed_role_arn is specified.
115 116 117 |
# File 'custom_resources/aws_sdk_call.rb', line 115 def external_id @external_id end |
#ignore_error_codes_matching ⇒ String? (readonly)
Default: - do not catch errors
The regex pattern to use to catch API errors.
The code property of the
Error object will be tested against this pattern. If there is a match an
error will not be thrown.
124 125 126 |
# File 'custom_resources/aws_sdk_call.rb', line 124 def ignore_error_codes_matching @ignore_error_codes_matching end |
#logging ⇒ AWSCDK::CustomResources::Logging? (readonly)
Default: Logging.all()
A property used to configure logging during lambda function execution.
Note: The default Logging configuration is all. This configuration will enable logging on all logged data in the lambda handler. This includes:
- The event object that is received by the lambda handler
- The response received after making a API call
- The response object that the lambda handler will return
- SDK versioning information
- Caught and uncaught errors
138 139 140 |
# File 'custom_resources/aws_sdk_call.rb', line 138 def logging @logging end |
#output_paths ⇒ Array<String>? (readonly)
Default: - return all data
Restrict the data returned by the custom resource to specific paths in the API response.
Use this to limit the data returned by the custom resource if working with API calls that could potentially result in custom response objects exceeding the hard limit of 4096 bytes.
Example for ECS / updateService: ['service.deploymentConfiguration.maximumPercent']
149 150 151 |
# File 'custom_resources/aws_sdk_call.rb', line 149 def output_paths @output_paths end |
#parameters ⇒ Object? (readonly)
Default: - no parameters
The parameters for the service action.
155 156 157 |
# File 'custom_resources/aws_sdk_call.rb', line 155 def parameters @parameters end |
#physical_resource_id ⇒ AWSCDK::CustomResources::PhysicalResourceId? (readonly)
Default: - no physical resource id
The physical resource id of the custom resource for this call.
Mandatory for onCreate call. In onUpdate, you can omit this to passthrough it from request.
163 164 165 |
# File 'custom_resources/aws_sdk_call.rb', line 163 def physical_resource_id @physical_resource_id end |
#region ⇒ String? (readonly)
Default: - the region where this custom resource is deployed
The region to send service requests to.
Note: Cross-region operations are generally considered an anti-pattern. Consider first deploying a stack in that region.
171 172 173 |
# File 'custom_resources/aws_sdk_call.rb', line 171 def region @region end |
#service ⇒ String (readonly)
The service to call.
This is the name of an AWS service, in one of the following forms:
- An AWS SDK for JavaScript v3 package name (
@aws-sdk/client-api-gateway) - An AWS SDK for JavaScript v3 client name (
api-gateway) - An AWS SDK for JavaScript v2 constructor name (
APIGateway) - A lowercase AWS SDK for JavaScript v2 constructor name (
apigateway)
82 83 84 |
# File 'custom_resources/aws_sdk_call.rb', line 82 def service @service end |
Class Method Details
.jsii_properties ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'custom_resources/aws_sdk_call.rb', line 173 def self.jsii_properties { :action => "action", :service => "service", :api_version => "apiVersion", :assumed_role_arn => "assumedRoleArn", :external_id => "externalId", :ignore_error_codes_matching => "ignoreErrorCodesMatching", :logging => "logging", :output_paths => "outputPaths", :parameters => "parameters", :physical_resource_id => "physicalResourceId", :region => "region", } end |
Instance Method Details
#to_jsii ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'custom_resources/aws_sdk_call.rb', line 189 def to_jsii result = {} result.merge!({ "action" => @action, "service" => @service, "apiVersion" => @api_version, "assumedRoleArn" => @assumed_role_arn, "externalId" => @external_id, "ignoreErrorCodesMatching" => @ignore_error_codes_matching, "logging" => @logging, "outputPaths" => @output_paths, "parameters" => @parameters, "physicalResourceId" => @physical_resource_id, "region" => @region, }) result.compact end |