cancelSubscription method
Cancels a flat-rate pricing subscription.
For subscriptions in PENDING_APPROVAL status, the
subscription is deleted immediately without scheduling.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter arn :
The ARN of the subscription to cancel.
Parameter ifMatch :
The ETag value from a previous GetSubscription
or ListSubscriptions response.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the request
is handled only once.
Implementation
Future<CancelSubscriptionOutput> cancelSubscription({
required String arn,
required String ifMatch,
String? clientToken,
}) async {
final headers = <String, String>{
'If-Match': ifMatch.toString(),
};
final $payload = <String, dynamic>{
'arn': arn,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'POST',
requestUri: '/v1/CancelSubscription',
headers: headers,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CancelSubscriptionOutput(
subscription: Subscription.fromJson($json),
eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
);
}