entity

package
v0.6.298 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Running   = "RUNNING"
	Starting  = "STARTING"
	Stopping  = "STOPPING"
	Deploying = "DEPLOYING"
	Stopped   = "STOPPED"
	Deleting  = "DELETING"
	Failure   = "FAILURE"
)

Workspace Status

View Source
const (
	Healthy     = "HEALTHY"
	Unhealthy   = "UNHEALTHY"
	Unavailable = "UNAVAILABLE"
)

Health Status

View Source
const DefaultUser = "ubuntu"
View Source
const WorkspaceGroupDevPlane = "devplane-brev-1"

Variables

View Source
var LegacyWorkspaceGroups = map[string]bool{
	"k8s.brevstack.com":            true,
	"brev-test-brevtenant-cluster": true,
}

Functions

func GetDefaultProjectFolderNameFromRepo added in v0.6.86

func GetDefaultProjectFolderNameFromRepo(repo string) string

func MapContainsKey added in v0.6.112

func MapContainsKey[K comparable, V any](m map[K]V, key K) bool

Types

type APIKey added in v0.6.280

type APIKey struct {
	Enabled      bool   `json:"enabled"`
	ID           string `json:"id"`
	ClientID     string `json:"clientID"`
	ClientSecret string `json:"clientSecret"`
}

type Application

type Application struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Port         int    `json:"port"`
	StartCommand string `json:"startCommand"`
	Version      string `json:"version"`
}

type AuthTokens

type AuthTokens struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type CFApplication added in v0.6.280

type CFApplication struct {
	CloudflareApplicationID  string `json:"cloudflareApplicationID"`
	CloudflareDNSRecordID    string `json:"cloudflareDnsRecordID"`
	Hostname                 string `json:"hostname"`
	Name                     string `json:"name"`
	ServiceType              string `json:"serviceType"`
	Port                     int    `json:"port"`
	UserApplicationSetupBash string `json:"userApplicationSetupBash"`
	Policy                   Policy `json:"policy"`
	HealthCheckID            string `json:"healthCheckID"`
}

CFApplication TODO Change this to Application. Theres an older application struct that should be removed

type CredentialProvider added in v0.6.296

type CredentialProvider string

CredentialProvider describes which authentication system is resposnible for auth tokens.

const (
	CredientialProviderUnspecified CredentialProvider = ""
)

type EmptyRepo added in v0.6.84

type EmptyRepo struct {
	EmptyDirectory *string `json:"emptyRepoDirectory,omitempty"` // need to be different names than gitrepo
}

type ExecName added in v0.6.71

type ExecName string

type ExecOptions added in v0.6.84

type ExecOptions struct {
	IsDisabled     bool       `json:"isDisabled"`
	ExecWorkDir    *string    `json:"execWorkDir"`
	LogPath        *string    `json:"logPath"`
	LogArchivePath *string    `json:"logArchivePath"`
	DependsOn      []ExecName `json:"dependsOn"`
}

type ExecStage added in v0.6.84

type ExecStage string
const (
	StartStage ExecStage = "start"
	BuildStage ExecStage = "build"
)

type ExecType added in v0.6.84

type ExecType string
const PathExecType ExecType = "path"
const StringExecType ExecType = "string"

type ExecV0 added in v0.6.71

type ExecV0 struct {
	Exec        string   `json:"exec"`
	ExecWorkDir string   `json:"execWorkDir"`
	DependsOn   []string `json:"dependsOn"`
}

type ExecV1 added in v0.6.84

type ExecV1 struct {
	Type  ExecType   `json:"type"`  // string or path // default=str
	Stage *ExecStage `json:"stage"` // start, build // default=start
	ExecOptions
	StringExec
	PathExec
}

type ExecsV0 added in v0.6.84

type ExecsV0 map[ExecName]ExecV0

type ExecsV1 added in v0.6.84

type ExecsV1 map[ExecName]ExecV1

type GitRepo added in v0.6.84

type GitRepo struct {
	Repository string `json:"repository,omitempty"`
	GitRepoOptions
}

