client

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClusterNotFound = errors.New("cluster not found")
View Source
var ErrTeamNotFound = errors.New("team not found")
View Source
var ErrUserNotFound = errors.New("user not found")

Functions

func GetClusterMemberRoleValues

func GetClusterMemberRoleValues() []string

GetClusterMemberRoleValues returns a slice of valid ClusterMemberRole values.

func GetMemberRoleValues

func GetMemberRoleValues() []string

GetMemberRoleValues returns a slice of valid MemberRole values.

Types

type AIAPIKey added in v1.2.0

type AIAPIKey struct {
	ID        string                `json:"id"        yaml:"id"`
	Name      string                `json:"name"      yaml:"name"`
	Prefix    string                `json:"prefix"    yaml:"prefix"`
	CreatedBy AIDeploymentCreatedBy `json:"createdBy" yaml:"createdBy"`
	CreatedAt string                `json:"createdAt" yaml:"createdAt"`
	ExpiresAt string                `json:"expiresAt" yaml:"expiresAt"`
}

type AIAPIKeyClient added in v1.2.0

type AIAPIKeyClient interface {
	ListAIAPIKeys(ctx context.Context, deploymentID string) ([]AIAPIKey, error)
	GetAIAPIKey(ctx context.Context, deploymentID string, name string) (*AIAPIKey, error)
	CreateAIAPIKey(ctx context.Context, deploymentID string, request NewAIAPIKeyRequest) (*AIAPIKeyWithSecret, error)
	DeleteAIAPIKey(ctx context.Context, deploymentID string, keyID string) error
}

type AIAPIKeyWithSecret added in v1.2.0

type AIAPIKeyWithSecret struct {
	AIAPIKey
	Key string `json:"key" yaml:"key"`
}

type AIClient added in v1.2.0

type AIClient interface {
	ListAIModels(ctx context.Context) ([]AIModel, error)
	ListAIDeployments(ctx context.Context) ([]AIDeployment, error)
	GetAIDeployment(ctx context.Context, name string) (*AIDeployment, error)
	CreateAIDeployment(ctx context.Context, request NewAIDeploymentRequest) (*AIDeployment, error)
	DeleteAIDeployment(ctx context.Context, id string) error
}

type AIDeployment added in v1.2.0

type AIDeployment struct {
	ID        string                `json:"id"        yaml:"id"`
	Name      string                `json:"name"      yaml:"name"`
	Model     string                `json:"model"     yaml:"model"`
	Endpoint  string                `json:"endpoint"  yaml:"endpoint"`
	CreatedBy AIDeploymentCreatedBy `json:"createdBy" yaml:"createdBy"`
}

type AIDeploymentCreatedBy added in v1.2.0

type AIDeploymentCreatedBy struct {
	ID   string `json:"id"   yaml:"id"`
	Name string `json:"name" yaml:"name"`
	UPN  string `json:"upn"  yaml:"upn"`
}

type AIModel added in v1.2.0

type AIModel struct {
	ID            string `json:"id"            yaml:"id"`
	DisplayName   string `json:"displayName"   yaml:"displayName"`
	Description   string `json:"description"   yaml:"description"`
	ContextLength int    `json:"contextLength" yaml:"contextLength"`
}

type AddClusterMemberRequest

type AddClusterMemberRequest struct {
	Subject AddClusterMemberSubject `json:"subject"`
	Roles   []ClusterMemberRole     `json:"roles"`
}

type AddClusterMemberSubject

type AddClusterMemberSubject struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

type AddClusterMembersPayload

type AddClusterMembersPayload struct {
	Values []AddClusterMemberRequest `json:"values"`
}

type AddMemberSubject

type AddMemberSubject struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

type AddTeamMemberRequest

type AddTeamMemberRequest struct {
	Roles   []MemberRole     `json:"roles"`
	Subject AddMemberSubject `json:"subject"`
}

type Cluster

type Cluster struct {
	ID              string           `json:"id"`
	Name            string           `json:"name"`
	Version         string           `json:"version"`
	ConsoleURL      string           `json:"consoleUrl"`
	EPG             string           `json:"epg"`
	IngressIP       string           `json:"ingressIp"`
	NodePools       NodePools        `json:"nodePools"`
	Status          ClusterStatus    `json:"status"`
	Roles           []string         `json:"roles"`
	ImagePullSecret *ImagePullSecret `json:"imagePullSecret"`
}

type ClusterClient

