updateSubscription method
Changes the plan tier of an existing subscription.
This operation replaces the plan tier value. If you omit the optional
usageLevel field, it is reset to the default.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter arn :
The ARN of the subscription to update.
Parameter ifMatch :
The ETag value from a previous GetSubscription
or ListSubscriptions response. This ensures you are updating
the expected version of the subscription.
Parameter planTier :
The new tier level for the subscription.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the request
is handled only once.
Parameter usageLevel :
The usage level within the plan tier. Specify DEFAULT for the
base configuration. If omitted, the usage level is reset to the default.
Implementation
Future<UpdateSubscriptionOutput> updateSubscription({
required String arn,
required String ifMatch,
required String planTier,
String? clientToken,
String? usageLevel,
}) async {
final headers = <String, String>{
'If-Match': ifMatch.toString(),
};
final $payload = <String, dynamic>{
'arn': arn,
'planTier': planTier,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (usageLevel != null) 'usageLevel': usageLevel,
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'POST',
requestUri: '/v1/UpdateSubscription',
headers: headers,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return UpdateSubscriptionOutput(
subscription: Subscription.fromJson($json),
eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
);
}