createFacet method

Future<void> createFacet({
  1. required String name,
  2. required ObjectType objectType,
  3. required String schemaArn,
  4. List<FacetAttribute>? attributes,
})

Creates a new Facet in a schema. Facet creation is allowed only in development or applied schemas.

May throw InternalServiceException. May throw InvalidArnException. May throw RetryableConflictException. May throw ValidationException. May throw LimitExceededException. May throw AccessDeniedException. May throw ResourceNotFoundException. May throw FacetAlreadyExistsException. May throw InvalidRuleException. May throw FacetValidationException.

Parameter name : The name of the Facet, which is unique for a given schema.

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.

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.

Implementation

Future<void> createFacet({
  required String name,
  required ObjectType objectType,
  required String schemaArn,
  List<FacetAttribute>? attributes,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(objectType, 'objectType');
  ArgumentError.checkNotNull(schemaArn, 'schemaArn');
  final headers = <String, String>{
    'x-amz-data-partition': schemaArn.toString(),
  };
  final $payload = <String, dynamic>{
    'Name': name,
    'ObjectType': objectType.toValue(),
    if (attributes != null) 'Attributes': attributes,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/amazonclouddirectory/2017-01-11/facet/create',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}