Role Bindings#
- class RoleBindingsClient(*, sdk_config: SDKConfiguration, generated_client: ApiClient)[source]#
Bases:
objectClient for managing Arize role bindings.
This class is primarily intended for internal use within the SDK. Users are highly encouraged to access resource-specific functionality via
arize.ArizeClient.A role binding assigns a role to a user on a specific resource. Only one binding per user per resource is allowed. The
resource_typemust be eitherSPACEorPROJECT, and theresource_idmust be a unique identifier encoding a resource of the matching type.The role bindings client is a thin wrapper around the generated REST API client, using the shared generated API client owned by
arize.config.SDKConfiguration.- Parameters:
sdk_config (SDKConfiguration) – Resolved SDK configuration.
generated_client (ApiClient) – Shared generated API client instance.
- list(*, resource_type: RoleBindingResourceType, user_id: str | None = None, limit: int = DEFAULT_LIST_LIMIT, cursor: str | None = None) RoleBindingListResponse[source]#
List role bindings for the authenticated user’s account.
Supports cursor-based pagination. Use
user_idto filter by a specific user.- Parameters:
resource_type (RoleBindingResourceType) – Resource type to list bindings for (
RoleBindingResourceType.SPACEorRoleBindingResourceType.PROJECT).limit (int) – Maximum number of role bindings to return. The server enforces an upper bound of 100.
cursor (str | None) – Opaque pagination cursor from a previous response.
user_id (str | None) – Global ID of the user to filter by. When provided, only bindings assigned to this user are returned.
- Returns:
A paginated role binding list response from the Arize REST API.
- Raises:
ApiException – If the API request fails.
- Return type:
- create(*, user_id: str, role_id: str, resource_type: RoleBindingResourceType, resource_id: str) RoleBinding[source]#
Create a new role binding.
Assigns a role to a user on the specified resource. Only one binding per user per resource is allowed.
# Example: # >>> client = arize.role_bindings.Client(…) # >>> binding = client.create( # … user_id=”user-123”, # … role_id=”role-456”, # … resource_type=RoleBindingResourceType.SPACE, # … resource_id=”space-789” # … ) # >>> print(binding.role_id) # “role-456”
- Parameters:
user_id (str) – Unique identifier of the user to bind the role to.
role_id (str) – Unique identifier of the role to assign.
resource_type (RoleBindingResourceType) – Type of resource to bind the role on (
RoleBindingResourceType.SPACEorRoleBindingResourceType.PROJECT).resource_id (str) – Unique identifier of the resource. Must encode a resource of the type specified by
resource_type.
- Returns:
The created role binding object.
- Raises:
ConflictException – If a binding already exists for the user on the specified resource.
ApiException – If the API request fails (for example, invalid resource type/ID combination or insufficient permissions).
- Return type:
- get(*, binding_id: str) RoleBinding[source]#
Get a role binding by ID.
- Parameters:
binding_id (str) – Role binding ID to retrieve.
- Returns:
The role binding object.
- Raises:
ApiException – If the API request fails (for example, binding not found).
- Return type:
- update(*, binding_id: str, role_id: str) RoleBinding[source]#
Update an existing role binding by replacing its assigned role.
Only the
role_idcan be changed on an existing binding. The user, resource type, and resource ID remain the same.# Example: # >>> client = arize.role_bindings.Client(…) # >>> updated_binding = client.update( # … binding_id=”role_binding-123”, # … role_id=”role-456” # … ) # >>> print(updated_binding.role_id) # “role-456”
- Parameters:
- Returns:
The updated role binding object.
- Raises:
ApiException – If the API request fails (for example, binding not found or insufficient permissions).
- Return type:
Response Types#
- class RoleBinding(*, id: Annotated[str, Strict(strict=True)], role_id: Annotated[str, Strict(strict=True)], user_id: Annotated[str, Strict(strict=True)], resource_type: RoleBindingResourceType, resource_id: Annotated[str, Strict(strict=True)], created_at: datetime, updated_at: datetime)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
- id: StrictStr#
- role_id: StrictStr#
- user_id: StrictStr#
- resource_type: RoleBindingResourceType#
- resource_id: StrictStr#
- created_at: datetime#
- updated_at: datetime#
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod from_json(json_str: str) Self | None[source]#
Create an instance of RoleBinding from a JSON string
- to_dict() Dict[str, Any][source]#
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic’s self.model_dump(by_alias=True):
None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
- class RoleBindingListResponse(*, role_bindings: List[RoleBinding], pagination: PaginationMetadata)[source]#
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
role_bindings (List[RoleBinding])
pagination (PaginationMetadata)
- role_bindings: List[RoleBinding]#
- pagination: PaginationMetadata#
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod from_json(json_str: str) Self | None[source]#
Create an instance of RoleBindingListResponse from a JSON string
- to_dict() Dict[str, Any][source]#
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic’s self.model_dump(by_alias=True):
None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
- classmethod from_dict(obj: Dict[str, Any] | None) Self | None[source]#
Create an instance of RoleBindingListResponse from a dict
- to_df(by_alias: bool = False, exclude_none: str | bool = True, json_normalize: bool = False, convert_dtypes: bool = True, expand_field: str = 'additional_properties', expand_prefix: str = '') pd.DataFrame#
Convert a list of objects to a
pandas.DataFrame.- Behavior:
If an item is a Pydantic v2 model, use .model_dump(by_alias=…).
If an item is a mapping (dict-like), use it as-is.
Otherwise, raise a ValueError (unsupported row type).
- Parameters:
self (object) – The object instance containing the field to convert.
by_alias (bool) – Use field aliases when dumping Pydantic models.
exclude_none (str | bool) – Control None/NaN column dropping. - False: keep Nones as-is - “all”: drop columns where all values are None/NaN - “any”: drop columns where any value is None/NaN - True: alias for “all”
json_normalize (bool) – If True, flatten nested dicts via
pandas.json_normalize.convert_dtypes (bool) – If True, call
DataFrame.convert_dtypes()at the end.expand_field (str) – If set, look for this field in each row and expand its keys into top-level columns.
expand_prefix (str) – If set, prefix expanded column names with this string.
- Returns:
The converted DataFrame.
- Return type:
- class RoleBindingResourceType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
-
Resource type for the binding. Only SPACE and PROJECT are supported for single-binding CRUD. resource_id must encode the same resource type.
- SPACE = 'SPACE'#
- PROJECT = 'PROJECT'#