ConnectionProps Struct
An API Destination Connection.
A connection defines the authorization type and credentials to use for authorization with an API destination HTTP endpoint.
| Source | aws-events/lib/connection.ts |
|---|---|
| Type last changed |
Example
ts
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)],
});
python
connection = events.Connection(self, "Connection",
authorization=events.Authorization.api_key("x-api-key", SecretValue.secrets_manager("ApiSecretName")),
description="Connection with API Key x-api-key"
)
destination = events.ApiDestination(self, "Destination",
connection=connection,
endpoint="https://example.com",
description="Calling example.com with API key x-api-key"
)
rule = events.Rule(self, "Rule",
schedule=events.Schedule.rate(Duration.minutes(1)),
targets=[targets.ApiDestination(destination)]
)
java
Connection connection = Connection.Builder.create(this, "Connection")
.authorization(Authorization.apiKey("x-api-key", SecretValue.secretsManager("ApiSecretName")))
.description("Connection with API Key x-api-key")
.build();
ApiDestination destination = ApiDestination.Builder.create(this, "Destination")
.connection(connection)
.endpoint("https://example.com")
.description("Calling example.com with API key x-api-key")
.build();
Rule rule = Rule.Builder.create(this, "Rule")
.schedule(Schedule.rate(Duration.minutes(1)))
.targets(List.of(new ApiDestination(destination)))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var connection = new Connection(this, "Connection", new ConnectionProps {
Authorization = Authorization.ApiKey("x-api-key", SecretValue.SecretsManager("ApiSecretName")),
Description = "Connection with API Key x-api-key"
});
var destination = new ApiDestination(this, "Destination", new ApiDestinationProps {
Connection = connection,
Endpoint = "https://example.com",
Description = "Calling example.com with API key x-api-key"
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Minutes(1)),
Targets = new [] { new ApiDestination(destination) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
connection := events.NewConnection(this, jsii.String("Connection"), &ConnectionProps{
Authorization: events.Authorization_ApiKey(jsii.String("x-api-key"), awscdk.SecretValue_SecretsManager(jsii.String("ApiSecretName"))),
Description: jsii.String("Connection with API Key x-api-key"),
})
destination := events.NewApiDestination(this, jsii.String("Destination"), &ApiDestinationProps{
Connection: Connection,
Endpoint: jsii.String("https://example.com"),
Description: jsii.String("Calling example.com with API key x-api-key"),
})
rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{
Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))),
Targets: []IRuleTarget{
targets.NewApiDestination(destination),
},
})
Properties
authorizationAuthorizationauthorizationAuthorizationauthorizationAuthorizationAuthorizationAuthorizationAuthorizationAuthorization required #The authorization type for the connection.
bodyParametersoptional{ [key: string]: HttpParameter }body_parametersoptionaltyping.Mapping[str, HttpParameter]bodyParametersoptionalMap<String, HttpParameter>BodyParametersoptionalIDictionary<string, HttpParameter>BodyParametersoptional*map[string]HttpParameter #Additional string parameters to add to the invocation bodies.
Default: No additional parameters
connectionNameoptionalstringconnection_nameoptionalstrconnectionNameoptionalStringConnectionNameoptionalstringConnectionNameoptional*string #The name of the connection.
Default: A name is automatically generated
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = none #The name of the connection.
headerParametersoptional{ [key: string]: HttpParameter }header_parametersoptionaltyping.Mapping[str, HttpParameter]headerParametersoptionalMap<String, HttpParameter>HeaderParametersoptionalIDictionary<string, HttpParameter>HeaderParametersoptional*map[string]HttpParameter #Additional string parameters to add to the invocation headers.
Default: No additional parameters
queryStringParametersoptional{ [key: string]: HttpParameter }query_string_parametersoptionaltyping.Mapping[str, HttpParameter]queryStringParametersoptionalMap<String, HttpParameter>QueryStringParametersoptionalIDictionary<string, HttpParameter>QueryStringParametersoptional*map[string]HttpParameter #Additional string parameters to add to the invocation query strings.
Default: No additional parameters