type ClusterClient interface {
	ListClusters(ctx context.Context) (ClusterList, error)
	GetCluster(ctx context.Context, name string) (*Cluster, error)
	GetClusterStatus(ctx context.Context, clusterID string) (*Cluster, error)
	CreateCluster(ctx context.Context, request NewClusterRequest) (*Cluster, error)
	DeleteCluster(ctx context.Context, name string) error
	GetClusterMembers(ctx context.Context, clusterID string) ([]ClusterMember, error)
	AddClusterMember(ctx context.Context, clusterID string, request []AddClusterMemberRequest) error
	RemoveClusterMember(ctx context.Context, clusterID string, memberID string) error
}

type ClusterList

type ClusterList []Cluster

type ClusterMember

type ClusterMember struct {
	Subject ClusterMemberSubject `json:"subject" yaml:"subject"`
	Roles   []ClusterMemberRole  `json:"roles"   yaml:"roles"`
}

type ClusterMemberRole

type ClusterMemberRole string
const (
	ClusterMemberRoleAdmin  ClusterMemberRole = "admin"
	ClusterMemberRoleReader ClusterMemberRole = "reader"
)

func (ClusterMemberRole) IsValid

func (r ClusterMemberRole) IsValid() bool

IsValid checks if the ClusterMemberRole is valid.

func (ClusterMemberRole) String

func (r ClusterMemberRole) String() string

String returns the string representation of ClusterMemberRole.

type ClusterMemberSubject

type ClusterMemberSubject struct {
	Type    string    `json:"type"    yaml:"type"`
	Name    string    `json:"name"    yaml:"name"`
	Details string    `json:"details" yaml:"details"`
	ID      uuid.UUID `json:"id"      yaml:"id"`
}

type ClusterStatus

type ClusterStatus struct {
	Ready      StatusReady      `json:"ready"`
	Deployment StatusDeployment `json:"deployment"`
}

type ComputeResources

type ComputeResources struct {
	Cores  int    `json:"cores"`
	Memory string `json:"memory"`
}

type DeleteTeamRequest

type DeleteTeamRequest struct {
	TeamID string `json:"teamId"`
}

type EditPullSecretRequest added in v1.4.0

type EditPullSecretRequest struct {
	Registries map[string]*PullSecretCredential `json:"registries"`
}

type ImagePullSecret added in v1.4.0

type ImagePullSecret struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	Registries []string `json:"registries"`
}

type IntegrationClient

type IntegrationClient interface {
	ListIntegrationInstances(ctx context.Context) ([]IntegrationInstance, error)
}

type IntegrationInstance

type IntegrationInstance struct {
	ID        string    `json:"id"`
	Type      string    `json:"type"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"createdAt"`
}

type Me

type Me struct {
	ID                string   `json:"id"`
	Name              string   `json:"name"`
	OrganizationRoles []string `json:"organizationRoles"`
	OrganizationName  string   `json:"organizationName"`
}

type MeClient

type MeClient interface {
	GetMe(ctx context.Context) (Me, error)
}

type MemberClient

type MemberClient interface {
	AddTeamMember(ctx context.Context, teamID string, request []AddTeamMemberRequest) error
	RemoveTeamMember(ctx context.Context, teamID string, memberID string) error
}

type MemberRole

type MemberRole string
const (
	MemberRoleOwner  MemberRole = "owner"
	MemberRoleMember MemberRole = "member"
)

func (MemberRole) IsValid

func (mr MemberRole) IsValid() bool

IsValid checks if the MemberRole is valid.

func (MemberRole) String

func (mr MemberRole) String() string

String returns the string representation of MemberRole.

type NewAIAPIKeyRequest added in v1.2.0

type NewAIAPIKeyRequest struct {
	Name    string `json:"name"`
	TTLDays int    `json:"ttlDays"`
}

type NewAIDeploymentRequest added in v1.2.0

type NewAIDeploymentRequest struct {
	Name  string `json:"name"`
	Model string `json:"model"`
}

type NewClusterRequest

type NewClusterRequest struct {
	Name           string    `json:"name"`
	SSOProvisioner string    `json:"ssoProvisioner"`
	NodePools      NodePools `json:"nodepools,omitempty"`
	Version        string    `json:"version,omitempty"`
	Environment    string    `json:"environment,omitempty"`
	PullSecretRef  *string   `json:"pullSecretRef,omitempty"`
}

type NewPullSecretRequest added in v1.4.0

type NewPullSecretRequest struct {
	Name       string                          `json:"name"`
	Registries map[string]PullSecretCredential `json:"registries"`
}

type NewTeamRequest

type NewTeamRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type NodePool

