Documentation
¶
Index ¶
- func GetBackendConfigDefaultOrg(project *workspace.Project) (string, error)
- func GetCloudInsecure(ws Context, cloudURL string) bool
- func GetCurrentCloudURL(ws Context, e env.Env, project *workspace.Project) (string, error)
- func InstallPlugin(ctx context.Context, pluginSpec workspace.PluginSpec, ...) (*semver.Version, error)
- func ValidateProjectDescription(s string) error
- func ValidateProjectName(s string) error
- func ValueOrDefaultProjectDescription(description string, projectDescription string, defaultDescription string) string
- func ValueOrSanitizedDefaultProjectName(name string, projectName string, defaultNameToSanitize string) string
- type Context
- type InstallPluginError
- type MockContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCloudInsecure ¶
GetCloudInsecure returns if this cloud url is saved as one that should use insecure transport.
func GetCurrentCloudURL ¶
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 ValidateProjectDescription ¶
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 ¶
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.
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)