Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.association

Module Contents

Association

class roboto.association.Association(/, **data)#View Source

Bases: pydantic.BaseModel

Use to declare an association between two Roboto entities.

Parameters

data Any

Attributes

Association.URL_ENCODING_SEP

URL_ENCODING_SEP ClassVar[str] = ':' #

Association.association_id

association_id str #

Roboto identifier

Association.association_type

association_type AssociationType #

association_type is the Roboto domain entity type of the association.

Association.association_version

association_version int | None = None #

association_version is the Roboto domain entity version of the association, if it exists.

Association.coalesce()

classmethod coalesce(associations=None, dataset_ids=None, file_ids=None, topic_ids=None, message_path_ids=None, throw_on_empty=False)#View Source

Parameters

associations Optional[collections.abc.Collection[Association]]
dataset_ids Optional[collections.abc.Collection[str]]
file_ids Optional[collections.abc.Collection[str]]
topic_ids Optional[collections.abc.Collection[str]]
message_path_ids Optional[collections.abc.Collection[str]]
throw_on_empty bool

Return type

Association.dataset()

classmethod dataset(dataset_id)#View Source

Parameters

dataset_id str

Return type

Properties

Association.dataset_id

dataset_id str | None #
Return type: Optional[str]

Association.device()

classmethod device(universal_device_id)#View Source

Create an association with a device.

Parameters

universal_device_id str

The device’s Roboto-assigned dv_ ID (universal_device_id), not its customer-chosen device_id.

Return type

Usage

Association.device("dv_abc123")
# Association(association_id='dv_abc123', association_type=<AssociationType.Device: 'device'>, ...)

Association.file()

classmethod file(file_id, version=None)#View Source

Parameters

file_id str
version Optional[int]

Properties

Association.file_id

file_id str | None #
Return type: Optional[str]

Association.from_id()

classmethod from_id(association_id)#View Source

Infer the association type from the ID prefix.

Roboto IDs follow the pattern {prefix}_{random_chars} where the prefix indicates the entity type:

  • ds_ → Dataset
  • fl_ → File
  • tp_ → Topic
  • mp_ → MessagePath
  • dv_ → Device
  • og_ → Org

Parameters

association_id str

A Roboto entity ID with a recognized prefix.

Returns

An Association with the inferred type.

Raises

If the ID prefix is not recognized.

Usage

Association.from_id("ds_abc123")
# Association(association_id='ds_abc123', association_type=AssociationType.Dataset)

Association.from_url_encoded_value()

classmethod from_url_encoded_value(encoded)#View Source

Reverse of Association::url_encode.

Parameters

encoded str

Return type

Association.group_by_type()

static group_by_type(associations)#View Source

Parameters

associations collections.abc.Collection[Association]

Return type

collections.abc.Mapping[AssociationType, collections.abc.Sequence[Association]]

Properties

Association.is_dataset

is_dataset bool #
Return type: bool

Association.is_device

is_device bool #
Return type: bool

Association.is_file

is_file bool #
Return type: bool

Association.is_msgpath

is_msgpath bool #
Return type: bool

Association.is_org

is_org bool #
Return type: bool

Association.is_topic

is_topic bool #
Return type: bool

Association.message_path_id

message_path_id str | None #
Return type: Optional[str]

Association.msgpath()

classmethod msgpath(msgpath_id)#View Source

Parameters

msgpath_id str

Return type

Association.org()

classmethod org(org_id)#View Source

Create an association with an organization.

Parameters

org_id str

The organization’s ID.

Return type

Usage

Association.org("og_abc123")
# Association(association_id='og_abc123', association_type=<AssociationType.Org: 'org'>, ...)

Attributes

Association.parent

parent Association | None = None #

The next level up in the hierarchy of this association. A message path’s parent is its topic, a topic’s parent is its file, and a file’s parent is its dataset.

The absense of a parent in an Association object doesn’t necessarily mean that a parent doesn’t exist; parents are only provided when they’re easily computable in the context of a given request.

Association.topic()

classmethod topic(topic_id)#View Source

Parameters

topic_id str

Properties

Association.topic_id

topic_id str | None #
Return type: Optional[str]

Association.url_encode()

url_encode()#View Source

Association encoded in a URL path segment ready format.

Return type

str

AssociationType

class roboto.association.AssociationType(*args, **kwds)#View Source

Bases: enum.Enum

AssociationType is the Roboto domain entity type of the association.

Attributes

AssociationType.Dataset

Dataset = 'dataset' #

AssociationType.Device

Device = 'device' #

AssociationType.File

File = 'file' #

AssociationType.MessagePath

MessagePath = 'message_path' #

AssociationType.Org

Org = 'org' #

AssociationType.Topic

Topic = 'topic' #

Was this page helpful?