lookupPolicy method

Future<LookupPolicyResponse> lookupPolicy({
  1. required String directoryArn,
  2. required ObjectReference objectReference,
  3. int? maxResults,
  4. String? nextToken,
})

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 InternalServiceException. May throw InvalidArnException. May throw RetryableConflictException. May throw ValidationException. May throw LimitExceededException. May throw AccessDeniedException. May throw DirectoryNotEnabledException. May throw InvalidNextTokenException. May throw ResourceNotFoundException.

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 {
  ArgumentError.checkNotNull(directoryArn, 'directoryArn');
  ArgumentError.checkNotNull(objectReference, 'objectReference');
  _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);
}