deleteResourcePolicy method
Deletes the resource-based policy attached to the resource, which can be a table or stream.
DeleteResourcePolicy is an idempotent operation; running it
multiple times on the same resource doesn't result in an error
response, unless you specify an ExpectedRevisionId, which
will then return a PolicyNotFoundException.
May throw InternalServerError.
May throw InvalidEndpointException.
May throw LimitExceededException.
May throw PolicyNotFoundException.
May throw ResourceInUseException.
May throw ResourceNotFoundException.
Parameter resourceArn :
The Amazon Resource Name (ARN) of the DynamoDB resource from which the
policy will be removed. The resources you can specify include tables and
streams. If you remove the policy of a table, it will also remove the
permissions for the table's indexes defined in that policy document. This
is because index permissions are defined in the table's policy.
Parameter expectedRevisionId :
A string value that you can use to conditionally delete your policy. When
you provide an expected revision ID, if the revision ID of the existing
policy on the resource doesn't match or if there's no policy attached to
the resource, the request will fail and return a
PolicyNotFoundException.
Implementation
Future<DeleteResourcePolicyOutput> deleteResourcePolicy({
required String resourceArn,
String? expectedRevisionId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'DynamoDB_20120810.DeleteResourcePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ResourceArn': resourceArn,
if (expectedRevisionId != null)
'ExpectedRevisionId': expectedRevisionId,
},
);
return DeleteResourcePolicyOutput.fromJson(jsonResponse.body);
}