Class: AWSCDK::EventsTargets::AWSAPIProps

Inherits:
AWSAPIInput
  • Object
show all
Defined in:
events_targets/awsapi_props.rb

Overview

Properties for an AwsApi target.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, service:, api_version: nil, catch_error_pattern: nil, parameters: nil, policy_statement: nil) ⇒ AWSAPIProps

Returns a new instance of AWSAPIProps.

Parameters:

  • action (String)

    The service action to call.

  • service (String)

    The service to call.

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

    API version to use for the service.

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

    The regex pattern to use to catch API errors.

  • parameters (Object, nil) (defaults to: nil)

    The parameters for the service action.

  • policy_statement (AWSCDK::IAM::PolicyStatement, nil) (defaults to: nil)

    The IAM policy statement to allow the API call.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'events_targets/awsapi_props.rb', line 13

def initialize(action:, service:, api_version: nil, catch_error_pattern: nil, parameters: nil, policy_statement: 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?
  @catch_error_pattern = catch_error_pattern
  Jsii::Type.check_type(@catch_error_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "catchErrorPattern") unless @catch_error_pattern.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "parameters") unless @parameters.nil?
  @policy_statement = policy_statement
  Jsii::Type.check_type(@policy_statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "policyStatement") unless @policy_statement.nil?
end

Instance Attribute Details

#actionString (readonly)

The service action to call.



32
33
34
# File 'events_targets/awsapi_props.rb', line 32

def action
  @action
end

#api_versionString? (readonly)

Deprecated.

the handler code was migrated to AWS SDK for JavaScript v3, which does not support this feature anymore

API version to use for the service.

Returns:

  • (String, nil)


42
43
44
# File 'events_targets/awsapi_props.rb', line 42

def api_version
  @api_version
end

#catch_error_patternString? (readonly)

Note:

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.

Returns:

  • (String, nil)


51
52
53
# File 'events_targets/awsapi_props.rb', line 51

def catch_error_pattern
  @catch_error_pattern
end

#parametersObject? (readonly)

Note:

Default: - no parameters

The parameters for the service action.



57
58
59
# File 'events_targets/awsapi_props.rb', line 57

def parameters
  @parameters
end

#policy_statementAWSCDK::IAM::PolicyStatement? (readonly)

Note:

Default: - extract the permission from the API call

The IAM policy statement to allow the API call.

Use only if resource restriction is needed.



65
66
67
# File 'events_targets/awsapi_props.rb', line 65

def policy_statement
  @policy_statement
end

#serviceString (readonly)

The service to call.



37
38
39
# File 'events_targets/awsapi_props.rb', line 37

def service
  @service
end

Class Method Details

.jsii_propertiesObject



67
68
69
70
71
72
73
74
75
76
# File 'events_targets/awsapi_props.rb', line 67

def self.jsii_properties
  {
    :action => "action",
    :service => "service",
    :api_version => "apiVersion",
    :catch_error_pattern => "catchErrorPattern",
    :parameters => "parameters",
    :policy_statement => "policyStatement",
  }
end

Instance Method Details

#to_jsiiObject



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'events_targets/awsapi_props.rb', line 78

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "action" => @action,
    "service" => @service,
    "apiVersion" => @api_version,
    "catchErrorPattern" => @catch_error_pattern,
    "parameters" => @parameters,
    "policyStatement" => @policy_statement,
  })
  result.compact
end