AwsApiProps

class aws_cdk.aws_events_targets.AwsApiProps(*, action, service, api_version=None, catch_error_pattern=None, parameters=None, policy_statement=None)

Bases: AwsApiInput

Properties for an AwsApi target.

Parameters:
  • action (str) – The service action to call.

  • service (str) – The service to call.

  • api_version (Optional[str]) – (deprecated) API version to use for the service.

  • catch_error_pattern (Optional[str]) – 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. Default: - do not catch errors

  • parameters (Any) – The parameters for the service action. Default: - no parameters

  • policy_statement (Optional[PolicyStatement]) – The IAM policy statement to allow the API call. Use only if resource restriction is needed. Default: - extract the permission from the API call

ExampleMetadata:

infused

Example:

rule = events.Rule(self, "Rule",
    schedule=events.Schedule.rate(Duration.hours(1))
)

rule.add_target(targets.AwsApi(
    service="ECS",
    action="updateService",
    parameters={
        "service": "my-service",
        "force_new_deployment": True
    }
))

Attributes

action

The service action to call.

See:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html

api_version

(deprecated) API version to use for the service.

Deprecated:

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

Stability:

deprecated

catch_error_pattern

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.

Default:
  • do not catch errors

parameters

The parameters for the service action.

Default:
  • no parameters

See:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html

policy_statement

The IAM policy statement to allow the API call.

Use only if resource restriction is needed.

Default:
  • extract the permission from the API call

service

The service to call.

See:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html