disassociateResourcesFromSubscription method

Future<DisassociateResourcesFromSubscriptionOutput> disassociateResourcesFromSubscription({
  1. required String arn,
  2. required String ifMatch,
  3. required List<String> resourceArns,
  4. String? clientToken,
})

Removes one or more resources from an existing subscription.

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 remove resources from.

Parameter ifMatch : The ETag value from a previous GetSubscription or ListSubscriptions response.

Parameter resourceArns : The ARNs of the resources to remove from the subscription. For subscriptions in the CloudFront plan family, you cannot remove the required CloudFront distribution or WAF web ACL.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the request is handled only once.

Implementation

Future<DisassociateResourcesFromSubscriptionOutput>
    disassociateResourcesFromSubscription({
  required String arn,
  required String ifMatch,
  required List<String> resourceArns,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'If-Match': ifMatch.toString(),
  };
  final $payload = <String, dynamic>{
    'arn': arn,
    'resourceArns': resourceArns,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/DisassociateResourcesFromSubscription',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return DisassociateResourcesFromSubscriptionOutput(
    subscription: Subscription.fromJson($json),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
  );
}