Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
NewCommand creates a new Cobra command and a Runner to handle the command's logic, and adds flags to the command for workspace, resource group, environment name, force and context.
func ValidateApplicationsCoreEnvironment ¶
func ValidateApplicationsCoreEnvironment(ctx context.Context, ws *workspaces.Workspace, mgmtClient clients.ApplicationsManagementClient, envName string) (string, error)
ValidateApplicationsCoreEnvironment is the default EnvironmentValidator. It targets Applications.Core/environments via the management client.
func ValidateArgs ¶
func ValidateArgs() cobra.PositionalArgs
ValidateArgs checks if the number of arguments passed to the command is between 1 and 2, and if the first argument is "kubernetes", and returns an error if either of these conditions are not met.
Types ¶
type EnvironmentValidator ¶
type EnvironmentValidator func(ctx context.Context, ws *workspaces.Workspace, mgmtClient clients.ApplicationsManagementClient, envName string) (envID string, err error)
EnvironmentValidator validates that the environment named envName exists in the scope of ws, and returns the fully-qualified environment resource ID to be persisted on the workspace. mgmtClient is the management client already created for the workspace scope; implementations are free to ignore it (e.g. preview implementations that talk to the Radius.Core resource provider directly).
type Runner ¶
type Runner struct {
ConfigHolder *framework.ConfigHolder
ConnectionFactory connections.Factory
Workspace *workspaces.Workspace
Force bool
ConfigFileInterface framework.ConfigFileInterface
Output output.Interface
HelmInterface helm.Interface
KubernetesInterface kubernetes.Interface
// EnvironmentValidator is invoked to validate that the requested environment exists
// and to construct the environment resource ID stored on the workspace. When nil,
// the legacy Applications.Core/environments validator is used.
EnvironmentValidator EnvironmentValidator
}
Runner is the runner implementation for the `rad workspace create` command.
func (*Runner) Run ¶
Run creates a workspace and sets it as the current workspace, returning an error if any occurs during the process."
func (*Runner) Validate ¶
Validate checks if the given workspace name is valid, if the given Kubernetes context is valid, if the Radius control plane is installed on the target platform, if the workspace already exists, if the user has specified the --force flag, if the given resource group and environment exist, and returns an error if any of these checks fail.