store

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JetbrainsGatewayConfigFileName = "sshConfigs.xml"
)

Variables

View Source
var (
	DefaultWorkspaceClassID    = config.GlobalConfig.GetDefaultWorkspaceClass()
	DefaultWorkspaceTemplateID = config.GlobalConfig.GetDefaultWorkspaceTemplate()
)
View Source
var (
	DefaultApplicationID = "92f59a4yf"
	DefaultApplication   = entity.Application{
		ID:           DefaultApplicationID,
		Name:         "VSCode",
		Port:         22778,
		StartCommand: "",
		Version:      "1.57.1",
	}
)
View Source
var DefaultApplicationList = []entity.Application{DefaultApplication}

Functions

func GetDefaultOrNilOrg

func GetDefaultOrNilOrg(orgs []entity.Organization) *entity.Organization

func NewRestyClient

func NewRestyClient(brevAPIURL string) *resty.Client

func VerifyPrivateKey added in v0.5.0

func VerifyPrivateKey(key []byte) error

Types

type Auth

type Auth interface {
	GetAccessToken() (string, error)
}

type AuthHTTPClient

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

func NewAuthHTTPClient

func NewAuthHTTPClient(auth Auth, brevAPIURL string) *AuthHTTPClient

type AuthHTTPStore

type AuthHTTPStore struct {
	NoAuthHTTPStore
	// contains filtered or unexported fields
}

func (AuthHTTPStore) ApproveUserByID added in v0.5.0

func (s AuthHTTPStore) ApproveUserByID(userID string) (*entity.User, error)

func (AuthHTTPStore) CreateOrganization

func (s AuthHTTPStore) CreateOrganization(req CreateOrganizationRequest) (*entity.Organization, error)

func (AuthHTTPStore) CreateSecret

func (AuthHTTPStore) CreateWorkspace added in v0.4.0

func (s AuthHTTPStore) CreateWorkspace(organizationID string, options *CreateWorkspacesOptions) (*entity.Workspace, error)

func (AuthHTTPStore) DeleteWorkspace added in v0.4.0

func (s AuthHTTPStore) DeleteWorkspace(workspaceID string) (*entity.Workspace, error)

func (AuthHTTPStore) GetActiveOrganizationOrDefault

func (s AuthHTTPStore) GetActiveOrganizationOrDefault() (*entity.Organization, error)

returns the 'set'/active organization or the default one or nil if no orgs exist

func (AuthHTTPStore) GetActiveOrganizationOrNil

func (s AuthHTTPStore) GetActiveOrganizationOrNil() (*entity.Organization, error)

returns the 'set'/active organization or nil if not set

func (AuthHTTPStore) GetAllWorkspaces

func (s AuthHTTPStore) GetAllWorkspaces(options *GetWorkspacesOptions) ([]entity.Workspace, error)

func (AuthHTTPStore) GetContextWorkspaces added in v0.6.0

func (s AuthHTTPStore) GetContextWorkspaces() ([]entity.Workspace, error)

func (AuthHTTPStore) GetCurrentUser

func (s AuthHTTPStore) GetCurrentUser() (*entity.User, error)

func (AuthHTTPStore) GetCurrentUserKeys

func (s AuthHTTPStore) GetCurrentUserKeys() (*entity.UserKeys, error)

func (AuthHTTPStore) GetOrganizations

func (s AuthHTTPStore) GetOrganizations(options *GetOrganizationsOptions) ([]entity.Organization, error)

func (AuthHTTPStore) GetUsers added in v0.5.0

func (s AuthHTTPStore) GetUsers(queryParams map[string]string) ([]entity.User, error)

func (AuthHTTPStore) GetWorkspace

func (s AuthHTTPStore) GetWorkspace(workspaceID string) (*entity.Workspace, error)

func (AuthHTTPStore) GetWorkspaceMetaData

func (s AuthHTTPStore) GetWorkspaceMetaData(workspaceID string) (*entity.WorkspaceMetaData, error)

func (AuthHTTPStore) GetWorkspaces

func (s AuthHTTPStore) GetWorkspaces(organizationID string, options *GetWorkspacesOptions) ([]entity.Workspace, error)

func (AuthHTTPStore) NewAuthHTTPStore