type NodePool struct {
	ID                 string            `json:"id,omitempty"`
	Name               string            `json:"name,omitempty"`
	Preset             string            `json:"preset,omitempty"`
	Replicas           *int              `json:"replicas,omitempty"`
	Compute            *ComputeResources `json:"compute,omitempty"`
	AutoscalingEnabled bool              `json:"autoscalingEnabled,omitempty"`
	MinCount           *int              `json:"minCount,omitempty"`
	MaxCount           *int              `json:"maxCount,omitempty"`
}

type NodePools

type NodePools []NodePool

type PullSecret added in v1.4.0

type PullSecret struct {
	ID         string   `json:"id"         yaml:"id"`
	Name       string   `json:"name"       yaml:"name"`
	CreatedAt  string   `json:"createdAt"  yaml:"createdAt"`
	Registries []string `json:"registries" yaml:"registries"`
}

type PullSecretClient added in v1.4.0

type PullSecretClient interface {
	ListPullSecrets(ctx context.Context) ([]PullSecret, error)
	GetPullSecret(ctx context.Context, id string) (*PullSecret, error)
	CreatePullSecret(ctx context.Context, request NewPullSecretRequest) (*PullSecret, error)
	EditPullSecret(ctx context.Context, id string, request EditPullSecretRequest) (*PullSecret, error)
	DeletePullSecret(ctx context.Context, id string) error
	SetClusterPullSecret(ctx context.Context, clusterID string, pullSecretID string) error
}

type PullSecretCredential added in v1.4.0

type PullSecretCredential struct {
	Username string `json:"username"`
	Password string `json:"password"` //nolint:gosec // G117: this is a credential payload, not a hardcoded secret
}

type RequestError

type RequestError struct {
	Message string
}

func (*RequestError) Error

func (e *RequestError) Error() string

type RestClient

type RestClient struct {
	// contains filtered or unexported fields
}

func New

func New(options ...RestClientOption) *RestClient

func (*RestClient) AddClusterMember

func (c *RestClient) AddClusterMember(ctx context.Context, clusterID string, request []AddClusterMemberRequest) error

func (*RestClient) AddTeamMember

func (c *RestClient) AddTeamMember(ctx context.Context, teamID string, request []AddTeamMemberRequest) error

func (*RestClient) CreateAIAPIKey added in v1.2.0

func (c *RestClient) CreateAIAPIKey(
	ctx context.Context, deploymentID string, request NewAIAPIKeyRequest,
) (*AIAPIKeyWithSecret, error)

func (*RestClient) CreateAIDeployment added in v1.2.0

func (c *RestClient) CreateAIDeployment(ctx context.Context, request NewAIDeploymentRequest) (*AIDeployment, error)

func (*RestClient) CreateCluster

func (c *RestClient) CreateCluster(ctx context.Context, request NewClusterRequest) (*Cluster, error)

func (*RestClient) CreatePullSecret added in v1.4.0

func (c *RestClient) CreatePullSecret(ctx context.Context, request NewPullSecretRequest) (*PullSecret, error)

func (*RestClient) CreateTeam

func (c *RestClient) CreateTeam(ctx context.Context, request NewTeamRequest) (*Team, error)

func (*RestClient) DeleteAIAPIKey added in v1.2.0

func (c *RestClient) DeleteAIAPIKey(ctx context.Context, deploymentID string, keyID string) error

func (*RestClient) DeleteAIDeployment added in v1.2.0

func (c *RestClient) DeleteAIDeployment(ctx context.Context, id string) error

func (*RestClient) DeleteCluster

func (c *RestClient) DeleteCluster(ctx context.Context, id string) error

func (*RestClient) DeletePullSecret added in v1.4.0

func (c *RestClient) DeletePullSecret(ctx context.Context, id string) error

func (*RestClient) DeleteTeam

func (c *RestClient) DeleteTeam(ctx context.Context, request DeleteTeamRequest) error

func (*RestClient) EditPullSecret added in v1.4.0

func (c *RestClient) EditPullSecret(
	ctx context.Context,
	id string,
	request EditPullSecretRequest,
) (*PullSecret, error)

func (*RestClient) GetAIAPIKey added in v1.2.0

func (c *RestClient) GetAIAPIKey(ctx context.Context, deploymentID string, name string) (*AIAPIKey, error)

func (*RestClient) GetAIDeployment added in v1.2.0

func (c *RestClient) GetAIDeployment(ctx context.Context, name string) (*AIDeployment, error)

func (*RestClient) GetCluster

func (c *RestClient) GetCluster(ctx context.Context, name string) (*Cluster, error)

