Class: AWSCDK::EventsTargets::APIGatewayProps

Inherits:
TargetBaseProps
  • Object
show all
Defined in:
events_targets/api_gateway_props.rb

Overview

Customize the API Gateway Event Target.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dead_letter_queue: nil, max_event_age: nil, retry_attempts: nil, event_role: nil, header_parameters: nil, method: nil, path: nil, path_parameter_values: nil, post_body: nil, query_string_parameters: nil, stage: nil) ⇒ APIGatewayProps

Returns a new instance of APIGatewayProps.

Parameters:

  • dead_letter_queue (AWSCDK::SQS::IQueue, nil) (defaults to: nil)

    The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

  • max_event_age (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum age of a request that Lambda sends to a function for processing.

  • retry_attempts (Numeric, nil) (defaults to: nil)

    The maximum number of times to retry when the function returns an error.

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

    The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered.

  • header_parameters (Hash{String => String}, nil) (defaults to: nil)

    The headers to be set when requesting API.

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

    The method for api resource invoked by the rule.

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

    The api resource invoked by the rule.

  • path_parameter_values (Array<String>, nil) (defaults to: nil)

    The path parameter values to be used to populate to wildcards("*") of requesting api path.

  • post_body (AWSCDK::Events::RuleTargetInput, nil) (defaults to: nil)

    This will be the post request body send to the API.

  • query_string_parameters (Hash{String => String}, nil) (defaults to: nil)

    The query parameters to be set when requesting API.

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

    The deploy stage of api gateway invoked by the rule.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'events_targets/api_gateway_props.rb', line 18

def initialize(dead_letter_queue: nil, max_event_age: nil, retry_attempts: nil, event_role: nil, header_parameters: nil, method: nil, path: nil, path_parameter_values: nil, post_body: nil, query_string_parameters: nil, stage: nil)
  @dead_letter_queue = dead_letter_queue
  Jsii::Type.check_type(@dead_letter_queue, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3FzLklRdWV1ZSJ9")), "deadLetterQueue") unless @dead_letter_queue.nil?
  @max_event_age = max_event_age
  Jsii::Type.check_type(@max_event_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxEventAge") unless @max_event_age.nil?
  @retry_attempts = retry_attempts
  Jsii::Type.check_type(@retry_attempts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retryAttempts") unless @retry_attempts.nil?
  @event_role = event_role
  Jsii::Type.check_type(@event_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "eventRole") unless @event_role.nil?
  @header_parameters = header_parameters
  Jsii::Type.check_type(@header_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "headerParameters") unless @header_parameters.nil?
  @method = method
  Jsii::Type.check_type(@method, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "method") unless @method.nil?
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless @path.nil?
  @path_parameter_values = path_parameter_values
  Jsii::Type.check_type(@path_parameter_values, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "pathParameterValues") unless @path_parameter_values.nil?
  @post_body = post_body
  Jsii::Type.check_type(@post_body, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLlJ1bGVUYXJnZXRJbnB1dCJ9")), "postBody") unless @post_body.nil?
  @query_string_parameters = query_string_parameters
  Jsii::Type.check_type(@query_string_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "queryStringParameters") unless @query_string_parameters.nil?
  @stage = stage
  Jsii::Type.check_type(@stage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stage") unless @stage.nil?
end

Instance Attribute Details

#dead_letter_queueAWSCDK::SQS::IQueue? (readonly)

Note:

Default: - no dead-letter queue

The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.

Returns:



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

def dead_letter_queue
  @dead_letter_queue
end

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

Note:

Default: - a new role will be created

The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered.

Returns:



72
73
74
# File 'events_targets/api_gateway_props.rb', line 72

def event_role
  @event_role
end

#header_parametersHash{String => String}? (readonly)

Note:

Default: no header parameters

The headers to be set when requesting API.

Returns:

  • (Hash{String => String}, nil)


77
78
79
# File 'events_targets/api_gateway_props.rb', line 77

def header_parameters
  @header_parameters
end

#max_event_ageAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(24)

The maximum age of a request that Lambda sends to a function for processing.

Minimum value of 60. Maximum value of 86400.

Returns:



59
60
61
# File 'events_targets/api_gateway_props.rb', line 59

def max_event_age
  @max_event_age
end

#methodString? (readonly)

Note:

Default: '*' that treated as ANY

The method for api resource invoked by the rule.

Returns:

  • (String, nil)


82
83
84
# File 'events_targets/api_gateway_props.rb', line 82

def method
  @method
end

#pathString? (readonly)

Note:

Default: '/'

The api resource invoked by the rule.

We can use wildcards('*') to specify the path. In that case, an equal number of real values must be specified for pathParameterValues.

Returns:

  • (String, nil)


90
91
92
# File 'events_targets/api_gateway_props.rb', line 90

def path
  @path
end

#path_parameter_valuesArray<String>? (readonly)

Note:

Default: no path parameters

The path parameter values to be used to populate to wildcards("*") of requesting api path.

Returns:

  • (Array<String>, nil)


95
96
97
# File 'events_targets/api_gateway_props.rb', line 95

def path_parameter_values
  @path_parameter_values
end

#post_bodyAWSCDK::Events::RuleTargetInput? (readonly)

Note:

Default: the entire EventBridge event

This will be the post request body send to the API.



100
101
102
# File 'events_targets/api_gateway_props.rb', line 100

def post_body
  @post_body
end

#query_string_parametersHash{String => String}? (readonly)

Note:

Default: no querystring parameters

The query parameters to be set when requesting API.

Returns:

  • (Hash{String => String}, nil)


105
106
107
# File 'events_targets/api_gateway_props.rb', line 105

def query_string_parameters
  @query_string_parameters
end

#retry_attemptsNumeric? (readonly)

Note:

Default: 185

The maximum number of times to retry when the function returns an error.

Minimum value of 0. Maximum value of 185.

Returns:

  • (Numeric, nil)


67
68
69
# File 'events_targets/api_gateway_props.rb', line 67

def retry_attempts
  @retry_attempts
end

#stageString? (readonly)

Note:

Default: the value of deploymentStage.stageName of target api gateway.

The deploy stage of api gateway invoked by the rule.

Returns:

  • (String, nil)


110
111
112
# File 'events_targets/api_gateway_props.rb', line 110

def stage
  @stage
end

Class Method Details

.jsii_propertiesObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'events_targets/api_gateway_props.rb', line 112

def self.jsii_properties
  {
    :dead_letter_queue => "deadLetterQueue",
    :max_event_age => "maxEventAge",
    :retry_attempts => "retryAttempts",
    :event_role => "eventRole",
    :header_parameters => "headerParameters",
    :method => "method",
    :path => "path",
    :path_parameter_values => "pathParameterValues",
    :post_body => "postBody",
    :query_string_parameters => "queryStringParameters",
    :stage => "stage",
  }
end

Instance Method Details

#to_jsiiObject



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'events_targets/api_gateway_props.rb', line 128

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "deadLetterQueue" => @dead_letter_queue,
    "maxEventAge" => @max_event_age,
    "retryAttempts" => @retry_attempts,
    "eventRole" => @event_role,
    "headerParameters" => @header_parameters,
    "method" => @method,
    "path" => @path,
    "pathParameterValues" => @path_parameter_values,
    "postBody" => @post_body,
    "queryStringParameters" => @query_string_parameters,
    "stage" => @stage,
  })
  result.compact
end