createApiDestination method
Creates an API destination, which is an HTTP invocation endpoint configured as a target for events.
May throw InternalException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceNotFoundException.
Parameter connectionArn :
The ARN of the connection to use for the API destination. The destination
endpoint must support the authorization type specified for the connection.
Parameter httpMethod :
The method to use for the request to the HTTP invocation endpoint.
Parameter invocationEndpoint :
The URL to the HTTP invocation endpoint for the API destination.
Parameter name :
The name for the API destination to create.
Parameter description :
A description for the API destination to create.
Parameter invocationRateLimitPerSecond :
The maximum number of requests per second to send to the HTTP invocation
endpoint.
Implementation
Future<CreateApiDestinationResponse> createApiDestination({
required String connectionArn,
required ApiDestinationHttpMethod httpMethod,
required String invocationEndpoint,
required String name,
String? description,
int? invocationRateLimitPerSecond,
}) async {
_s.validateNumRange(
'invocationRateLimitPerSecond',
invocationRateLimitPerSecond,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSEvents.CreateApiDestination'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ConnectionArn': connectionArn,
'HttpMethod': httpMethod.value,
'InvocationEndpoint': invocationEndpoint,
'Name': name,
if (description != null) 'Description': description,
if (invocationRateLimitPerSecond != null)
'InvocationRateLimitPerSecond': invocationRateLimitPerSecond,
},
);
return CreateApiDestinationResponse.fromJson(jsonResponse.body);
}