roboto.updates#

Module Contents#

class roboto.updates.CustomFieldChangeset(/, **data)#

Bases: pydantic.BaseModel

Describes a set of changes to apply to an entity’s custom-field values.

Each referenced field name must be a custom field defined for the entity’s type in the caller’s organization, and that field must be Ready. Any value supplied must satisfy that field’s declared type. Field names not mentioned by the changeset are left unchanged. A cleared field reads back as None.

Parameters:

data (Any)

class Builder#
build()#
Return type:

CustomFieldChangeset

clear_field(name)#
Parameters:

name (str)

Return type:

CustomFieldChangeset

set_field(name, value)#
Parameters:
  • name (str)

  • value (Any)

Return type:

CustomFieldChangeset

apply_field_updates(existing)#

Apply this changeset to an existing custom-field map.

Parameters:

existing (dict[str, Any]) – Current custom-field name-to-value map. Not mutated.

Returns:

A new map reflecting the changeset. set_fields entries overwrite existing values; clear_fields entries set their values to None. Field names not mentioned by the changeset are carried through unchanged.

Return type:

dict[str, Any]

clear_fields: StrSequence | None = None#

Field names whose values should be cleared to None.

combine(other)#

Merge this changeset with other such that other wins on conflicts.

For any field name appearing in both set_fields maps, other’s value wins. A field appearing in one side’s set_fields and the other side’s clear_fields resolves to whichever side is other.

Parameters:

other (CustomFieldChangeset)

Return type:

CustomFieldChangeset

is_empty()#

Return True when applying this changeset would not change any value.

Return type:

bool

set_fields: dict[str, Any] | None = None#

Field names to set or overwrite, mapped to their new values.

Each value’s Python type must match the corresponding field’s declared CustomFieldType.

class roboto.updates.MetadataChangeset(/, **data)#

Bases: pydantic.BaseModel

Changeset for metadata

Parameters:

data (Any)

class Builder#
build()#
Return type:

MetadataChangeset

put_field(key, value)#
Parameters:
  • key (str)

  • value (Any)

Return type:

MetadataChangeset

put_tag(tag)#
Parameters:

tag (str)

Return type:

MetadataChangeset

remove_field(key)#
Parameters:

key (str)

Return type:

MetadataChangeset

remove_tag(tag)#
Parameters:

tag (str)

Return type:

MetadataChangeset

apply_field_updates(existing_metadata)#
Parameters:

existing_metadata (dict[str, Any])

Return type:

dict[str, Any]

apply_tag_updates(existing_tags)#
Parameters:

existing_tags (list[str])

Return type:

StrSequence

combine(other)#
Parameters:

other (MetadataChangeset)

Return type:

MetadataChangeset

classmethod from_metadata(metadata)#

Creates a changeset that will replace any existing metadata with what’s provided.

Parameters:

metadata (Mapping[str, Any])

Return type:

MetadataChangeset

is_empty()#
Return type:

bool

put_fields: dict[str, Any] | None = None#
put_tags: StrSequence | None = None#
remove_fields: StrSequence | None = None#
remove_tags: StrSequence | None = None#
replace_all: bool = False#
roboto.updates.StrSequence#
class roboto.updates.TaglessMetadataChangeset(/, **data)#

Bases: pydantic.BaseModel

Changeset for tagless metadata

Parameters:

data (Any)

class Builder#
build()#
Return type:

TaglessMetadataChangeset

put_field(key, value)#
Parameters:
  • key (str)

  • value (Any)

Return type:

TaglessMetadataChangeset

remove_field(key)#
Parameters:

key (str)

Return type:

TaglessMetadataChangeset

apply_field_updates(existing_metadata)#
Parameters:

existing_metadata (dict[str, Any])

Return type:

dict[str, Any]

classmethod from_replacement_metadata(metadata)#

Creates a changeset to replace any existing metadata with the metadata provided.

Parameters:

metadata (dict[str, Any])

Return type:

TaglessMetadataChangeset

has_changes()#

Checks whether applying this changeset would result in any metadata changes.

Return type:

bool

put_fields: dict[str, Any] | None = None#
remove_fields: StrSequence | None = None#
replace_all: bool = False#
class roboto.updates.UpdateCondition(/, **data)#

Bases: pydantic.BaseModel

A condition to be applied to an update operation, succeeding only if the condition evaluates to True at update-time.

value is compared to the resource’s current value of key using comparator.

This is a severely constrainted subset of the conditions supported by DynamoDB. See: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html

Parameters:

data (Any)

comparator: Literal['eq', 'ne']#
key: str#
value: Any = None#