sift_client.resources.access_control.resource_attributes
¶
| CLASS | DESCRIPTION |
|---|---|
ResourceAttributesAPIAsync |
High-level API for resource attributes. |
ResourceAttributeKeysAPIAsync |
High-level API for resource attribute keys. |
ResourceAttributeEnumValuesAPIAsync |
High-level API for the enum values defined on resource attribute keys. |
ResourceAttributeAssignmentsAPIAsync |
High-level API for resource attribute assignments. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
ResourceLike |
|
ResourceLike
module-attribute
¶
ResourceLike = Union[
ResourceAttributeEntity, Asset, Channel, Run
]
ResourceAttributesAPIAsync
¶
ResourceAttributesAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for resource attributes.
Resource attributes describe the Sift objects an access decision applies to. A resource is the "what" in an access decision.
Create or fetch an attribute key via keys, define enum values via enum_values
when the key uses them, then assign a value to resources via assignments. Pass
existing Asset, Channel, and Run objects directly, or build a
ResourceAttributeEntity from a resource ID.
Initialize the ResourceAttributesAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
keys |
Nested keys API. See |
enum_values |
Nested enum values API. See |
assignments |
Nested assignments API. See |
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
keys
instance-attribute
¶
keys: ResourceAttributeKeysAPIAsync = (
ResourceAttributeKeysAPIAsync(sift_client)
)
Nested keys API. See ResourceAttributeKeysAPIAsync.
enum_values
instance-attribute
¶
enum_values: ResourceAttributeEnumValuesAPIAsync = (
ResourceAttributeEnumValuesAPIAsync(sift_client)
)
Nested enum values API. See ResourceAttributeEnumValuesAPIAsync.
assignments
instance-attribute
¶
assignments: ResourceAttributeAssignmentsAPIAsync = (
ResourceAttributeAssignmentsAPIAsync(sift_client)
)
Nested assignments API. See ResourceAttributeAssignmentsAPIAsync.
ResourceAttributeKeysAPIAsync
¶
ResourceAttributeKeysAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for resource attribute keys.
Accessed as a nested resource via client.access_control.resource_attributes.keys.
Initialize the ResourceAttributeKeysAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
get |
Get a resource attribute key by ID. |
list_ |
List resource attribute keys with optional filtering. |
find |
Find a single key matching the query. Takes the same arguments as |
create |
Create a resource attribute key. |
get_or_create |
Get a key by display name, creating it if it does not exist. |
update |
Update a key. |
archive |
Archive a key. Cascades to its enum values and assignments. |
unarchive |
Unarchive a key. Does not restore its cascaded enum values or assignments. |
check_archive_impact |
Check how many assignments archiving a key would affect. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
get
async
¶
get(*, key_id: str) -> ResourceAttributeKey
Get a resource attribute key by ID.
| PARAMETER | DESCRIPTION |
|---|---|
key_id
|
The ID of the key.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The key. |
list_
async
¶
list_(
*,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
value_type: ResourceAttributeValueType | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
description_contains: str | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[ResourceAttributeKey]
List resource attribute keys with optional filtering.
The service does not yet support filtering keys by modified date or user.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact display name of the key.
TYPE:
|
names
|
Display names to filter by.
TYPE:
|
name_contains
|
Substring match on the display name.
TYPE:
|
name_regex
|
Regex match on the display name.
TYPE:
|
value_type
|
Filter to keys of this value type.
TYPE:
|
created_after
|
Filter to keys created after this datetime.
TYPE:
|
created_before
|
Filter to keys created before this datetime.
TYPE:
|
description_contains
|
Substring match on the description.
TYPE:
|
include_archived
|
If True, include archived keys.
TYPE:
|
filter_query
|
Explicit CEL query.
TYPE:
|
order_by
|
Field and direction to order by.
TYPE:
|
limit
|
Maximum number of keys to return.
TYPE:
|
page_size
|
Results to fetch per request.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttributeKey]
|
The matching keys. |
find
async
¶
find(**kwargs) -> ResourceAttributeKey | None
Find a single key matching the query. Takes the same arguments as list_.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Keyword arguments to pass to
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey | None
|
The key found, or None if no key matches. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If more than one key matches. |
create
async
¶
create(
display_name: str,
value_type: ResourceAttributeValueType,
*,
description: str = "",
) -> ResourceAttributeKey
Create a resource attribute key.
| PARAMETER | DESCRIPTION |
|---|---|
display_name
|
The human-readable name of the key.
TYPE:
|
value_type
|
The value type of the key. |
description
|
Optional description.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The created key. |
get_or_create
async
¶
get_or_create(
display_name: str,
value_type: ResourceAttributeValueType,
*,
description: str = "",
) -> ResourceAttributeKey
Get a key by display name, creating it if it does not exist.
| PARAMETER | DESCRIPTION |
|---|---|
display_name
|
The human-readable name of the key.
TYPE:
|
value_type
|
The value type used if the key is created. |
description
|
Optional description used if the key is created.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The existing or newly created key. |
Note
Display names are not guaranteed unique. If multiple keys share the display name, the first active match is returned.
update
async
¶
update(
key: str | ResourceAttributeKey,
update: ResourceAttributeKeyUpdate | dict,
) -> ResourceAttributeKey
Update a key.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to update.
TYPE:
|
update
|
Updates to apply to the key.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The updated key. |
archive
async
¶
archive(
key: str | ResourceAttributeKey,
) -> ResourceAttributeKey
Archive a key. Cascades to its enum values and assignments.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to archive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The archived key. |
unarchive
async
¶
unarchive(
key: str | ResourceAttributeKey,
) -> ResourceAttributeKey
Unarchive a key. Does not restore its cascaded enum values or assignments.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to unarchive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeKey
|
The unarchived key. |
check_archive_impact
async
¶
check_archive_impact(
key: str | ResourceAttributeKey,
) -> int
Check how many assignments archiving a key would affect.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The number of active assignments archiving this key would affect. |
ResourceAttributeEnumValuesAPIAsync
¶
ResourceAttributeEnumValuesAPIAsync(
sift_client: SiftClient,
)
Bases: ResourceBase
High-level API for the enum values defined on resource attribute keys.
Accessed as a nested resource via
client.access_control.resource_attributes.enum_values.
Initialize the ResourceAttributeEnumValuesAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
create |
Create a single enum value for a key. |
list_ |
List the enum values defined for a key. |
get_or_create |
Get enum values for a key by name, creating any that don't exist. |
archive |
Archive an enum value, migrating existing assignments to a replacement. |
unarchive |
Unarchive an enum value. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
create
async
¶
create(
key: str | ResourceAttributeKey,
display_name: str,
*,
description: str = "",
) -> ResourceAttributeEnumValue
Create a single enum value for a key.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID the enum value belongs to.
TYPE:
|
display_name
|
The human-readable name of the enum value.
TYPE:
|
description
|
Optional description.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeEnumValue
|
The created enum value. |
list_
async
¶
list_(
key: str | ResourceAttributeKey,
*,
name: str | None = None,
names: list[str] | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[ResourceAttributeEnumValue]
List the enum values defined for a key.
The service does not yet support filtering enum values by description, modified date, or user.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to list enum values for.
TYPE:
|
name
|
Exact display name of the enum value.
TYPE:
|
names
|
Display names to filter by.
TYPE:
|
name_contains
|
Substring match on the display name.
TYPE:
|
name_regex
|
Regex match on the display name.
TYPE:
|
created_after
|
Filter to enum values created after this datetime.
TYPE:
|
created_before
|
Filter to enum values created before this datetime.
TYPE:
|
include_archived
|
If True, include archived enum values.
TYPE:
|
filter_query
|
Explicit CEL query.
TYPE:
|
order_by
|
Field and direction to order by.
TYPE:
|
limit
|
Maximum number of enum values to return.
TYPE:
|
page_size
|
Results to fetch per request.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttributeEnumValue]
|
The matching enum values. |
get_or_create
async
¶
get_or_create(
key: str | ResourceAttributeKey, names: list[str]
) -> list[ResourceAttributeEnumValue]
Get enum values for a key by name, creating any that don't exist.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID the enum values belong to.
TYPE:
|
names
|
Display names of the enum values to get or create.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttributeEnumValue]
|
The enum values, in the same order as |
archive
async
¶
archive(
enum_value: str | ResourceAttributeEnumValue,
*,
replacement: str
| ResourceAttributeEnumValue
| None = None,
) -> int
Archive an enum value, migrating existing assignments to a replacement.
| PARAMETER | DESCRIPTION |
|---|---|
enum_value
|
The enum value or enum value ID to archive.
TYPE:
|
replacement
|
Optional enum value or enum value ID that existing assignments are migrated to.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The number of assignments migrated. |
unarchive
async
¶
unarchive(
enum_value: str | ResourceAttributeEnumValue,
) -> ResourceAttributeEnumValue
Unarchive an enum value.
| PARAMETER | DESCRIPTION |
|---|---|
enum_value
|
The enum value or enum value ID to unarchive.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeEnumValue
|
The unarchived enum value. |
ResourceAttributeAssignmentsAPIAsync
¶
ResourceAttributeAssignmentsAPIAsync(
sift_client: SiftClient,
)
Bases: ResourceBase
High-level API for resource attribute assignments.
Accessed as a nested resource via
client.access_control.resource_attributes.assignments.
Initialize the ResourceAttributeAssignmentsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
create |
Assign a key's value to resources. |
get |
Get a single assignment by ID. |
list_ |
List resource attribute assignments. |
archive |
Batch archive assignments. |
unarchive |
Batch unarchive assignments. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
create
async
¶
create(
key: str | ResourceAttributeKey,
resources: list[
ResourceAttributeEntity | Asset | Channel | Run
],
*,
value: ResourceAttributeValueLike,
) -> list[ResourceAttributeAssignment]
Assign a key's value to resources.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key or key ID to assign. Its
TYPE:
|
resources
|
Resources to assign to. Pass
TYPE:
|
value
|
For |
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttributeAssignment]
|
The created assignments, one per enum value per resource for |
list[ResourceAttributeAssignment]
|
|
get
async
¶
get(*, assignment_id: str) -> ResourceAttributeAssignment
Get a single assignment by ID.
| PARAMETER | DESCRIPTION |
|---|---|
assignment_id
|
The ID of the assignment.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResourceAttributeAssignment
|
The assignment. |
list_
async
¶
list_(
*,
key: str | ResourceAttributeKey | None = None,
resource: ResourceAttributeEntity
| Asset
| Channel
| Run
| None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
created_by: str | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[ResourceAttributeAssignment]
List resource attribute assignments.
For SET_OF_ENUM keys, each enum value is returned as its own assignment.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
Filter to assignments of this key.
TYPE:
|
resource
|
Filter to assignments on this resource. Cannot be combined with
the other filter arguments. Pass a resource object or
TYPE:
|
created_after
|
Filter to assignments created after this datetime.
TYPE:
|
created_before
|
Filter to assignments created before this datetime.
TYPE:
|
created_by
|
Filter to assignments created by this user ID.
TYPE:
|
include_archived
|
If True, include archived assignments.
TYPE:
|
filter_query
|
Explicit CEL query.
TYPE:
|
order_by
|
Field and direction to order by.
TYPE:
|
limit
|
Maximum number of assignments to return.
TYPE:
|
page_size
|
Results to fetch per request.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttributeAssignment]
|
The matching assignments. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
archive
async
¶
archive(
assignments: list[str | ResourceAttributeAssignment],
) -> None
Batch archive assignments.
| PARAMETER | DESCRIPTION |
|---|---|
assignments
|
The assignments or assignment IDs to archive.
TYPE:
|
unarchive
async
¶
unarchive(
assignments: list[str | ResourceAttributeAssignment],
) -> None
Batch unarchive assignments.
| PARAMETER | DESCRIPTION |
|---|---|
assignments
|
The assignments or assignment IDs to unarchive.
TYPE:
|