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