describeEffectivePolicy method
- required EffectivePolicyType policyType,
- String? targetId,
Returns the contents of the effective policy for specified policy type and account. The effective policy is the aggregation of any policies of the specified type that the account inherits, plus any policy of that type that is directly attached to the account.
This operation applies only to management policies. It does not apply to authorization policies: service control policies (SCPs) and resource control policies (RCPs).
For more information about policy inheritance, see Understanding management policy inheritance in the Organizations User Guide.
You can call this operation from any account in a organization.
May throw AccessDeniedException.
May throw AWSOrganizationsNotInUseException.
May throw ConstraintViolationException.
May throw EffectivePolicyNotFoundException.
May throw InvalidInputException.
May throw ServiceException.
May throw TargetNotFoundException.
May throw TooManyRequestsException.
May throw UnsupportedAPIEndpointException.
Parameter policyType :
The type of policy that you want information about. You can specify one of
the following values:
- DECLARATIVE_POLICY_EC2
- BACKUP_POLICY
- TAG_POLICY
- CHATBOT_POLICY
- AISERVICES_OPT_OUT_POLICY
- SECURITYHUB_POLICY
- UPGRADE_ROLLOUT_POLICY
- INSPECTOR_POLICY
- BEDROCK_POLICY
- S3_POLICY
- NETWORK_SECURITY_DIRECTOR_POLICY
Parameter targetId :
When you're signed in as the management account, specify the ID of the
account that you want details about. Specifying an organization root or
organizational unit (OU) as the target is not supported.
Implementation
Future<DescribeEffectivePolicyResponse> describeEffectivePolicy({
required EffectivePolicyType policyType,
String? targetId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSOrganizationsV20161128.DescribeEffectivePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'PolicyType': policyType.value,
if (targetId != null) 'TargetId': targetId,
},
);
return DescribeEffectivePolicyResponse.fromJson(jsonResponse.body);
}