Authorization¶
-
class
aws_cdk.aws_events.
Authorization
¶ Bases:
object
Authorization type for an API Destination Connection.
- ExampleMetadata
infused
Example:
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(cdk.Duration.minutes(1)), targets=[targets.ApiDestination(destination)] )
Static Methods
-
classmethod
api_key
(api_key_name, api_key_value)¶ 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.
- Parameters
api_key_name (
str
) –api_key_value (
SecretValue
) –
- Return type
-
classmethod
basic
(username, password)¶ Use username and password authorization.
- Parameters
username (
str
) –password (
SecretValue
) –
- Return type
-
classmethod
oauth
(*, authorization_endpoint, client_id, client_secret, http_method, body_parameters=None, header_parameters=None, query_string_parameters=None)¶ Use OAuth authorization.
- Parameters
authorization_endpoint (
str
) – The URL to the authorization endpoint.client_id (
str
) – The client ID to use for OAuth authorization for the connection.client_secret (
SecretValue
) – The client secret associated with the client ID to use for OAuth authorization for the connection.http_method (
HttpMethod
) – The method to use for the authorization request. (Can only choose POST, GET or PUT).body_parameters (
Optional
[Mapping
[str
,HttpParameter
]]) – Additional string parameters to add to the OAuth request body. Default: - No additional parametersheader_parameters (
Optional
[Mapping
[str
,HttpParameter
]]) – Additional string parameters to add to the OAuth request header. Default: - No additional parametersquery_string_parameters (
Optional
[Mapping
[str
,HttpParameter
]]) – Additional string parameters to add to the OAuth request query string. Default: - No additional parameters
- Return type