func (GitRepo) GetDir added in v0.6.84

func (g GitRepo) GetDir() string

type GitRepoOptions added in v0.6.84

type GitRepoOptions struct {
	Branch       *string `json:"branch,omitempty"`           // branch, tag, commit
	GitDirectory *string `json:"gitRepoDirectory,omitempty"` // need to be different names than emptyrepo
}

type GlobalUserType added in v0.6.74

type GlobalUserType string
const (
	Admin    GlobalUserType = "Admin"
	Standard GlobalUserType = "Standard"
)

type IDEConfig added in v0.6.71

type IDEConfig struct {
	DefaultWorkingDir string       `json:"defaultWorkingDir"`
	VSCode            VSCodeConfig `json:"vscode"`

} // @Name IDEConfig

type ModifyWorkspaceRequest added in v0.6.97

type ModifyWorkspaceRequest struct {
	WorkspaceClass    string    `json:"workspaceClassId"`
	IsStoppable       *bool     `json:"isStoppable"`
	StartupScriptPath string    `json:"startupScriptPath"`
	Name              string    `json:"name"`
	Description       string    `json:"description"`
	IDEConfig         IDEConfig `json:"ideConfig"`
	Repos             ReposV0   `json:"repos"`
	Execs             ExecsV0   `json:"execs"`
	ReposV1           *ReposV1  `json:"reposV1"`
	ExecsV1           *ExecsV1  `json:"execsV1"`
	InstanceType      string    `json:"instanceType"`
}

type OnboardingData added in v0.6.91

type OnboardingData struct {
	Editor                 string `json:"editor"`
	SSH                    bool   `json:"ssh"`
	UsedCLI                bool   `json:"usedCli"`
	FinishedOnboarding     bool   `json:"finishedOnboarding"`
	CliOnboardingSkipped   bool   `json:"cliOnboardingSkipped"`
	CliOnboardingIntro     bool   `json:"cliOnboardingIntro"`
	CliOnboardingLs        bool   `json:"cliOnboardingLs"`
	CliOnboardingBrevOpen  bool   `json:"cliOnboardingBrevOpen"`
	CliOnboardingBrevShell bool   `json:"cliOnboardingBrevShell"`
	CliOnboardingCompleted bool   `json:"cliOnboardingCompleted"`
}

type Organization

type Organization struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	UserNetworkID string `json:"userNetworkId"`
}

type PathExec added in v0.6.84

type PathExec struct {
	ExecPath string `json:"execPath,omitempty"`
}

type Policy added in v0.6.280

type Policy struct {
	AllowedUserAuthIDs []string `json:"allowedUserAuthIDs"`
	AllowEveryone      bool     `json:"allowEveryone"`
	APIKey             APIKey   `json:"apiKey"`
}

type RepoName added in v0.6.71

type RepoName string

type RepoType added in v0.6.84

type RepoType string
const (
	GitRepoType   RepoType = "git"
	EmptyRepoType RepoType = "empty"
)

type RepoV0 added in v0.6.71

type RepoV0 struct {
	Repository    string   `json:"repository"`
	Branch        string   `json:"branch"` // branch, tag, commit
	Directory     string   `json:"directory"`
	BrevPath      string   `json:"brevPath"`
	SetupExecPath string   `json:"setupExecPath"`
	ExecWorkDir   string   `json:"execWorkDir"`
	DependsOn     []string `json:"dependsOn"`
}

type RepoV1 added in v0.6.84

type RepoV1 struct {
	Type RepoType `json:"type"`
	GitRepo
	EmptyRepo
}

func (RepoV1) GetDir added in v0.6.84

func (r RepoV1) GetDir() (string, error)

type ReposV0 added in v0.6.84

type ReposV0 map[RepoName]RepoV0

type ReposV1 added in v0.6.84

type ReposV1 map[RepoName]RepoV1

type RequestCreateWorkspace

type RequestCreateWorkspace 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         []Application `json:"applications"`
}

type StringExec added in v0.6.84

type StringExec struct {
	ExecStr string `json:"execStr,omitempty"`
}

