createObject method
Creates an object in a Directory. Additionally attaches the object
to a parent, if a parent reference and LinkName is specified.
An object is simply a collection of Facet attributes. You can also
use this API call to create a policy object, if the facet from which you
create the object is a policy facet.
May throw AccessDeniedException.
May throw DirectoryNotEnabledException.
May throw FacetValidationException.
May throw InternalServiceException.
May throw InvalidArnException.
May throw LimitExceededException.
May throw LinkNameAlreadyInUseException.
May throw ResourceNotFoundException.
May throw RetryableConflictException.
May throw UnsupportedIndexTypeException.
May throw ValidationException.
Parameter directoryArn :
The Amazon Resource Name (ARN) that is associated with the
Directory in which the object will be created. For more
information, see arns.
Parameter schemaFacets :
A list of schema facets to be associated with the object. Do not provide
minor version components. See SchemaFacet for details.
Parameter linkName :
The name of link that is used to attach this object to a parent.
Parameter objectAttributeList :
The attribute map whose attribute ARN contains the key and attribute value
as the map value.
Parameter parentReference :
If specified, the parent reference to which this object will be attached.
Implementation
Future<CreateObjectResponse> createObject({
required String directoryArn,
required List<SchemaFacet> schemaFacets,
String? linkName,
List<AttributeKeyAndValue>? objectAttributeList,
ObjectReference? parentReference,
}) async {
final headers = <String, String>{
'x-amz-data-partition': directoryArn.toString(),
};
final $payload = <String, dynamic>{
'SchemaFacets': schemaFacets,
if (linkName != null) 'LinkName': linkName,
if (objectAttributeList != null)
'ObjectAttributeList': objectAttributeList,
if (parentReference != null) 'ParentReference': parentReference,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/amazonclouddirectory/2017-01-11/object',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateObjectResponse.fromJson(response);
}