juju: github.com/juju/juju/cmd/juju/commands Index | Files | Directories

package commands

import "github.com/juju/juju/cmd/juju/commands"


Package Files

add_sshkeys.go bootstrap.go bootstrap_clouds.go bootstrap_interactive.go commands.go debugcode.go debughooks.go debuglog.go enableha.go exec.go helptool.go import_sshkeys.go list_sshkeys.go main.go migrate.go plugin.go remove_sshkeys.go repl.go scp.go ssh.go ssh_container.go ssh_machine.go sshkeys.go switch.go synctools.go upgradecontroller.go upgrademodel.go version.go


const (
    // SSHRetryDelay is the time to wait for an SSH connection to be established
    // to a single endpoint of a target.
    SSHRetryDelay = 500 * time.Millisecond

    // SSHTimeout is the time to wait for before giving up trying to establish
    // an SSH connection to a target, after retrying.
    SSHTimeout = 5 * time.Second

    // SSHPort is the TCP port used for SSH connections.
    SSHPort = 22
const JujuPluginPattern = "^juju-[a-zA-Z]"
const JujuPluginPrefix = "juju-"


var SeverityColor = map[string]*ansiterm.Context{
    "TRACE":   ansiterm.Foreground(ansiterm.Default),
    "DEBUG":   ansiterm.Foreground(ansiterm.Green),
    "INFO":    ansiterm.Foreground(ansiterm.BrightBlue),
    "WARNING": ansiterm.Foreground(ansiterm.Yellow),
    "ERROR":   ansiterm.Foreground(ansiterm.BrightRed),
    "CRITICAL": {
        Foreground: ansiterm.White,
        Background: ansiterm.Red,

func ConvertActionResults Uses

func ConvertActionResults(result params.ActionResult, query actionQuery, compat bool) map[string]interface{}

ConvertActionResults takes the results from the api and creates a map suitable for format conversion to YAML or JSON.

func Main Uses

func Main(args []string) int

Main registers subcommands for the juju executable, and hands over control to the cmd package. This function is not redundant with main, because it provides an entry point for testing with arbitrary command line arguments. This function returns the exit code, for main to pass to os.Exit.

func NewAddKeysCommand Uses

func NewAddKeysCommand() cmd.Command

NewAddKeysCommand is used to add a new ssh key to a model.

func NewImportKeysCommand Uses

func NewImportKeysCommand() cmd.Command

NewImportKeysCommand is used to add new authorized ssh keys to a model.

func NewJujuCommand Uses

func NewJujuCommand(ctx *cmd.Context, jujuMsg string) cmd.Command

NewJujuCommand creates the "juju" super command.

func NewJujuCommandWithStore Uses

func NewJujuCommandWithStore(
    ctx *cmd.Context, store jujuclient.ClientStore, log *cmd.Log, jujuMsg, helpHint string, whitelist []string, embedded bool,
) cmd.Command

NewJujuCommandWithStore creates the "juju" super command with the specified parameters.

func NewListKeysCommand Uses

func NewListKeysCommand() cmd.Command

NewListKeysCommand returns a command used to list the authorized ssh keys.

func NewRemoveKeysCommand Uses

func NewRemoveKeysCommand() cmd.Command

NewRemoveKeysCommand is used to delete ssk keys for a user.

func RegisterCommand Uses

func RegisterCommand(newCommand func() cmd.Command)

RegisterCommand adds the provided func to the set of those that will be called when the juju command runs. Each returned command will be registered with the "juju" supercommand.

func RegisterEnvCommand Uses

func RegisterEnvCommand(newCommand func() modelcmd.ModelCommand)

RegisterEnvCommand adds the provided func to the set of those that will be called when the juju command runs. Each returned command will be wrapped in envCmdWrapper, which is what gets registered with the "juju" supercommand.

func RunPlugin Uses

func RunPlugin(callback cmd.MissingCallback) cmd.MissingCallback

RunPlugin attempts to find the plugin on path to run

type ApplicationAPI Uses

type ApplicationAPI interface {
    Close() error
    UnitsInfo(units []names.UnitTag) ([]application.UnitInfo, error)

ApplicationAPI defines application related APIs.

type BootstrapInterface Uses

type BootstrapInterface interface {
    // Bootstrap bootstraps a controller.
    Bootstrap(ctx environs.BootstrapContext, environ environs.BootstrapEnviron, callCtx context.ProviderCallContext, args bootstrap.BootstrapParams) error

    // CloudDetector returns a CloudDetector for the given provider,
    // if the provider supports it.
    CloudDetector(environs.EnvironProvider) (environs.CloudDetector, bool)

    // CloudRegionDetector returns a CloudRegionDetector for the given provider,
    // if the provider supports it.
    CloudRegionDetector(environs.EnvironProvider) (environs.CloudRegionDetector, bool)

    // CloudFinalizer returns a CloudFinalizer for the given provider,
    // if the provider supports it.
    CloudFinalizer(environs.EnvironProvider) (environs.CloudFinalizer, bool)

BootstrapInterface provides bootstrap functionality that Run calls to support cleaner testing.

type CloudCredentialAPI Uses

type CloudCredentialAPI interface {
    Cloud(tag names.CloudTag) (jujucloud.Cloud, error)
    CredentialContents(cloud, credential string, withSecrets bool) ([]params.CredentialContentResult, error)
    BestAPIVersion() int
    Close() error

CloudCredentialAPI defines cloud credential related APIs.

type Context Uses

type Context interface {
    InterruptNotify(c chan<- os.Signal)
    StopInterruptNotify(c chan<- os.Signal)
    GetStdout() io.Writer
    GetStderr() io.Writer
    GetStdin() io.Reader

Context defines methods for command context.

type DebugLogAPI Uses

type DebugLogAPI interface {
    WatchDebugLog(params common.DebugLogParams) (<-chan common.LogMessage, error)
    Close() error

type ExecClient Uses

type ExecClient interface {
    RunOnAllMachines(commands string, timeout time.Duration) ([]params.ActionResult, error)
    Run(params.RunParams) ([]params.ActionResult, error)

RunClient exposes the capabilities required by the CLI

type MakeHAClient Uses

type MakeHAClient interface {
    Close() error
        numControllers int, cons constraints.Value,
        placement []string) (params.ControllersChanges, error)

MakeHAClient defines the methods on the client api that the ensure availability command calls.

type ModelAPI Uses

type ModelAPI interface {
    Close() error
    ModelInfo([]names.ModelTag) ([]params.ModelInfoResult, error)

ModelAPI defines model related APIs.

type ModelCommand Uses

type ModelCommand interface {
    NewControllerAPIRoot() (api.Connection, error)
    ModelDetails() (string, *jujuclient.ModelDetails, error)
    NewAPIRoot() (api.Connection, error)
    ModelIdentifier() (string, error)

ModelCommand defines methods of the model command.

type NotFoundCommand Uses

type NotFoundCommand struct {
    ArgName  string
    CmdName  string
    HelpHint string

NotFoundCommand gives valuable feedback to the operator about what commands could be available if a mistake around the subcommand name is given.

func (NotFoundCommand) Error Uses

func (c NotFoundCommand) Error() string

type PluginCommand Uses

type PluginCommand struct {
    // contains filtered or unexported fields

func (*PluginCommand) Info Uses

func (*PluginCommand) Info() *cmd.Info

Info is just a stub so that PluginCommand implements cmd.Command. Since this is never actually called, we can happily return nil.

func (*PluginCommand) Init Uses

func (c *PluginCommand) Init(args []string) error

func (*PluginCommand) Run Uses

func (c *PluginCommand) Run(ctx *cmd.Context) error

func (*PluginCommand) SetFlags Uses

func (c *PluginCommand) SetFlags(f *gnuflag.FlagSet)

type PluginDescription Uses

type PluginDescription struct {
    // contains filtered or unexported fields

func GetPluginDescriptions Uses

func GetPluginDescriptions() []PluginDescription

GetPluginDescriptions runs each plugin with "--description". The calls to the plugins are run in parallel, so the function should only take as long as the longest call.

type SSHKeysBase Uses

type SSHKeysBase struct {

func (*SSHKeysBase) NewKeyManagerClient Uses

func (c *SSHKeysBase) NewKeyManagerClient() (*keymanager.Client, error)

NewKeyManagerClient returns a keymanager client for the root api endpoint that the environment command returns.

type UpgradePrecheckEnviron Uses

type UpgradePrecheckEnviron interface {

UpgradePrecheckEnviron combines two interfaces required by result of getEnviron. It is for testing purposes only.


mocksPackage mocks is a generated GoMock package.

Package commands imports 120 packages (graph) and is imported by 46 packages. Updated 2020-09-20. Refresh now. Tools for package owners.