Skip to content

upload_entity_definitions async

upload_entity_definitions(
    *,
    config_overrides: Optional[AsyncIoTThingsGraphClientConfig] = None,
    document: Optional[DefinitionDocument] = None,
    sync_with_public_namespace: Optional[SyncWithPublicNamespace] = None,
    deprecate_existing_entities: Optional[DeprecateExistingEntities] = None,
) -> UploadEntityDefinitionsResponse

Asynchronously uploads one or more entity definitions to the user's namespace. The document parameter is required if syncWithPublicNamespace and deleteExistingEntites are false. If the syncWithPublicNamespace parameter is set to true, the user's namespace will synchronize with the latest version of the public namespace. If deprecateExistingEntities is set to true, all entities in the latest version will be deleted before the new DefinitionDocument is uploaded.

When a user uploads entity definitions for the first time, the service creates a new namespace for the user. The new namespace tracks the public namespace. Currently users can have only one namespace. The namespace version increments whenever a user uploads entity definitions that are backwards-incompatible and whenever a user sets the syncWithPublicNamespace parameter or the deprecateExistingEntities parameter to true.

The IDs for all of the entities should be in URN format. Each entity must be in the user's namespace. Users can't create entities in the public namespace, but entity definitions can refer to entities in the public namespace.

Valid entities are Device, DeviceModel, Service, Capability, State, Action, Event, Property, Mapping, Enum.

Parameters:

  • document (Optional[DefinitionDocument], default: None ) –

    The DefinitionDocument that defines the updated entities.

  • sync_with_public_namespace (Optional[SyncWithPublicNamespace], default: None ) –

    A Boolean that specifies whether to synchronize with the latest version of the public namespace. If set to true, the upload will create a new namespace version.

  • deprecate_existing_entities (Optional[DeprecateExistingEntities], default: None ) –

    A Boolean that specifies whether to deprecate all entities in the latest version before uploading the new DefinitionDocument. If set to true, the upload will create a new namespace version.

Raises:

Source code in docs_src/capo_iotthingsgraph/_services/async_io_t_things_graph.py
async def upload_entity_definitions(
    self,
    *,
    config_overrides: Optional[AsyncIoTThingsGraphClientConfig] = None,
    document: Optional[
        "capo_iotthingsgraph.types.definition_document.DefinitionDocument"
    ] = None,
    sync_with_public_namespace: Optional[
        "capo_iotthingsgraph.types.sync_with_public_namespace.SyncWithPublicNamespace"
    ] = None,
    deprecate_existing_entities: Optional[
        "capo_iotthingsgraph.types.deprecate_existing_entities.DeprecateExistingEntities"
    ] = None,
) -> "capo_iotthingsgraph.types.upload_entity_definitions_response.UploadEntityDefinitionsResponse":
    """<p>Asynchronously uploads one or more entity definitions to the user's namespace. The <code>document</code> parameter is required if <code>syncWithPublicNamespace</code> and <code>deleteExistingEntites</code> are false. If the <code>syncWithPublicNamespace</code> parameter is set to <code>true</code>, the user's namespace will synchronize with the latest version of the public namespace. If <code>deprecateExistingEntities</code> is set to true, all entities in the latest version will be deleted before the new <code>DefinitionDocument</code> is uploaded.</p> <p>When a user uploads entity definitions for the first time, the service creates a new namespace for the user. The new namespace tracks the public namespace. Currently users can have only one namespace. The namespace version increments whenever a user uploads entity definitions that are backwards-incompatible and whenever a user sets the <code>syncWithPublicNamespace</code> parameter or the <code>deprecateExistingEntities</code> parameter to <code>true</code>.</p> <p>The IDs for all of the entities should be in URN format. Each entity must be in the user's namespace. Users can't create entities in the public namespace, but entity definitions can refer to entities in the public namespace.</p> <p>Valid entities are <code>Device</code>, <code>DeviceModel</code>, <code>Service</code>, <code>Capability</code>, <code>State</code>, <code>Action</code>, <code>Event</code>, <code>Property</code>, <code>Mapping</code>, <code>Enum</code>. </p>

    Args:
        document: <p>The <code>DefinitionDocument</code> that defines the updated entities.</p>
        sync_with_public_namespace: <p>A Boolean that specifies whether to synchronize with the latest version of the public namespace. If set to <code>true</code>, the upload will create a new namespace version.</p>
        deprecate_existing_entities: <p>A Boolean that specifies whether to deprecate all entities in the latest version before uploading the new <code>DefinitionDocument</code>. If set to <code>true</code>, the upload will create a new namespace version.</p>

    Raises:
        capo_iotthingsgraph.errors.internal_failure_exception.InternalFailureException: <p></p>
        capo_iotthingsgraph.errors.invalid_request_exception.InvalidRequestException: <p></p>
        capo_iotthingsgraph.errors.throttling_exception.ThrottlingException: <p></p>
        capo_iotthingsgraph.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iotthingsgraph.types.upload_entity_definitions_request.UploadEntityDefinitionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_iotthingsgraph.types.upload_entity_definitions_response.UploadEntityDefinitionsResponse"
    ]:
        import capo_iotthingsgraph._operations.iot_things_graph_front_end_service.upload_entity_definitions

        (
            output,
            http_response,
        ) = await capo_iotthingsgraph._operations.iot_things_graph_front_end_service.upload_entity_definitions.async_upload_entity_definitions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UploadEntityDefinitions")
    )
    input_: capo_iotthingsgraph.types.upload_entity_definitions_request.UploadEntityDefinitionsRequest = {}
    if document is not None:
        input_["document"] = document
    if sync_with_public_namespace is not None:
        input_["sync_with_public_namespace"] = sync_with_public_namespace
    if deprecate_existing_entities is not None:
        input_["deprecate_existing_entities"] = deprecate_existing_entities

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