client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 12 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 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"`
}

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 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 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 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 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) CreateCluster

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

func (*RestClient) CreateTeam

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

func (*RestClient) DeleteCluster

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

func (*RestClient) DeleteTeam

func (c *RestClient) DeleteTeam(ctx context.Context, request DeleteTeamRequest) 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) 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) ListClusters

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

func (*RestClient) ListIntegrationInstances

func (c *RestClient) ListIntegrationInstances(ctx context.Context) ([]IntegrationInstance, 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

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