Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = models.Command{ Name: "environments", ShortHelp: "Manage environments for which you have access", LongHelp: "This command has been moved! Please use [environments list](#environments-list) instead. This alias will be removed in the next CLI update.\n\n" + "The `environments` command allows you to manage your environments. The environments command can not be run directly but has sub commands.", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(cmd *cli.Cmd) { cmd.CommandLong(ListSubCmd.Name, ListSubCmd.ShortHelp, ListSubCmd.LongHelp, ListSubCmd.CmdFunc(settings)) cmd.CommandLong(RenameSubCmd.Name, RenameSubCmd.ShortHelp, RenameSubCmd.LongHelp, RenameSubCmd.CmdFunc(settings)) cmd.Action = func() { logrus.Warnln("This command has been moved! Please use \"catalyze environments list\" instead. This alias will be removed in the next CLI update.") logrus.Warnln("You can list all available environments subcommands by running \"catalyze environments --help\".") if _, err := auth.New(settings, prompts.New()).Signin(); err != nil { logrus.Fatal(err.Error()) } err := CmdList(New(settings)) if err != nil { logrus.Fatal(err.Error()) } } } }, }
Cmd is the contract between the user and the CLI. This specifies the command name, arguments, and required/optional arguments and flags for the command.
View Source
var ListSubCmd = models.Command{ Name: "list", ShortHelp: "List all environments you have access to", LongHelp: "`environments list` lists all environments that you are granted access to. " + "These environments include those you created and those that other Catalyze customers have added you to. " + "Here is a sample command\n\n" + "```\ncatalyze environments list\n```", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(subCmd *cli.Cmd) { subCmd.Action = func() { if _, err := auth.New(settings, prompts.New()).Signin(); err != nil { logrus.Fatalln(err.Error()) } err := CmdList(New(settings)) if err != nil { logrus.Fatalln(err.Error()) } } } }, }
View Source
var RenameSubCmd = models.Command{ Name: "rename", ShortHelp: "Rename an environment", LongHelp: "`environments rename` allows you to rename your environment. Here is a sample command\n\n" + "```\ncatalyze -E \"<your_env_alias>\" environments rename MyNewEnvName\n```", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(subCmd *cli.Cmd) { name := subCmd.StringArg("NAME", "", "The new name of the environment") subCmd.Action = func() { if _, err := auth.New(settings, prompts.New()).Signin(); err != nil { logrus.Fatal(err.Error()) } if err := config.CheckRequiredAssociation(true, true, settings); err != nil { logrus.Fatal(err.Error()) } err := CmdRename(settings.EnvironmentID, *name, New(settings)) if err != nil { logrus.Fatalln(err.Error()) } } subCmd.Spec = "NAME" } }, }
Functions ¶
func CmdList ¶
func CmdList(environments IEnvironments) error
CmdList lists all environments which the user has access to
func CmdRename ¶
func CmdRename(envID, name string, ie IEnvironments) error
Types ¶
type IEnvironments ¶
type IEnvironments interface { List() (*[]models.Environment, map[string]error) Retrieve(envID string) (*models.Environment, error) Update(envID string, updates map[string]string) error }
IEnvironments is an interface for interacting with environments
func New ¶
func New(settings *models.Settings) IEnvironments
New generates a new instance of IEnvironments
type SEnvironments ¶
SEnvironments is a concrete implementation of IEnvironments
func (*SEnvironments) List ¶
func (e *SEnvironments) List() (*[]models.Environment, map[string]error)
func (*SEnvironments) Retrieve ¶
func (e *SEnvironments) Retrieve(envID string) (*models.Environment, error)
Click to show internal directories.
Click to hide internal directories.