azure.digitaltwins.core.aio package¶
-
class
azure.digitaltwins.core.aio.
DigitalTwinsClient
(endpoint: str, credential: AsyncTokenCredential, **kwargs)[source]¶ Creates an instance of the Digital Twins client.
- Parameters
endpoint (str) – The URL endpoint of an Azure search service
credential (AsyncTokenCredential) – A credential to authenticate requests to the service.
-
async
create_models
(dtdl_models: List[object], **kwargs) → List[azure.digitaltwins.core._generated.models._models_py3.DigitalTwinsModelData][source]¶ Create one or more models. When any error occurs, no models are uploaded.
- Parameters
model_list (List[object]) – The set of models to create. Each dict corresponds to exactly one model.
- Returns
The list of created models
- Return type
List[DigitalTwinsModelData]
- Raises
ResourceExistsError – One or more of the provided models already exist.
-
async
decommission_model
(model_id: str, **kwargs) → None[source]¶ Decommissions a model.
- Parameters
model_id (str) – The ID for the model. The ID is globally unique and case sensitive.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – There is no model with the provided ID.
-
async
delete_digital_twin
(digital_twin_id: str, **kwargs) → None[source]¶ Delete a digital twin.
- Parameters
digital_twin_id (str) – The ID of the digital twin.
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID.
-
async
delete_event_route
(event_route_id: str, **kwargs) → None[source]¶ Delete an event route.
- Parameters
event_route_id (str) – The ID of the event route to delete.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – There is no event route with the provided ID.
-
async
delete_model
(model_id: str, **kwargs) → None[source]¶ Delete a model.
- Parameters
model_id (str) – The ID of the model to delete.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – There is no model with the provided ID.
ResourceExistsError – There are dependencies on the model that prevent it from being deleted.
-
async
delete_relationship
(digital_twin_id: str, relationship_id: str, **kwargs) → None[source]¶ Delete a relationship on a digital twin.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin or relationship with the provided ID.
-
async
get_component
(digital_twin_id: str, component_name: str, **kwargs) → Dict[str, object][source]¶ Get a component on a digital twin.
- Parameters
- Returns
Dictionary containing the component.
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin with the provided ID or the component name is invalid.
-
async
get_digital_twin
(digital_twin_id: str, **kwargs) → Dict[str, object][source]¶ Get a digital twin.
- Parameters
digital_twin_id (str) – The ID of the digital twin.
- Returns
Dictionary containing the twin.
- Return type
- Raises
ResourceNotFoundError – If the digital twin doesn’t exist.
-
async
get_event_route
(event_route_id: str, **kwargs) → DigitalTwinsEventRoute[source]¶ Get an event route.
- Parameters
event_route_id (str) – The ID of the event route.
- Returns
The event route object.
- Return type
- Raises
ResourceNotFoundError – There is no event route with the provided ID.
-
async
get_model
(model_id: str, **kwargs) → azure.digitaltwins.core._generated.models._models_py3.DigitalTwinsModelData[source]¶ Get a model, including the model metadata and the model definition.
- Parameters
model_id (str) – The ID of the model.
- Keyword Arguments
include_model_definition (bool) – Include the model definition as part of the result. The default value is False.
- Returns
The model data.
- Return type
- Raises
ResourceNotFoundError – If there is no model with the provided ID.
-
async
get_relationship
(digital_twin_id: str, relationship_id: str, **kwargs) → Dict[str, object][source]¶ Get a relationship on a digital twin.
- Parameters
- Returns
Dictionary containing the relationship.
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin or relationship with the provided ID.
-
list_event_routes
(**kwargs) → azure.core.async_paging.AsyncItemPaged[DigitalTwinsEventRoute][source]¶ Retrieves all event routes.
- Keyword Arguments
results_per_page (int) – The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
- Returns
An iterator instance of event routes.
- Return type
- Raises
-
list_incoming_relationships
(digital_twin_id: str, **kwargs) → azure.core.async_paging.AsyncItemPaged[IncomingRelationship][source]¶ Retrieve all incoming relationships for a digital twin.
- Parameters
digital_twin_id (str) – The ID of the digital twin.
- Returns
An iterator instance of list of incoming relationships.
- Return type
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID.
-
list_models
(dependencies_for: Optional[List[str]] = None, **kwargs) → azure.core.async_paging.AsyncItemPaged[azure.digitaltwins.core._generated.models._models_py3.DigitalTwinsModelData][source]¶ Get the list of models.
- Parameters
dependencies_for (List[str]) – The model IDs to have dependencies retrieved. If omitted, all models are retrieved.
- Keyword Arguments
- Returns
An iterator instance of list of model data.
- Return type
AsyncItemPaged[DigitalTwinsModelData]
- Raises
-
list_relationships
(digital_twin_id: str, relationship_id: Optional[str] = None, **kwargs) → azure.core.async_paging.AsyncItemPaged[Dict[str, object]][source]¶ Retrieve relationships for a digital twin.
- Parameters
- Returns
An iterator instance of list of relationships.
- Return type
AsyncItemPaged[Dict[str,object]]
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID.
-
async
publish_component_telemetry
(digital_twin_id: str, component_name: str, telemetry: object, **kwargs) → None[source]¶ Publish telemetry from a digital twin’s component, which is then consumed by one or many destination endpoints (subscribers) defined under.
- Parameters
- Keyword Arguments
message_id (str) – The message ID. If not specified, a UUID will be generated.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID or the component name is invalid.
-
async
publish_telemetry
(digital_twin_id: str, telemetry: object, **kwargs) → None[source]¶ Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
- Parameters
- Keyword Arguments
message_id (str) – The message ID. If not specified, a UUID will be generated.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID.
-
query_twins
(query_expression: str, **kwargs) → azure.core.async_paging.AsyncItemPaged[Dict[str, object]][source]¶ Query for digital twins.
Note: that there may be a delay between before changes in your instance are reflected in queries. For more details on query limitations, see https://docs.microsoft.com/azure/digital-twins/how-to-query-graph#query-limitations
- Parameters
query_expression (str) – The query expression to execute.
- Returns
An iterable of query results.
- Return type
AsyncItemPaged[Dict[str, object]]
- Raises
-
async
update_component
(digital_twin_id: str, component_name: str, json_patch: List[Dict[str, object]], **kwargs) → None[source]¶ Update properties of a component on a digital twin using a JSON patch.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin with the provided ID or the component name is invalid.
-
async
update_digital_twin
(digital_twin_id: str, json_patch: List[Dict[str, object]], **kwargs) → None[source]¶ Update a digital twin using a JSON patch.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is no digital twin with the provided ID.
-
async
update_relationship
(digital_twin_id: str, relationship_id: str, json_patch: List[Dict[str, object]], **kwargs) → None[source]¶ Updates the properties of a relationship on a digital twin using a JSON patch.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
None
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin or relationship with the provided ID.
-
async
upsert_digital_twin
(digital_twin_id: str, digital_twin: Dict[str, object], **kwargs) → Dict[str, object][source]¶ Create or update a digital twin.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
Dictionary containing the created or updated twin.
- Return type
- Raises
ResourceExistsError – If the digital twin already exists.
-
async
upsert_event_route
(event_route_id: str, event_route: DigitalTwinsEventRoute, **kwargs) → None[source]¶ Create or update an event route.
- Parameters
event_route_id (str) – The ID of the event route to create or update.
event_route (DigitalTwinsEventRoute) – The event route data.
- Returns
None
- Return type
- Raises
-
async
upsert_relationship
(digital_twin_id: str, relationship_id: str, relationship: Dict[str, object], **kwargs) → Dict[str, object][source]¶ Create or update a relationship on a digital twin.
- Parameters
- Keyword Arguments
match_condition (MatchConditions) – The condition under which to perform the operation.
etag (str) – Only perform the operation if the entity’s etag matches the value provided according to the match_condition.
- Returns
The created or updated relationship.
- Return type
- Raises
ResourceNotFoundError – If there is either no digital twin, target digital twin or relationship with the provided ID.