IAM Access Policies

Access_Policies interface

Access to the access_policies 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,
)
access_policy = arch.access_policies.create(...)
class archivist.access_policies.AccessPolicy[source]

AccessPolicy object

property name: str | None

name of the access policy

Type:

str

class archivist.access_policies._AccessPoliciesClient(archivist_instance: Archivist)[source]

AccessPoliciesClient

Access to access_policies 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 access policies.

Counts number of access policies that match criteria.

Parameters:

display_name (str) -- display name (optional0

Returns:

integer count of access policies.

create(props: dict[str, Any], filters: list[dict[str, Any]], access_permissions: list[dict[str, Any]]) AccessPolicy[source]

Create access policy

Creates access policy with defined attributes.

Parameters:
  • props (dict) -- properties of created access policy.

  • filters (list) -- assets filters

  • permissions (access) -- list of access permissions

Returns:

AccessPolicy instance

create_from_data(data: dict[str, Any]) AccessPolicy[source]

Create access policy

Creates access policy 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 access policy.

Returns:

AccessPolicy instance

delete(identity: str) dict[str, Any][source]

Delete Access Policy

Deletes access policy.

Parameters:

identity (str) -- access_policies identity e.g. access_policies/xxxxxxxxxxxxxxxxxxxxxxx

Returns:

AccessPolicy instance - empty?

list(*, page_size: int | None = None, display_name: str | None = None) Generator[AccessPolicy, None, None][source]

List access policies.

List access policies that match criteria.

Parameters:
  • display_name (str) -- display name (optional0

  • page_size (int) -- optional page size. (Rarely used).

Returns:

iterable that returns AccessPolicy instances

list_matching_access_policies(asset_id: str, *, page_size: int | None = None) Generator[AccessPolicy, None, None][source]

List matching access policies.

List access policies that match asset.

Parameters:
  • asset_id (str) -- e.g. assets/xxxxxxxxxxxxxxx

  • page_size (int) -- optional page size. (Rarely used).

Returns:

iterable that returns AccessPolicy instances

list_matching_assets(access_policy_id: str, *, page_size: int | None = None) Generator[Asset, None, None][source]

List matching assets.

List assets that match access policy.

Parameters:
  • access_policy_id (str) -- e.g. access_policies/xxxxxxxxxxxxxxx

  • page_size (int) -- optional page size. (Rarely used).

Returns:

iterable that returns Asset instances

read(identity: str) AccessPolicy[source]

Read Access Policy

Reads access policy.

Parameters:

identity (str) -- access_policies identity e.g. access_policies/xxxxxxxxxxxxxxxxxxxxxxx

Returns:

AccessPolicy instance

update(identity, *, props: dict[str, Any] | None = None, filters: list[dict] | None = None, access_permissions: list[dict] | None = None) AccessPolicy[source]

Update Access Policy

Update access policy.

Parameters:
  • identity (str) -- access_policies identity e.g. access_policies/xxxxxxxxxxxxxxxxxxxxxxx

  • props (dict) -- properties of created access policy.

  • filters (list) -- assets filters

  • permissions (access) -- list of access permissions

Returns:

AccessPolicy instance