Skip to content

Commit

Permalink
Add --id and --name search params to cluster list. (#16)
Browse files Browse the repository at this point in the history
* Add `--id` and `--name` search params to `cluster list`.
  • Loading branch information
Gerrit91 authored Sep 11, 2020
1 parent dea5698 commit 2f60978
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ func init() {
})

// Cluster list --------------------------------------------------------------------
clusterListCmd.Flags().String("id", "", "show clusters of given id")
clusterListCmd.Flags().String("name", "", "show clusters of given name")
clusterListCmd.Flags().String("project", "", "show clusters of given project")
clusterListCmd.Flags().String("partition", "", "show clusters in partition")
clusterListCmd.Flags().String("tenant", "", "show clusters of given tenant")
Expand Down Expand Up @@ -477,12 +479,21 @@ func clusterCreate() error {
}

func clusterList() error {
id := viper.GetString("id")
name := viper.GetString("name")
tenant := viper.GetString("tenant")
partition := viper.GetString("partition")
project := viper.GetString("project")
var cfr *models.V1ClusterFindRequest
if tenant != "" || partition != "" || project != "" {
if id != "" || name != "" || tenant != "" || partition != "" || project != "" {
cfr = &models.V1ClusterFindRequest{}

if id != "" {
cfr.ID = &id
}
if name != "" {
cfr.Name = &name
}
if tenant != "" {
cfr.Tenant = &tenant
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.15
require (
github.com/Masterminds/semver v1.5.0
github.com/fatih/color v1.9.0
github.com/fi-ts/cloud-go v0.8.1
github.com/fi-ts/cloud-go v0.8.2
github.com/gardener/gardener v1.8.2
github.com/go-openapi/runtime v0.19.21
github.com/go-openapi/strfmt v0.19.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fi-ts/cloud-go v0.8.1 h1:IUcZA7gDIoc2ULLMhyfbnfqH2tdI/juZimjkeFfWwK4=
github.com/fi-ts/cloud-go v0.8.1/go.mod h1:10CDK7f0l/7v0UyvjjQSFpWGZYVo6IUsKOTezGpSyYM=
github.com/fi-ts/cloud-go v0.8.2 h1:fmOrAz531Y1Bt+GyCibNu1+NRphSsrYcq2iO9QDUtMs=
github.com/fi-ts/cloud-go v0.8.2/go.mod h1:10CDK7f0l/7v0UyvjjQSFpWGZYVo6IUsKOTezGpSyYM=
github.com/frankban/quicktest v1.5.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down

0 comments on commit 2f60978

Please # to comment.