def test_decommission_model(self, update): fake_endpoint = 'endpoint' fake_credential = 'credential' fake_model_id = 'model_id' json_patch = "{ 'op': 'replace', 'path': '/decommissioned', 'value': true }" digital_twin_models_client = DigitalTwinsClient(fake_endpoint, fake_credential) digital_twin_models_client.decommission_model(fake_model_id) update.assert_called_with( fake_model_id, json_patch )
# Get event route created_event_route = service_client.get_event_route(event_route_id) print('Created Event Route:') print(created_event_route) # Clean up service_client.delete_event_route(event_route_id) for relationship in dtdl_relationships: service_client.delete_relationship(relationship["$sourceId"], relationship["$relationshipId"]) service_client.delete_digital_twin(building_twin_id) service_client.delete_digital_twin(floor_twin_id) service_client.delete_digital_twin(hvac_twin_id) service_client.delete_digital_twin(room_twin_id) service_client.decommission_model(building_twin_id) service_client.decommission_model(floor_twin_id) service_client.decommission_model(hvac_twin_id) service_client.decommission_model(room_twin_id) service_client.delete_model(building_twin_id) service_client.delete_model(floor_twin_id) service_client.delete_model(hvac_twin_id) service_client.delete_model(room_twin_id) except HttpResponseError as e: print("\nThis sample has caught an error. {0}".format(e.message))
# Create digital twin created_twin = service_client.upsert_digital_twin(digital_twin_id, temporary_twin) print('Created Digital Twin:') print(created_twin) # Update component component_path = "Component1" options = { "patchDocument": { "ComponentProp1": "value2" } } service_client.update_component(digital_twin_id, component_path, options) # Get component get_component = service_client.get_component(digital_twin_id, component_path) print('Get Component:') print(get_component) # Delete digital twin service_client.delete_digital_twin(digital_twin_id) # Decomission model service_client.decommission_model(model_id) # Delete model service_client.delete_model(model_id) except HttpResponseError as e: print("\nThis sample has caught an error. {0}".format(e.message))
created_event_route = service_client.get_event_route(event_route_id) print('Created Event Route:') print(created_event_route) # Clean up service_client.delete_event_route(event_route_id) for relationship in hospital_relationships: service_client.delete_relationship(relationship["$sourceId"], relationship["$relationshipId"]) service_client.delete_digital_twin(building_twin_id) service_client.delete_digital_twin(floor_twin_id) service_client.delete_digital_twin(hvac_twin_id) service_client.delete_digital_twin(room_twin_id) service_client.decommission_model(building_model_id) service_client.decommission_model(floor_model_id) service_client.decommission_model(hvac_model_id) service_client.decommission_model(room_model_id) service_client.decommission_model(wifi_model_id) service_client.delete_model(building_model_id) service_client.delete_model(floor_model_id) service_client.delete_model(hvac_model_id) service_client.delete_model(room_model_id) service_client.delete_model(wifi_model_id) except HttpResponseError as e: print("\nThis sample has caught an error. {0}".format(e.message))