type Tunnel added in v0.6.280

type Tunnel struct {
	TunnelID        string          `json:"tunnelID"`
	Applications    []CFApplication `json:"applications"`
	TunnelSetupBash string          `json:"tunnelSetupBash"`
	TunnelStatus    string          `json:"tunnelStatus"`
}

type UpdateUser added in v0.5.0

type UpdateUser struct {
	Username          string                 `json:"username,omitempty"`
	Name              string                 `json:"name,omitempty"`
	Email             string                 `json:"email,omitempty"`
	BaseWorkspaceRepo string                 `json:"baseWorkspaceRepo,omitempty"`
	OnboardingData    map[string]interface{} `json:"onboardingData,omitempty"`
	IdeConfig         IDEConfig              `json:"ideConfig,omitempty"`
}

type User

type User struct {
	ID                string                 `json:"id"`
	PublicKey         string                 `json:"publicKey,omitempty"`
	Username          string                 `json:"username"`
	Name              string                 `json:"name"`
	Email             string                 `json:"email"`
	WorkspacePassword string                 `json:"workspacePassword"`
	BaseWorkspaceRepo string                 `json:"baseWorkspaceRepo"`
	GlobalUserType    GlobalUserType         `json:"globalUserType"`
	IdeConfig         IDEConfig              `json:"ideConfig,omitempty"`
	OnboardingData    map[string]interface{} `json:"onboardingData"`
}

func (User) GetOnboardingData added in v0.6.91

func (u User) GetOnboardingData() (*OnboardingData, error)

type UserKeys

type UserKeys struct {
	PrivateKey string `json:"privateKey"`
	PublicKey  string `json:"publicKey"`
}

type VSCodeConfig added in v0.6.71

type VSCodeConfig struct {
	Extensions []VscodeExtensionMetadata `json:"extensions"`

} // @Name VSCodeConfig

type VerbBuildStatus added in v0.6.280

type VerbBuildStatus string
const (
	Unset        VerbBuildStatus = ""
	CreateFailed VerbBuildStatus = "CREATE_FAILED"
	Pending      VerbBuildStatus = "PENDING"
	Building     VerbBuildStatus = "BUILDING"
	Completed    VerbBuildStatus = "COMPLETED"
)

type VscodeExtensionMetadata added in v0.6.71

type VscodeExtensionMetadata struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Version     string `json:"version"`
	Publisher   string `json:"publisher"`
	Description string `json:"description"`
	Repository  string `json:"repository"`

} // @Name ExtensionMetadata

func (VscodeExtensionMetadata) GetID added in v0.6.71

func (v VscodeExtensionMetadata) GetID() string

type Workspace

type Workspace struct {
	ID                   string            `json:"id"`
	Name                 string            `json:"name"`
	WorkspaceGroupID     string            `json:"workspaceGroupId"`
	OrganizationID       string            `json:"organizationId"`
	WorkspaceClassID     string            `json:"workspaceClassId"` // WorkspaceClassID is resources, like "2x8"
	InstanceType         string            `json:"instanceType,omitempty"`
	CreatedByUserID      string            `json:"createdByUserId"`
	DNS                  string            `json:"dns"`
	Status               string            `json:"status"`
	Password             string            `json:"password"`
	GitRepo              string            `json:"gitRepo"`
	Version              string            `json:"version"`
	WorkspaceTemplate    WorkspaceTemplate `json:"workspaceTemplate"`
	NetworkID            string            `json:"networkId"`
	StartupScriptPath    string            `json:"startupScriptPath"`
	ReposV0              ReposV0           `json:"repos"`
	ExecsV0              ExecsV0           `json:"execs"`
	ReposV1              *ReposV1          `json:"reposV1"`
	ExecsV1              *ExecsV1          `json:"execsV1"`
	IDEConfig            IDEConfig         `json:"ideConfig"`
	SSHPort              int               `json:"sshPort"`
	SSHUser              string            `json:"sshUser"`
	SSHProxyHostname     string            `json:"sshProxyHostname"`
	HostSSHPort          int               `json:"hostSshPort"`
	HostSSHUser          string            `json:"hostSshUser"`
	HostSSHProxyHostname string            `json:"hostSshProxyHostname"`
	VerbBuildStatus      VerbBuildStatus   `json:"verbBuildStatus"`
	VerbYaml             string            `json:"verbYaml"`
	// PrimaryApplicationId         string `json:"primaryApplicationId,omitempty"`
	// LastOnlineAt         string `json:"lastOnlineAt,omitempty"`
	// CreatedAt         string `json:"createdAt,omitempty"`
	// UpdatedAt         string `json:"updatedAt,omitempty"`
	HealthStatus    string        `json:"healthStatus"`
	IsStoppable     bool          `json:"isStoppable"` // used for autopstop only
	StatusMessage   string        `json:"statusMessage"`
	StopTimeout     time.Duration `json:"stopTimeout"`
	AdditionalUsers []string      `json:"additionalUsers"`
	Tunnel          Tunnel        `json:"tunnel"`
}

