lookupPolicy method
Lists all policies from the root of the Directory to the object
specified. If there are no policies present, an empty list is returned. If
policies are present, and if some objects don't have the policies
attached, it returns the ObjectIdentifier for such objects.
If policies are present, it returns ObjectIdentifier,
policyId, and policyType. Paths that don't lead
to the root from the target object are ignored. For more information, see
Policies.
May throw AccessDeniedException.
May throw DirectoryNotEnabledException.
May throw InternalServiceException.
May throw InvalidArnException.
May throw InvalidNextTokenException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw RetryableConflictException.
May throw ValidationException.
Parameter directoryArn :
The Amazon Resource Name (ARN) that is associated with the
Directory. For more information, see arns.
Parameter objectReference :
Reference that identifies the object whose policies will be looked up.
Parameter maxResults :
The maximum number of items to be retrieved in a single call. This is an
approximate number.
Parameter nextToken :
The token to request the next page of results.
Implementation
Future<LookupPolicyResponse> lookupPolicy({
required String directoryArn,
required ObjectReference objectReference,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1152921504606846976,
);
final headers = <String, String>{
'x-amz-data-partition': directoryArn.toString(),
};
final $payload = <String, dynamic>{
'ObjectReference': objectReference,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/amazonclouddirectory/2017-01-11/policy/lookup',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return LookupPolicyResponse.fromJson(response);
}