createApiMapping method
Creates an API mapping.
May throw NotFoundException. May throw TooManyRequestsException. May throw BadRequestException. May throw ConflictException.
Parameter apiId
:
The API identifier.
Parameter domainName
:
The domain name.
Parameter stage
:
The API stage.
Parameter apiMappingKey
:
The API mapping key.
Implementation
Future<CreateApiMappingResponse> createApiMapping({
required String apiId,
required String domainName,
required String stage,
String? apiMappingKey,
}) async {
ArgumentError.checkNotNull(apiId, 'apiId');
ArgumentError.checkNotNull(domainName, 'domainName');
ArgumentError.checkNotNull(stage, 'stage');
final $payload = <String, dynamic>{
'apiId': apiId,
'stage': stage,
if (apiMappingKey != null) 'apiMappingKey': apiMappingKey,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/v2/domainnames/${Uri.encodeComponent(domainName)}/apimappings',
exceptionFnMap: _exceptionFns,
);
return CreateApiMappingResponse.fromJson(response);
}