Skip to content

Commit

Permalink
Some checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed May 10, 2024
1 parent 75d6d6d commit 03bd462
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/fi-ts/cloud-go/api/client/volume"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/pointer"

"github.com/fi-ts/cloud-go/api/models"
"github.com/fi-ts/cloudctl/cmd/helper"
Expand Down Expand Up @@ -267,6 +268,13 @@ func (c *config) volumeSetQoS(args []string) error {
policyId := helper.ViperString("qos-id")
policyName := helper.ViperString("qos-name")

if pointer.SafeDeref(policyId) == "" && pointer.SafeDeref(policyName) == "" {
return fmt.Errorf("either qos-id or qos-name must be specified")
}
if pointer.SafeDeref(policyId) != "" && pointer.SafeDeref(policyName) != "" {
return fmt.Errorf("either qos-id or qos-name must be specified, not both")
}

params := volume.NewSetVolumeQoSPolicyParams().
WithID(*vol.VolumeID).
WithBody(&models.V1VolumeSetQoSPolicyRequest{
Expand Down

0 comments on commit 03bd462

Please sign in to comment.