func (*RestClient) GetClusterMembers

func (c *RestClient) GetClusterMembers(ctx context.Context, clusterID string) ([]ClusterMember, error)

func (*RestClient) GetClusterStatus

func (c *RestClient) GetClusterStatus(ctx context.Context, clusterID string) (*Cluster, error)

func (*RestClient) GetMe

func (c *RestClient) GetMe(ctx context.Context) (Me, error)

func (*RestClient) GetPullSecret added in v1.4.0

func (c *RestClient) GetPullSecret(ctx context.Context, id string) (*PullSecret, error)

func (*RestClient) GetTeam

func (c *RestClient) GetTeam(ctx context.Context, name string) (*Team, error)

func (*RestClient) GetTeamMembers

func (c *RestClient) GetTeamMembers(ctx context.Context, teamID string) ([]TeamMember, error)

func (*RestClient) GetUser

func (c *RestClient) GetUser(ctx context.Context, upn string) (*User, error)

func (*RestClient) ListAIAPIKeys added in v1.2.0

func (c *RestClient) ListAIAPIKeys(ctx context.Context, deploymentID string) ([]AIAPIKey, error)

func (*RestClient) ListAIDeployments added in v1.2.0

func (c *RestClient) ListAIDeployments(ctx context.Context) ([]AIDeployment, error)

func (*RestClient) ListAIModels added in v1.2.0

func (c *RestClient) ListAIModels(ctx context.Context) ([]AIModel, error)

func (*RestClient) ListClusters

func (c *RestClient) ListClusters(ctx context.Context) (ClusterList, error)

func (*RestClient) ListIntegrationInstances

func (c *RestClient) ListIntegrationInstances(ctx context.Context) ([]IntegrationInstance, error)

func (*RestClient) ListPullSecrets added in v1.4.0

func (c *RestClient) ListPullSecrets(ctx context.Context) ([]PullSecret, error)

func (*RestClient) ListTeams

func (c *RestClient) ListTeams(ctx context.Context) ([]Team, error)

func (*RestClient) ListUsers

func (c *RestClient) ListUsers(ctx context.Context) ([]User, error)

func (*RestClient) RemoveClusterMember

func (c *RestClient) RemoveClusterMember(ctx context.Context, clusterID string, memberID string) error

func (*RestClient) RemoveTeamMember

func (c *RestClient) RemoveTeamMember(ctx context.Context, teamID string, memberID string) error

func (*RestClient) SetClusterPullSecret added in v1.4.0

func (c *RestClient) SetClusterPullSecret(ctx context.Context, clusterID string, pullSecretID string) error

type RestClientOption

type RestClientOption func(*RestClient)

func WithAuthenticator

func WithAuthenticator(authenticator *authenticator.Authenticator) RestClientOption

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) RestClientOption

type StatusDeployment

type StatusDeployment struct {
	Active bool `json:"active"`
	Failed bool `json:"failed"`
}

type StatusReady

type StatusReady struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

type Subject

type Subject struct {
	Type    string    `json:"type"    yaml:"type"`
	Name    string    `json:"name"    yaml:"name"`
	Details string    `json:"details" yaml:"details"`
	ID      uuid.UUID `json:"id"      yaml:"id"`
}

type Team

type Team struct {
	ID          string   `json:"id"          yaml:"id"`
	Name        string   `json:"name"        yaml:"name"`
	Description string   `json:"description" yaml:"description"`
	Role        []string `json:"roles"       yaml:"roles"`
}

type TeamList

type TeamList []Team

type TeamMember

type TeamMember struct {
	Subject Subject      `json:"subject"`
	Roles   []MemberRole `json:"roles"`
}

type TeamsClient

type TeamsClient interface {
	ListTeams(ctx context.Context) ([]Team, error)
	GetTeam(ctx context.Context, name string) (*Team, error)
	GetTeamMembers(ctx context.Context, teamID string) ([]TeamMember, error)
	CreateTeam(ctx context.Context, request NewTeamRequest) (*Team, error)
	DeleteTeam(ctx context.Context, request DeleteTeamRequest) error
}

type User

type User struct {
	ID    string   `json:"id"    yaml:"id"`
	Name  string   `json:"name"  yaml:"name"`
	UPN   string   `json:"upn"   yaml:"upn"`
	Roles []string `json:"roles" yaml:"roles"`
}

type UserClient

type UserClient interface {
	ListUsers(ctx context.Context) ([]User, error)
	GetUser(ctx context.Context, upn string) (*User, error)
}

type UserList

type UserList []User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL