cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:     "create <cluster_id>",
	Short:   "Creates the specified cluster",
	Long:    "Creates the specified cluster in Pharos.",
	Args:    func(cmd *cobra.Command, args []string) error { return argID(args) },
	PreRunE: func(cmd *cobra.Command, args []string) error { return markFlagsRequired(cmd) },
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runCreate(args[0], environment, clusterAuthorityData, server, client)
	},
}

CreateCmd implements a CLI command that allows users to create a cluster in Pharos.

View Source
var CurrentCmd = &cobra.Command{
	Use:   "current",
	Short: "Print current cluster",
	Long:  "Prints current cluster in the designated kubeconfig file.",
	RunE:  func(cmd *cobra.Command, args []string) error { return runCurrent(file) },
}

CurrentCmd is the pharos clusters current command.

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <cluster_id>",
	Short: "Deletes the specified cluster",
	Long:  "Marks the specified cluster as deleted in Pharos.",
	Args:  func(cmd *cobra.Command, args []string) error { return argID(args) },
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runDelete(args[0], client)
	},
}

DeleteCmd implements a CLI command that allows users to mark a cluster as deleted in the Pharos database.

View Source
var GetCmd = &cobra.Command{
	Use:   "get <cluster_id>",
	Short: "Retrieves information about the specified cluster",
	Long:  "Retrieves information about the specified cluster and merges it into designated kubeconfig file.",
	Args:  func(cmd *cobra.Command, args []string) error { return argID(args) },
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runGet(args[0], file, dryRun, client)
	},
}

GetCmd implements a CLI command that allows users to get cluster information from a new cluster and merge it into an existing kubeconfig file.

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Retrieves a list of all clusters",
	Long:  "Retrieves a list of all clusters currently registered with Pharos.",
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runList(environment, inactive, client)
	},
}

ListCmd implements a CLI command that allows users to retrieve a list of all clusters currently registered with pharos-api.

View Source
var SetupCmd = &cobra.Command{
	Use:   "setup",
	Short: "Setup Pharos config",
	Long:  "Setup Pharos configuration file. Overwrites previously saved configuration.",
	RunE: func(cmd *cobra.Command, args []string) error {
		return runSetup(pharosConfig, pharosURL, awsProfile, awsRoleARN)
	},
}

SetupCmd is the pharos setup command.

View Source
var SwitchCmd = &cobra.Command{
	Use:   "switch <cluster_id>",
	Short: "Switch to specified cluster",
	Long:  "Switches the current context in the designated kubeconfig file to the context referencing the specified cluster.",
	Args:  func(cmd *cobra.Command, args []string) error { return argID(args) },
	RunE:  func(cmd *cobra.Command, args []string) error { return runSwitch(file, args[0]) },
}

SwitchCmd implements a CLI command that allows users to switch between clusters.

View Source
var SyncCmd = &cobra.Command{
	Use:   "sync",
	Short: "Retrieves information from clusters",
	Long:  "Retrieves information from specified clusters and merges it into designated kubeconfig file.",
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runSync(file, inactive, dryRun, overwrite, client)
	},
}

SyncCmd implements a CLI command that allows users to get cluster information from all currently existing clusters in Pharos and merge it into an existing kubeconfig file.

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update <cluster_id>",
	Short: "Updates the status of a cluster",
	Long:  "Updates the status of the specified cluster in Pharos.",
	Args:  func(cmd *cobra.Command, args []string) error { return argID(args) },
	RunE: func(cmd *cobra.Command, args []string) error {
		client, err := api.ClientFromConfig(pharosConfig)
		if err != nil {
			return errors.Wrap(err, "unable to create client from pharos config file")
		}
		return runUpdate(args[0], active, client)
	},
}

UpdateCmd implements a CLI command that allows users to update the status of a cluster in Pharos.

Functions

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewClustersCmd added in v0.1.1

func NewClustersCmd() *cobra.Command

NewClustersCmd returns a new cobra.Command with all the necessary clusters sub-commands attached to it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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