roboto.principal#
Module Contents#
- class roboto.principal.RobotoPrincipal(/, **data)#
Bases:
pydantic.BaseModel
Represents a principal (user, organization, device, etc.) in the Roboto platform.
- Parameters:
data (Any)
- classmethod for_device(device_id, org_id)#
Create a principal representing a device.
- Parameters:
device_id (str) – Unique identifier for the device.
org_id (str) – Organization ID that owns the device.
- Returns:
A RobotoPrincipal instance configured for the specified device.
- Return type:
- classmethod for_invocation(invocation_id)#
Create a principal representing an invocation.
- Parameters:
invocation_id (str) – Unique identifier for the invocation.
- Returns:
A RobotoPrincipal instance configured for the specified invocation.
- Return type:
- classmethod for_org(org_id)#
Create a principal representing an organization.
- Parameters:
org_id (str) – Unique identifier for the organization.
- Returns:
A RobotoPrincipal instance configured for the specified organization.
- Return type:
- classmethod for_user(user_id)#
Create a principal representing a user.
- Parameters:
user_id (str) – Unique identifier for the user.
- Returns:
A RobotoPrincipal instance configured for the specified user.
- Return type:
- classmethod from_string(serialized_principal)#
Create a principal from a serialized string representation.
- Parameters:
serialized_principal (str) – String in format “ptype:id”.
- Returns:
A RobotoPrincipal instance parsed from the string.
- Raises:
ValueError – If the serialized principal is not in the correct format.
- Return type:
- id: str#
Fully qualified principal ID.
For resources which have universally unique IDs (e.g. users, orgs, invocations, datasets, files, etc.) this will just be the resource ID.
For resources which have org-unique IDs (e.g. devices, actions), this will be the resource ID + “@” + the org ID, e.g. a device
sn001
in orgog_67890
will have a fully qualified ID ofsn001@og_67890
.
- ptype: RobotoPrincipalType#
The type of principal (user or organization).
- validate_id(value)#
- Parameters:
value (str)
- Return type:
str