func (Workspace) CanShow added in v0.6.269

func (w Workspace) CanShow(userID string) bool

func (Workspace) GetHostIdentifier added in v0.6.274

func (w Workspace) GetHostIdentifier() WorkspaceLocalID

func (Workspace) GetHostSSHPort added in v0.6.262

func (w Workspace) GetHostSSHPort() int

func (Workspace) GetHostSSHUser added in v0.6.262

func (w Workspace) GetHostSSHUser() string

func (Workspace) GetHostname added in v0.6.203

func (w Workspace) GetHostname() string

func (Workspace) GetID

func (w Workspace) GetID() string

func (Workspace) GetIsStoppable added in v0.6.73

func (w Workspace) GetIsStoppable() bool

func (Workspace) GetLocalIdentifier added in v0.5.0

func (w Workspace) GetLocalIdentifier() WorkspaceLocalID

func (Workspace) GetNodeIdentifierForVPN added in v0.6.22

func (w Workspace) GetNodeIdentifierForVPN() string

func (Workspace) GetProjectFolderPath added in v0.6.63

func (w Workspace) GetProjectFolderPath() string

func (Workspace) GetSSHPort added in v0.6.262

func (w Workspace) GetSSHPort() int

func (Workspace) GetSSHURL added in v0.6.0

func (w Workspace) GetSSHURL() string

func (Workspace) GetSSHUser added in v0.6.262

func (w Workspace) GetSSHUser() string

func (Workspace) GetStopTimeout added in v0.6.72

func (w Workspace) GetStopTimeout() time.Duration

func (Workspace) GetUsername added in v0.6.203

func (w Workspace) GetUsername() string

func (Workspace) IsLegacy added in v0.6.203

func (w Workspace) IsLegacy() bool

func (Workspace) IsShared added in v0.6.269

func (w Workspace) IsShared(userID string) bool

type WorkspaceGroup added in v0.6.99

type WorkspaceGroup struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	BaseDNS        string `json:"baseDns"`
	Status         string `json:"status"`
	Platform       string `json:"platform"`
	PlatformID     string `json:"platformId"`
	PlatformRegion string `json:"platformRegion"`
	Version        string `json:"version"`
	TenantType     string `json:"tenantType"`

} // @Name WorkspaceGroup

type WorkspaceLocalID added in v0.5.0

type WorkspaceLocalID string

type WorkspaceMetaData

type WorkspaceMetaData struct {
	PodName       string `json:"podName"`
	NamespaceName string `json:"namespaceName"`
}

func (WorkspaceMetaData) GetNamespaceName

func (w WorkspaceMetaData) GetNamespaceName() string

func (WorkspaceMetaData) GetPodName

func (w WorkspaceMetaData) GetPodName() string

type WorkspaceTemplate added in v0.6.0

type WorkspaceTemplate struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	RegistryURI string `json:"registryUri"`
	Image       string `json:"image"`
	Public      bool   `json:"public"`
	Port        int    `json:"port"`
}

type WorkspaceWithMeta

type WorkspaceWithMeta struct {
	WorkspaceMetaData
	Workspace
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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