createFacet method
Creates a new Facet in a schema. Facet creation is allowed only in development or applied schemas.
May throw AccessDeniedException.
May throw FacetAlreadyExistsException.
May throw FacetValidationException.
May throw InternalServiceException.
May throw InvalidArnException.
May throw InvalidRuleException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw RetryableConflictException.
May throw ValidationException.
Parameter name :
The name of the Facet, which is unique for a given schema.
Parameter schemaArn :
The schema ARN in which the new Facet will be created. For more
information, see arns.
Parameter attributes :
The attributes that are associated with the Facet.
Parameter facetStyle :
There are two different styles that you can define on any given facet,
Static and Dynamic. For static facets, all
attributes must be defined in the schema. For dynamic facets, attributes
can be defined during data plane operations.
Parameter objectType :
Specifies whether a given object created from this facet is of type node,
leaf node, policy or index.
- Node: Can have multiple children but one parent.
- Leaf node: Cannot have children but can have multiple parents.
- Policy: Allows you to store a policy document and policy type. For more information, see Policies.
- Index: Can be created with the Index API.
Implementation
Future<void> createFacet({
required String name,
required String schemaArn,
List<FacetAttribute>? attributes,
FacetStyle? facetStyle,
ObjectType? objectType,
}) async {
final headers = <String, String>{
'x-amz-data-partition': schemaArn.toString(),
};
final $payload = <String, dynamic>{
'Name': name,
if (attributes != null) 'Attributes': attributes,
if (facetStyle != null) 'FacetStyle': facetStyle.value,
if (objectType != null) 'ObjectType': objectType.value,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/amazonclouddirectory/2017-01-11/facet/create',
headers: headers,
exceptionFnMap: _exceptionFns,
);
}