createUsagePlanKey method
Creates a usage plan key for adding an existing API key to a usage plan.
May throw BadRequestException.
May throw ConflictException.
May throw LimitExceededException.
May throw NotFoundException.
May throw TooManyRequestsException.
May throw UnauthorizedException.
Parameter keyId :
The identifier of a UsagePlanKey resource for a plan customer.
Parameter keyType :
The type of a UsagePlanKey resource for a plan customer.
Parameter usagePlanId :
The Id of the UsagePlan resource representing the usage plan containing
the to-be-created UsagePlanKey resource representing a plan customer.
Implementation
Future<UsagePlanKey> createUsagePlanKey({
required String keyId,
required String keyType,
required String usagePlanId,
}) async {
final $payload = <String, dynamic>{
'keyId': keyId,
'keyType': keyType,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/usageplans/${Uri.encodeComponent(usagePlanId)}/keys',
exceptionFnMap: _exceptionFns,
);
return UsagePlanKey.fromJson(response);
}