createUsagePlan method
- required String name,
- List<
ApiStage> ? apiStages, - String? description,
- QuotaSettings? quota,
- Map<
String, String> ? tags, - ThrottleSettings? throttle,
Creates a usage plan with the throttle and quota limits, as well as the associated API stages, specified in the payload.
May throw BadRequestException. May throw UnauthorizedException. May throw TooManyRequestsException. May throw LimitExceededException. May throw ConflictException. May throw NotFoundException.
Parameter name
:
Required
The name of the usage plan.
Parameter apiStages
:
The associated API stages of the usage plan.
Parameter description
:
The description of the usage plan.
Parameter quota
:
The quota of the usage plan.
Parameter tags
:
The key-value map of strings. The valid character set is a-zA-Z+-=._:/
.
The tag key can be up to 128 characters and must not start with
aws:
. The tag value can be up to 256 characters.
Parameter throttle
:
The throttling limits of the usage plan.
Implementation
Future<UsagePlan> createUsagePlan({
required String name,
List<ApiStage>? apiStages,
String? description,
QuotaSettings? quota,
Map<String, String>? tags,
ThrottleSettings? throttle,
}) async {
ArgumentError.checkNotNull(name, 'name');
final $payload = <String, dynamic>{
'name': name,
if (apiStages != null) 'apiStages': apiStages,
if (description != null) 'description': description,
if (quota != null) 'quota': quota,
if (tags != null) 'tags': tags,
if (throttle != null) 'throttle': throttle,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/usageplans',
exceptionFnMap: _exceptionFns,
);
return UsagePlan.fromJson(response);
}