class Connection (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.Connection |
Java | software.amazon.awscdk.services.events.Connection |
Python | aws_cdk.aws_events.Connection |
TypeScript (source) | @aws-cdk/aws-events » Connection |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IConnection
Define an EventBridge Connection.
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(cdk.Duration.minutes(1)),
targets: [new targets.ApiDestination(destination)],
});
Initializer
new Connection(scope: Construct, id: string, props: ConnectionProps)
Parameters
- scope
Construct
- id
string
- props
Connection
Props
Construct Props
Name | Type | Description |
---|---|---|
authorization | Authorization | The authorization type for the connection. |
body | { [string]: Http } | Additional string parameters to add to the invocation bodies. |
connection | string | The name of the connection. |
description? | string | The name of the connection. |
header | { [string]: Http } | Additional string parameters to add to the invocation headers. |
query | { [string]: Http } | Additional string parameters to add to the invocation query strings. |
authorization
Type:
Authorization
The authorization type for the connection.
bodyParameters?
Type:
{ [string]:
Http
}
(optional, default: No additional parameters)
Additional string parameters to add to the invocation bodies.
connectionName?
Type:
string
(optional, default: A name is automatically generated)
The name of the connection.
description?
Type:
string
(optional, default: none)
The name of the connection.
headerParameters?
Type:
{ [string]:
Http
}
(optional, default: No additional parameters)
Additional string parameters to add to the invocation headers.
queryStringParameters?
Type:
{ [string]:
Http
}
(optional, default: No additional parameters)
Additional string parameters to add to the invocation query strings.
Properties
Name | Type | Description |
---|---|---|
connection | string | The ARN of the connection created. |
connection | string | The Name for the connection. |
connection | string | The ARN for the secret created for the connection. |
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
connectionArn
Type:
string
The ARN of the connection created.
connectionName
Type:
string
The Name for the connection.
connectionSecretArn
Type:
string
The ARN for the secret created for the connection.
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:
Construct
The construct tree node associated with this construct.
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 | Import an existing connection resource. |
static from | Import an existing connection resource. |
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.
ConnectionAttributes(scope, id, attrs)
static frompublic static fromConnectionAttributes(scope: Construct, id: string, attrs: ConnectionAttributes): IConnection
Parameters
- scope
Construct
— Parent construct. - id
string
— Construct ID. - attrs
Connection
— Imported connection properties.Attributes
Returns
Import an existing connection resource.
EventBusArn(scope, id, connectionArn, connectionSecretArn)
static frompublic static fromEventBusArn(scope: Construct, id: string, connectionArn: string, connectionSecretArn: string): IConnection
Parameters
- scope
Construct
— Parent construct. - id
string
— Construct ID. - connectionArn
string
— ARN of imported connection. - connectionSecretArn
string
Returns
Import an existing connection resource.