class Authorization
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Authorization |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#Authorization |
![]() | software.amazon.awscdk.services.events.Authorization |
![]() | aws_cdk.aws_events.Authorization |
![]() | aws-cdk-lib » aws_events » Authorization |
Authorization type for an API Destination 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(Duration.minutes(1)),
targets: [new targets.ApiDestination(destination)],
});
Initializer
new Authorization()
Methods
Name | Description |
---|---|
static api | Use API key authorization. |
static basic(username, password) | Use username and password authorization. |
static oauth(props) | Use OAuth authorization. |
static apiKey(apiKeyName, apiKeyValue)
public static apiKey(apiKeyName: string, apiKeyValue: SecretValue): Authorization
Parameters
- apiKeyName
string
- apiKeyValue
Secret
Value
Returns
Use API key authorization.
API key authorization has two components: an API key name and an API key value. What these are depends on the target of your connection.
static basic(username, password)
public static basic(username: string, password: SecretValue): Authorization
Parameters
- username
string
- password
Secret
Value
Returns
Use username and password authorization.
static oauth(props)
public static oauth(props: OAuthAuthorizationProps): Authorization
Parameters
- props
OAuth
Authorization Props
Returns
Use OAuth authorization.