attachObject method

Future<AttachObjectResponse> attachObject({
  1. required ObjectReference childReference,
  2. required String directoryArn,
  3. required String linkName,
  4. required ObjectReference parentReference,
})

Attaches an existing object to another object. An object can be accessed in two ways:

  1. Using the path
  2. Using ObjectIdentifier

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 LinkNameAlreadyInUseException. May throw InvalidAttachmentException. May throw ValidationException. May throw FacetValidationException.

Parameter childReference : The child object reference to be attached to the object.

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

Parameter linkName : The link name with which the child object is attached to the parent.

Parameter parentReference : The parent object reference.

Implementation

Future<AttachObjectResponse> attachObject({
  required ObjectReference childReference,
  required String directoryArn,
  required String linkName,
  required ObjectReference parentReference,
}) async {
  ArgumentError.checkNotNull(childReference, 'childReference');
  ArgumentError.checkNotNull(directoryArn, 'directoryArn');
  ArgumentError.checkNotNull(linkName, 'linkName');
  _s.validateStringLength(
    'linkName',
    linkName,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(parentReference, 'parentReference');
  final headers = <String, String>{
    'x-amz-data-partition': directoryArn.toString(),
  };
  final $payload = <String, dynamic>{
    'ChildReference': childReference,
    'LinkName': linkName,
    'ParentReference': parentReference,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/amazonclouddirectory/2017-01-11/object/attach',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return AttachObjectResponse.fromJson(response);
}