attachPolicy method

Future<void> attachPolicy({
  1. required String directoryArn,
  2. required ObjectReference objectReference,
  3. required ObjectReference policyReference,
})

Attaches a policy object to a regular object. An object can have a limited number of attached policies.

May throw InternalServiceException. May throw InvalidArnException. May throw RetryableConflictException. May throw ValidationException. May throw LimitExceededException. May throw AccessDeniedException. May throw DirectoryNotEnabledException. May throw ResourceNotFoundException. May throw NotPolicyException.

Parameter directoryArn : The Amazon Resource Name (ARN) that is associated with the Directory where both objects reside. For more information, see arns.

Parameter objectReference : The reference that identifies the object to which the policy will be attached.

Parameter policyReference : The reference that is associated with the policy object.

Implementation

Future<void> attachPolicy({
  required String directoryArn,
  required ObjectReference objectReference,
  required ObjectReference policyReference,
}) async {
  ArgumentError.checkNotNull(directoryArn, 'directoryArn');
  ArgumentError.checkNotNull(objectReference, 'objectReference');
  ArgumentError.checkNotNull(policyReference, 'policyReference');
  final headers = <String, String>{
    'x-amz-data-partition': directoryArn.toString(),
  };
  final $payload = <String, dynamic>{
    'ObjectReference': objectReference,
    'PolicyReference': policyReference,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/amazonclouddirectory/2017-01-11/policy/attach',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}