aws-cdk-lib.aws_events.Authorization

class Authorization

LanguageType name
.NETAmazon.CDK.AWS.Events.Authorization
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#Authorization
Javasoftware.amazon.awscdk.services.events.Authorization
Pythonaws_cdk.aws_events.Authorization
TypeScript (source)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

NameDescription
static apiKey(apiKeyName, apiKeyValue)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 SecretValue

Returns

  • Authorization

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 SecretValue

Returns

  • Authorization

Use username and password authorization.


static oauth(props)

public static oauth(props: OAuthAuthorizationProps): Authorization

Parameters

  • props OAuthAuthorizationProps

Returns

  • Authorization

Use OAuth authorization.