envswitch

package
v0.31.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner)

NewCommand creates a new cobra command for switching the current environment, which takes in a factory and returns a cobra command and a runner.

Types

type Runner

type Runner struct {
	ConfigHolder      *framework.ConfigHolder
	Output            output.Interface
	Workspace         *workspaces.Workspace
	ApplicationName   string
	EnvironmentId     resources.ID
	EnvironmentName   string
	Scope             resources.ID
	ConnectionFactory connections.Factory
}

Runner is the runner implementation for the `rad env switch` command.

func NewRunner

func NewRunner(factory framework.Factory) *Runner

NewRunner creates a new instance of the `rad env switch` runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run updates the workspace section of the configuration with the workspace name and environment ID provided. It returns an error if the update fails.

func (*Runner) Validate

func (r *Runner) Validate(cmd *cobra.Command, args []string) error

Validate checks if the requested environment exists and if it is an editable workspace, then sets the environment name, scope, and environment ID for the Runner struct. If the requested environment is already set as the default environment, it logs a message. If an error occurs, it is returned.

Jump to

Keyboard shortcuts

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