deleteAPIKey method

Future<void> deleteAPIKey({
  1. required String aPIKey,
  2. required Scope scope,
})

Deletes the specified API key.

After you delete a key, it can take up to 24 hours for WAF to disallow use of the key in all regions.

May throw WAFInternalErrorException. May throw WAFInvalidOperationException. May throw WAFInvalidParameterException. May throw WAFNonexistentItemException. May throw WAFOptimisticLockException.

Parameter aPIKey : The encrypted API key that you want to delete.

Parameter scope : Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use CLOUDFRONT.

To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:

  • CLI - Specify the Region when you use the CloudFront scope: --scope=CLOUDFRONT --region=us-east-1.
  • API and SDKs - For all calls, use the Region endpoint us-east-1.

Implementation

Future<void> deleteAPIKey({
  required String aPIKey,
  required Scope scope,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSWAF_20190729.DeleteAPIKey'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'APIKey': aPIKey,
      'Scope': scope.value,
    },
  );
}