createEntity method

Future<CreateEntityResponse> createEntity({
  1. required String entityName,
  2. required String workspaceId,
  3. Map<String, ComponentRequest>? components,
  4. Map<String, CompositeComponentRequest>? compositeComponents,
  5. String? description,
  6. String? entityId,
  7. String? parentEntityId,
  8. Map<String, String>? tags,
})

Creates an entity.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter entityName : The name of the entity.

Parameter workspaceId : The ID of the workspace that contains the entity.

Parameter components : An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.

Parameter compositeComponents : This is an object that maps strings to compositeComponent updates in the request. Each key of the map represents the componentPath of the compositeComponent.

Parameter description : The description of the entity.

Parameter entityId : The ID of the entity.

Parameter parentEntityId : The ID of the entity's parent entity.

Parameter tags : Metadata that you can use to manage the entity.

Implementation

Future<CreateEntityResponse> createEntity({
  required String entityName,
  required String workspaceId,
  Map<String, ComponentRequest>? components,
  Map<String, CompositeComponentRequest>? compositeComponents,
  String? description,
  String? entityId,
  String? parentEntityId,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'entityName': entityName,
    if (components != null) 'components': components,
    if (compositeComponents != null)
      'compositeComponents': compositeComponents,
    if (description != null) 'description': description,
    if (entityId != null) 'entityId': entityId,
    if (parentEntityId != null) 'parentEntityId': parentEntityId,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/workspaces/${Uri.encodeComponent(workspaceId)}/entities',
    exceptionFnMap: _exceptionFns,
  );
  return CreateEntityResponse.fromJson(response);
}