hosts

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandCreate = &cli.Command{
	Name:      "create",
	Usage:     "Create a new host",
	ArgsUsage: "[--status | -st <status>] [--roleFullname | -R <service:role>] [--customIdentifier <customIdentifier>] [--memo <memo>] <hostName>",
	Description: `
    Create a new host with status, roleFullname, customIdentifier and/or memo.
    Requests "POST /api/v0/hosts". See https://mackerel.io/api-docs/entry/hosts#create .
`,
	Action: doCreate,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "status",
			Aliases: []string{"st"},
			Value:   "",
			Usage:   "Host status ('working', 'standby', 'maintenance')",
		},
		&cli.StringSliceFlag{
			Name:    "roleFullname",
			Aliases: []string{"R"},
			Usage:   "Multiple choices are allowed. ex. My-Service:proxy, My-Service:db-master",
		},
		&cli.StringFlag{
			Name:  "customIdentifier",
			Value: "",
			Usage: "CustomIdentifier for the Host",
		},
		&cli.StringFlag{
			Name:  "memo",
			Value: "",
			Usage: "memo for the Host",
		},
	},
}

CommandCreate is definition of mkr create subcommand

View Source
var CommandHosts = &cli.Command{
	Name:      "hosts",
	Usage:     "List hosts",
	ArgsUsage: "[--verbose | -v] [--name | -n <name>] [--service | -s <service>] [[--role | -r <role>]...] [[--status | --st <status>]...] [--jq <formula>]",
	Description: `
    List the information of the hosts refined by host name, service name, role name and/or status.
    Requests "GET /api/v0/hosts.json". See https://mackerel.io/api-docs/entry/hosts#list .
`,
	Action: doHosts,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "name",
			Aliases: []string{"n"},
			Value:   "",
			Usage:   "List hosts only matched with <name>",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Value:   "",
			Usage:   "List hosts only belonging to <service>",
		},
		&cli.StringSliceFlag{
			Name:    "role",
			Aliases: []string{"r"},
			Usage:   "List hosts only belonging to <role>. Multiple choices are allowed. Required --service",
		},
		&cli.StringSliceFlag{
			Name:    "status",
			Aliases: []string{"st"},
			Usage:   "List hosts only matched <status>. Multiple choices are allowed.",
		},
		&cli.StringFlag{
			Name:    "format",
			Aliases: []string{"f"},
			Value:   "",
			Usage:   "Output format template",
		},
		&cli.BoolFlag{
			Name:    "verbose",
			Aliases: []string{"v"},
			Usage:   "Verbose output mode",
		},
		jq.CommandLineFlag,
	},
}

CommandHosts is definition of mkr hosts subcommand

View Source
var CommandRetire = &cli.Command{
	Name:      "retire",
	Usage:     "Retire hosts",
	ArgsUsage: "[--force] hostIds...",
	Description: `
    Retire host identified by <hostId>. Be careful because this is an irreversible operation.
    Requests POST /api/v0/hosts/<hostId>/retire parallelly. See https://mackerel.io/api-docs/entry/hosts#retire .
`,
	Action: doRetire,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:  "force",
			Usage: "Force retirement without confirmation.",
		},
	},
}
View Source
var CommandUpdate = &cli.Command{
	Name:      "update",
	Usage:     "Update the host",
	ArgsUsage: "[--name | -n <name>] [--displayName <displayName>] [--status | -st <status>] [--roleFullname | -R <service:role>] [--overwriteRoles | -o] [--memo <memo>] [<hostIds...>]",
	Description: `
    Update the host identified with <hostId>.
    Requests "PUT /api/v0/hosts/<hostId>". See https://mackerel.io/api-docs/entry/hosts#update-information .
`,
	Action: doUpdate,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "name",
			Aliases: []string{"n"},
			Value:   "",
			Usage:   "Update hostname.",
		},
		&cli.StringFlag{
			Name:  "displayName",
			Value: "",
			Usage: "Update displayName.",
		},
		&cli.StringFlag{
			Name:    "status",
			Aliases: []string{"st"},
			Value:   "",
			Usage:   "Update status.",
		},
		&cli.StringSliceFlag{
			Name:    "roleFullname",
			Aliases: []string{"R"},
			Usage:   "Update rolefullname.",
		},
		&cli.BoolFlag{
			Name:    "overwriteRoles",
			Aliases: []string{"o"},
			Usage:   "Overwrite roles instead of adding specified roles.",
		},
		&cli.StringFlag{
			Name:  "memo",
			Value: "",
			Usage: "memo for the Host",
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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