class ApiDestination (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.ApiDestination |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#ApiDestination |
Java | software.amazon.awscdk.services.events.ApiDestination |
Python | aws_cdk.aws_events.ApiDestination |
TypeScript (source) | aws-cdk-lib » aws_events » ApiDestination |
Implements
IConstruct
, IDependable
, IResource
, IApi
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
Api
Destination Props
Construct Props
Name | Type | Description |
---|---|---|
connection | IConnection | The ARN of the connection to use for the API destination. |
endpoint | string | The URL to the HTTP invocation endpoint for the API destination.. |
api | string | The name for the API destination. |
description? | string | A description for the API destination. |
http | Http | The method to use for the request to the HTTP invocation endpoint. |
rate | number | The 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:
Http
(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
Name | Type | Description |
---|---|---|
api | string | The ARN of the Api Destination created. |
api | string | The Name of the Api Destination created. |
connection | IConnection | The Connection to associate with Api Destination. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The 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:
Resource
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
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Create an Api Destination construct from an existing Api Destination ARN. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ApiDestinationAttributes(scope, id, attrs)
static frompublic static fromApiDestinationAttributes(scope: Construct, id: string, attrs: ApiDestinationAttributes): ApiDestination
Parameters
- scope
Construct
— The scope creating construct (usuallythis
). - id
string
— The construct's id. - attrs
Api
— The Api Destination import attributes.Destination Attributes
Returns
Create an Api Destination construct from an existing Api Destination ARN.