workspace

package
v3.0.0-...-a5432f4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBackendConfigDefaultOrg

func GetBackendConfigDefaultOrg(project *workspace.Project) (string, error)

func GetCloudInsecure

func GetCloudInsecure(ws Context, cloudURL string) bool

GetCloudInsecure returns if this cloud url is saved as one that should use insecure transport.

func GetCurrentCloudURL

func GetCurrentCloudURL(ws Context, e env.Env, project *workspace.Project) (string, error)

GetCurrentCloudURL returns the URL of the cloud we are currently connected to. This may be empty if we have not logged in. Note if CODEINFRA_BACKEND_URL is set, the corresponding value is returned instead irrespective of the backend for current project or stored credentials.

func InstallPlugin

func InstallPlugin(ctx context.Context, pluginSpec workspace.PluginSpec,
	log func(sev diag.Severity, msg string),
) (*semver.Version, error)

func ValidateProjectDescription

func ValidateProjectDescription(s string) error

ValidateProjectDescription ensures a project description name is valid, if it is not it returns an error with a message suitable for display to an end user.

func ValidateProjectName

func ValidateProjectName(s string) error

ValidateProjectName ensures a project name is valid, if it is not it returns an error with a message suitable for display to an end user.

func ValueOrDefaultProjectDescription

func ValueOrDefaultProjectDescription(
	description string, projectDescription string, defaultDescription string,
) string

ValueOrDefaultProjectDescription returns the value or defaultDescription.

func ValueOrSanitizedDefaultProjectName

func ValueOrSanitizedDefaultProjectName(name string, projectName string, defaultNameToSanitize string) string

ValueOrSanitizedDefaultProjectName returns the value or a sanitized valid project name based on defaultNameToSanitize.

Types

type Context

type Context interface {
	// ReadProject attempts to detect and read a Codeinfra project for the current workspace. If the
	// project is successfully detected and read, it is returned along with the path to its containing
	// directory, which will be used as the root of the project's Codeinfra program.
	ReadProject() (*workspace.Project, string, error)

	// GetStoredCredentials returns any credentials stored on the local machine.
	GetStoredCredentials() (workspace.Credentials, error)
}

Context is an interface that represents the context of a workspace. It provides access to loading projects and plugins.

var Instance Context = &workspaceContext{}

type InstallPluginError

type InstallPluginError struct {
	// The specification of the plugin to install
	Spec workspace.PluginSpec
	// The underlying error that occurred during the download or install.
	Err error
}

InstallPluginError is returned by InstallPlugin if we couldn't install the plugin

func (*InstallPluginError) Error

func (err *InstallPluginError) Error() string

func (*InstallPluginError) Unwrap

func (err *InstallPluginError) Unwrap() error

type MockContext

type MockContext struct {
	ReadProjectF          func() (*workspace.Project, string, error)
	GetStoredCredentialsF func() (workspace.Credentials, error)
}

func (*MockContext) GetStoredCredentials

func (c *MockContext) GetStoredCredentials() (workspace.Credentials, error)

func (*MockContext) ReadProject

func (c *MockContext) ReadProject() (*workspace.Project, string, error)

Jump to

Keyboard shortcuts

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