role_assignments
Role assignments model.
Corresponds to "List Role Assignments in a Dataset" endpoint: https://borealisdata.ca/guides/en/latest/api/native-api.html#list-role-assignments-in-a-dataset
RoleAssignment
Bases: BaseModel
A single role assignment.
Source code in src/dv_schema_models/role_assignments.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
get_raw(key)
Get a raw top-level field not covered by the schema (requires extra='allow').
Source code in src/dv_schema_models/role_assignments.py
23 24 25 | |
RoleAssignments
Bases: BaseModel
Role assignments model.
Source code in src/dv_schema_models/role_assignments.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
count_field(field_name, value=None)
Count the number of occurrences of a field with a specific value. If value is None, counts all occurrences of the field regardless of value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field_name
|
str
|
The name of the field to count. |
required |
value
|
str | int | None
|
The value to look for and count. If None, counts all occurrences of the field regardless of value. |
None
|
Returns:
| Type | Description |
|---|---|
int
|
The number of occurrences of the field with the specified value. |
Source code in src/dv_schema_models/role_assignments.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
get_value(field_name)
Get a list of all values for the given field name. Returns None for role assignments that don't have the field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field_name
|
str
|
The name of the field to retrieve values for. |
required |
Returns:
| Type | Description |
|---|---|
list[str | int | None]
|
A list of values for the specified field, or None for role assignments that don't have the field. |
Source code in src/dv_schema_models/role_assignments.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
load_role_assignments(metadata)
Parse a role assignments JSON payload (already loaded as a dict) into a RoleAssignments.
Accepts the full {status, data: [...]} export envelope (including error
responses with no data), or a bare single role assignment dict (no envelope).
Source code in src/dv_schema_models/role_assignments.py
81 82 83 84 85 86 87 88 89 | |