viam-sdk 0.25.2__py3-none-linux_armv7l.whl → 0.62.0__py3-none-linux_armv7l.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- viam/app/_logs.py +3 -6
- viam/app/app_client.py +606 -262
- viam/app/billing_client.py +60 -18
- viam/app/data_client.py +1086 -315
- viam/app/ml_training_client.py +51 -48
- viam/app/provisioning_client.py +3 -5
- viam/app/viam_client.py +105 -11
- viam/components/arm/__init__.py +1 -25
- viam/components/arm/arm.py +21 -22
- viam/components/arm/client.py +27 -30
- viam/components/arm/service.py +3 -3
- viam/components/audio_in/__init__.py +24 -0
- viam/components/audio_in/audio_in.py +74 -0
- viam/components/audio_in/client.py +76 -0
- viam/components/audio_in/service.py +83 -0
- viam/components/audio_input/__init__.py +1 -1
- viam/components/audio_input/audio_input.py +4 -3
- viam/components/audio_input/client.py +19 -8
- viam/components/audio_input/service.py +10 -0
- viam/components/audio_out/__init__.py +21 -0
- viam/components/audio_out/audio_out.py +72 -0
- viam/components/audio_out/client.py +67 -0
- viam/components/audio_out/service.py +63 -0
- viam/components/base/__init__.py +2 -10
- viam/components/base/base.py +20 -20
- viam/components/base/client.py +27 -30
- viam/components/board/__init__.py +2 -25
- viam/components/board/board.py +39 -77
- viam/components/board/client.py +39 -73
- viam/components/button/__init__.py +10 -0
- viam/components/button/button.py +41 -0
- viam/components/button/client.py +52 -0
- viam/components/button/service.py +46 -0
- viam/components/camera/__init__.py +1 -1
- viam/components/camera/camera.py +31 -22
- viam/components/camera/client.py +30 -20
- viam/components/camera/service.py +14 -12
- viam/components/component_base.py +10 -7
- viam/components/encoder/__init__.py +1 -1
- viam/components/encoder/client.py +15 -16
- viam/components/encoder/encoder.py +9 -9
- viam/components/gantry/__init__.py +1 -13
- viam/components/gantry/client.py +41 -28
- viam/components/gantry/gantry.py +48 -17
- viam/components/gantry/service.py +21 -5
- viam/components/generic/__init__.py +1 -1
- viam/components/generic/client.py +11 -7
- viam/components/generic/generic.py +3 -3
- viam/components/gripper/__init__.py +3 -12
- viam/components/gripper/client.py +43 -20
- viam/components/gripper/gripper.py +87 -12
- viam/components/gripper/service.py +32 -3
- viam/components/input/__init__.py +1 -14
- viam/components/input/client.py +22 -23
- viam/components/input/input.py +18 -12
- viam/components/motor/__init__.py +1 -21
- viam/components/motor/client.py +36 -42
- viam/components/motor/motor.py +24 -24
- viam/components/movement_sensor/__init__.py +1 -1
- viam/components/movement_sensor/client.py +33 -40
- viam/components/movement_sensor/movement_sensor.py +12 -12
- viam/components/pose_tracker/__init__.py +1 -1
- viam/components/pose_tracker/client.py +9 -8
- viam/components/pose_tracker/pose_tracker.py +2 -2
- viam/components/power_sensor/__init__.py +1 -1
- viam/components/power_sensor/client.py +15 -18
- viam/components/power_sensor/power_sensor.py +12 -12
- viam/components/sensor/__init__.py +1 -1
- viam/components/sensor/client.py +9 -8
- viam/components/sensor/sensor.py +5 -5
- viam/components/servo/__init__.py +1 -13
- viam/components/servo/client.py +18 -18
- viam/components/servo/servo.py +12 -12
- viam/components/switch/__init__.py +10 -0
- viam/components/switch/client.py +83 -0
- viam/components/switch/service.py +72 -0
- viam/components/switch/switch.py +95 -0
- viam/gen/app/agent/v1/agent_pb2.py +40 -29
- viam/gen/app/agent/v1/agent_pb2.pyi +73 -11
- viam/gen/app/cloudslam/v1/cloud_slam_pb2.py +45 -42
- viam/gen/app/data/v1/data_grpc.py +98 -2
- viam/gen/app/data/v1/data_pb2.py +238 -119
- viam/gen/app/data/v1/data_pb2.pyi +804 -34
- viam/gen/app/datapipelines/v1/data_pipelines_grpc.py +84 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.py +57 -0
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +387 -0
- viam/gen/app/dataset/v1/dataset_grpc.py +10 -2
- viam/gen/app/dataset/v1/dataset_pb2.py +38 -31
- viam/gen/app/dataset/v1/dataset_pb2.pyi +36 -1
- viam/gen/app/datasync/v1/data_sync_grpc.py +1 -1
- viam/gen/app/datasync/v1/data_sync_pb2.py +61 -51
- viam/gen/app/datasync/v1/data_sync_pb2.pyi +52 -12
- viam/gen/app/mlinference/__init__.py +0 -0
- viam/gen/app/mlinference/v1/__init__.py +0 -0
- viam/gen/app/mlinference/v1/ml_inference_grpc.py +28 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.py +23 -0
- viam/gen/app/mlinference/v1/ml_inference_pb2.pyi +63 -0
- viam/gen/app/mltraining/v1/ml_training_grpc.py +18 -2
- viam/gen/app/mltraining/v1/ml_training_pb2.py +134 -101
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +193 -7
- viam/gen/app/packages/v1/packages_pb2.py +43 -40
- viam/gen/app/v1/app_grpc.py +290 -2
- viam/gen/app/v1/app_pb2.py +670 -453
- viam/gen/app/v1/app_pb2.pyi +3133 -947
- viam/gen/app/v1/billing_grpc.py +34 -2
- viam/gen/app/v1/billing_pb2.py +94 -35
- viam/gen/app/v1/billing_pb2.pyi +314 -61
- viam/gen/app/v1/end_user_pb2.py +50 -29
- viam/gen/app/v1/robot_pb2.py +120 -111
- viam/gen/app/v1/robot_pb2.pyi +137 -15
- viam/gen/common/v1/common_pb2.py +86 -66
- viam/gen/common/v1/common_pb2.pyi +184 -8
- viam/gen/component/arm/v1/arm_grpc.py +18 -2
- viam/gen/component/arm/v1/arm_pb2.py +68 -55
- viam/gen/component/arm/v1/arm_pb2.pyi +73 -3
- viam/gen/component/audioin/__init__.py +0 -0
- viam/gen/component/audioin/v1/__init__.py +0 -0
- viam/gen/component/audioin/v1/audioin_grpc.py +54 -0
- viam/gen/component/audioin/v1/audioin_pb2.py +34 -0
- viam/gen/component/audioin/v1/audioin_pb2.pyi +94 -0
- viam/gen/component/audioinput/v1/audioinput_pb2.py +35 -32
- viam/gen/component/audioout/__init__.py +0 -0
- viam/gen/component/audioout/v1/__init__.py +0 -0
- viam/gen/component/audioout/v1/audioout_grpc.py +54 -0
- viam/gen/component/audioout/v1/audioout_pb2.py +32 -0
- viam/gen/component/audioout/v1/audioout_pb2.pyi +47 -0
- viam/gen/component/base/v1/base_pb2.py +57 -54
- viam/gen/component/board/v1/board_pb2.py +93 -90
- viam/gen/component/button/__init__.py +0 -0
- viam/gen/component/button/v1/__init__.py +0 -0
- viam/gen/component/button/v1/button_grpc.py +38 -0
- viam/gen/component/button/v1/button_pb2.py +28 -0
- viam/gen/component/button/v1/button_pb2.pyi +39 -0
- viam/gen/component/camera/v1/camera_pb2.py +58 -55
- viam/gen/component/camera/v1/camera_pb2.pyi +31 -7
- viam/gen/component/encoder/v1/encoder_pb2.py +35 -32
- viam/gen/component/gantry/v1/gantry_grpc.py +9 -1
- viam/gen/component/gantry/v1/gantry_pb2.py +56 -51
- viam/gen/component/generic/v1/generic_pb2.py +15 -12
- viam/gen/component/gripper/v1/gripper_grpc.py +18 -2
- viam/gen/component/gripper/v1/gripper_pb2.py +48 -37
- viam/gen/component/gripper/v1/gripper_pb2.pyi +43 -1
- viam/gen/component/inputcontroller/v1/input_controller_pb2.py +45 -42
- viam/gen/component/motor/v1/motor_pb2.py +77 -74
- viam/gen/component/movementsensor/v1/movementsensor_pb2.py +69 -66
- viam/gen/component/posetracker/v1/pose_tracker_pb2.py +25 -22
- viam/gen/component/powersensor/v1/powersensor_pb2.py +33 -30
- viam/gen/component/sensor/v1/sensor_pb2.py +17 -14
- viam/gen/component/servo/v1/servo_pb2.py +41 -38
- viam/gen/component/switch/__init__.py +0 -0
- viam/gen/component/switch/v1/__init__.py +0 -0
- viam/gen/component/switch/v1/switch_grpc.py +54 -0
- viam/gen/component/switch/v1/switch_pb2.py +40 -0
- viam/gen/component/switch/v1/switch_pb2.pyi +116 -0
- viam/gen/component/testecho/v1/testecho_pb2.py +29 -26
- viam/gen/module/v1/module_pb2.py +36 -33
- viam/gen/module/v1/module_pb2.pyi +7 -2
- viam/gen/proto/rpc/examples/echo/v1/echo_pb2.py +26 -23
- viam/gen/proto/rpc/examples/echoresource/v1/echoresource_pb2.py +23 -20
- viam/gen/proto/rpc/v1/auth_pb2.py +27 -24
- viam/gen/proto/rpc/webrtc/v1/grpc_pb2.py +35 -32
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.py +62 -57
- viam/gen/proto/rpc/webrtc/v1/signaling_pb2.pyi +18 -4
- viam/gen/provisioning/v1/provisioning_grpc.py +10 -2
- viam/gen/provisioning/v1/provisioning_pb2.py +38 -31
- viam/gen/provisioning/v1/provisioning_pb2.pyi +20 -2
- viam/gen/robot/v1/robot_grpc.py +61 -29
- viam/gen/robot/v1/robot_pb2.py +186 -155
- viam/gen/robot/v1/robot_pb2.pyi +278 -59
- viam/gen/service/datamanager/v1/data_manager_grpc.py +11 -2
- viam/gen/service/datamanager/v1/data_manager_pb2.py +27 -17
- viam/gen/service/datamanager/v1/data_manager_pb2.pyi +47 -1
- viam/gen/service/discovery/__init__.py +0 -0
- viam/gen/service/discovery/v1/__init__.py +0 -0
- viam/gen/service/discovery/v1/discovery_grpc.py +39 -0
- viam/gen/service/discovery/v1/discovery_pb2.py +29 -0
- viam/gen/service/discovery/v1/discovery_pb2.pyi +51 -0
- viam/gen/service/generic/v1/generic_pb2.py +13 -10
- viam/gen/service/mlmodel/v1/mlmodel_pb2.py +75 -72
- viam/gen/service/motion/v1/motion_pb2.py +118 -85
- viam/gen/service/motion/v1/motion_pb2.pyi +130 -68
- viam/gen/service/navigation/v1/navigation_pb2.py +75 -72
- viam/gen/service/sensors/v1/sensors_pb2.py +59 -56
- viam/gen/service/shell/v1/shell_pb2.py +35 -32
- viam/gen/service/slam/v1/slam_pb2.py +43 -40
- viam/gen/service/slam/v1/slam_pb2.pyi +1 -1
- viam/gen/service/video/__init__.py +0 -0
- viam/gen/service/video/v1/__init__.py +0 -0
- viam/gen/service/video/v1/video_grpc.py +39 -0
- viam/gen/service/video/v1/video_pb2.py +29 -0
- viam/gen/service/video/v1/video_pb2.pyi +72 -0
- viam/gen/service/vision/v1/vision_pb2.py +60 -57
- viam/gen/service/vision/v1/vision_pb2.pyi +28 -3
- viam/gen/service/worldstatestore/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/__init__.py +0 -0
- viam/gen/service/worldstatestore/v1/world_state_store_grpc.py +55 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.py +39 -0
- viam/gen/service/worldstatestore/v1/world_state_store_pb2.pyi +171 -0
- viam/gen/stream/v1/stream_grpc.py +17 -1
- viam/gen/stream/v1/stream_pb2.py +34 -21
- viam/gen/stream/v1/stream_pb2.pyi +79 -1
- viam/gen/tagger/v1/tagger_pb2.py +9 -8
- viam/logging.py +77 -18
- viam/media/audio.py +28 -0
- viam/media/utils/pil/__init__.py +7 -3
- viam/media/video.py +80 -17
- viam/module/module.py +111 -38
- viam/module/resource_data_consumer.py +41 -0
- viam/module/service.py +9 -1
- viam/module/types.py +2 -4
- viam/proto/app/__init__.py +199 -0
- viam/proto/app/agent/__init__.py +5 -2
- viam/proto/app/billing.py +31 -4
- viam/proto/app/cloudslam/__init__.py +1 -0
- viam/proto/app/data/__init__.py +63 -0
- viam/proto/app/datapipelines/__init__.py +56 -0
- viam/proto/app/dataset/__init__.py +5 -0
- viam/proto/app/datasync/__init__.py +3 -0
- viam/proto/app/end_user.py +1 -0
- viam/proto/app/mlinference/__init__.py +15 -0
- viam/proto/app/mltraining/__init__.py +13 -0
- viam/proto/app/packages/__init__.py +1 -0
- viam/proto/app/robot.py +7 -0
- viam/proto/common/__init__.py +15 -0
- viam/proto/component/arm/__init__.py +7 -0
- viam/proto/component/audioin/__init__.py +16 -0
- viam/proto/component/audioinput/__init__.py +1 -0
- viam/proto/component/audioout/__init__.py +15 -0
- viam/proto/component/base/__init__.py +1 -0
- viam/proto/component/board/__init__.py +1 -0
- viam/proto/component/button/__init__.py +15 -0
- viam/proto/component/camera/__init__.py +1 -0
- viam/proto/component/encoder/__init__.py +1 -0
- viam/proto/component/gantry/__init__.py +1 -0
- viam/proto/component/generic/__init__.py +1 -0
- viam/proto/component/gripper/__init__.py +5 -0
- viam/proto/component/inputcontroller/__init__.py +1 -0
- viam/proto/component/motor/__init__.py +1 -0
- viam/proto/component/movementsensor/__init__.py +1 -0
- viam/proto/component/posetracker/__init__.py +1 -0
- viam/proto/component/powersensor/__init__.py +1 -0
- viam/proto/component/sensor/__init__.py +1 -0
- viam/proto/component/servo/__init__.py +1 -0
- viam/proto/component/switch/__init__.py +26 -0
- viam/proto/component/testecho/__init__.py +1 -0
- viam/proto/module/__init__.py +1 -0
- viam/proto/provisioning/__init__.py +5 -0
- viam/proto/robot/__init__.py +29 -8
- viam/proto/rpc/auth.py +1 -0
- viam/proto/rpc/examples/echo/__init__.py +1 -0
- viam/proto/rpc/examples/echoresource/__init__.py +1 -0
- viam/proto/rpc/webrtc/grpc.py +1 -0
- viam/proto/rpc/webrtc/signaling.py +3 -0
- viam/proto/service/datamanager/__init__.py +9 -1
- viam/proto/service/discovery/__init__.py +15 -0
- viam/proto/service/generic/__init__.py +1 -0
- viam/proto/service/mlmodel/__init__.py +1 -0
- viam/proto/service/motion/__init__.py +3 -0
- viam/proto/service/navigation/__init__.py +1 -0
- viam/proto/service/sensors/__init__.py +1 -0
- viam/proto/service/shell/__init__.py +1 -0
- viam/proto/service/slam/__init__.py +1 -0
- viam/proto/service/video/__init__.py +15 -0
- viam/proto/service/vision/__init__.py +1 -0
- viam/proto/service/worldstatestore/__init__.py +32 -0
- viam/proto/stream/__init__.py +11 -0
- viam/py.typed +0 -0
- viam/resource/base.py +12 -8
- viam/resource/easy_resource.py +24 -13
- viam/resource/manager.py +6 -5
- viam/resource/registry.py +39 -51
- viam/resource/rpc_client_base.py +33 -1
- viam/resource/types.py +13 -14
- viam/robot/client.py +190 -122
- viam/robot/service.py +2 -50
- viam/rpc/dial.py +54 -4
- viam/rpc/libviam_rust_utils.so +0 -0
- viam/rpc/server.py +25 -11
- viam/rpc/types.py +2 -4
- viam/services/discovery/__init__.py +12 -0
- viam/services/discovery/client.py +55 -0
- viam/services/discovery/discovery.py +52 -0
- viam/services/discovery/service.py +43 -0
- viam/services/generic/__init__.py +1 -1
- viam/services/generic/client.py +8 -5
- viam/services/generic/generic.py +2 -2
- viam/services/mlmodel/__init__.py +1 -1
- viam/services/mlmodel/client.py +17 -7
- viam/services/mlmodel/mlmodel.py +23 -12
- viam/services/mlmodel/service.py +5 -2
- viam/services/mlmodel/utils.py +11 -1
- viam/services/motion/__init__.py +2 -2
- viam/services/motion/client.py +32 -32
- viam/services/motion/motion.py +66 -62
- viam/services/navigation/__init__.py +1 -1
- viam/services/navigation/client.py +30 -20
- viam/services/navigation/navigation.py +23 -23
- viam/services/service_base.py +13 -9
- viam/services/service_client_base.py +3 -3
- viam/services/slam/__init__.py +1 -1
- viam/services/slam/client.py +15 -10
- viam/services/slam/slam.py +11 -11
- viam/services/vision/__init__.py +1 -1
- viam/services/vision/client.py +31 -24
- viam/services/vision/service.py +8 -8
- viam/services/vision/vision.py +36 -53
- viam/services/worldstatestore/__init__.py +18 -0
- viam/services/worldstatestore/client.py +94 -0
- viam/services/worldstatestore/service.py +55 -0
- viam/services/worldstatestore/worldstatestore.py +90 -0
- viam/sessions_client.py +115 -46
- viam/streams.py +3 -6
- viam/utils.py +44 -14
- viam/version_metadata.py +4 -0
- {viam_sdk-0.25.2.dist-info → viam_sdk-0.62.0.dist-info}/METADATA +27 -28
- viam_sdk-0.62.0.dist-info/RECORD +514 -0
- {viam_sdk-0.25.2.dist-info → viam_sdk-0.62.0.dist-info}/WHEEL +1 -1
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_grpc.py +0 -27
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.py +0 -18
- viam/gen/proto/rpc/examples/fileupload/v1/fileupload_pb2.pyi +0 -45
- viam/proto/rpc/examples/fileupload/__init__.py +0 -18
- viam/services/sensors/__init__.py +0 -5
- viam/services/sensors/client.py +0 -65
- viam_sdk-0.25.2.dist-info/LICENSE +0 -202
- viam_sdk-0.25.2.dist-info/RECORD +0 -442
- /viam/gen/{proto/rpc/examples/fileupload → app/datapipelines}/__init__.py +0 -0
- /viam/gen/{proto/rpc/examples/fileupload → app/datapipelines}/v1/__init__.py +0 -0
- /LICENSE → /viam_sdk-0.62.0.dist-info/licenses/LICENSE +0 -0
viam/app/app_client.py
CHANGED
|
@@ -12,6 +12,7 @@ from viam.proto.app import (
|
|
|
12
12
|
AddRoleRequest,
|
|
13
13
|
APIKeyWithAuthorizations,
|
|
14
14
|
AppServiceStub,
|
|
15
|
+
AuthenticatorInfo,
|
|
15
16
|
Authorization,
|
|
16
17
|
AuthorizedPermissions,
|
|
17
18
|
ChangeRoleRequest,
|
|
@@ -47,16 +48,18 @@ from viam.proto.app import (
|
|
|
47
48
|
DeleteRobotPartRequest,
|
|
48
49
|
DeleteRobotPartSecretRequest,
|
|
49
50
|
DeleteRobotRequest,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
from viam.proto.app import FragmentVisibility as FragmentVisibilityPB
|
|
53
|
-
from viam.proto.app import (
|
|
51
|
+
GetFragmentHistoryRequest,
|
|
52
|
+
GetFragmentHistoryResponse,
|
|
54
53
|
GetFragmentRequest,
|
|
55
54
|
GetFragmentResponse,
|
|
55
|
+
GetLocationMetadataRequest,
|
|
56
|
+
GetLocationMetadataResponse,
|
|
56
57
|
GetLocationRequest,
|
|
57
58
|
GetLocationResponse,
|
|
58
59
|
GetModuleRequest,
|
|
59
60
|
GetModuleResponse,
|
|
61
|
+
GetOrganizationMetadataRequest,
|
|
62
|
+
GetOrganizationMetadataResponse,
|
|
60
63
|
GetOrganizationNamespaceAvailabilityRequest,
|
|
61
64
|
GetOrganizationNamespaceAvailabilityResponse,
|
|
62
65
|
GetOrganizationRequest,
|
|
@@ -67,10 +70,14 @@ from viam.proto.app import (
|
|
|
67
70
|
GetRegistryItemResponse,
|
|
68
71
|
GetRobotAPIKeysRequest,
|
|
69
72
|
GetRobotAPIKeysResponse,
|
|
73
|
+
GetRobotMetadataRequest,
|
|
74
|
+
GetRobotMetadataResponse,
|
|
70
75
|
GetRobotPartHistoryRequest,
|
|
71
76
|
GetRobotPartHistoryResponse,
|
|
72
77
|
GetRobotPartLogsRequest,
|
|
73
78
|
GetRobotPartLogsResponse,
|
|
79
|
+
GetRobotPartMetadataRequest,
|
|
80
|
+
GetRobotPartMetadataResponse,
|
|
74
81
|
GetRobotPartRequest,
|
|
75
82
|
GetRobotPartResponse,
|
|
76
83
|
GetRobotPartsRequest,
|
|
@@ -125,10 +132,6 @@ from viam.proto.app import (
|
|
|
125
132
|
ResendOrganizationInviteRequest,
|
|
126
133
|
ResendOrganizationInviteResponse,
|
|
127
134
|
Robot,
|
|
128
|
-
)
|
|
129
|
-
from viam.proto.app import RobotPart as RobotPartPB
|
|
130
|
-
from viam.proto.app import RobotPartHistoryEntry as RobotPartHistoryEntryPB
|
|
131
|
-
from viam.proto.app import (
|
|
132
135
|
RotateKeyRequest,
|
|
133
136
|
RotateKeyResponse,
|
|
134
137
|
RoverRentalRobot,
|
|
@@ -139,15 +142,23 @@ from viam.proto.app import (
|
|
|
139
142
|
UnshareLocationRequest,
|
|
140
143
|
UpdateFragmentRequest,
|
|
141
144
|
UpdateFragmentResponse,
|
|
145
|
+
UpdateLocationMetadataRequest,
|
|
146
|
+
UpdateLocationMetadataResponse,
|
|
142
147
|
UpdateLocationRequest,
|
|
143
148
|
UpdateLocationResponse,
|
|
144
149
|
UpdateModuleRequest,
|
|
145
150
|
UpdateModuleResponse,
|
|
146
151
|
UpdateOrganizationInviteAuthorizationsRequest,
|
|
147
152
|
UpdateOrganizationInviteAuthorizationsResponse,
|
|
153
|
+
UpdateOrganizationMetadataRequest,
|
|
154
|
+
UpdateOrganizationMetadataResponse,
|
|
148
155
|
UpdateOrganizationRequest,
|
|
149
156
|
UpdateOrganizationResponse,
|
|
150
157
|
UpdateRegistryItemRequest,
|
|
158
|
+
UpdateRobotMetadataRequest,
|
|
159
|
+
UpdateRobotMetadataResponse,
|
|
160
|
+
UpdateRobotPartMetadataRequest,
|
|
161
|
+
UpdateRobotPartMetadataResponse,
|
|
151
162
|
UpdateRobotPartRequest,
|
|
152
163
|
UpdateRobotPartResponse,
|
|
153
164
|
UpdateRobotRequest,
|
|
@@ -155,6 +166,11 @@ from viam.proto.app import (
|
|
|
155
166
|
UploadModuleFileRequest,
|
|
156
167
|
Visibility,
|
|
157
168
|
)
|
|
169
|
+
from viam.proto.app import Fragment as FragmentPB
|
|
170
|
+
from viam.proto.app import FragmentHistoryEntry as FragmentHistoryEntryPB
|
|
171
|
+
from viam.proto.app import FragmentVisibility as FragmentVisibilityPB
|
|
172
|
+
from viam.proto.app import RobotPart as RobotPartPB
|
|
173
|
+
from viam.proto.app import RobotPartHistoryEntry as RobotPartHistoryEntryPB
|
|
158
174
|
from viam.proto.app.packages import PackageType
|
|
159
175
|
from viam.proto.common import LogEntry as LogEntryPB
|
|
160
176
|
from viam.utils import datetime_to_timestamp, dict_to_struct, struct_to_dict
|
|
@@ -193,6 +209,7 @@ class RobotPart:
|
|
|
193
209
|
self.local_fqdn = robot_part.local_fqdn
|
|
194
210
|
self.created_on = robot_part.created_on.ToDatetime() if robot_part.HasField("created_on") else None
|
|
195
211
|
self.secrets = list(robot_part.secrets)
|
|
212
|
+
self.last_updated = robot_part.last_updated.ToDatetime() if robot_part.HasField("last_updated") else None
|
|
196
213
|
return self
|
|
197
214
|
|
|
198
215
|
id: str
|
|
@@ -209,6 +226,7 @@ class RobotPart:
|
|
|
209
226
|
local_fqdn: str
|
|
210
227
|
created_on: Optional[datetime]
|
|
211
228
|
secrets: Optional[List[SharedSecret]]
|
|
229
|
+
last_updated: Optional[datetime]
|
|
212
230
|
|
|
213
231
|
@property
|
|
214
232
|
def proto(self) -> RobotPartPB:
|
|
@@ -227,6 +245,7 @@ class RobotPart:
|
|
|
227
245
|
local_fqdn=self.local_fqdn,
|
|
228
246
|
created_on=datetime_to_timestamp(self.created_on) if self.created_on else None,
|
|
229
247
|
secrets=self.secrets,
|
|
248
|
+
last_updated=datetime_to_timestamp(self.last_updated) if self.last_updated else None,
|
|
230
249
|
)
|
|
231
250
|
|
|
232
251
|
|
|
@@ -352,6 +371,7 @@ class Fragment:
|
|
|
352
371
|
self.organization_count = fragment.organization_count
|
|
353
372
|
self.only_used_by_owner = fragment.only_used_by_owner
|
|
354
373
|
self.visibility = Fragment.Visibility.from_proto(fragment.visibility)
|
|
374
|
+
self.last_updated = fragment.last_updated.ToDatetime() if fragment.HasField("last_updated") else None
|
|
355
375
|
return self
|
|
356
376
|
|
|
357
377
|
id: str
|
|
@@ -365,6 +385,7 @@ class Fragment:
|
|
|
365
385
|
organization_count: int
|
|
366
386
|
only_used_by_owner: bool
|
|
367
387
|
visibility: Visibility
|
|
388
|
+
last_updated: Optional[datetime]
|
|
368
389
|
|
|
369
390
|
@property
|
|
370
391
|
def proto(self) -> FragmentPB:
|
|
@@ -380,6 +401,45 @@ class Fragment:
|
|
|
380
401
|
organization_count=self.organization_count,
|
|
381
402
|
only_used_by_owner=self.only_used_by_owner,
|
|
382
403
|
visibility=self.visibility.to_proto(),
|
|
404
|
+
last_updated=datetime_to_timestamp(self.last_updated) if self.last_updated else None,
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
class FragmentHistoryEntry:
|
|
409
|
+
"""A class that mirrors the `FragmentHistoryEntry` proto message.
|
|
410
|
+
|
|
411
|
+
Use this class to make the attributes of a `viam.proto.app.FragmentHistoryEntry` more accessible and easier to read/interpret.
|
|
412
|
+
"""
|
|
413
|
+
|
|
414
|
+
@classmethod
|
|
415
|
+
def from_proto(cls, fragment_history_entry: FragmentHistoryEntryPB) -> Self:
|
|
416
|
+
"""Create a `FragmentHistoryEntry` from the .proto defined `FragmentHistoryEntry`.
|
|
417
|
+
|
|
418
|
+
Args:
|
|
419
|
+
fragment_history_entry (viam.proto.app.FragmentHistoryEntry): The object to copy from.
|
|
420
|
+
|
|
421
|
+
Returns:
|
|
422
|
+
FragmentHistoryEntry: The `FragmentHistoryEntry`.
|
|
423
|
+
"""
|
|
424
|
+
self = cls()
|
|
425
|
+
self.fragment = fragment_history_entry.fragment
|
|
426
|
+
self.edited_on = fragment_history_entry.edited_on.ToDatetime()
|
|
427
|
+
self.old = Fragment.from_proto(fragment_history_entry.old)
|
|
428
|
+
self.edited_by = fragment_history_entry.edited_by
|
|
429
|
+
return self
|
|
430
|
+
|
|
431
|
+
fragment: str
|
|
432
|
+
edited_on: datetime
|
|
433
|
+
old: Fragment
|
|
434
|
+
edited_by: AuthenticatorInfo
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def proto(self) -> FragmentHistoryEntryPB:
|
|
438
|
+
return FragmentHistoryEntryPB(
|
|
439
|
+
fragment=self.fragment,
|
|
440
|
+
edited_on=datetime_to_timestamp(self.edited_on),
|
|
441
|
+
edited_by=self.edited_by,
|
|
442
|
+
old=self.old.proto if self.old else None,
|
|
383
443
|
)
|
|
384
444
|
|
|
385
445
|
|
|
@@ -470,34 +530,29 @@ class AppClient:
|
|
|
470
530
|
async def main():
|
|
471
531
|
|
|
472
532
|
# Make a ViamClient
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
viam_client.close()
|
|
533
|
+
async with await connect() as viam_client:
|
|
534
|
+
# Instantiate an AppClient called "cloud" to run cloud app API methods on
|
|
535
|
+
cloud = viam_client.app_client
|
|
478
536
|
|
|
479
537
|
if __name__ == '__main__':
|
|
480
538
|
asyncio.run(main())
|
|
481
539
|
|
|
482
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
540
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/>`_.
|
|
483
541
|
"""
|
|
484
542
|
|
|
485
|
-
def __init__(self, channel: Channel, metadata: Mapping[str, str]
|
|
543
|
+
def __init__(self, channel: Channel, metadata: Mapping[str, str]):
|
|
486
544
|
"""Create an `AppClient` that maintains a connection to app.
|
|
487
545
|
|
|
488
546
|
Args:
|
|
489
547
|
channel (grpclib.client.Channel): connection to app.
|
|
490
548
|
metadata (Mapping[str, str]): Required authorization token to send requests to app.
|
|
491
|
-
location_id (Optional[str]): Default location ID.
|
|
492
549
|
"""
|
|
493
550
|
self._metadata = metadata
|
|
494
551
|
self._app_client = AppServiceStub(channel)
|
|
495
|
-
self._location_id = location_id
|
|
496
552
|
self._channel = channel
|
|
497
553
|
|
|
498
554
|
_app_client: AppServiceStub
|
|
499
555
|
_metadata: Mapping[str, str]
|
|
500
|
-
_location_id: Optional[str]
|
|
501
556
|
_channel: Channel
|
|
502
557
|
_organization_id: Optional[str] = None
|
|
503
558
|
|
|
@@ -544,7 +599,7 @@ class AppClient:
|
|
|
544
599
|
Returns:
|
|
545
600
|
str: The ID of the user.
|
|
546
601
|
|
|
547
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
602
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getuseridbyemail>`_.
|
|
548
603
|
"""
|
|
549
604
|
request = GetUserIDByEmailRequest(email=email)
|
|
550
605
|
response: GetUserIDByEmailResponse = await self._app_client.GetUserIDByEmail(request, metadata=self._metadata)
|
|
@@ -563,7 +618,7 @@ class AppClient:
|
|
|
563
618
|
Returns:
|
|
564
619
|
Organization: The created organization.
|
|
565
620
|
|
|
566
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
621
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createorganization>`_.
|
|
567
622
|
"""
|
|
568
623
|
request = CreateOrganizationRequest(name=name)
|
|
569
624
|
response: CreateOrganizationResponse = await self._app_client.CreateOrganization(request, metadata=self._metadata)
|
|
@@ -579,7 +634,7 @@ class AppClient:
|
|
|
579
634
|
Returns:
|
|
580
635
|
List[viam.proto.app.Organization]: The list of organizations.
|
|
581
636
|
|
|
582
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
637
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listorganizations>`_.
|
|
583
638
|
"""
|
|
584
639
|
request = ListOrganizationsRequest()
|
|
585
640
|
response: ListOrganizationsResponse = await self._app_client.ListOrganizations(request, metadata=self._metadata)
|
|
@@ -590,7 +645,7 @@ class AppClient:
|
|
|
590
645
|
|
|
591
646
|
::
|
|
592
647
|
|
|
593
|
-
org_list = await cloud.
|
|
648
|
+
org_list = await cloud.get_organizations_with_access_to_location("location-id")
|
|
594
649
|
|
|
595
650
|
Args:
|
|
596
651
|
location_id (str): The ID of the location.
|
|
@@ -598,7 +653,7 @@ class AppClient:
|
|
|
598
653
|
Returns:
|
|
599
654
|
List[viam.proto.app.OrganizationIdentity]: The list of organizations.
|
|
600
655
|
|
|
601
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
656
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getorganizationswithaccesstolocation>`_.
|
|
602
657
|
"""
|
|
603
658
|
request = GetOrganizationsWithAccessToLocationRequest(location_id=location_id)
|
|
604
659
|
response: GetOrganizationsWithAccessToLocationResponse = await self._app_client.GetOrganizationsWithAccessToLocation(
|
|
@@ -611,25 +666,30 @@ class AppClient:
|
|
|
611
666
|
|
|
612
667
|
::
|
|
613
668
|
|
|
614
|
-
org_list = await cloud.list_organizations_by_user("
|
|
669
|
+
org_list = await cloud.list_organizations_by_user("<YOUR-USER-ID>")
|
|
615
670
|
|
|
616
671
|
Args:
|
|
617
|
-
user_id (str): The ID of the user
|
|
672
|
+
user_id (str): The ID of the user. You can retrieve this with the get_user_id_by_email() method.
|
|
618
673
|
|
|
619
674
|
Returns:
|
|
620
675
|
List[OrgDetails]: The list of organizations.
|
|
621
676
|
|
|
622
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
677
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listorganizationsbyuser>`_.
|
|
623
678
|
"""
|
|
624
679
|
request = ListOrganizationsByUserRequest(user_id=user_id)
|
|
625
680
|
response: ListOrganizationsByUserResponse = await self._app_client.ListOrganizationsByUser(request, metadata=self._metadata)
|
|
626
681
|
return list(response.orgs)
|
|
627
682
|
|
|
628
683
|
async def get_organization(self, org_id: str) -> Organization:
|
|
629
|
-
"""
|
|
684
|
+
"""Retrieve the organization object for the requested organization containing the organization's ID,
|
|
685
|
+
name, public namespace, and more.
|
|
686
|
+
|
|
687
|
+
::
|
|
688
|
+
|
|
689
|
+
org = await cloud.get_organization("<YOUR-ORG-ID>")
|
|
630
690
|
|
|
631
691
|
Args:
|
|
632
|
-
org_id (str): The ID of the organization to query.
|
|
692
|
+
org_id (str): The ID of the organization to query. You can retrieve this from the organization settings page.
|
|
633
693
|
|
|
634
694
|
Raises:
|
|
635
695
|
GRPCError: If the provided org_id is invalid, or not currently authed to.
|
|
@@ -637,7 +697,7 @@ class AppClient:
|
|
|
637
697
|
Returns:
|
|
638
698
|
viam.proto.app.Organization: The requested organization.
|
|
639
699
|
|
|
640
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
700
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getorganization>`_.
|
|
641
701
|
"""
|
|
642
702
|
request = GetOrganizationRequest(organization_id=org_id)
|
|
643
703
|
response: GetOrganizationResponse = await self._app_client.GetOrganization(request, metadata=self._metadata)
|
|
@@ -652,7 +712,7 @@ class AppClient:
|
|
|
652
712
|
public_namespace="my-cool-organization")
|
|
653
713
|
|
|
654
714
|
Args:
|
|
655
|
-
public_namespace (str): Organization namespace to check. Namespaces can only contain lowercase
|
|
715
|
+
public_namespace (str): Organization namespace to check. Namespaces can only contain lowercase alphanumeric and dash
|
|
656
716
|
characters.
|
|
657
717
|
|
|
658
718
|
Raises:
|
|
@@ -661,7 +721,7 @@ class AppClient:
|
|
|
661
721
|
Returns:
|
|
662
722
|
bool: True if the provided namespace is available.
|
|
663
723
|
|
|
664
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
724
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getorganizationnamespaceavailability>`_.
|
|
665
725
|
"""
|
|
666
726
|
request = GetOrganizationNamespaceAvailabilityRequest(public_namespace=public_namespace)
|
|
667
727
|
response: GetOrganizationNamespaceAvailabilityResponse = await self._app_client.GetOrganizationNamespaceAvailability(
|
|
@@ -679,6 +739,14 @@ class AppClient:
|
|
|
679
739
|
) -> Organization:
|
|
680
740
|
"""Updates organization details.
|
|
681
741
|
|
|
742
|
+
::
|
|
743
|
+
|
|
744
|
+
organization = await cloud.update_organization(
|
|
745
|
+
org_id="<YOUR-ORG-ID>",
|
|
746
|
+
name="Artoo's Org",
|
|
747
|
+
public_namespace="artoo"
|
|
748
|
+
)
|
|
749
|
+
|
|
682
750
|
Args:
|
|
683
751
|
org_id (str): The ID of the organization to update.
|
|
684
752
|
name (Optional[str]): If provided, updates the org's name.
|
|
@@ -692,7 +760,7 @@ class AppClient:
|
|
|
692
760
|
Returns:
|
|
693
761
|
viam.proto.app.Organization: The updated organization.
|
|
694
762
|
|
|
695
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
763
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updateorganization>`_.
|
|
696
764
|
"""
|
|
697
765
|
request = UpdateOrganizationRequest(
|
|
698
766
|
organization_id=org_id,
|
|
@@ -708,13 +776,14 @@ class AppClient:
|
|
|
708
776
|
"""Delete an organization
|
|
709
777
|
|
|
710
778
|
::
|
|
711
|
-
|
|
779
|
+
|
|
780
|
+
await cloud.delete_organization("<YOUR-ORG-ID>")
|
|
712
781
|
|
|
713
782
|
Args:
|
|
714
783
|
org_id (str): The ID of the organization.
|
|
715
|
-
You can obtain your organization ID from the
|
|
784
|
+
You can obtain your organization ID from the organization settings page.
|
|
716
785
|
|
|
717
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
786
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleteorganization>`_.
|
|
718
787
|
"""
|
|
719
788
|
request = DeleteOrganizationRequest(organization_id=org_id)
|
|
720
789
|
await self._app_client.DeleteOrganization(request, metadata=self._metadata)
|
|
@@ -724,17 +793,17 @@ class AppClient:
|
|
|
724
793
|
|
|
725
794
|
::
|
|
726
795
|
|
|
727
|
-
member_list, invite_list = await cloud.list_organization_members("
|
|
796
|
+
member_list, invite_list = await cloud.list_organization_members("<YOUR-ORG-ID>")
|
|
728
797
|
|
|
729
798
|
Args:
|
|
730
799
|
org_id (str): The ID of the organization to list members of.
|
|
731
|
-
You can obtain your organization ID from the
|
|
800
|
+
You can obtain your organization ID from the organization settings page.
|
|
732
801
|
|
|
733
802
|
Returns:
|
|
734
803
|
Tuple[List[viam.proto.app.OrganizationMember], List[viam.proto.app.OrganizationInvite]]: A tuple containing two lists; the first
|
|
735
804
|
[0] of organization members, and the second [1] of organization invites.
|
|
736
805
|
|
|
737
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
806
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listorganizationmembers>`_.
|
|
738
807
|
"""
|
|
739
808
|
request = ListOrganizationMembersRequest(organization_id=org_id)
|
|
740
809
|
response: ListOrganizationMembersResponse = await self._app_client.ListOrganizationMembers(request, metadata=self._metadata)
|
|
@@ -751,11 +820,11 @@ class AppClient:
|
|
|
751
820
|
|
|
752
821
|
::
|
|
753
822
|
|
|
754
|
-
await cloud.create_organization_invite("
|
|
823
|
+
await cloud.create_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
|
|
755
824
|
|
|
756
825
|
Args:
|
|
757
826
|
org_id (str): The ID of the organization to create an invite for.
|
|
758
|
-
You can obtain your organization ID from the
|
|
827
|
+
You can obtain your organization ID from the organization settings page.
|
|
759
828
|
email (str): The email address to send the invite to.
|
|
760
829
|
authorizations (Optional[List[viam.proto.app.Authorization]]): Specifications of the
|
|
761
830
|
authorizations to include in the invite. If not provided, full owner permissions will
|
|
@@ -771,7 +840,7 @@ class AppClient:
|
|
|
771
840
|
Returns:
|
|
772
841
|
OrganizationInvite: The organization invite.
|
|
773
842
|
|
|
774
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
843
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createorganizationinvite>`_.
|
|
775
844
|
"""
|
|
776
845
|
request = CreateOrganizationInviteRequest(
|
|
777
846
|
organization_id=org_id, email=email, authorizations=authorizations, send_email_invite=send_email_invite
|
|
@@ -795,24 +864,25 @@ class AppClient:
|
|
|
795
864
|
|
|
796
865
|
from viam.proto.app import Authorization
|
|
797
866
|
|
|
798
|
-
|
|
799
|
-
authorization_type="
|
|
800
|
-
authorization_id="
|
|
801
|
-
resource_type="
|
|
802
|
-
resource_id="
|
|
803
|
-
identity_id="
|
|
804
|
-
organization_id="
|
|
867
|
+
auth = Authorization(
|
|
868
|
+
authorization_type="role",
|
|
869
|
+
authorization_id="location_owner",
|
|
870
|
+
resource_type="location", # "robot", "location", or "organization"
|
|
871
|
+
resource_id="012456lni0", # machine id, location id or org id
|
|
872
|
+
identity_id="",
|
|
873
|
+
organization_id="<YOUR-ORG-ID>",
|
|
874
|
+
identity_type=""
|
|
805
875
|
)
|
|
806
876
|
|
|
807
877
|
update_invite = await cloud.update_organization_invite_authorizations(
|
|
808
|
-
org_id="
|
|
878
|
+
org_id="<YOUR-ORG-ID>",
|
|
809
879
|
email="notarealemail@viam.com",
|
|
810
|
-
add_authorizations
|
|
880
|
+
add_authorizations=[auth]
|
|
811
881
|
)
|
|
812
882
|
|
|
813
883
|
Args:
|
|
814
884
|
org_id (str): The ID of the organization that the invite is for.
|
|
815
|
-
You can obtain your organization ID from the
|
|
885
|
+
You can obtain your organization ID from the organization settings page.
|
|
816
886
|
email (str): Email of the user the invite was sent to.
|
|
817
887
|
add_authorizations (Optional[List[viam.proto.app.Authorization]]): Optional list of authorizations to add to the invite.
|
|
818
888
|
remove_authorizations (Optional[List[viam.proto.app.Authorization]]): Optional list of authorizations to remove from the invite.
|
|
@@ -824,7 +894,7 @@ class AppClient:
|
|
|
824
894
|
Returns:
|
|
825
895
|
viam.proto.app.OrganizationInvite: The updated invite.
|
|
826
896
|
|
|
827
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
897
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updateorganizationinviteauthorizations>`_.
|
|
828
898
|
"""
|
|
829
899
|
request = UpdateOrganizationInviteAuthorizationsRequest(
|
|
830
900
|
organization_id=org_id, email=email, add_authorizations=add_authorizations, remove_authorizations=remove_authorizations
|
|
@@ -839,17 +909,17 @@ class AppClient:
|
|
|
839
909
|
|
|
840
910
|
::
|
|
841
911
|
|
|
842
|
-
member_list, invite_list = await cloud.list_organization_members()
|
|
912
|
+
member_list, invite_list = await cloud.list_organization_members(org_id="<YOUR-ORG-ID>")
|
|
843
913
|
first_user_id = member_list[0].user_id
|
|
844
914
|
|
|
845
915
|
await cloud.delete_organization_member(org_id="org_id", user_id=first_user_id)
|
|
846
916
|
|
|
847
917
|
Args:
|
|
848
918
|
org_id (str): The ID of the org to remove the user from.
|
|
849
|
-
You can obtain your organization ID from the
|
|
919
|
+
You can obtain your organization ID from the organization settings page.
|
|
850
920
|
user_id (str): The ID of the user to remove.
|
|
851
921
|
|
|
852
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
922
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleteorganizationmember>`_.
|
|
853
923
|
"""
|
|
854
924
|
request = DeleteOrganizationMemberRequest(organization_id=org_id, user_id=user_id)
|
|
855
925
|
await self._app_client.DeleteOrganizationMember(request, metadata=self._metadata)
|
|
@@ -859,17 +929,17 @@ class AppClient:
|
|
|
859
929
|
|
|
860
930
|
::
|
|
861
931
|
|
|
862
|
-
await cloud.delete_organization_invite("
|
|
932
|
+
await cloud.delete_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
|
|
863
933
|
|
|
864
934
|
Args:
|
|
865
935
|
org_id (str): The ID of the organization that the invite to delete was for.
|
|
866
|
-
You can obtain your organization ID from the
|
|
936
|
+
You can obtain your organization ID from the organization settings page.
|
|
867
937
|
email (str): The email address the pending invite was sent to.
|
|
868
938
|
|
|
869
939
|
Raises:
|
|
870
940
|
GRPCError: If no pending invite is associated with the provided email address.
|
|
871
941
|
|
|
872
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
942
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleteorganizationinvite>`_.
|
|
873
943
|
"""
|
|
874
944
|
request = DeleteOrganizationInviteRequest(organization_id=org_id, email=email)
|
|
875
945
|
await self._app_client.DeleteOrganizationInvite(request, metadata=self._metadata)
|
|
@@ -879,11 +949,11 @@ class AppClient:
|
|
|
879
949
|
|
|
880
950
|
::
|
|
881
951
|
|
|
882
|
-
org_invite = await cloud.resend_organization_invite("
|
|
952
|
+
org_invite = await cloud.resend_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
|
|
883
953
|
|
|
884
954
|
Args:
|
|
885
955
|
org_id (str): The ID of the organization that the invite to resend was for.
|
|
886
|
-
You can obtain your organization ID from the
|
|
956
|
+
You can obtain your organization ID from the organization settings page.
|
|
887
957
|
email (str): The email address associated with the invite.
|
|
888
958
|
|
|
889
959
|
Raises:
|
|
@@ -892,7 +962,7 @@ class AppClient:
|
|
|
892
962
|
Returns:
|
|
893
963
|
viam.proto.app.OrganizationInvite: The organization invite sent.
|
|
894
964
|
|
|
895
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
965
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#resendorganizationinvite>`_.
|
|
896
966
|
"""
|
|
897
967
|
request = ResendOrganizationInviteRequest(organization_id=org_id, email=email)
|
|
898
968
|
response: ResendOrganizationInviteResponse = await self._app_client.ResendOrganizationInvite(request, metadata=self._metadata)
|
|
@@ -903,11 +973,11 @@ class AppClient:
|
|
|
903
973
|
|
|
904
974
|
::
|
|
905
975
|
|
|
906
|
-
my_new_location = await cloud.create_location(org_id="
|
|
976
|
+
my_new_location = await cloud.create_location(org_id="<YOUR-ORG-ID>", name="Robotville", parent_location_id="111ab12345")
|
|
907
977
|
|
|
908
978
|
Args:
|
|
909
979
|
org_id (str): The ID of the organization to create the location under.
|
|
910
|
-
You can obtain your organization ID from the
|
|
980
|
+
You can obtain your organization ID from the organization settings page.
|
|
911
981
|
name (str): Name of the location.
|
|
912
982
|
parent_location_id (Optional[str]): Optional parent location to put the location under. Defaults to a root-level location if no
|
|
913
983
|
location ID is provided.
|
|
@@ -918,7 +988,7 @@ class AppClient:
|
|
|
918
988
|
Returns:
|
|
919
989
|
viam.proto.app.Location: The newly created location.
|
|
920
990
|
|
|
921
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
991
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createlocation>`_.
|
|
922
992
|
"""
|
|
923
993
|
request = CreateLocationRequest(organization_id=org_id, name=name, parent_location_id=parent_location_id)
|
|
924
994
|
response: CreateLocationResponse = await self._app_client.CreateLocation(request, metadata=self._metadata)
|
|
@@ -941,9 +1011,9 @@ class AppClient:
|
|
|
941
1011
|
Returns:
|
|
942
1012
|
viam.proto.app.Location: The location.
|
|
943
1013
|
|
|
944
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1014
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getlocation>`_.
|
|
945
1015
|
"""
|
|
946
|
-
request = GetLocationRequest(location_id=location_id if location_id else
|
|
1016
|
+
request = GetLocationRequest(location_id=location_id if location_id else "")
|
|
947
1017
|
response: GetLocationResponse = await self._app_client.GetLocation(request, metadata=self._metadata)
|
|
948
1018
|
return response.location
|
|
949
1019
|
|
|
@@ -986,7 +1056,7 @@ class AppClient:
|
|
|
986
1056
|
Returns:
|
|
987
1057
|
viam.proto.app.Location: The newly updated location.
|
|
988
1058
|
|
|
989
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1059
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updatelocation>`_.
|
|
990
1060
|
"""
|
|
991
1061
|
request = UpdateLocationRequest(location_id=location_id, name=name, parent_location_id=parent_location_id)
|
|
992
1062
|
response: UpdateLocationResponse = await self._app_client.UpdateLocation(request, metadata=self._metadata)
|
|
@@ -1005,7 +1075,7 @@ class AppClient:
|
|
|
1005
1075
|
Raises:
|
|
1006
1076
|
GRPCError: If an invalid location ID is passed.
|
|
1007
1077
|
|
|
1008
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1078
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deletelocation>`_.
|
|
1009
1079
|
"""
|
|
1010
1080
|
request = DeleteLocationRequest(location_id=location_id)
|
|
1011
1081
|
await self._app_client.DeleteLocation(request, metadata=self._metadata)
|
|
@@ -1015,16 +1085,16 @@ class AppClient:
|
|
|
1015
1085
|
|
|
1016
1086
|
::
|
|
1017
1087
|
|
|
1018
|
-
locations = await cloud.list_locations("
|
|
1088
|
+
locations = await cloud.list_locations("<YOUR-ORG-ID>")
|
|
1019
1089
|
|
|
1020
1090
|
Args:
|
|
1021
1091
|
org_id (str): The ID of the org to list locations for.
|
|
1022
|
-
You can obtain your organization ID from the
|
|
1092
|
+
You can obtain your organization ID from the organization settings page.
|
|
1023
1093
|
|
|
1024
1094
|
Returns:
|
|
1025
1095
|
List[viam.proto.app.Location]: The list of locations.
|
|
1026
1096
|
|
|
1027
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1097
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listlocations>`_.
|
|
1028
1098
|
"""
|
|
1029
1099
|
request = ListLocationsRequest(organization_id=org_id)
|
|
1030
1100
|
response: ListLocationsResponse = await self._app_client.ListLocations(request, metadata=self._metadata)
|
|
@@ -1035,13 +1105,13 @@ class AppClient:
|
|
|
1035
1105
|
|
|
1036
1106
|
::
|
|
1037
1107
|
|
|
1038
|
-
await cloud.share_location("
|
|
1108
|
+
await cloud.share_location("<YOUR-ORG-ID>", "<YOUR-LOCATION-ID>")
|
|
1039
1109
|
|
|
1040
1110
|
Args:
|
|
1041
1111
|
organization_id (str): The ID of the organization.
|
|
1042
1112
|
location_id (str): The ID of the location.
|
|
1043
1113
|
|
|
1044
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1114
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#sharelocation>`_.
|
|
1045
1115
|
"""
|
|
1046
1116
|
request = ShareLocationRequest(location_id=location_id, organization_id=organization_id)
|
|
1047
1117
|
await self._app_client.ShareLocation(request, metadata=self._metadata)
|
|
@@ -1051,13 +1121,13 @@ class AppClient:
|
|
|
1051
1121
|
|
|
1052
1122
|
::
|
|
1053
1123
|
|
|
1054
|
-
await cloud.unshare_location("
|
|
1124
|
+
await cloud.unshare_location("<YOUR-ORG-ID>", "<YOUR-LOCATION-ID>")
|
|
1055
1125
|
|
|
1056
1126
|
Args:
|
|
1057
1127
|
organization_id (str): The ID of the organization.
|
|
1058
1128
|
location_id (str): The ID of the location.
|
|
1059
1129
|
|
|
1060
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1130
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#unsharelocation>`_.
|
|
1061
1131
|
"""
|
|
1062
1132
|
request = UnshareLocationRequest(location_id=location_id, organization_id=organization_id)
|
|
1063
1133
|
await self._app_client.UnshareLocation(request, metadata=self._metadata)
|
|
@@ -1080,9 +1150,9 @@ class AppClient:
|
|
|
1080
1150
|
Returns:
|
|
1081
1151
|
viam.proto.app.LocationAuth: The `LocationAuth` containing location secrets.
|
|
1082
1152
|
|
|
1083
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1153
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#locationauth>`_.
|
|
1084
1154
|
"""
|
|
1085
|
-
request = LocationAuthRequest(location_id=location_id if location_id else
|
|
1155
|
+
request = LocationAuthRequest(location_id=location_id if location_id else "")
|
|
1086
1156
|
response: LocationAuthResponse = await self._app_client.LocationAuth(request, metadata=self._metadata)
|
|
1087
1157
|
return response.auth
|
|
1088
1158
|
|
|
@@ -1091,7 +1161,7 @@ class AppClient:
|
|
|
1091
1161
|
|
|
1092
1162
|
::
|
|
1093
1163
|
|
|
1094
|
-
new_loc_auth = await cloud.create_location_secret()
|
|
1164
|
+
new_loc_auth = await cloud.create_location_secret(location_id="123xy12345")
|
|
1095
1165
|
|
|
1096
1166
|
Args:
|
|
1097
1167
|
location_id (Optional[str]): ID of the location to generate a new secret for. Defaults to the location ID provided at
|
|
@@ -1104,9 +1174,9 @@ class AppClient:
|
|
|
1104
1174
|
Returns:
|
|
1105
1175
|
viam.proto.app.LocationAuth: The specified location's `LocationAuth` containing the newly created secret.
|
|
1106
1176
|
|
|
1107
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1177
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createlocationsecret>`_.
|
|
1108
1178
|
"""
|
|
1109
|
-
request = CreateLocationSecretRequest(location_id=location_id if location_id else
|
|
1179
|
+
request = CreateLocationSecretRequest(location_id=location_id if location_id else "")
|
|
1110
1180
|
response: CreateLocationSecretResponse = await self._app_client.CreateLocationSecret(request, metadata=self._metadata)
|
|
1111
1181
|
return response.auth
|
|
1112
1182
|
|
|
@@ -1116,7 +1186,9 @@ class AppClient:
|
|
|
1116
1186
|
::
|
|
1117
1187
|
|
|
1118
1188
|
await cloud.delete_location_secret(
|
|
1119
|
-
secret_id="abcd123-456-7890ab-cxyz98-989898xyzxyz"
|
|
1189
|
+
secret_id="abcd123-456-7890ab-cxyz98-989898xyzxyz",
|
|
1190
|
+
location_id="123xy12345"
|
|
1191
|
+
)
|
|
1120
1192
|
|
|
1121
1193
|
Args:
|
|
1122
1194
|
location_id (str): ID of the location to delete secret from. Defaults to the location ID provided at `AppClient` instantiation.
|
|
@@ -1126,30 +1198,28 @@ class AppClient:
|
|
|
1126
1198
|
GRPCError: If either an invalid location ID or secret ID is passed or a location ID isn't passed and there was no location
|
|
1127
1199
|
ID provided at `AppClient` instantiation.
|
|
1128
1200
|
|
|
1129
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1201
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deletelocationsecret>`_.
|
|
1130
1202
|
"""
|
|
1131
|
-
request = DeleteLocationSecretRequest(
|
|
1132
|
-
location_id=location_id if location_id else self._location_id if self._location_id else "", secret_id=secret_id
|
|
1133
|
-
)
|
|
1203
|
+
request = DeleteLocationSecretRequest(location_id=location_id if location_id else "", secret_id=secret_id)
|
|
1134
1204
|
await self._app_client.DeleteLocationSecret(request, metadata=self._metadata)
|
|
1135
1205
|
|
|
1136
1206
|
async def get_robot(self, robot_id: str) -> Robot:
|
|
1137
|
-
"""Get a
|
|
1207
|
+
"""Get a machine.
|
|
1138
1208
|
|
|
1139
1209
|
::
|
|
1140
1210
|
|
|
1141
|
-
|
|
1211
|
+
machine = await cloud.get_robot(robot_id="1a123456-x1yz-0ab0-a12xyzabc")
|
|
1142
1212
|
|
|
1143
1213
|
Args:
|
|
1144
|
-
robot_id (str): ID of the
|
|
1214
|
+
robot_id (str): ID of the machine to get. You can copy this value from the URL of the machine's page.
|
|
1145
1215
|
|
|
1146
1216
|
Raises:
|
|
1147
|
-
GRPCError: If an invalid
|
|
1217
|
+
GRPCError: If an invalid machine ID is passed.
|
|
1148
1218
|
|
|
1149
1219
|
Returns:
|
|
1150
|
-
viam.proto.app.Robot: The
|
|
1220
|
+
viam.proto.app.Robot: The machine.
|
|
1151
1221
|
|
|
1152
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1222
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobot>`_.
|
|
1153
1223
|
"""
|
|
1154
1224
|
request = GetRobotRequest(id=robot_id)
|
|
1155
1225
|
response: GetRobotResponse = await self._app_client.GetRobot(request, metadata=self._metadata)
|
|
@@ -1164,60 +1234,70 @@ class AppClient:
|
|
|
1164
1234
|
|
|
1165
1235
|
Args:
|
|
1166
1236
|
org_id (str): The ID of the organization to list rover rental robots for.
|
|
1167
|
-
You can obtain your organization ID from the
|
|
1237
|
+
You can obtain your organization ID from the organization settings page.
|
|
1168
1238
|
|
|
1169
1239
|
Returns:
|
|
1170
1240
|
List[viam.proto.app.RoverRentalRobot]: The list of rover rental robots.
|
|
1171
1241
|
|
|
1172
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1242
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/>`_.
|
|
1173
1243
|
"""
|
|
1174
1244
|
request = GetRoverRentalRobotsRequest(org_id=org_id)
|
|
1175
1245
|
response: GetRoverRentalRobotsResponse = await self._app_client.GetRoverRentalRobots(request, metadata=self._metadata)
|
|
1176
1246
|
return list(response.robots)
|
|
1177
1247
|
|
|
1178
1248
|
async def get_robot_parts(self, robot_id: str) -> List[RobotPart]:
|
|
1179
|
-
"""Get a list of all the parts under a specific
|
|
1249
|
+
"""Get a list of all the parts under a specific machine.
|
|
1180
1250
|
|
|
1181
1251
|
::
|
|
1182
1252
|
|
|
1183
1253
|
list_of_parts = await cloud.get_robot_parts(
|
|
1184
|
-
robot_id="1a123456-x1yz-0ab0-a12xyzabc"
|
|
1254
|
+
robot_id="1a123456-x1yz-0ab0-a12xyzabc"
|
|
1255
|
+
)
|
|
1185
1256
|
|
|
1186
1257
|
Args:
|
|
1187
|
-
robot_id (str): ID of the
|
|
1258
|
+
robot_id (str): ID of the machine to get parts from.
|
|
1188
1259
|
|
|
1189
1260
|
Raises:
|
|
1190
|
-
GRPCError: If an invalid
|
|
1261
|
+
GRPCError: If an invalid machine ID is passed.
|
|
1191
1262
|
|
|
1192
1263
|
Returns:
|
|
1193
|
-
List[viam.app.app_client.RobotPart]: The list of
|
|
1264
|
+
List[viam.app.app_client.RobotPart]: The list of machine parts.
|
|
1194
1265
|
|
|
1195
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1266
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobotparts>`_.
|
|
1196
1267
|
"""
|
|
1197
1268
|
request = GetRobotPartsRequest(robot_id=robot_id)
|
|
1198
1269
|
response: GetRobotPartsResponse = await self._app_client.GetRobotParts(request, metadata=self._metadata)
|
|
1199
1270
|
return [RobotPart.from_proto(robot_part=part) for part in response.parts]
|
|
1200
1271
|
|
|
1201
1272
|
async def get_robot_part(self, robot_part_id: str, dest: Optional[str] = None, indent: int = 4) -> RobotPart:
|
|
1202
|
-
"""Get a
|
|
1273
|
+
"""Get a machine part including its part config, part address, and other information.
|
|
1203
1274
|
|
|
1204
1275
|
::
|
|
1205
1276
|
|
|
1206
1277
|
my_robot_part = await cloud.get_robot_part(
|
|
1207
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1278
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1279
|
+
)
|
|
1280
|
+
# Get the part's config
|
|
1281
|
+
machine_part_config = my_robot_part.robot_config
|
|
1282
|
+
# Get the part's address
|
|
1283
|
+
address = my_robot_part.fqdn
|
|
1284
|
+
# Check if machine is live (last access time less than 10 sec ago)
|
|
1285
|
+
if (time.time() - my_robot_part.last_access.timestamp()) <= 10000:
|
|
1286
|
+
print("Machine is live.")
|
|
1287
|
+
|
|
1288
|
+
Args:
|
|
1289
|
+
robot_part_id (str): ID of the machine part to get. You can retrieve this value by navigating to the machine's page,
|
|
1290
|
+
clicking on the part status dropdown, and clicking the copy icon next to Part ID.
|
|
1291
|
+
dest (Optional[str]): Optional filepath to write the machine part's config file in JSON format to.
|
|
1212
1292
|
indent (int): Size (in number of spaces) of indent when writing config to `dest`. Defaults to 4.
|
|
1213
1293
|
|
|
1214
1294
|
Raises:
|
|
1215
|
-
GRPCError: If an invalid
|
|
1295
|
+
GRPCError: If an invalid machine part ID is passed.
|
|
1216
1296
|
|
|
1217
1297
|
Returns:
|
|
1218
|
-
viam.app.app_client.RobotPart: The
|
|
1298
|
+
viam.app.app_client.RobotPart: The machine part.
|
|
1219
1299
|
|
|
1220
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1300
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobotpart>`_.
|
|
1221
1301
|
"""
|
|
1222
1302
|
request = GetRobotPartRequest(id=robot_part_id)
|
|
1223
1303
|
response: GetRobotPartResponse = await self._app_client.GetRobotPart(request, metadata=self._metadata)
|
|
@@ -1245,10 +1325,12 @@ class AppClient:
|
|
|
1245
1325
|
::
|
|
1246
1326
|
|
|
1247
1327
|
part_logs = await cloud.get_robot_part_logs(
|
|
1248
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22",
|
|
1328
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22",
|
|
1329
|
+
num_log_entries=20
|
|
1330
|
+
)
|
|
1249
1331
|
|
|
1250
1332
|
Args:
|
|
1251
|
-
robot_part_id (str): ID of the
|
|
1333
|
+
robot_part_id (str): ID of the machine part to get logs from.
|
|
1252
1334
|
filter (Optional[str]): Only include logs with messages that contain the string `filter`. Defaults to empty string "" (that is,
|
|
1253
1335
|
no filter).
|
|
1254
1336
|
dest (Optional[str]): Optional filepath to write the log entries to.
|
|
@@ -1262,7 +1344,7 @@ class AppClient:
|
|
|
1262
1344
|
Returns:
|
|
1263
1345
|
List[viam.app.app_client.LogEntry]: The list of log entries.
|
|
1264
1346
|
|
|
1265
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1347
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobotpartlogs>`_.
|
|
1266
1348
|
"""
|
|
1267
1349
|
if num_log_entries < 0:
|
|
1268
1350
|
raise ValueError("'num_log_entries must be at least 0.")
|
|
@@ -1309,21 +1391,22 @@ class AppClient:
|
|
|
1309
1391
|
async def tail_robot_part_logs(
|
|
1310
1392
|
self, robot_part_id: str, errors_only: bool = True, filter: Optional[str] = None
|
|
1311
1393
|
) -> _LogsStream[List[LogEntry]]:
|
|
1312
|
-
"""Get an asynchronous iterator that receives live
|
|
1394
|
+
"""Get an asynchronous iterator that receives live machine part logs.
|
|
1313
1395
|
|
|
1314
1396
|
::
|
|
1315
1397
|
|
|
1316
1398
|
logs_stream = await cloud.tail_robot_part_logs(
|
|
1317
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1399
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1400
|
+
)
|
|
1318
1401
|
|
|
1319
1402
|
Args:
|
|
1320
|
-
robot_part_id (str): ID of the
|
|
1403
|
+
robot_part_id (str): ID of the machine part to retrieve logs from.
|
|
1321
1404
|
errors_only (bool): Boolean specifying whether or not to only include error logs. Defaults to True.
|
|
1322
1405
|
filter (Optional[str]): Only include logs with messages that contain the string `filter`. Defaults to empty string "" (that is,
|
|
1323
1406
|
no filter).
|
|
1324
1407
|
|
|
1325
1408
|
Returns:
|
|
1326
|
-
_LogsStream[List[LogEntry]]: The asynchronous iterator receiving live
|
|
1409
|
+
_LogsStream[List[LogEntry]]: The asynchronous iterator receiving live machine part logs.
|
|
1327
1410
|
"""
|
|
1328
1411
|
|
|
1329
1412
|
async def read() -> AsyncIterator[List[LogEntry]]:
|
|
@@ -1342,118 +1425,131 @@ class AppClient:
|
|
|
1342
1425
|
return _LogsStreamWithIterator(read())
|
|
1343
1426
|
|
|
1344
1427
|
async def get_robot_part_history(self, robot_part_id: str) -> List[RobotPartHistoryEntry]:
|
|
1345
|
-
"""Get a list containing the history of a
|
|
1428
|
+
"""Get a list containing the history of a machine part.
|
|
1346
1429
|
|
|
1347
1430
|
::
|
|
1348
1431
|
|
|
1349
1432
|
part_history = await cloud.get_robot_part_history(
|
|
1350
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1433
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1434
|
+
)
|
|
1351
1435
|
|
|
1352
1436
|
Args:
|
|
1353
|
-
robot_part_id (str): ID of the
|
|
1437
|
+
robot_part_id (str): ID of the machine part to retrieve history from.
|
|
1354
1438
|
|
|
1355
1439
|
Raises:
|
|
1356
|
-
GRPCError: If an invalid
|
|
1440
|
+
GRPCError: If an invalid machine part ID is provided.
|
|
1357
1441
|
|
|
1358
1442
|
Returns:
|
|
1359
|
-
List[viam.app.app_client.RobotPartHistoryEntry]: The list of the
|
|
1443
|
+
List[viam.app.app_client.RobotPartHistoryEntry]: The list of the machine part's history.
|
|
1360
1444
|
|
|
1361
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1445
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobotapikeys>`_.
|
|
1362
1446
|
"""
|
|
1363
1447
|
request = GetRobotPartHistoryRequest(id=robot_part_id)
|
|
1364
1448
|
response: GetRobotPartHistoryResponse = await self._app_client.GetRobotPartHistory(request, metadata=self._metadata)
|
|
1365
1449
|
return [RobotPartHistoryEntry.from_proto(part_history) for part_history in response.history]
|
|
1366
1450
|
|
|
1367
|
-
async def update_robot_part(
|
|
1368
|
-
|
|
1451
|
+
async def update_robot_part(
|
|
1452
|
+
self, robot_part_id: str, name: str, robot_config: Optional[Mapping[str, Any]] = None, last_known_update: Optional[datetime] = None
|
|
1453
|
+
) -> RobotPart:
|
|
1454
|
+
"""Change the name and assign an optional new configuration to a machine part.
|
|
1369
1455
|
|
|
1370
1456
|
::
|
|
1371
1457
|
|
|
1372
|
-
|
|
1373
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1458
|
+
my_machine_part = await cloud.update_robot_part(
|
|
1459
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1460
|
+
)
|
|
1374
1461
|
|
|
1375
1462
|
Args:
|
|
1376
1463
|
robot_part_id (str): ID of the robot part to update.
|
|
1377
1464
|
name (str): New name to be updated on the robot part.
|
|
1378
|
-
robot_config (Mapping[str, Any]): Optional new config represented as a dictionary to be updated on the
|
|
1465
|
+
robot_config (Mapping[str, Any]): Optional new config represented as a dictionary to be updated on the machine part. The machine
|
|
1379
1466
|
part's config will remain as is (no change) if one isn't passed.
|
|
1380
|
-
|
|
1467
|
+
last_known_update (datetime): Optional time of the last known update to this part's config. If provided, this will result in a
|
|
1468
|
+
GRPCError if the upstream config has changed since this time, indicating that the local config is out of date. Omitting this
|
|
1469
|
+
parameter will result in an overwrite of the upstream config.
|
|
1381
1470
|
Raises:
|
|
1382
|
-
GRPCError: If either an invalid
|
|
1383
|
-
|
|
1471
|
+
GRPCError: If either an invalid machine part ID, name, or config is passed, or if the upstream config has changed since
|
|
1472
|
+
last_known_update.
|
|
1384
1473
|
Returns:
|
|
1385
1474
|
viam.app.app_client.RobotPart: The newly updated robot part.
|
|
1386
1475
|
|
|
1387
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1476
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updaterobotpart>`_.
|
|
1388
1477
|
"""
|
|
1389
|
-
request = UpdateRobotPartRequest(
|
|
1478
|
+
request = UpdateRobotPartRequest(
|
|
1479
|
+
id=robot_part_id,
|
|
1480
|
+
name=name,
|
|
1481
|
+
robot_config=dict_to_struct(robot_config) if robot_config else None,
|
|
1482
|
+
last_known_update=datetime_to_timestamp(last_known_update),
|
|
1483
|
+
)
|
|
1390
1484
|
response: UpdateRobotPartResponse = await self._app_client.UpdateRobotPart(request, metadata=self._metadata)
|
|
1391
1485
|
return RobotPart.from_proto(robot_part=response.part)
|
|
1392
1486
|
|
|
1393
1487
|
async def new_robot_part(self, robot_id: str, part_name: str) -> str:
|
|
1394
|
-
"""Create a new
|
|
1488
|
+
"""Create a new machine part.
|
|
1395
1489
|
|
|
1396
1490
|
::
|
|
1397
1491
|
|
|
1398
1492
|
new_part_id = await cloud.new_robot_part(
|
|
1399
|
-
robot_id="1a123456-x1yz-0ab0-a12xyzabc", part_name="myNewSubPart"
|
|
1493
|
+
robot_id="1a123456-x1yz-0ab0-a12xyzabc", part_name="myNewSubPart"
|
|
1494
|
+
)
|
|
1400
1495
|
|
|
1401
1496
|
Args:
|
|
1402
|
-
robot_id (str): ID of the
|
|
1497
|
+
robot_id (str): ID of the machine to create a new part for.
|
|
1403
1498
|
part_name (str): Name of the new part.
|
|
1404
1499
|
|
|
1405
1500
|
Raises:
|
|
1406
|
-
GRPCError: If either an invalid
|
|
1501
|
+
GRPCError: If either an invalid machine ID or name is passed.
|
|
1407
1502
|
|
|
1408
1503
|
Returns:
|
|
1409
|
-
str: The new
|
|
1504
|
+
str: The new machine part's ID.
|
|
1410
1505
|
|
|
1411
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1506
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#newrobotpart>`_.
|
|
1412
1507
|
"""
|
|
1413
1508
|
request = NewRobotPartRequest(robot_id=robot_id, part_name=part_name)
|
|
1414
1509
|
response: NewRobotPartResponse = await self._app_client.NewRobotPart(request, metadata=self._metadata)
|
|
1415
1510
|
return response.part_id
|
|
1416
1511
|
|
|
1417
1512
|
async def delete_robot_part(self, robot_part_id: str) -> None:
|
|
1418
|
-
"""Delete the specified
|
|
1513
|
+
"""Delete the specified machine part.
|
|
1419
1514
|
|
|
1420
1515
|
::
|
|
1421
1516
|
|
|
1422
1517
|
await cloud.delete_robot_part(
|
|
1423
|
-
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1518
|
+
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
|
|
1519
|
+
)
|
|
1424
1520
|
|
|
1425
1521
|
Args:
|
|
1426
|
-
robot_part_id (str): ID of the
|
|
1522
|
+
robot_part_id (str): ID of the machine part to delete. Must be specified.
|
|
1427
1523
|
|
|
1428
1524
|
Raises:
|
|
1429
|
-
GRPCError: If an invalid
|
|
1525
|
+
GRPCError: If an invalid machine part ID is passed.
|
|
1430
1526
|
|
|
1431
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1527
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleterobotpart>`_.
|
|
1432
1528
|
"""
|
|
1433
1529
|
request = DeleteRobotPartRequest(part_id=robot_part_id)
|
|
1434
1530
|
await self._app_client.DeleteRobotPart(request, metadata=self._metadata)
|
|
1435
1531
|
|
|
1436
1532
|
async def get_robot_api_keys(self, robot_id: str) -> List[APIKeyWithAuthorizations]:
|
|
1437
|
-
"""Gets the
|
|
1533
|
+
"""Gets the API Keys for the machine.
|
|
1438
1534
|
|
|
1439
1535
|
::
|
|
1440
1536
|
|
|
1441
|
-
await cloud.get_robot_api_keys(robot_id="robot-id")
|
|
1537
|
+
api_keys = await cloud.get_robot_api_keys(robot_id="robot-id")
|
|
1442
1538
|
|
|
1443
1539
|
Args:
|
|
1444
|
-
robot_id (str): The ID of the
|
|
1540
|
+
robot_id (str): The ID of the machine.
|
|
1445
1541
|
|
|
1446
1542
|
Returns:
|
|
1447
1543
|
List[APIKeyWithAuthorizations]: The list of API keys.
|
|
1448
1544
|
|
|
1449
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1545
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getrobotapikeys>`_.
|
|
1450
1546
|
"""
|
|
1451
1547
|
request = GetRobotAPIKeysRequest(robot_id=robot_id)
|
|
1452
1548
|
response: GetRobotAPIKeysResponse = await self._app_client.GetRobotAPIKeys(request, metadata=self._metadata)
|
|
1453
1549
|
return list(response.api_keys)
|
|
1454
1550
|
|
|
1455
1551
|
async def mark_part_as_main(self, robot_part_id: str) -> None:
|
|
1456
|
-
"""Mark a
|
|
1552
|
+
"""Mark a machine part as the main part of a machine.
|
|
1457
1553
|
|
|
1458
1554
|
::
|
|
1459
1555
|
|
|
@@ -1461,18 +1557,18 @@ class AppClient:
|
|
|
1461
1557
|
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
|
|
1462
1558
|
|
|
1463
1559
|
Args:
|
|
1464
|
-
robot_part_id (str): ID of the
|
|
1560
|
+
robot_part_id (str): ID of the machine part to mark as main.
|
|
1465
1561
|
|
|
1466
1562
|
Raises:
|
|
1467
|
-
GRPCError: If an invalid
|
|
1563
|
+
GRPCError: If an invalid machine part ID is passed.
|
|
1468
1564
|
|
|
1469
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1565
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#markpartasmain>`_.
|
|
1470
1566
|
"""
|
|
1471
1567
|
request = MarkPartAsMainRequest(part_id=robot_part_id)
|
|
1472
1568
|
await self._app_client.MarkPartAsMain(request, metadata=self._metadata)
|
|
1473
1569
|
|
|
1474
1570
|
async def mark_part_for_restart(self, robot_part_id: str) -> None:
|
|
1475
|
-
"""Mark the specified
|
|
1571
|
+
"""Mark the specified machine part for restart.
|
|
1476
1572
|
|
|
1477
1573
|
::
|
|
1478
1574
|
|
|
@@ -1480,18 +1576,18 @@ class AppClient:
|
|
|
1480
1576
|
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
|
|
1481
1577
|
|
|
1482
1578
|
Args:
|
|
1483
|
-
robot_part_id (str): ID of the
|
|
1579
|
+
robot_part_id (str): ID of the machine part to mark for restart.
|
|
1484
1580
|
|
|
1485
1581
|
Raises:
|
|
1486
|
-
GRPCError: If an invalid
|
|
1582
|
+
GRPCError: If an invalid machine part ID is passed.
|
|
1487
1583
|
|
|
1488
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1584
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#markpartforrestart>`_.
|
|
1489
1585
|
"""
|
|
1490
1586
|
request = MarkPartForRestartRequest(part_id=robot_part_id)
|
|
1491
1587
|
await self._app_client.MarkPartForRestart(request, metadata=self._metadata)
|
|
1492
1588
|
|
|
1493
1589
|
async def create_robot_part_secret(self, robot_part_id: str) -> RobotPart:
|
|
1494
|
-
"""Create a
|
|
1590
|
+
"""Create a machine part secret.
|
|
1495
1591
|
|
|
1496
1592
|
::
|
|
1497
1593
|
|
|
@@ -1499,22 +1595,22 @@ class AppClient:
|
|
|
1499
1595
|
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
|
|
1500
1596
|
|
|
1501
1597
|
Args:
|
|
1502
|
-
robot_part_id (str): ID of the
|
|
1598
|
+
robot_part_id (str): ID of the machine part to create a secret for.
|
|
1503
1599
|
|
|
1504
1600
|
Raises:
|
|
1505
|
-
GRPCError: If an invalid
|
|
1601
|
+
GRPCError: If an invalid machine part ID is passed.
|
|
1506
1602
|
|
|
1507
1603
|
Returns:
|
|
1508
|
-
viam.app.app_client.RobotPart: The
|
|
1604
|
+
viam.app.app_client.RobotPart: The machine part the new secret was generated for.
|
|
1509
1605
|
|
|
1510
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1606
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createrobotpartsecret>`_.
|
|
1511
1607
|
"""
|
|
1512
1608
|
request = CreateRobotPartSecretRequest(part_id=robot_part_id)
|
|
1513
1609
|
response: CreateRobotPartSecretResponse = await self._app_client.CreateRobotPartSecret(request, metadata=self._metadata)
|
|
1514
1610
|
return RobotPart.from_proto(response.part)
|
|
1515
1611
|
|
|
1516
1612
|
async def delete_robot_part_secret(self, robot_part_id: str, secret_id: str) -> None:
|
|
1517
|
-
"""Delete a
|
|
1613
|
+
"""Delete a machine part secret.
|
|
1518
1614
|
|
|
1519
1615
|
::
|
|
1520
1616
|
|
|
@@ -1523,26 +1619,26 @@ class AppClient:
|
|
|
1523
1619
|
secret_id="123xyz12-abcd-4321-12ab-12xy1xyz12xy")
|
|
1524
1620
|
|
|
1525
1621
|
Args:
|
|
1526
|
-
robot_part_id (str): ID of the
|
|
1622
|
+
robot_part_id (str): ID of the machine part to delete the secret from.
|
|
1527
1623
|
secret_id (str): ID of the secret to delete.
|
|
1528
1624
|
|
|
1529
1625
|
Raises:
|
|
1530
|
-
GRPCError: If an invalid
|
|
1626
|
+
GRPCError: If an invalid machine part ID or secret ID is passed.
|
|
1531
1627
|
|
|
1532
|
-
For more information, see `Fleet Management API <
|
|
1628
|
+
For more information, see `Fleet Management API <hhttps://docs.viam.com/dev/reference/apis/fleet/#deleterobotpartsecret>`_.
|
|
1533
1629
|
"""
|
|
1534
1630
|
request = DeleteRobotPartSecretRequest(part_id=robot_part_id, secret_id=secret_id)
|
|
1535
1631
|
await self._app_client.DeleteRobotPartSecret(request, metadata=self._metadata)
|
|
1536
1632
|
|
|
1537
1633
|
async def list_robots(self, location_id: Optional[str] = None) -> List[Robot]:
|
|
1538
|
-
"""Get a list of all
|
|
1634
|
+
"""Get a list of all machines under the specified location.
|
|
1539
1635
|
|
|
1540
1636
|
::
|
|
1541
1637
|
|
|
1542
1638
|
list_of_machines = await cloud.list_robots(location_id="123ab12345")
|
|
1543
1639
|
|
|
1544
1640
|
Args:
|
|
1545
|
-
location_id (Optional[str]): ID of the location to retrieve the
|
|
1641
|
+
location_id (Optional[str]): ID of the location to retrieve the machines from. Defaults to the location ID provided at
|
|
1546
1642
|
`AppClient` instantiation.
|
|
1547
1643
|
|
|
1548
1644
|
Raises:
|
|
@@ -1552,22 +1648,22 @@ class AppClient:
|
|
|
1552
1648
|
Returns:
|
|
1553
1649
|
List[viam.proto.app.Robot]: The list of robots.
|
|
1554
1650
|
|
|
1555
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1651
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listrobots>`_.
|
|
1556
1652
|
"""
|
|
1557
|
-
request = ListRobotsRequest(location_id=location_id if location_id else
|
|
1653
|
+
request = ListRobotsRequest(location_id=location_id if location_id else "")
|
|
1558
1654
|
response: ListRobotsResponse = await self._app_client.ListRobots(request, metadata=self._metadata)
|
|
1559
1655
|
return list(response.robots)
|
|
1560
1656
|
|
|
1561
1657
|
async def new_robot(self, name: str, location_id: Optional[str] = None) -> str:
|
|
1562
|
-
"""Create a new
|
|
1658
|
+
"""Create a new machine.
|
|
1563
1659
|
|
|
1564
1660
|
::
|
|
1565
1661
|
|
|
1566
|
-
new_machine_id = await cloud.new_robot(name="beepboop")
|
|
1662
|
+
new_machine_id = await cloud.new_robot(name="beepboop", location_id="my-location-id")
|
|
1567
1663
|
|
|
1568
1664
|
Args:
|
|
1569
|
-
name (str): Name of the new
|
|
1570
|
-
location_id (Optional[str]): ID of the location under which to create the
|
|
1665
|
+
name (str): Name of the new machine.
|
|
1666
|
+
location_id (Optional[str]): ID of the location under which to create the machine. Defaults to the current authorized location.
|
|
1571
1667
|
|
|
1572
1668
|
Raises:
|
|
1573
1669
|
GRPCError: If an invalid location ID is passed or one isn't passed and there was no location ID provided at `AppClient`
|
|
@@ -1576,56 +1672,56 @@ class AppClient:
|
|
|
1576
1672
|
Returns:
|
|
1577
1673
|
str: The new robot's ID.
|
|
1578
1674
|
|
|
1579
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1675
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#newrobot>`_.
|
|
1580
1676
|
"""
|
|
1581
|
-
request = NewRobotRequest(location=location_id if location_id else
|
|
1677
|
+
request = NewRobotRequest(location=location_id if location_id else "", name=name)
|
|
1582
1678
|
response: NewRobotResponse = await self._app_client.NewRobot(request, metadata=self._metadata)
|
|
1583
1679
|
return response.id
|
|
1584
1680
|
|
|
1585
1681
|
async def update_robot(self, robot_id: str, name: str, location_id: Optional[str] = None) -> Robot:
|
|
1586
|
-
"""Change the name of an existing
|
|
1682
|
+
"""Change the name of an existing machine.
|
|
1587
1683
|
|
|
1588
1684
|
::
|
|
1589
1685
|
|
|
1590
1686
|
updated_robot = await cloud.update_robot(
|
|
1591
1687
|
robot_id="1a123456-x1yz-0ab0-a12xyzabc",
|
|
1592
|
-
name="Orange-Robot"
|
|
1688
|
+
name="Orange-Robot",
|
|
1689
|
+
location_id="23ab12345"
|
|
1690
|
+
)
|
|
1593
1691
|
|
|
1594
1692
|
Args:
|
|
1595
|
-
robot_id (str): ID of the
|
|
1596
|
-
name (str): New name to be updated on the
|
|
1597
|
-
location_id (Optional[str]): ID of the location under which the
|
|
1693
|
+
robot_id (str): ID of the machine to update.
|
|
1694
|
+
name (str): New name to be updated on the machine.
|
|
1695
|
+
location_id (Optional[str]): ID of the location under which the machine exists. Defaults to the location ID provided at
|
|
1598
1696
|
`AppClient` instantiation
|
|
1599
1697
|
|
|
1600
1698
|
Raises:
|
|
1601
|
-
GRPCError: If either an invalid
|
|
1602
|
-
ID provided at `AppClient` instantiation.
|
|
1699
|
+
GRPCError: If either an invalid machine ID, name, or location ID is passed or a location ID isn't passed and there was no
|
|
1700
|
+
location ID provided at `AppClient` instantiation.
|
|
1603
1701
|
|
|
1604
1702
|
Returns:
|
|
1605
|
-
viam.proto.app.Robot: The newly updated
|
|
1703
|
+
viam.proto.app.Robot: The newly updated machine.
|
|
1606
1704
|
|
|
1607
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1705
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updaterobot>`_.
|
|
1608
1706
|
"""
|
|
1609
|
-
request = UpdateRobotRequest(
|
|
1610
|
-
id=robot_id, name=name, location=location_id if location_id else self._location_id if self._location_id else ""
|
|
1611
|
-
)
|
|
1707
|
+
request = UpdateRobotRequest(id=robot_id, name=name, location=location_id if location_id else "")
|
|
1612
1708
|
response: UpdateRobotResponse = await self._app_client.UpdateRobot(request, metadata=self._metadata)
|
|
1613
1709
|
return response.robot
|
|
1614
1710
|
|
|
1615
1711
|
async def delete_robot(self, robot_id: str) -> None:
|
|
1616
|
-
"""Delete the specified
|
|
1712
|
+
"""Delete the specified machine.
|
|
1617
1713
|
|
|
1618
1714
|
::
|
|
1619
1715
|
|
|
1620
1716
|
await cloud.delete_robot(robot_id="1a123456-x1yz-0ab0-a12xyzabc")
|
|
1621
1717
|
|
|
1622
1718
|
Args:
|
|
1623
|
-
robot_id (str): ID of the
|
|
1719
|
+
robot_id (str): ID of the machine to delete.
|
|
1624
1720
|
|
|
1625
1721
|
Raises:
|
|
1626
|
-
GRPCError: If an invalid
|
|
1722
|
+
GRPCError: If an invalid machine ID is passed.
|
|
1627
1723
|
|
|
1628
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1724
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleterobot>`_.
|
|
1629
1725
|
"""
|
|
1630
1726
|
request = DeleteRobotRequest(id=robot_id)
|
|
1631
1727
|
await self._app_client.DeleteRobot(request, metadata=self._metadata)
|
|
@@ -1641,9 +1737,9 @@ class AppClient:
|
|
|
1641
1737
|
|
|
1642
1738
|
Args:
|
|
1643
1739
|
org_id (str): The ID of the organization to list fragments for.
|
|
1644
|
-
You can obtain your organization ID from the
|
|
1645
|
-
show_public (bool):
|
|
1646
|
-
|
|
1740
|
+
You can obtain your organization ID from the organization settings page.
|
|
1741
|
+
show_public (bool): Optional boolean specifying whether or not to only show public fragments. If True, only public fragments
|
|
1742
|
+
will return. If False, only private fragments will return. Defaults to True.
|
|
1647
1743
|
|
|
1648
1744
|
.. deprecated:: 0.25.0
|
|
1649
1745
|
Use ``visibilities`` instead.
|
|
@@ -1653,7 +1749,7 @@ class AppClient:
|
|
|
1653
1749
|
Returns:
|
|
1654
1750
|
List[viam.app.app_client.Fragment]: The list of fragments.
|
|
1655
1751
|
|
|
1656
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1752
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listfragments>`_.
|
|
1657
1753
|
"""
|
|
1658
1754
|
request = ListFragmentsRequest(
|
|
1659
1755
|
organization_id=org_id,
|
|
@@ -1663,7 +1759,7 @@ class AppClient:
|
|
|
1663
1759
|
response: ListFragmentsResponse = await self._app_client.ListFragments(request, metadata=self._metadata)
|
|
1664
1760
|
return [Fragment.from_proto(fragment=fragment) for fragment in response.fragments]
|
|
1665
1761
|
|
|
1666
|
-
async def get_fragment(self, fragment_id: str) -> Fragment:
|
|
1762
|
+
async def get_fragment(self, fragment_id: str, version: Optional[str] = None) -> Fragment:
|
|
1667
1763
|
"""Get a fragment.
|
|
1668
1764
|
|
|
1669
1765
|
::
|
|
@@ -1675,6 +1771,7 @@ class AppClient:
|
|
|
1675
1771
|
|
|
1676
1772
|
Args:
|
|
1677
1773
|
fragment_id (str): ID of the fragment to get.
|
|
1774
|
+
version (str): Optional specification of the fragment version to get (revision or tag).
|
|
1678
1775
|
|
|
1679
1776
|
Raises:
|
|
1680
1777
|
GRPCError: If an invalid fragment ID is passed.
|
|
@@ -1682,9 +1779,9 @@ class AppClient:
|
|
|
1682
1779
|
Returns:
|
|
1683
1780
|
viam.app.app_client.Fragment: The fragment.
|
|
1684
1781
|
|
|
1685
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1782
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getfragment>`_.
|
|
1686
1783
|
"""
|
|
1687
|
-
request = GetFragmentRequest(id=fragment_id)
|
|
1784
|
+
request = GetFragmentRequest(id=fragment_id, version=version)
|
|
1688
1785
|
response: GetFragmentResponse = await self._app_client.GetFragment(request, metadata=self._metadata)
|
|
1689
1786
|
return Fragment.from_proto(fragment=response.fragment)
|
|
1690
1787
|
|
|
@@ -1697,7 +1794,7 @@ class AppClient:
|
|
|
1697
1794
|
|
|
1698
1795
|
Args:
|
|
1699
1796
|
org_id (str): The ID of the organization to create the fragment within.
|
|
1700
|
-
You can obtain your organization ID from the
|
|
1797
|
+
You can obtain your organization ID from the organization settings page.
|
|
1701
1798
|
name (str): Name of the fragment.
|
|
1702
1799
|
config (Optional[Mapping[str, Any]]): Optional Dictionary representation of new config to assign to specified fragment. Can be
|
|
1703
1800
|
assigned by updating the fragment.
|
|
@@ -1708,7 +1805,7 @@ class AppClient:
|
|
|
1708
1805
|
Returns:
|
|
1709
1806
|
viam.app.app_client.Fragment: The newly created fragment.
|
|
1710
1807
|
|
|
1711
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1808
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createfragment>`_.
|
|
1712
1809
|
"""
|
|
1713
1810
|
request = CreateFragmentRequest(name=name, config=dict_to_struct(config) if config else None, organization_id=org_id)
|
|
1714
1811
|
response: CreateFragmentResponse = await self._app_client.CreateFragment(request, metadata=self._metadata)
|
|
@@ -1721,6 +1818,7 @@ class AppClient:
|
|
|
1721
1818
|
config: Optional[Mapping[str, Any]] = None,
|
|
1722
1819
|
public: Optional[bool] = None,
|
|
1723
1820
|
visibility: Optional[Fragment.Visibility] = None,
|
|
1821
|
+
last_known_update: Optional[datetime] = None,
|
|
1724
1822
|
) -> Fragment:
|
|
1725
1823
|
"""Update a fragment name AND its config and/or visibility.
|
|
1726
1824
|
|
|
@@ -1735,22 +1833,24 @@ class AppClient:
|
|
|
1735
1833
|
name (str): New name to associate with the fragment.
|
|
1736
1834
|
config (Optional[Mapping[str, Any]]): Optional Dictionary representation of new config to assign to specified fragment. Not
|
|
1737
1835
|
passing this parameter will leave the fragment's config unchanged.
|
|
1738
|
-
public (bool):
|
|
1739
|
-
|
|
1836
|
+
public (bool): Boolean specifying whether the fragment is public. Not passing this parameter will leave the fragment's
|
|
1837
|
+
visibility unchanged. A fragment is private by default when created.
|
|
1740
1838
|
|
|
1741
1839
|
.. deprecated:: 0.25.0
|
|
1742
1840
|
Use ``visibility`` instead.
|
|
1743
1841
|
visibility (Optional[FragmentVisibility]): Optional FragmentVisibility list specifying who should be allowed
|
|
1744
1842
|
to view the fragment. Not passing this parameter will leave the fragment's visibility unchanged.
|
|
1745
1843
|
A fragment is private by default when created.
|
|
1746
|
-
|
|
1844
|
+
last_known_update (datetime): Optional time of the last known update to this fragment's config. If provided, this will result in
|
|
1845
|
+
a GRPCError if the upstream config has changed since this time, indicating that the local config is out of date. Omitting
|
|
1846
|
+
this parameter will result in an overwrite of the upstream config.
|
|
1747
1847
|
Raises:
|
|
1748
|
-
GRPCError: if an invalid ID, name, or config is passed.
|
|
1848
|
+
GRPCError: if an invalid ID, name, or config is passed, or if the upstream fragment config has changed since last_known_update.
|
|
1749
1849
|
|
|
1750
1850
|
Returns:
|
|
1751
1851
|
viam.app.app_client.Fragment: The newly updated fragment.
|
|
1752
1852
|
|
|
1753
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1853
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updatefragment>`_.
|
|
1754
1854
|
"""
|
|
1755
1855
|
request = UpdateFragmentRequest(
|
|
1756
1856
|
id=fragment_id,
|
|
@@ -1758,6 +1858,7 @@ class AppClient:
|
|
|
1758
1858
|
config=dict_to_struct(config) if config else None,
|
|
1759
1859
|
public=public,
|
|
1760
1860
|
visibility=visibility.to_proto() if visibility else None,
|
|
1861
|
+
last_known_update=datetime_to_timestamp(last_known_update),
|
|
1761
1862
|
)
|
|
1762
1863
|
response: UpdateFragmentResponse = await self._app_client.UpdateFragment(request, metadata=self._metadata)
|
|
1763
1864
|
return Fragment.from_proto(response.fragment)
|
|
@@ -1776,11 +1877,43 @@ class AppClient:
|
|
|
1776
1877
|
Raises:
|
|
1777
1878
|
GRPCError: If an invalid fragment ID is passed.
|
|
1778
1879
|
|
|
1779
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1880
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deletefragment>`_.
|
|
1780
1881
|
"""
|
|
1781
1882
|
request = DeleteFragmentRequest(id=fragment_id)
|
|
1782
1883
|
await self._app_client.DeleteFragment(request, metadata=self._metadata)
|
|
1783
1884
|
|
|
1885
|
+
async def get_fragment_history(
|
|
1886
|
+
self, id: str, page_token: Optional[str] = "", page_limit: Optional[int] = 10
|
|
1887
|
+
) -> List[FragmentHistoryEntry]:
|
|
1888
|
+
"""Get fragment history.
|
|
1889
|
+
|
|
1890
|
+
::
|
|
1891
|
+
|
|
1892
|
+
fragment_history = await cloud.get_fragment_history(
|
|
1893
|
+
id = "12a12ab1-1234-5678-abcd-abcd01234567",
|
|
1894
|
+
page_token = "pg-token",
|
|
1895
|
+
page_limit = 10
|
|
1896
|
+
)
|
|
1897
|
+
|
|
1898
|
+
Args:
|
|
1899
|
+
id (str): ID of the fragment to fetch history for.
|
|
1900
|
+
page_token (Optional[str]): the page token for the fragment history collection
|
|
1901
|
+
page_limit (Optional[int]): the number of fragment history documents to return in the result.
|
|
1902
|
+
The default page limit is 10.
|
|
1903
|
+
|
|
1904
|
+
Raises:
|
|
1905
|
+
GRPCError: if an invalid fragment id, page token or page limit is passed.
|
|
1906
|
+
|
|
1907
|
+
Returns:
|
|
1908
|
+
viam.app.app_client.FragmentHistoryResponse: A list of documents with the fragment history.
|
|
1909
|
+
|
|
1910
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getfragmenthistory>`_.
|
|
1911
|
+
"""
|
|
1912
|
+
|
|
1913
|
+
request = GetFragmentHistoryRequest(id=id, page_token=page_token, page_limit=page_limit)
|
|
1914
|
+
response: GetFragmentHistoryResponse = await self._app_client.GetFragmentHistory(request, metadata=self._metadata)
|
|
1915
|
+
return [FragmentHistoryEntry.from_proto(fragment_history) for fragment_history in response.history]
|
|
1916
|
+
|
|
1784
1917
|
async def add_role(
|
|
1785
1918
|
self,
|
|
1786
1919
|
org_id: str,
|
|
@@ -1794,15 +1927,16 @@ class AppClient:
|
|
|
1794
1927
|
::
|
|
1795
1928
|
|
|
1796
1929
|
await cloud.add_role(
|
|
1797
|
-
org_id="
|
|
1930
|
+
org_id="<YOUR-ORG-ID>",
|
|
1798
1931
|
identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
|
|
1799
1932
|
role="owner",
|
|
1800
1933
|
resource_type="location",
|
|
1801
|
-
resource_id="111ab12345"
|
|
1934
|
+
resource_id="111ab12345"
|
|
1935
|
+
)
|
|
1802
1936
|
|
|
1803
1937
|
Args:
|
|
1804
1938
|
org_id (str): The ID of the organization to create the role in.
|
|
1805
|
-
You can obtain your organization ID from the
|
|
1939
|
+
You can obtain your organization ID from the organization settings page.
|
|
1806
1940
|
identity_id (str): ID of the entity the role belongs to (for example, a user ID).
|
|
1807
1941
|
role (Union[Literal["owner"], Literal["operator"]]): The role to add.
|
|
1808
1942
|
resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource to add role to.
|
|
@@ -1812,7 +1946,7 @@ class AppClient:
|
|
|
1812
1946
|
Raises:
|
|
1813
1947
|
GRPCError: If either an invalid identity ID, role ID, resource type, or resource ID is passed.
|
|
1814
1948
|
|
|
1815
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1949
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#addrole>`_.
|
|
1816
1950
|
"""
|
|
1817
1951
|
authorization = await self._create_authorization(
|
|
1818
1952
|
organization_id=org_id,
|
|
@@ -1838,15 +1972,16 @@ class AppClient:
|
|
|
1838
1972
|
::
|
|
1839
1973
|
|
|
1840
1974
|
await cloud.remove_role(
|
|
1841
|
-
org_id="
|
|
1975
|
+
org_id="<YOUR-ORG-ID>",
|
|
1842
1976
|
identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
|
|
1843
1977
|
role="owner",
|
|
1844
1978
|
resource_type="location",
|
|
1845
|
-
resource_id="111ab12345"
|
|
1979
|
+
resource_id="111ab12345"
|
|
1980
|
+
)
|
|
1846
1981
|
|
|
1847
1982
|
Args:
|
|
1848
1983
|
org_id (str): The ID of the organization the role exists in.
|
|
1849
|
-
You can obtain your organization ID from the
|
|
1984
|
+
You can obtain your organization ID from the organization settings page.
|
|
1850
1985
|
identity_id (str): ID of the entity the role belongs to (for example, a user ID).
|
|
1851
1986
|
role (Union[Literal["owner"], Literal["operator"]]): The role to remove.
|
|
1852
1987
|
resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource the role is being
|
|
@@ -1856,7 +1991,7 @@ class AppClient:
|
|
|
1856
1991
|
Raises:
|
|
1857
1992
|
GRPCError: If either an invalid identity ID, role ID, resource type, or resource ID or is passed.
|
|
1858
1993
|
|
|
1859
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
1994
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#removerole>`_.
|
|
1860
1995
|
"""
|
|
1861
1996
|
authorization = await self._create_authorization(
|
|
1862
1997
|
organization_id=org_id,
|
|
@@ -1886,15 +2021,16 @@ class AppClient:
|
|
|
1886
2021
|
::
|
|
1887
2022
|
|
|
1888
2023
|
await cloud.change_role(
|
|
1889
|
-
organization_id="
|
|
2024
|
+
organization_id="<YOUR-ORG-ID>",
|
|
1890
2025
|
old_identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
|
|
1891
2026
|
old_role="operator",
|
|
1892
2027
|
old_resource_type="location",
|
|
1893
2028
|
old_resource_id="111ab12345",
|
|
1894
2029
|
new_identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
|
|
1895
|
-
new_role="owner",
|
|
2030
|
+
new_role="owner",
|
|
1896
2031
|
new_resource_type="organization",
|
|
1897
|
-
new_resource_id="abc12345"
|
|
2032
|
+
new_resource_id="abc12345"
|
|
2033
|
+
)
|
|
1898
2034
|
|
|
1899
2035
|
Args:
|
|
1900
2036
|
organization_id (str): ID of the organization
|
|
@@ -1904,13 +2040,13 @@ class AppClient:
|
|
|
1904
2040
|
added to. Must match `old_resource_id`.
|
|
1905
2041
|
old_resource_id (str): ID of the resource the role applies to (that is, either an organization, location, or robot ID).
|
|
1906
2042
|
|
|
1907
|
-
new_identity_id (str): New ID of the entity the role
|
|
2043
|
+
new_identity_id (str): New ID of the entity the role belongs to (for example, a user ID).
|
|
1908
2044
|
new_role (Union[Literal["owner"], Literal["operator"]]): The new role.
|
|
1909
2045
|
new_resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource to add role to.
|
|
1910
2046
|
Must match `new_resource_id`.
|
|
1911
2047
|
new_resource_id (str): New ID of the resource the role applies to (that is, either an organization, location, or robot ID).
|
|
1912
2048
|
|
|
1913
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2049
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#changerole>`_.
|
|
1914
2050
|
"""
|
|
1915
2051
|
old_authorization = await self._create_authorization(
|
|
1916
2052
|
organization_id=organization_id,
|
|
@@ -1938,7 +2074,7 @@ class AppClient:
|
|
|
1938
2074
|
::
|
|
1939
2075
|
|
|
1940
2076
|
list_of_auths = await cloud.list_authorizations(
|
|
1941
|
-
org_id="
|
|
2077
|
+
org_id="<YOUR-ORG-ID>",
|
|
1942
2078
|
resource_ids=["1a123456-x1yz-0ab0-a12xyzabc"])
|
|
1943
2079
|
|
|
1944
2080
|
Args:
|
|
@@ -1952,7 +2088,7 @@ class AppClient:
|
|
|
1952
2088
|
Returns:
|
|
1953
2089
|
List[viam.proto.app.Authorization]: The list of authorizations.
|
|
1954
2090
|
|
|
1955
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2091
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listauthorizations>`_.
|
|
1956
2092
|
"""
|
|
1957
2093
|
request = ListAuthorizationsRequest(organization_id=org_id, resource_ids=resource_ids)
|
|
1958
2094
|
response: ListAuthorizationsResponse = await self._app_client.ListAuthorizations(request, metadata=self._metadata)
|
|
@@ -1968,7 +2104,7 @@ class AppClient:
|
|
|
1968
2104
|
# Check whether the entity you're currently authenticated to has permission to control and/or
|
|
1969
2105
|
# read logs from robots in the "organization-identifier123" org
|
|
1970
2106
|
permissions = [AuthorizedPermissions(resource_type="organization",
|
|
1971
|
-
resource_id="
|
|
2107
|
+
resource_id="<YOUR-ORG-ID>",
|
|
1972
2108
|
permissions=["control_robot",
|
|
1973
2109
|
"read_robot_logs"])]
|
|
1974
2110
|
|
|
@@ -1984,13 +2120,13 @@ class AppClient:
|
|
|
1984
2120
|
Returns:
|
|
1985
2121
|
List[viam.proto.app.AuthorizedPermissions]: The permissions argument, with invalid permissions filtered out.
|
|
1986
2122
|
|
|
1987
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2123
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#checkpermissions>`_.
|
|
1988
2124
|
"""
|
|
1989
2125
|
request = CheckPermissionsRequest(permissions=permissions)
|
|
1990
2126
|
response: CheckPermissionsResponse = await self._app_client.CheckPermissions(request, metadata=self._metadata)
|
|
1991
2127
|
return list(response.authorized_permissions)
|
|
1992
2128
|
|
|
1993
|
-
async def get_registry_item(self, item_id: str) -> RegistryItem:
|
|
2129
|
+
async def get_registry_item(self, item_id: str, include_markdown_documentation: bool = False) -> RegistryItem:
|
|
1994
2130
|
"""Get registry item by ID.
|
|
1995
2131
|
|
|
1996
2132
|
::
|
|
@@ -1998,14 +2134,17 @@ class AppClient:
|
|
|
1998
2134
|
item = await cloud.get_registry_item("item-id")
|
|
1999
2135
|
|
|
2000
2136
|
Args:
|
|
2001
|
-
item_id (str): The ID of the registry item.
|
|
2137
|
+
item_id (str): The ID of the registry item. This is the namespace and name of the item in the
|
|
2138
|
+
form `namespace:name`. For example, `Viam's csi-cam-pi module's <https://app.viam.com/module/viam/csi-cam-pi>`_ item ID
|
|
2139
|
+
would be `viam:csi-cam-pi`. You can also use `org-id:name`. For example,
|
|
2140
|
+
`abc01234-0123-4567-ab12-a11a00a2aa22:training-script`.
|
|
2002
2141
|
|
|
2003
2142
|
Returns:
|
|
2004
2143
|
RegistryItem: The registry item.
|
|
2005
2144
|
|
|
2006
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2145
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getregistryitem>`_.
|
|
2007
2146
|
"""
|
|
2008
|
-
request = GetRegistryItemRequest(item_id=item_id)
|
|
2147
|
+
request = GetRegistryItemRequest(item_id=item_id, include_markdown_documentation=include_markdown_documentation)
|
|
2009
2148
|
response: GetRegistryItemResponse = await self._app_client.GetRegistryItem(request, metadata=self._metadata)
|
|
2010
2149
|
return response.item
|
|
2011
2150
|
|
|
@@ -2014,14 +2153,16 @@ class AppClient:
|
|
|
2014
2153
|
|
|
2015
2154
|
::
|
|
2016
2155
|
|
|
2017
|
-
|
|
2156
|
+
from viam.proto.app.packages import PackageType
|
|
2157
|
+
|
|
2158
|
+
await cloud.create_registry_item("<YOUR-ORG-ID>", "name", PackageType.PACKAGE_TYPE_ML_MODEL)
|
|
2018
2159
|
|
|
2019
2160
|
Args:
|
|
2020
2161
|
organization_id (str): The organization to create the registry item under.
|
|
2021
2162
|
name (str): The name of the registry item, which must be unique within your org.
|
|
2022
2163
|
type (PackageType.ValueType): The type of the item in the registry.
|
|
2023
2164
|
|
|
2024
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2165
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createregistryitem>`_.
|
|
2025
2166
|
"""
|
|
2026
2167
|
request = CreateRegistryItemRequest(organization_id=organization_id, name=name, type=type)
|
|
2027
2168
|
await self._app_client.CreateRegistryItem(request, metadata=self._metadata)
|
|
@@ -2033,13 +2174,24 @@ class AppClient:
|
|
|
2033
2174
|
|
|
2034
2175
|
::
|
|
2035
2176
|
|
|
2036
|
-
|
|
2177
|
+
from viam.proto.app.packages import PackageType
|
|
2178
|
+
from viam.proto.app import Visibility
|
|
2179
|
+
|
|
2180
|
+
await cloud.update_registry_item(
|
|
2181
|
+
"your-namespace:your-name",
|
|
2182
|
+
PackageType.PACKAGE_TYPE_ML_TRAINING,
|
|
2183
|
+
"description",
|
|
2184
|
+
Visibility.VISIBILITY_PUBLIC
|
|
2185
|
+
)
|
|
2037
2186
|
|
|
2038
2187
|
Args:
|
|
2039
|
-
item_id (str): The ID of the registry item
|
|
2188
|
+
item_id (str): The ID of the registry item, containing either the namespace and module name
|
|
2189
|
+
(for example, `my-org:my-module`) or organization ID and module name (`org-id:my-module`).
|
|
2040
2190
|
type (PackageType.ValueType): The type of the item in the registry.
|
|
2041
2191
|
description (str): The description of the registry item.
|
|
2042
2192
|
visibility (Visibility.ValueType): The visibility of the registry item.
|
|
2193
|
+
|
|
2194
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updateregistryitem>`_.
|
|
2043
2195
|
"""
|
|
2044
2196
|
|
|
2045
2197
|
request = UpdateRegistryItemRequest(item_id=item_id, type=type, description=description, visibility=visibility)
|
|
@@ -2057,6 +2209,29 @@ class AppClient:
|
|
|
2057
2209
|
) -> List[RegistryItem]:
|
|
2058
2210
|
"""List the registry items in an organization.
|
|
2059
2211
|
|
|
2212
|
+
::
|
|
2213
|
+
|
|
2214
|
+
from viam.proto.app.packages import PackageType
|
|
2215
|
+
from viam.proto.app import Visibility, RegistryItemStatus
|
|
2216
|
+
|
|
2217
|
+
# List private, published ml training scripts in your organization
|
|
2218
|
+
registry_items = await cloud.list_registry_items(
|
|
2219
|
+
organization_id="<YOUR-ORG-ID>",
|
|
2220
|
+
types=[PackageType.PACKAGE_TYPE_ML_TRAINING],
|
|
2221
|
+
visibilities=[Visibility.VISIBILITY_PRIVATE],
|
|
2222
|
+
platforms=[""],
|
|
2223
|
+
statuses=[RegistryItemStatus.REGISTRY_ITEM_STATUS_PUBLISHED]
|
|
2224
|
+
)
|
|
2225
|
+
|
|
2226
|
+
# List public, published linux modules in all organizations
|
|
2227
|
+
registry_items = await cloud.list_registry_items(
|
|
2228
|
+
organization_id="",
|
|
2229
|
+
types=[PackageType.PACKAGE_TYPE_MODULE],
|
|
2230
|
+
visibilities=[Visibility.VISIBILITY_PUBLIC],
|
|
2231
|
+
platforms=["linux/any"],
|
|
2232
|
+
statuses=[RegistryItemStatus.REGISTRY_ITEM_STATUS_PUBLISHED]
|
|
2233
|
+
)
|
|
2234
|
+
|
|
2060
2235
|
Args:
|
|
2061
2236
|
organization_id (str): The ID of the organization to return registry items for.
|
|
2062
2237
|
types (List[PackageType.ValueType]): The types of registry items.
|
|
@@ -2069,7 +2244,7 @@ class AppClient:
|
|
|
2069
2244
|
Returns:
|
|
2070
2245
|
List[RegistryItem]: The list of registry items.
|
|
2071
2246
|
|
|
2072
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2247
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listregistryitems>`_.
|
|
2073
2248
|
"""
|
|
2074
2249
|
request = ListRegistryItemsRequest(
|
|
2075
2250
|
organization_id=organization_id,
|
|
@@ -2088,12 +2263,13 @@ class AppClient:
|
|
|
2088
2263
|
|
|
2089
2264
|
::
|
|
2090
2265
|
|
|
2091
|
-
await cloud.delete_registry_item("
|
|
2266
|
+
await cloud.delete_registry_item("your-namespace:your-name")
|
|
2092
2267
|
|
|
2093
2268
|
Args:
|
|
2094
|
-
item_id (str): The ID of the registry item
|
|
2269
|
+
item_id (str): The ID of the deleted registry item, containing either the namespace and module name
|
|
2270
|
+
(for example, `my-org:my-module`) or organization ID and module name (`org-id:my-module`).
|
|
2095
2271
|
|
|
2096
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2272
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deleteregistryitem>`_.
|
|
2097
2273
|
"""
|
|
2098
2274
|
request = DeleteRegistryItemRequest(item_id=item_id)
|
|
2099
2275
|
await self._app_client.DeleteRegistryItem(request, metadata=self._metadata)
|
|
@@ -2108,7 +2284,7 @@ class AppClient:
|
|
|
2108
2284
|
|
|
2109
2285
|
Args:
|
|
2110
2286
|
org_id (str): The ID of the organization to create the module under.
|
|
2111
|
-
You can obtain your organization ID from the
|
|
2287
|
+
You can obtain your organization ID from the organization settings page.
|
|
2112
2288
|
name (str): The name of the module. Must be unique within your organization.
|
|
2113
2289
|
|
|
2114
2290
|
Raises:
|
|
@@ -2117,7 +2293,7 @@ class AppClient:
|
|
|
2117
2293
|
Returns:
|
|
2118
2294
|
Tuple[str, str]: A tuple containing the ID [0] of the new module and its URL [1].
|
|
2119
2295
|
|
|
2120
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2296
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createmodule>`_.
|
|
2121
2297
|
"""
|
|
2122
2298
|
request = CreateModuleRequest(organization_id=org_id, name=name)
|
|
2123
2299
|
response: CreateModuleResponse = await self._app_client.CreateModule(request, metadata=self._metadata)
|
|
@@ -2136,18 +2312,27 @@ class AppClient:
|
|
|
2136
2312
|
|
|
2137
2313
|
::
|
|
2138
2314
|
|
|
2315
|
+
from viam.proto.app import Model
|
|
2316
|
+
|
|
2317
|
+
model = Model(
|
|
2318
|
+
api="rdk:component:base",
|
|
2319
|
+
model="my-group:cool_new_hoverboard_module:wheeled"
|
|
2320
|
+
)
|
|
2321
|
+
|
|
2139
2322
|
url_of_my_module = await cloud.update_module(
|
|
2140
2323
|
module_id="my-group:cool_new_hoverboard_module",
|
|
2141
2324
|
url="https://docsformymodule.viam.com",
|
|
2325
|
+
models=[model],
|
|
2142
2326
|
description="A base to support hoverboards.",
|
|
2143
|
-
entrypoint="exec"
|
|
2327
|
+
entrypoint="exec"
|
|
2328
|
+
)
|
|
2144
2329
|
|
|
2145
2330
|
Args:
|
|
2146
|
-
module_id (str): ID of the module being updated, containing
|
|
2147
|
-
(for example,
|
|
2331
|
+
module_id (str): ID of the module being updated, containing either the namespace and module name
|
|
2332
|
+
(for example, `my-org:my-module`) or organization ID and module name (`org-id:my-module`).
|
|
2148
2333
|
url (str): The url to reference for documentation and code (NOT the url of the module itself).
|
|
2149
2334
|
description (str): A short description of the module that explains its purpose.
|
|
2150
|
-
models (
|
|
2335
|
+
models (List[viam.proto.app.Model]): list of models that are available in the module.
|
|
2151
2336
|
entrypoint (str): The executable to run to start the module program.
|
|
2152
2337
|
public (bool): The visibility that should be set for the module. Defaults to False (private).
|
|
2153
2338
|
|
|
@@ -2157,7 +2342,7 @@ class AppClient:
|
|
|
2157
2342
|
Returns:
|
|
2158
2343
|
str: The URL of the newly updated module.
|
|
2159
2344
|
|
|
2160
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2345
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#updatemodule>`_.
|
|
2161
2346
|
"""
|
|
2162
2347
|
request = UpdateModuleRequest(
|
|
2163
2348
|
module_id=module_id,
|
|
@@ -2175,16 +2360,27 @@ class AppClient:
|
|
|
2175
2360
|
|
|
2176
2361
|
::
|
|
2177
2362
|
|
|
2178
|
-
|
|
2363
|
+
from viam.proto.app import ModuleFileInfo
|
|
2364
|
+
|
|
2365
|
+
module_file_info = ModuleFileInfo(
|
|
2366
|
+
module_id = "sierra:cool_new_hoverboard_module",
|
|
2367
|
+
version = "1.0.0",
|
|
2368
|
+
platform = "darwin/arm64"
|
|
2369
|
+
)
|
|
2370
|
+
|
|
2371
|
+
file_id = await cloud.upload_module_file(
|
|
2372
|
+
module_file_info=module_file_info,
|
|
2373
|
+
file=b"<file>"
|
|
2374
|
+
)
|
|
2179
2375
|
|
|
2180
2376
|
Args:
|
|
2181
2377
|
module_file_info (Optional[viam.proto.app.ModuleFileInfo]): Relevant metadata.
|
|
2182
2378
|
file (bytes): Bytes of file to upload.
|
|
2183
2379
|
|
|
2184
2380
|
Returns:
|
|
2185
|
-
str:
|
|
2381
|
+
str: URL of uploaded file.
|
|
2186
2382
|
|
|
2187
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2383
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#uploadmodulefile>`_.
|
|
2188
2384
|
"""
|
|
2189
2385
|
request_module_file_info = UploadModuleFileRequest(module_file_info=module_file_info)
|
|
2190
2386
|
request_file = UploadModuleFileRequest(file=file)
|
|
@@ -2202,10 +2398,11 @@ class AppClient:
|
|
|
2202
2398
|
|
|
2203
2399
|
::
|
|
2204
2400
|
|
|
2205
|
-
the_module = await cloud.get_module(module_id="my-cool-modular-base")
|
|
2401
|
+
the_module = await cloud.get_module(module_id="my-group:my-cool-modular-base")
|
|
2206
2402
|
|
|
2207
2403
|
Args:
|
|
2208
|
-
module_id (str): ID of the module being retrieved, containing
|
|
2404
|
+
module_id (str): ID of the module being retrieved, containing either the namespace and module name
|
|
2405
|
+
(for example, `my-org:my-module`) or organization ID and module name (`org-id:my-module`).
|
|
2209
2406
|
|
|
2210
2407
|
Raises:
|
|
2211
2408
|
GRPCError: If an invalid module ID is passed.
|
|
@@ -2213,7 +2410,7 @@ class AppClient:
|
|
|
2213
2410
|
Returns:
|
|
2214
2411
|
viam.proto.app.Module: The module.
|
|
2215
2412
|
|
|
2216
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2413
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#getmodule>`_.
|
|
2217
2414
|
"""
|
|
2218
2415
|
request = GetModuleRequest(module_id=module_id)
|
|
2219
2416
|
response: GetModuleResponse = await self._app_client.GetModule(request, metadata=self._metadata)
|
|
@@ -2224,16 +2421,16 @@ class AppClient:
|
|
|
2224
2421
|
|
|
2225
2422
|
::
|
|
2226
2423
|
|
|
2227
|
-
modules_list = await cloud.list_modules("
|
|
2424
|
+
modules_list = await cloud.list_modules("<YOUR-ORG-ID>")
|
|
2228
2425
|
|
|
2229
2426
|
Args:
|
|
2230
2427
|
org_id (str): The ID of the organization to list modules for.
|
|
2231
|
-
You can obtain your organization ID from the
|
|
2428
|
+
You can obtain your organization ID from the organization settings page.
|
|
2232
2429
|
|
|
2233
2430
|
Returns:
|
|
2234
2431
|
List[viam.proto.app.Module]: The list of modules.
|
|
2235
2432
|
|
|
2236
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2433
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listmodules>`_.
|
|
2237
2434
|
"""
|
|
2238
2435
|
request = ListModulesRequest(organization_id=org_id)
|
|
2239
2436
|
response: ListModulesResponse = await self._app_client.ListModules(request, metadata=self._metadata)
|
|
@@ -2249,16 +2446,20 @@ class AppClient:
|
|
|
2249
2446
|
from viam.app.app_client import APIKeyAuthorization
|
|
2250
2447
|
|
|
2251
2448
|
auth = APIKeyAuthorization(
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2449
|
+
role="owner",
|
|
2450
|
+
resource_type="robot",
|
|
2451
|
+
resource_id="your-machine-id123"
|
|
2255
2452
|
)
|
|
2256
2453
|
|
|
2257
|
-
api_key, api_key_id = cloud.create_key(
|
|
2454
|
+
api_key, api_key_id = cloud.create_key(
|
|
2455
|
+
org_id="<YOUR-ORG-ID>",
|
|
2456
|
+
authorizations=[auth],
|
|
2457
|
+
name="my_key"
|
|
2458
|
+
)
|
|
2258
2459
|
|
|
2259
2460
|
Args:
|
|
2260
2461
|
org_id (str): The ID of the organization to create the key for.
|
|
2261
|
-
You can obtain your organization ID from the
|
|
2462
|
+
You can obtain your organization ID from the organization settings page.
|
|
2262
2463
|
authorizations (List[viam.proto.app.Authorization]): A list of authorizations to associate
|
|
2263
2464
|
with the key.
|
|
2264
2465
|
name (Optional[str]): A name for the key. If None, defaults to the current timestamp.
|
|
@@ -2269,7 +2470,7 @@ class AppClient:
|
|
|
2269
2470
|
Returns:
|
|
2270
2471
|
Tuple[str, str]: The api key and api key ID.
|
|
2271
2472
|
|
|
2272
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2473
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createkey>`_.
|
|
2273
2474
|
"""
|
|
2274
2475
|
name = name if name is not None else str(datetime.now())
|
|
2275
2476
|
authorizations_pb = [await self._create_authorization_for_new_api_key(org_id, auth) for auth in authorizations]
|
|
@@ -2287,7 +2488,7 @@ class AppClient:
|
|
|
2287
2488
|
Args:
|
|
2288
2489
|
id (str): The ID of the API key.
|
|
2289
2490
|
|
|
2290
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2491
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#deletekey>`_.
|
|
2291
2492
|
"""
|
|
2292
2493
|
request = DeleteKeyRequest(id=id)
|
|
2293
2494
|
await self._app_client.DeleteKey(request, metadata=self._metadata)
|
|
@@ -2306,7 +2507,7 @@ class AppClient:
|
|
|
2306
2507
|
Returns:
|
|
2307
2508
|
Tuple[str, str]: The API key and API key id
|
|
2308
2509
|
|
|
2309
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2510
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#createkeyfromexistingkeyauthorizations>`_.
|
|
2310
2511
|
"""
|
|
2311
2512
|
request = CreateKeyFromExistingKeyAuthorizationsRequest(id=id)
|
|
2312
2513
|
response: CreateKeyFromExistingKeyAuthorizationsResponse = await self._app_client.CreateKeyFromExistingKeyAuthorizations(
|
|
@@ -2320,14 +2521,17 @@ class AppClient:
|
|
|
2320
2521
|
|
|
2321
2522
|
::
|
|
2322
2523
|
|
|
2323
|
-
keys = await cloud.list_keys()
|
|
2524
|
+
keys = await cloud.list_keys(org_id="<YOUR-ORG-ID>")
|
|
2324
2525
|
|
|
2325
2526
|
Args:
|
|
2326
2527
|
org_id (str): The ID of the organization to list API keys for.
|
|
2327
|
-
You can obtain your organization ID from the
|
|
2528
|
+
You can obtain your organization ID from the organization settings page.
|
|
2328
2529
|
|
|
2329
2530
|
Returns:
|
|
2330
|
-
List[viam.proto.app.APIKeyWithAuthorizations]: The existing API keys and authorizations.
|
|
2531
|
+
List[viam.proto.app.APIKeyWithAuthorizations]: The existing API keys and authorizations.
|
|
2532
|
+
|
|
2533
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#listkeys>`_.
|
|
2534
|
+
"""
|
|
2331
2535
|
request = ListKeysRequest(org_id=org_id)
|
|
2332
2536
|
response: ListKeysResponse = await self._app_client.ListKeys(request, metadata=self._metadata)
|
|
2333
2537
|
return list(response.api_keys)
|
|
@@ -2337,7 +2541,7 @@ class AppClient:
|
|
|
2337
2541
|
|
|
2338
2542
|
::
|
|
2339
2543
|
|
|
2340
|
-
|
|
2544
|
+
key, id = await cloud.rotate_key("key-id")
|
|
2341
2545
|
|
|
2342
2546
|
Args:
|
|
2343
2547
|
id (str): The ID of the key to be rotated.
|
|
@@ -2345,8 +2549,148 @@ class AppClient:
|
|
|
2345
2549
|
Returns:
|
|
2346
2550
|
Tuple[str, str]: The API key and API key id
|
|
2347
2551
|
|
|
2348
|
-
For more information, see `Fleet Management API <https://docs.viam.com/
|
|
2552
|
+
For more information, see `Fleet Management API <https://docs.viam.com/dev/reference/apis/fleet/#rotatekey>`_.
|
|
2349
2553
|
"""
|
|
2350
2554
|
request = RotateKeyRequest(id=id)
|
|
2351
2555
|
response: RotateKeyResponse = await self._app_client.RotateKey(request, metadata=self._metadata)
|
|
2352
2556
|
return response.key, response.id
|
|
2557
|
+
|
|
2558
|
+
async def get_organization_metadata(self, org_id: str) -> Mapping[str, Any]:
|
|
2559
|
+
"""Get an organization's user-defined metadata.
|
|
2560
|
+
|
|
2561
|
+
::
|
|
2562
|
+
|
|
2563
|
+
metadata = await cloud.get_organization_metadata(org_id="<YOUR-ORG-ID>")
|
|
2564
|
+
|
|
2565
|
+
Args:
|
|
2566
|
+
org_id (str): The ID of the organization with which the user-defined metadata is associated.
|
|
2567
|
+
You can obtain your organization ID from the organization settings page.
|
|
2568
|
+
|
|
2569
|
+
Returns:
|
|
2570
|
+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary
|
|
2571
|
+
"""
|
|
2572
|
+
request = GetOrganizationMetadataRequest(organization_id=org_id)
|
|
2573
|
+
response: GetOrganizationMetadataResponse = await self._app_client.GetOrganizationMetadata(request, metadata=self._metadata)
|
|
2574
|
+
return struct_to_dict(response.data)
|
|
2575
|
+
|
|
2576
|
+
async def update_organization_metadata(self, org_id: str, metadata: Mapping[str, Any]) -> None:
|
|
2577
|
+
"""Update an organization's user-defined metadata.
|
|
2578
|
+
|
|
2579
|
+
::
|
|
2580
|
+
|
|
2581
|
+
await cloud.update_organization_metadata(org_id="<YOUR-ORG-ID>", metadata={
|
|
2582
|
+
"TEST_API_KEY": "ABC123",
|
|
2583
|
+
})
|
|
2584
|
+
|
|
2585
|
+
Args:
|
|
2586
|
+
organization_id (str): The ID of the organization with which to associate the user-defined metadata.
|
|
2587
|
+
You can obtain your organization ID from the organization settings page.
|
|
2588
|
+
metadata (Mapping[str, Any]): The user-defined metadata to upload as a Python dictionary.
|
|
2589
|
+
"""
|
|
2590
|
+
request = UpdateOrganizationMetadataRequest(organization_id=org_id, data=dict_to_struct(metadata))
|
|
2591
|
+
_: UpdateOrganizationMetadataResponse = await self._app_client.UpdateOrganizationMetadata(request, metadata=self._metadata)
|
|
2592
|
+
|
|
2593
|
+
async def get_location_metadata(self, location_id: str) -> Mapping[str, Any]:
|
|
2594
|
+
"""Get a location's user-defined metadata.
|
|
2595
|
+
|
|
2596
|
+
::
|
|
2597
|
+
|
|
2598
|
+
metadata = await cloud.get_location_metadata(location_id="<YOUR-LOCATION-ID>")
|
|
2599
|
+
|
|
2600
|
+
Args:
|
|
2601
|
+
location_id (str): The ID of the location with which the user-defined metadata is associated.
|
|
2602
|
+
You can obtain your location ID from the location's page.
|
|
2603
|
+
|
|
2604
|
+
Returns:
|
|
2605
|
+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
|
|
2606
|
+
"""
|
|
2607
|
+
request = GetLocationMetadataRequest(location_id=location_id)
|
|
2608
|
+
response: GetLocationMetadataResponse = await self._app_client.GetLocationMetadata(request, metadata=self._metadata)
|
|
2609
|
+
return struct_to_dict(response.data)
|
|
2610
|
+
|
|
2611
|
+
async def update_location_metadata(self, location_id: str, metadata: Mapping[str, Any]) -> None:
|
|
2612
|
+
"""Update a location's user-defined metadata.
|
|
2613
|
+
|
|
2614
|
+
::
|
|
2615
|
+
|
|
2616
|
+
await cloud.update_location_metadata(location_id="<YOUR-LOCATION-ID>", metadata={
|
|
2617
|
+
"TEST_API_KEY": "ABC123",
|
|
2618
|
+
})
|
|
2619
|
+
|
|
2620
|
+
Args:
|
|
2621
|
+
location_id (str): The ID of the location with which to associate the user-defined metadata.
|
|
2622
|
+
You can obtain your location ID from the location's page.
|
|
2623
|
+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
|
|
2624
|
+
"""
|
|
2625
|
+
request = UpdateLocationMetadataRequest(location_id=location_id, data=dict_to_struct(metadata))
|
|
2626
|
+
_: UpdateLocationMetadataResponse = await self._app_client.UpdateLocationMetadata(request, metadata=self._metadata)
|
|
2627
|
+
|
|
2628
|
+
async def get_robot_metadata(self, robot_id: str) -> Mapping[str, Any]:
|
|
2629
|
+
"""Get a robot's user-defined metadata.
|
|
2630
|
+
|
|
2631
|
+
::
|
|
2632
|
+
|
|
2633
|
+
metadata = await cloud.get_robot_metadata(robot_id="<YOUR-ROBOT-ID>")
|
|
2634
|
+
|
|
2635
|
+
Args:
|
|
2636
|
+
robot_id (str): The ID of the robot with which the user-defined metadata is associated.
|
|
2637
|
+
You can obtain your robot ID from the machine page.
|
|
2638
|
+
|
|
2639
|
+
Returns:
|
|
2640
|
+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
|
|
2641
|
+
"""
|
|
2642
|
+
request = GetRobotMetadataRequest(id=robot_id)
|
|
2643
|
+
response: GetRobotMetadataResponse = await self._app_client.GetRobotMetadata(request, metadata=self._metadata)
|
|
2644
|
+
return struct_to_dict(response.data)
|
|
2645
|
+
|
|
2646
|
+
async def update_robot_metadata(self, robot_id: str, metadata: Mapping[str, Any]) -> None:
|
|
2647
|
+
"""Update a robot's user-defined metadata.
|
|
2648
|
+
|
|
2649
|
+
::
|
|
2650
|
+
|
|
2651
|
+
await cloud.update_robot_metadata(robot_id="<YOUR-ROBOT-ID>", metadata={
|
|
2652
|
+
"TEST_API_KEY": "ABC123",
|
|
2653
|
+
})
|
|
2654
|
+
|
|
2655
|
+
Args:
|
|
2656
|
+
robot_id (str): The ID of the robot with which to associate the user-defined metadata.
|
|
2657
|
+
You can obtain your robot ID from the machine page.
|
|
2658
|
+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
|
|
2659
|
+
"""
|
|
2660
|
+
request = UpdateRobotMetadataRequest(id=robot_id, data=dict_to_struct(metadata))
|
|
2661
|
+
_: UpdateRobotMetadataResponse = await self._app_client.UpdateRobotMetadata(request, metadata=self._metadata)
|
|
2662
|
+
|
|
2663
|
+
async def get_robot_part_metadata(self, robot_part_id: str) -> Mapping[str, Any]:
|
|
2664
|
+
"""Get a robot part's user-defined metadata.
|
|
2665
|
+
|
|
2666
|
+
::
|
|
2667
|
+
|
|
2668
|
+
metadata = await cloud.get_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>")
|
|
2669
|
+
|
|
2670
|
+
Args:
|
|
2671
|
+
robot_part_id (str): The ID of the robot part with which the user-defined metadata is associated.
|
|
2672
|
+
You can obtain your robot part ID from the machine page.
|
|
2673
|
+
|
|
2674
|
+
Returns:
|
|
2675
|
+
Mapping[str, Any]: The user-defined metadata converted from JSON to a Python dictionary.
|
|
2676
|
+
"""
|
|
2677
|
+
request = GetRobotPartMetadataRequest(id=robot_part_id)
|
|
2678
|
+
response: GetRobotPartMetadataResponse = await self._app_client.GetRobotPartMetadata(request, metadata=self._metadata)
|
|
2679
|
+
return struct_to_dict(response.data)
|
|
2680
|
+
|
|
2681
|
+
async def update_robot_part_metadata(self, robot_part_id: str, metadata: Mapping[str, Any]) -> None:
|
|
2682
|
+
"""Update a robot part's user-defined metadata.
|
|
2683
|
+
|
|
2684
|
+
::
|
|
2685
|
+
|
|
2686
|
+
await cloud.update_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>", metadata={
|
|
2687
|
+
"TEST_API_KEY": "ABC123",
|
|
2688
|
+
})
|
|
2689
|
+
|
|
2690
|
+
Args:
|
|
2691
|
+
robot_id (str): The ID of the robot part with which to associate the user-defined metadata.
|
|
2692
|
+
You can obtain your robot part ID from the machine page.
|
|
2693
|
+
metadata (Mapping[str, Any]): The user-defined metadata converted from JSON to a Python dictionary.
|
|
2694
|
+
"""
|
|
2695
|
+
request = UpdateRobotPartMetadataRequest(id=robot_part_id, data=dict_to_struct(metadata))
|
|
2696
|
+
_: UpdateRobotPartMetadataResponse = await self._app_client.UpdateRobotPartMetadata(request, metadata=self._metadata)
|