func (s AuthHTTPStore) NewAuthHTTPStore() *AuthHTTPStore

Used if need new instance to customize settings

func (AuthHTTPStore) ResetWorkspace added in v0.4.0

func (s AuthHTTPStore) ResetWorkspace(workspaceID string) (*entity.Workspace, error)

func (AuthHTTPStore) SetDefaultOrganization added in v0.4.0

func (s AuthHTTPStore) SetDefaultOrganization(org *entity.Organization) error

func (*AuthHTTPStore) SetForbiddenStatusRetryHandler added in v0.4.0

func (s *AuthHTTPStore) SetForbiddenStatusRetryHandler(handler func() error) error

func (AuthHTTPStore) StartWorkspace added in v0.4.0

func (s AuthHTTPStore) StartWorkspace(workspaceID string) (*entity.Workspace, error)

func (AuthHTTPStore) StopWorkspace

func (s AuthHTTPStore) StopWorkspace(workspaceID string) (*entity.Workspace, error)

func (AuthHTTPStore) UpdateUser added in v0.5.0

func (s AuthHTTPStore) UpdateUser(userID string, updatedUser *entity.UpdateUser) (*entity.User, error)

type BasicStore

type BasicStore struct{}

func NewBasicStore

func NewBasicStore() *BasicStore

func (*BasicStore) WithFileSystem

func (b *BasicStore) WithFileSystem(fs afero.Fs) *FileStore

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	Name string `json:"name"`
}

type CreateSecretRequest

type CreateSecretRequest struct {
	Name          string        `json:"name"`
	HierarchyType HierarchyType `json:"hierarchyType"`
	HierarchyID   string        `json:"hierarchyID"`
	Src           SecretReqSrc  `json:"src"`
	Dest          SecretReqDest `json:"dest"`
}

type CreateWorkspacesOptions added in v0.4.0

type CreateWorkspacesOptions struct {
	Name                 string               `json:"name"`
	WorkspaceGroupID     string               `json:"workspaceGroupId"`
	WorkspaceClassID     string               `json:"workspaceClassId"`
	GitRepo              string               `json:"gitRepo"`
	IsStoppable          bool                 `json:"isStoppable"`
	WorkspaceTemplateID  string               `json:"workspaceTemplateId"`
	PrimaryApplicationID string               `json:"primaryApplicationId"`
	Applications         []entity.Application `json:"applications"`
}

func NewCreateWorkspacesOptions added in v0.4.0

func NewCreateWorkspacesOptions(clusterID string, name string) *CreateWorkspacesOptions

func (*CreateWorkspacesOptions) WithGitRepo added in v0.4.0

func (c *CreateWorkspacesOptions) WithGitRepo(gitRepo string) *CreateWorkspacesOptions

func (*CreateWorkspacesOptions) WithWorkspaceClassID added in v0.5.0

func (c *CreateWorkspacesOptions) WithWorkspaceClassID(workspaceClassID string) *CreateWorkspacesOptions

type DestConfig

type DestConfig struct {
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
}

type DestType

type DestType string
const (
	File        DestType = "file"
	EnvVariable DestType = "env"
)

type FileStore

type FileStore struct {
	BasicStore
	// contains filtered or unexported fields
}

func (FileStore) CreateNewSSHConfigBackup

func (f FileStore) CreateNewSSHConfigBackup() error

func (FileStore) DeleteAuthTokens added in v0.4.0

func (f FileStore) DeleteAuthTokens() error

func (FileStore) DoesJetbrainsFilePathExist added in v0.6.3

func (f FileStore) DoesJetbrainsFilePathExist() (bool, error)

func (FileStore) FileExists added in v0.5.0

func (f FileStore) FileExists(filepath string) (bool, error)

func (FileStore) GetAuthTokens added in v0.4.0

func (f FileStore) GetAuthTokens() (*entity.AuthTokens, error)

func (FileStore) GetBrevSSHConfigPath added in v0.6.0

func (f FileStore) GetBrevSSHConfigPath() (string, error)

func (FileStore) GetJetBrainsConfig added in v0.5.0

func (f FileStore) GetJetBrainsConfig() (string, error)

func (FileStore) GetJetBrainsConfigPath added in v0.5.0

