github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/cmd/juju/machine/list.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package machine 5 6 import ( 7 "github.com/juju/cmd" 8 9 jujucmd "github.com/juju/juju/cmd" 10 "github.com/juju/juju/cmd/modelcmd" 11 ) 12 13 var usageListMachinesSummary = ` 14 Lists machines in a model.`[1:] 15 16 var usageListMachinesDetails = ` 17 By default, the tabular format is used. 18 The following sections are included: ID, STATE, DNS, INS-ID, SERIES, AZ 19 Note: AZ above is the cloud region's availability zone. 20 21 Examples: 22 juju machines 23 24 See also: 25 status` 26 27 // NewListMachineCommand returns a command that lists the machines in a model. 28 func NewListMachinesCommand() cmd.Command { 29 return modelcmd.Wrap(newListMachinesCommand(nil)) 30 } 31 32 func newListMachinesCommand(api statusAPI) *listMachinesCommand { 33 listCmd := &listMachinesCommand{} 34 listCmd.defaultFormat = "tabular" 35 listCmd.api = api 36 return listCmd 37 } 38 39 // listMachineCommand holds information about machines in a model. 40 type listMachinesCommand struct { 41 baselistMachinesCommand 42 } 43 44 // Info implements Command.Info. 45 func (c *listMachinesCommand) Info() *cmd.Info { 46 return jujucmd.Info(&cmd.Info{ 47 Name: "machines", 48 Purpose: usageListMachinesSummary, 49 Doc: usageListMachinesDetails, 50 Aliases: []string{"list-machines"}, 51 }) 52 } 53 54 // Init ensures the machines Command does not take arguments. 55 func (c *listMachinesCommand) Init(args []string) error { 56 return cmd.CheckEmpty(args) 57 }