deletePolicy method

Future<void> deletePolicy({
  1. required String policyId,
  2. required String policyStoreId,
})

Deletes the specified policy from the policy store.

This operation is idempotent; if you specify a policy that doesn't exist, the request response returns a successful HTTP 200 status code.

May throw ConflictException. May throw ResourceNotFoundException.

Parameter policyId : Specifies the ID of the policy that you want to delete.

You can use the policy name in place of the policy ID. When using a name, prefix it with name/. For example:

  • ID: SPEXAMPLEabcdefg111111
  • Name: name/example-policy

Parameter policyStoreId : Specifies the ID of the policy store that contains the policy that you want to delete.

To specify a policy store, use its ID or alias name. When using an alias name, prefix it with policy-store-alias/. For example:

  • ID: PSEXAMPLEabcdefg111111
  • Alias name: policy-store-alias/example-policy-store
To view aliases, use ListPolicyStoreAliases.

Implementation

Future<void> deletePolicy({
  required String policyId,
  required String policyStoreId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VerifiedPermissions.DeletePolicy'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'policyId': policyId,
      'policyStoreId': policyStoreId,
    },
  );
}