Skip to content

Commit

Permalink
Add filters for machine rack and state. (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed May 15, 2023
1 parent 965edba commit dba3765
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,19 @@ func (c *machineCmd) listCmdFlags(cmd *cobra.Command, lastEventErrorThresholdDef
{flagName: "project", f: c.comp.ProjectListCompletion},
{flagName: "id", f: c.comp.MachineListCompletion},
{flagName: "image", f: c.comp.ImageListCompletion},
{flagName: "state", f: cobra.FixedCompletions([]string{
// empty does not work:
// models.V1FirewallFindRequestStateValueEmpty,
models.V1FirewallFindRequestStateValueLOCKED,
models.V1MachineFindRequestStateValueRESERVED,
}, cobra.ShellCompDirectiveDefault)},
}

cmd.Flags().String("id", "", "ID to filter [optional]")
cmd.Flags().String("partition", "", "partition to filter [optional]")
cmd.Flags().String("size", "", "size to filter [optional]")
cmd.Flags().String("rack", "", "rack to filter [optional]")
cmd.Flags().String("state", "", "state to filter [optional]")
cmd.Flags().String("name", "", "allocation name to filter [optional]")
cmd.Flags().String("project", "", "allocation project to filter [optional]")
cmd.Flags().String("image", "", "allocation image to filter [optional]")
Expand Down Expand Up @@ -531,11 +539,13 @@ func machineFindRequestFromCLI() *models.V1MachineFindRequest {
ID: viper.GetString("id"),
PartitionID: viper.GetString("partition"),
Sizeid: viper.GetString("size"),
Rackid: viper.GetString("rack"),
Name: viper.GetString("name"),
AllocationProject: viper.GetString("project"),
AllocationImageID: viper.GetString("image"),
AllocationHostname: viper.GetString("hostname"),
NicsMacAddresses: viper.GetStringSlice("mac"),
StateValue: viper.GetString("state"),
Tags: viper.GetStringSlice("tags"),
}
}
Expand Down
2 changes: 2 additions & 0 deletions docs/metalctl_machine_ipmi.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ metalctl machine ipmi [<machine ID>] [flags]
--name string allocation name to filter [optional]
--partition string partition to filter [optional]
--project string allocation project to filter [optional]
--rack string rack to filter [optional]
--size string size to filter [optional]
--state string state to filter [optional]
--tags strings tags to filter, use it like: --tags "tag1,tag2" or --tags "tag3".
```

Expand Down
2 changes: 2 additions & 0 deletions docs/metalctl_machine_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ metalctl machine issues [<machine ID>] [flags]
--only strings issue types to include [optional]
--partition string partition to filter [optional]
--project string allocation project to filter [optional]
--rack string rack to filter [optional]
--severity string issue severity to include [optional]
--size string size to filter [optional]
--state string state to filter [optional]
--tags strings tags to filter, use it like: --tags "tag1,tag2" or --tags "tag3".
```

Expand Down
2 changes: 2 additions & 0 deletions docs/metalctl_machine_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ metalctl machine list [flags]
--name string allocation name to filter [optional]
--partition string partition to filter [optional]
--project string allocation project to filter [optional]
--rack string rack to filter [optional]
--size string size to filter [optional]
--sort-by strings sort by (comma separated) column(s), sort direction can be changed by appending :asc or :desc behind the column identifier. possible values: age|event|id|image|liveliness|partition|project|rack|size|when
--state string state to filter [optional]
--tags strings tags to filter, use it like: --tags "tag1,tag2" or --tags "tag3".
```

Expand Down

0 comments on commit dba3765

Please sign in to comment.