deletePolicy method
Deletes the specified policy from your organization. Before you perform this operation, you must first detach the policy from all organizational units (OUs), roots, and accounts.
You can only call this operation from the management account or a member account that is a delegated administrator.
May throw AccessDeniedException.
May throw AWSOrganizationsNotInUseException.
May throw ConcurrentModificationException.
May throw InvalidInputException.
May throw PolicyInUseException.
May throw PolicyNotFoundException.
May throw ServiceException.
May throw TooManyRequestsException.
May throw UnsupportedAPIEndpointException.
Parameter policyId :
ID for the policy that you want to delete. You can get the ID from the
ListPolicies or ListPoliciesForTarget operations.
The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lowercase or uppercase letters, digits, or the underscore character (_).
Implementation
Future<void> deletePolicy({
required String policyId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSOrganizationsV20161128.DeletePolicy'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'PolicyId': policyId,
},
);
}