func (f FileStore) GetJetBrainsConfigPath() (string, error)

func (FileStore) GetOrCreateFile added in v0.5.0

func (f FileStore) GetOrCreateFile(path string) (afero.File, error)

func (FileStore) GetPrivateKeyPath added in v0.6.0

func (f FileStore) GetPrivateKeyPath() string

func (FileStore) GetUserSSHConfig added in v0.6.0

func (f FileStore) GetUserSSHConfig() (string, error)

!! need something to resolve file path of user ssh

func (FileStore) GetUserSSHConfigPath added in v0.6.0

func (f FileStore) GetUserSSHConfigPath() (string, error)

func (FileStore) SaveAuthTokens added in v0.4.0

func (f FileStore) SaveAuthTokens(token entity.AuthTokens) error

func (*FileStore) WithAuthHTTPClient

func (f *FileStore) WithAuthHTTPClient(c *AuthHTTPClient) *AuthHTTPStore

func (*FileStore) WithNoAuthHTTPClient

func (f *FileStore) WithNoAuthHTTPClient(c *NoAuthHTTPClient) *NoAuthHTTPStore

func (FileStore) WriteBrevSSHConfig added in v0.6.0

func (f FileStore) WriteBrevSSHConfig(config string) error

func (FileStore) WriteJetBrainsConfig added in v0.5.0

func (f FileStore) WriteJetBrainsConfig(config string) error

func (FileStore) WritePrivateKey

func (f FileStore) WritePrivateKey(pem string) error

func (FileStore) WriteUserSSHConfig added in v0.6.0

func (f FileStore) WriteUserSSHConfig(config string) error

type GetOrganizationsOptions added in v0.4.0

type GetOrganizationsOptions struct {
	Name string
}

type GetWorkspacesOptions

type GetWorkspacesOptions struct {
	UserID string
	Name   string
}

type GithubReleaseMetadata added in v0.4.0

type GithubReleaseMetadata struct {
	TagName      string `json:"tag_name"`
	IsDraft      bool   `json:"draft"`
	IsPrerelease bool   `json:"prerelease"`
	Name         string `json:"name"`
	Body         string `json:"body"`
}

type HTTPResponseError

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

func NewHTTPResponseError

func NewHTTPResponseError(response *resty.Response) *HTTPResponseError

func (HTTPResponseError) Error

func (e HTTPResponseError) Error() string

type HierarchyType

type HierarchyType string
const (
	Org  HierarchyType = "org"
	User HierarchyType = "user"
)

type NoAuthHTTPClient

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

func NewNoAuthHTTPClient

func NewNoAuthHTTPClient(brevAPIURL string) *NoAuthHTTPClient

type NoAuthHTTPStore

type NoAuthHTTPStore struct {
	FileStore
	// contains filtered or unexported fields
}

func (NoAuthHTTPStore) CreateUser

func (n NoAuthHTTPStore) CreateUser(identityToken string) (*entity.User, error)

func (NoAuthHTTPStore) GetLatestReleaseMetadata added in v0.4.0

func (n NoAuthHTTPStore) GetLatestReleaseMetadata() (*GithubReleaseMetadata, error)

func (NoAuthHTTPStore) NewNoAuthHTTPStore

func (n NoAuthHTTPStore) NewNoAuthHTTPStore() *NoAuthHTTPStore

Used if need new instance to customize settings

func (*NoAuthHTTPStore) WithAuth

func (n *NoAuthHTTPStore) WithAuth(auth Auth) *AuthHTTPStore

func (*NoAuthHTTPStore) WithAuthHTTPClient

func (n *NoAuthHTTPStore) WithAuthHTTPClient(c *AuthHTTPClient) *AuthHTTPStore

type SecretReqDest

type SecretReqDest struct {
	Type   DestType   `json:"type"`
	Config DestConfig `json:"config"`
}

type SecretReqSrc

type SecretReqSrc struct {
	Type   SrcType   `json:"type"`
	Config SrcConfig `json:"config"`
}

type SrcConfig

type SrcConfig struct {
	Value string `json:"value"`
}

type SrcType

type SrcType string
const (
	KeyValue SrcType = "kv2"
)

Jump to

Keyboard shortcuts

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