aws-cdk-lib.aws_events.ApiDestination

class ApiDestination (construct)

LanguageType name
.NETAmazon.CDK.AWS.Events.ApiDestination
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#ApiDestination
Javasoftware.amazon.awscdk.services.events.ApiDestination
Pythonaws_cdk.aws_events.ApiDestination
TypeScript (source)aws-cdk-lib » aws_events » ApiDestination

Implements IConstruct, IDependable, IResource, IApiDestination

Define an EventBridge Api Destination.

Example

const connection = new events.Connection(this, 'Connection', {
  authorization: events.Authorization.apiKey('x-api-key', SecretValue.secretsManager('ApiSecretName')),
  description: 'Connection with API Key x-api-key',
});

const destination = new events.ApiDestination(this, 'Destination', {
  connection,
  endpoint: 'https://example.com',
  description: 'Calling example.com with API key x-api-key',
});

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(Duration.minutes(1)),
  targets: [new targets.ApiDestination(destination)],
});

Initializer

new ApiDestination(scope: Construct, id: string, props: ApiDestinationProps)

Parameters

  • scope Construct
  • id string
  • props ApiDestinationProps

Construct Props

NameTypeDescription
connectionIConnectionThe ARN of the connection to use for the API destination.
endpointstringThe URL to the HTTP invocation endpoint for the API destination..
apiDestinationName?stringThe name for the API destination.
description?stringA description for the API destination.
httpMethod?HttpMethodThe method to use for the request to the HTTP invocation endpoint.
rateLimitPerSecond?numberThe maximum number of requests per second to send to the HTTP invocation endpoint.

connection

Type: IConnection

The ARN of the connection to use for the API destination.


endpoint

Type: string

The URL to the HTTP invocation endpoint for the API destination..


apiDestinationName?

Type: string (optional, default: A unique name will be generated)

The name for the API destination.


description?

Type: string (optional, default: none)

A description for the API destination.


httpMethod?

Type: HttpMethod (optional, default: HttpMethod.POST)

The method to use for the request to the HTTP invocation endpoint.


rateLimitPerSecond?

Type: number (optional, default: Not rate limited)

The maximum number of requests per second to send to the HTTP invocation endpoint.

Properties

NameTypeDescription
apiDestinationArnstringThe ARN of the Api Destination created.
apiDestinationNamestringThe Name of the Api Destination created.
connectionIConnectionThe Connection to associate with Api Destination.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

apiDestinationArn

Type: string

The ARN of the Api Destination created.


apiDestinationName

Type: string

The Name of the Api Destination created.


connection

Type: IConnection

The Connection to associate with Api Destination.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.