Skip to content

create_entity async

create_entity(
    workspace_id: Id,
    entity_name: EntityName,
    *,
    config_overrides: Optional[AsyncIoTTwinMakerClientConfig] = None,
    entity_id: Optional[EntityId] = None,
    description: Optional[Description] = None,
    components: Optional[ComponentsMapRequest] = None,
    composite_components: Optional[CompositeComponentsMapRequest] = None,
    parent_entity_id: Optional[ParentEntityId] = None,
    tags: Optional[TagMap] = None,
) -> CreateEntityResponse

Creates an entity.

Parameters:

  • workspace_id (Id) –

    The ID of the workspace that contains the entity.

  • entity_id (Optional[EntityId], default: None ) –

    The ID of the entity.

  • entity_name (EntityName) –

    The name of the entity.

  • description (Optional[Description], default: None ) –

    The description of the entity.

  • components (Optional[ComponentsMapRequest], default: None ) –

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

  • composite_components (Optional[CompositeComponentsMapRequest], default: None ) –

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

  • parent_entity_id (Optional[ParentEntityId], default: None ) –

    The ID of the entity's parent entity.

  • tags (Optional[TagMap], default: None ) –

    Metadata that you can use to manage the entity.

Raises:

Source code in docs_src/capo_iottwinmaker/_services/async_io_t_twin_maker.py
async def create_entity(
    self,
    workspace_id: "capo_iottwinmaker.types.id.Id",
    entity_name: "capo_iottwinmaker.types.entity_name.EntityName",
    *,
    config_overrides: Optional[AsyncIoTTwinMakerClientConfig] = None,
    entity_id: Optional["capo_iottwinmaker.types.entity_id.EntityId"] = None,
    description: Optional["capo_iottwinmaker.types.description.Description"] = None,
    components: Optional[
        "capo_iottwinmaker.types.components_map_request.ComponentsMapRequest"
    ] = None,
    composite_components: Optional[
        "capo_iottwinmaker.types.composite_components_map_request.CompositeComponentsMapRequest"
    ] = None,
    parent_entity_id: Optional[
        "capo_iottwinmaker.types.parent_entity_id.ParentEntityId"
    ] = None,
    tags: Optional["capo_iottwinmaker.types.tag_map.TagMap"] = None,
) -> "capo_iottwinmaker.types.create_entity_response.CreateEntityResponse":
    """<p>Creates an entity.</p>

    Args:
        workspace_id: <p>The ID of the workspace that contains the entity.</p>
        entity_id: <p>The ID of the entity.</p>
        entity_name: <p>The name of the entity.</p>
        description: <p>The description of the entity.</p>
        components: <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
        composite_components: <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
        parent_entity_id: <p>The ID of the entity's parent entity.</p>
        tags: <p>Metadata that you can use to manage the entity.</p>

    Raises:
        capo_iottwinmaker.errors.access_denied_exception.AccessDeniedException: <p>Access is denied.</p>
        capo_iottwinmaker.errors.conflict_exception.ConflictException: <p>A conflict occurred.</p>
        capo_iottwinmaker.errors.internal_server_exception.InternalServerException: <p>An unexpected error has occurred.</p>
        capo_iottwinmaker.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota was exceeded.</p>
        capo_iottwinmaker.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iottwinmaker.errors.validation_exception.ValidationException: <p>Failed</p>
        capo_iottwinmaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iottwinmaker.types.create_entity_request.CreateEntityRequest]",
    ) -> AsyncOperationResponse[
        "capo_iottwinmaker.types.create_entity_response.CreateEntityResponse"
    ]:
        import capo_iottwinmaker._operations.aws_io_t_twin_maker.create_entity

        (
            output,
            http_response,
        ) = await capo_iottwinmaker._operations.aws_io_t_twin_maker.create_entity.async_create_entity(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEntity")
    )
    input_: capo_iottwinmaker.types.create_entity_request.CreateEntityRequest = {
        "workspace_id": workspace_id,
        "entity_name": entity_name,
    }
    if entity_id is not None:
        input_["entity_id"] = entity_id
    if description is not None:
        input_["description"] = description
    if components is not None:
        input_["components"] = components
    if composite_components is not None:
        input_["composite_components"] = composite_components
    if parent_entity_id is not None:
        input_["parent_entity_id"] = parent_entity_id
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output