workspace

package
v0.0.0-...-5b6efc0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RolesKey              = "roles"
	IsHiddenKey           = "hideForUnauthorized"
	DefaultInformerResync = time.Second * 10
)

Variables

This section is empty.

Functions

func AdminRole

func AdminRole(userrole userpkg.Role) userpkg.Role

Types

type Capability

type Capability = int
const (
	None Capability = iota
	Read
	Write
	Delete
	Execute
)

type ContextKey

type ContextKey int
const (
	// the key type to use when adding WorkspaceAccess to a Context
	WorkspaceKey ContextKey = iota
)

type Data

type Data struct {
	Name                string
	Roles               []string
	HideForUnauthorized string
	Labels              map[string]string
	Namespace           string
}

type InputData

type InputData struct {
	Name                string
	Roles               []string
	HideForUnauthorized string
	Labels              [][]string
}

type MissingRole

type MissingRole struct {
	Name        userpkg.Role `json:"name"`
	Description string       `json:"description"`
}

type Workspace

type Workspace struct {
	Name                string `json:"name"`
	Description         string `json:"description"`
	HideForUnauthorized bool   `json:"hideForUnauthorized"`

	// the list of required roles for access
	Roles [][]userpkg.Role `json:"roles,omitempty"`
}

func (Workspace) UserCanSeeCustomRoles

func (ws Workspace) UserCanSeeCustomRoles(user userpkg.User) ([]userpkg.Role, bool)

func (Workspace) UserHasAccess

func (ws Workspace) UserHasAccess(user userpkg.User) bool

func (Workspace) UserHasAdminAccess

func (ws Workspace) UserHasAdminAccess(user userpkg.User) bool

type WorkspaceClient

type WorkspaceClient interface {
	// list the workspaces visible to a specific user
	ListWorkspaces() []Workspace
	GetNamespace() string
	Create(k8sclient kubernetes.Interface, cd Data) (string, error)
	Update(k8sclient kubernetes.Interface, cd Data) (string, error)
	Delete(k8sclient kubernetes.Interface, namespace string, wsName string) (string, error)
}

func NewWorkspaceClient

func NewWorkspaceClient(clientSet kubernetes.Interface, namespace string) WorkspaceClient

type WorkspaceClientMock

type WorkspaceClientMock struct {
	mock.Mock
}

func NewDefaultWorkspaceClientMock

func NewDefaultWorkspaceClientMock() *WorkspaceClientMock

func (*WorkspaceClientMock) GetNamespace

func (m *WorkspaceClientMock) GetNamespace() string

func (*WorkspaceClientMock) HasAccessToWorkspace

func (m *WorkspaceClientMock) HasAccessToWorkspace(ctx context.Context, workspaceName string, userTokens []string) (bool, error)

func (*WorkspaceClientMock) ListWorkspaces

func (m *WorkspaceClientMock) ListWorkspaces(ctx context.Context, userTokens []string) ([]Workspace, error)

type WorkspaceGetRequest

type WorkspaceGetRequest struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Roles       []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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