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