Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/viam/app/app_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def from_proto(cls, robot_part: RobotPartPB) -> Self:
self.created_on = robot_part.created_on.ToDatetime() if robot_part.HasField("created_on") else None
self.secrets = list(robot_part.secrets)
self.last_updated = robot_part.last_updated.ToDatetime() if robot_part.HasField("last_updated") else None
self.robot_config_json = robot_part.robot_config_json if robot_part.HasField("robot_config_json") else None
return self

id: str
Expand All @@ -229,6 +230,7 @@ def from_proto(cls, robot_part: RobotPartPB) -> Self:
created_on: Optional[datetime]
secrets: Optional[List[SharedSecret]]
last_updated: Optional[datetime]
robot_config_json: Optional[str]

@property
def proto(self) -> RobotPartPB:
Expand All @@ -248,6 +250,7 @@ def proto(self) -> RobotPartPB:
created_on=datetime_to_timestamp(self.created_on) if self.created_on else None,
secrets=self.secrets,
last_updated=datetime_to_timestamp(self.last_updated) if self.last_updated else None,
robot_config_json=self.robot_config_json if self.robot_config_json else None,
)


Expand Down Expand Up @@ -1475,7 +1478,12 @@ async def get_robot_part_history(self, robot_part_id: str) -> List[RobotPartHist
return [RobotPartHistoryEntry.from_proto(part_history) for part_history in response.history]

async def update_robot_part(
self, robot_part_id: str, name: str, robot_config: Optional[Mapping[str, Any]] = None, last_known_update: Optional[datetime] = None
self,
robot_part_id: str,
name: str,
robot_config: Optional[Mapping[str, Any]] = None,
last_known_update: Optional[datetime] = None,
robot_config_json: Optional[str] = None,
) -> RobotPart:
"""Change the name and assign an optional new configuration to a machine part.

Expand All @@ -1493,6 +1501,8 @@ async def update_robot_part(
last_known_update (datetime): Optional time of the last known update to this part's config. If provided, this will result in a
GRPCError if the upstream config has changed since this time, indicating that the local config is out of date. Omitting this
parameter will result in an overwrite of the upstream config.
robot_config_json (str): Optional raw JSON string of the robot config, preserving user-defined key order.
When set, this takes precedence over robot_config for storage purposes.
Raises:
GRPCError: If either an invalid machine part ID, name, or config is passed, or if the upstream config has changed since
last_known_update.
Expand All @@ -1506,6 +1516,7 @@ async def update_robot_part(
name=name,
robot_config=dict_to_struct(robot_config) if robot_config else None,
last_known_update=datetime_to_timestamp(last_known_update),
robot_config_json=robot_config_json if robot_config_json else None,
)
response: UpdateRobotPartResponse = await self._app_client.UpdateRobotPart(request, metadata=self._metadata)
return RobotPart.from_proto(robot_part=response.part)
Expand Down
240 changes: 120 additions & 120 deletions src/viam/gen/app/data/v1/data_pb2.py

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/viam/gen/app/data/v1/data_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ class BinaryMetadata(_message.Message):
ANNOTATIONS_FIELD_NUMBER: _builtins.int
DATASET_IDS_FIELD_NUMBER: _builtins.int
BINARY_DATA_ID_FIELD_NUMBER: _builtins.int
FILE_SIZE_BYTES_FIELD_NUMBER: _builtins.int

@_builtins.property
@_deprecated('This field has been marked as deprecated using proto field options.')
Expand All @@ -994,6 +995,7 @@ class BinaryMetadata(_message.Message):
file_ext: _builtins.str
uri: _builtins.str
binary_data_id: _builtins.str
file_size_bytes: _builtins.int

@_builtins.property
def capture_metadata(self) -> Global___CaptureMetadata:
Expand All @@ -1015,13 +1017,13 @@ class BinaryMetadata(_message.Message):
def dataset_ids(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]:
...

def __init__(self, *, id: _builtins.str=..., capture_metadata: Global___CaptureMetadata | None=..., time_requested: _timestamp_pb2.Timestamp | None=..., time_received: _timestamp_pb2.Timestamp | None=..., file_name: _builtins.str=..., file_ext: _builtins.str=..., uri: _builtins.str=..., annotations: Global___Annotations | None=..., dataset_ids: _abc.Iterable[_builtins.str] | None=..., binary_data_id: _builtins.str=...) -> None:
def __init__(self, *, id: _builtins.str=..., capture_metadata: Global___CaptureMetadata | None=..., time_requested: _timestamp_pb2.Timestamp | None=..., time_received: _timestamp_pb2.Timestamp | None=..., file_name: _builtins.str=..., file_ext: _builtins.str=..., uri: _builtins.str=..., annotations: Global___Annotations | None=..., dataset_ids: _abc.Iterable[_builtins.str] | None=..., binary_data_id: _builtins.str=..., file_size_bytes: _builtins.int=...) -> None:
...
_HasFieldArgType: _TypeAlias = _typing.Literal['annotations', b'annotations', 'capture_metadata', b'capture_metadata', 'time_received', b'time_received', 'time_requested', b'time_requested']

def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool:
...
_ClearFieldArgType: _TypeAlias = _typing.Literal['annotations', b'annotations', 'binary_data_id', b'binary_data_id', 'capture_metadata', b'capture_metadata', 'dataset_ids', b'dataset_ids', 'file_ext', b'file_ext', 'file_name', b'file_name', 'id', b'id', 'time_received', b'time_received', 'time_requested', b'time_requested', 'uri', b'uri']
_ClearFieldArgType: _TypeAlias = _typing.Literal['annotations', b'annotations', 'binary_data_id', b'binary_data_id', 'capture_metadata', b'capture_metadata', 'dataset_ids', b'dataset_ids', 'file_ext', b'file_ext', 'file_name', b'file_name', 'file_size_bytes', b'file_size_bytes', 'id', b'id', 'time_received', b'time_received', 'time_requested', b'time_requested', 'uri', b'uri']

def ClearField(self, field_name: _ClearFieldArgType) -> None:
...
Expand Down
1,170 changes: 586 additions & 584 deletions src/viam/gen/app/v1/app_pb2.py

Large diffs are not rendered by default.

30 changes: 24 additions & 6 deletions src/viam/gen/app/v1/app_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ class RobotPart(_message.Message):
LAST_UPDATED_FIELD_NUMBER: _builtins.int
ONLINE_STATE_FIELD_NUMBER: _builtins.int
SECONDS_SINCE_ONLINE_FIELD_NUMBER: _builtins.int
ROBOT_CONFIG_JSON_FIELD_NUMBER: _builtins.int
id: _builtins.str
name: _builtins.str
dns_name: _builtins.str
Expand All @@ -351,6 +352,8 @@ class RobotPart(_message.Message):
local_fqdn: _builtins.str
online_state: Global___OnlineState.ValueType
seconds_since_online: _builtins.int
robot_config_json: _builtins.str
'robot_config_json is the raw JSON string of the robot config, preserving user-defined key order.'

@_builtins.property
def robot_config(self) -> _struct_pb2.Struct:
Expand All @@ -376,16 +379,21 @@ class RobotPart(_message.Message):
def last_updated(self) -> _timestamp_pb2.Timestamp:
"""latest timestamp when a robot part was updated"""

def __init__(self, *, id: _builtins.str=..., name: _builtins.str=..., dns_name: _builtins.str=..., secret: _builtins.str=..., robot: _builtins.str=..., location_id: _builtins.str=..., robot_config: _struct_pb2.Struct | None=..., last_access: _timestamp_pb2.Timestamp | None=..., user_supplied_info: _struct_pb2.Struct | None=..., main_part: _builtins.bool=..., fqdn: _builtins.str=..., local_fqdn: _builtins.str=..., created_on: _timestamp_pb2.Timestamp | None=..., secrets: _abc.Iterable[Global___SharedSecret] | None=..., last_updated: _timestamp_pb2.Timestamp | None=..., online_state: Global___OnlineState.ValueType=..., seconds_since_online: _builtins.int=...) -> None:
def __init__(self, *, id: _builtins.str=..., name: _builtins.str=..., dns_name: _builtins.str=..., secret: _builtins.str=..., robot: _builtins.str=..., location_id: _builtins.str=..., robot_config: _struct_pb2.Struct | None=..., last_access: _timestamp_pb2.Timestamp | None=..., user_supplied_info: _struct_pb2.Struct | None=..., main_part: _builtins.bool=..., fqdn: _builtins.str=..., local_fqdn: _builtins.str=..., created_on: _timestamp_pb2.Timestamp | None=..., secrets: _abc.Iterable[Global___SharedSecret] | None=..., last_updated: _timestamp_pb2.Timestamp | None=..., online_state: Global___OnlineState.ValueType=..., seconds_since_online: _builtins.int=..., robot_config_json: _builtins.str | None=...) -> None:
...
_HasFieldArgType: _TypeAlias = _typing.Literal['created_on', b'created_on', 'last_access', b'last_access', 'last_updated', b'last_updated', 'robot_config', b'robot_config', 'user_supplied_info', b'user_supplied_info']
_HasFieldArgType: _TypeAlias = _typing.Literal['_robot_config_json', b'_robot_config_json', 'created_on', b'created_on', 'last_access', b'last_access', 'last_updated', b'last_updated', 'robot_config', b'robot_config', 'robot_config_json', b'robot_config_json', 'user_supplied_info', b'user_supplied_info']

def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool:
...
_ClearFieldArgType: _TypeAlias = _typing.Literal['created_on', b'created_on', 'dns_name', b'dns_name', 'fqdn', b'fqdn', 'id', b'id', 'last_access', b'last_access', 'last_updated', b'last_updated', 'local_fqdn', b'local_fqdn', 'location_id', b'location_id', 'main_part', b'main_part', 'name', b'name', 'online_state', b'online_state', 'robot', b'robot', 'robot_config', b'robot_config', 'seconds_since_online', b'seconds_since_online', 'secret', b'secret', 'secrets', b'secrets', 'user_supplied_info', b'user_supplied_info']
_ClearFieldArgType: _TypeAlias = _typing.Literal['_robot_config_json', b'_robot_config_json', 'created_on', b'created_on', 'dns_name', b'dns_name', 'fqdn', b'fqdn', 'id', b'id', 'last_access', b'last_access', 'last_updated', b'last_updated', 'local_fqdn', b'local_fqdn', 'location_id', b'location_id', 'main_part', b'main_part', 'name', b'name', 'online_state', b'online_state', 'robot', b'robot', 'robot_config', b'robot_config', 'robot_config_json', b'robot_config_json', 'seconds_since_online', b'seconds_since_online', 'secret', b'secret', 'secrets', b'secrets', 'user_supplied_info', b'user_supplied_info']

def ClearField(self, field_name: _ClearFieldArgType) -> None:
...
_WhichOneofReturnType__robot_config_json: _TypeAlias = _typing.Literal['robot_config_json']
_WhichOneofArgType__robot_config_json: _TypeAlias = _typing.Literal['_robot_config_json', b'_robot_config_json']

def WhichOneof(self, oneof_group: _WhichOneofArgType__robot_config_json) -> _WhichOneofReturnType__robot_config_json | None:
...
Global___RobotPart: _TypeAlias = RobotPart

@_typing.final
Expand Down Expand Up @@ -2403,8 +2411,11 @@ class UpdateRobotPartRequest(_message.Message):
NAME_FIELD_NUMBER: _builtins.int
ROBOT_CONFIG_FIELD_NUMBER: _builtins.int
LAST_KNOWN_UPDATE_FIELD_NUMBER: _builtins.int
ROBOT_CONFIG_JSON_FIELD_NUMBER: _builtins.int
id: _builtins.str
name: _builtins.str
robot_config_json: _builtins.str
'robot_config_json is the raw JSON string of the robot config, preserving user-defined key order.\n When set, this takes precedence over robot_config for storage purposes.\n '

@_builtins.property
def robot_config(self) -> _struct_pb2.Struct:
Expand All @@ -2414,21 +2425,28 @@ class UpdateRobotPartRequest(_message.Message):
def last_known_update(self) -> _timestamp_pb2.Timestamp:
...

def __init__(self, *, id: _builtins.str=..., name: _builtins.str=..., robot_config: _struct_pb2.Struct | None=..., last_known_update: _timestamp_pb2.Timestamp | None=...) -> None:
def __init__(self, *, id: _builtins.str=..., name: _builtins.str=..., robot_config: _struct_pb2.Struct | None=..., last_known_update: _timestamp_pb2.Timestamp | None=..., robot_config_json: _builtins.str | None=...) -> None:
...
_HasFieldArgType: _TypeAlias = _typing.Literal['_last_known_update', b'_last_known_update', 'last_known_update', b'last_known_update', 'robot_config', b'robot_config']
_HasFieldArgType: _TypeAlias = _typing.Literal['_last_known_update', b'_last_known_update', '_robot_config_json', b'_robot_config_json', 'last_known_update', b'last_known_update', 'robot_config', b'robot_config', 'robot_config_json', b'robot_config_json']

def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool:
...
_ClearFieldArgType: _TypeAlias = _typing.Literal['_last_known_update', b'_last_known_update', 'id', b'id', 'last_known_update', b'last_known_update', 'name', b'name', 'robot_config', b'robot_config']
_ClearFieldArgType: _TypeAlias = _typing.Literal['_last_known_update', b'_last_known_update', '_robot_config_json', b'_robot_config_json', 'id', b'id', 'last_known_update', b'last_known_update', 'name', b'name', 'robot_config', b'robot_config', 'robot_config_json', b'robot_config_json']

def ClearField(self, field_name: _ClearFieldArgType) -> None:
...
_WhichOneofReturnType__last_known_update: _TypeAlias = _typing.Literal['last_known_update']
_WhichOneofArgType__last_known_update: _TypeAlias = _typing.Literal['_last_known_update', b'_last_known_update']
_WhichOneofReturnType__robot_config_json: _TypeAlias = _typing.Literal['robot_config_json']
_WhichOneofArgType__robot_config_json: _TypeAlias = _typing.Literal['_robot_config_json', b'_robot_config_json']

@_typing.overload
def WhichOneof(self, oneof_group: _WhichOneofArgType__last_known_update) -> _WhichOneofReturnType__last_known_update | None:
...

@_typing.overload
def WhichOneof(self, oneof_group: _WhichOneofArgType__robot_config_json) -> _WhichOneofReturnType__robot_config_json | None:
...
Global___UpdateRobotPartRequest: _TypeAlias = UpdateRobotPartRequest

@_typing.final
Expand Down
Loading