Documentation Index
Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
The rolebindings client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
A role binding assigns a role to a user on a specific resource. Only SPACE and PROJECT resource types are supported for single-binding CRUD, and resource_id must encode the same resource type. Only one binding per user per resource is allowed.
Get a Role Binding
Get returns a single role binding by ID.
Signature:
func (c *Client) Get(ctx context.Context, bindingID string) (*RoleBindingResponse, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
binding, err := client.RoleBindings.Get(context.Background(), "your-binding-id")
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Fatalf("role binding not found: %v", notFound)
}
log.Fatal(err)
}
fmt.Printf("binding %s: user=%s role=%s resource=%s (%s)\n",
binding.Id,
binding.UserId,
binding.RoleId,
binding.ResourceId,
binding.ResourceType,
)
}
Create a Role Binding
Create issues a POST to create a new role binding and returns the created binding.
Signature:
func (c *Client) Create(
ctx context.Context,
req CreateRequest,
) (*RoleBindingResponse, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2"
"github.com/Arize-ai/client-go-v2/rolebindings"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
binding, err := client.RoleBindings.Create(
context.Background(),
rolebindings.CreateRequest{
UserId: "your-user-id",
RoleId: "your-role-id",
ResourceType: rolebindings.RoleBindingResourceTypePROJECT, // or RoleBindingResourceTypeSPACE
ResourceId: "your-project-id",
},
)
if err != nil {
var conflict *arize.ConflictError
if errors.As(err, &conflict) {
log.Fatalf("binding already exists for this user/resource: %v", conflict)
}
log.Fatal(err)
}
fmt.Printf("created binding %s\n", binding.Id)
}
Update a Role Binding
Update changes the role assigned by an existing binding and returns the updated binding.
Signature:
func (c *Client) Update(
ctx context.Context,
bindingID string,
req UpdateRequest,
) (*RoleBindingResponse, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2"
"github.com/Arize-ai/client-go-v2/rolebindings"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
binding, err := client.RoleBindings.Update(
context.Background(),
"your-binding-id",
rolebindings.UpdateRequest{
RoleId: "new-role-id",
},
)
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Fatalf("role binding not found: %v", notFound)
}
log.Fatal(err)
}
fmt.Printf("updated binding %s now bound to role %s\n", binding.Id, binding.RoleId)
}
Delete a Role Binding
Delete removes a role binding by ID. It returns only an error.
Signature:
func (c *Client) Delete(ctx context.Context, bindingID string) error
Usage Example:
package main
import (
"context"
"errors"
"log"
"github.com/Arize-ai/client-go-v2"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
err = client.RoleBindings.Delete(context.Background(), "your-binding-id")
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Printf("no binding to remove: %v", notFound)
return
}
log.Fatal(err)
}
}