IAM Subjects
Subjects interface
Access to the subjects endpoint.
The user is not expected to use this class directly. It is an attribute of the
Archivist
class.
For example instantiate an Archivist instance and execute the methods of the class:
with open(".auth_token", mode="r", encoding="utf-8") as tokenfile:
authtoken = tokenfile.read().strip()
# Initialize connection to Archivist
arch = Archivist(
"https://app.datatrails.ai",
authtoken,
)
subject = arch.subjects.create(...)
- class archivist.subjects._SubjectsClient(archivist_instance: Archivist)[source]
SubjectsClient
Access to subjects entities using CRUD interface. This class is usually accessed as an attribute of the Archivist class.
- Parameters:
archivist (Archivist) --
Archivist
instance
- count(*, display_name: str | None = None) int [source]
Count subjects.
Counts number of subjects that match criteria.
- Parameters:
display_name (str) -- display name (optional)
- Returns:
integer count of subjects.
- create(display_name: str, wallet_pub_key: list[str], tessera_pub_key: list[str]) Subject [source]
Create subject
Creates subject with defined attributes.
- Parameters:
display_name (str) -- display name of subject.
wallet_pub_key (list) -- wallet public keys
tessera_pub_key (list) -- tessera public keys
- Returns:
Subject
instance
- create_from_b64(data: dict[str, Any]) Subject [source]
Create subject
Creates subject with request body from b64 encoded string
- Parameters:
data (dict) -- Dictionary with 2 fields:
A YAML representation of the data argument would be:
display_name: An imported subject subject_string: ey66...
- Returns:
Subject
instance
- create_from_data(data: dict[str, Any]) Subject [source]
Create subject
Creates subject with request body from data stream. Suitable for reading data from a file using json.load or yaml.load
- Parameters:
data (dict) -- request body of subject.
- Returns:
Subject
instance
- delete(identity: str) dict[str, Any] [source]
Delete Subject
Deletes subject.
- Parameters:
identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx
- Returns:
Subject
instance - empty?
- import_subject(display_name: str, subject: Subject) Subject [source]
- Create subject from another subject usually
from another organization.
- list(*, page_size: int | None = None, display_name: str | None = None)[source]
List subjects.
List subjects that match criteria.
- Parameters:
display_name (str) -- display name (optional)
page_size (int) -- optional page size. (Rarely used).
- Returns:
iterable that returns
Subject
instances
- read(identity: str) Subject [source]
Read Subject
Reads subject.
- Parameters:
identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx
- Returns:
Subject
instance
- Import the self subjects from the foreign archivist connection
from another organization - mutually share.
- update(identity: str, *, display_name: str | None = None, wallet_pub_key: list[str] | None = None, tessera_pub_key: list[str] | None = None) Subject [source]
Update Subject
Update subject.
- Parameters:
identity (str) -- subjects identity e.g. subjects/xxxxxxxxxxxxxxxxxxxxxxx
display_name (str) -- display name of subject.
wallet_pub_key (list) -- wallet public keys
tessera_pub_key (list) -- tessera public keys
- Returns:
Subject
instance