-
Notifications
You must be signed in to change notification settings - Fork 0
/
cinder.go
36 lines (31 loc) · 881 Bytes
/
cinder.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
package prune
import (
"net/url"
"github.com/BytemanD/skyman/common/i18n"
"github.com/BytemanD/skyman/openstack"
"github.com/spf13/cobra"
)
var volumePrune = &cobra.Command{
Use: "volume",
Short: "Prune volume(s)",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
name, _ := cmd.Flags().GetString("name")
yes, _ := cmd.Flags().GetBool("yes")
status, _ := cmd.Flags().GetString("status")
query := url.Values{}
if name != "" {
query.Set("name", name)
}
if status != "" {
query.Add("status", status)
}
client := openstack.DefaultClient()
client.CinderV2().Volumes().Prune(query, yes)
},
}
func init() {
volumePrune.Flags().StringP("name", "n", "", "Search by volume name")
volumePrune.Flags().StringP("status", "s", "error", "Search by server status")
volumePrune.Flags().BoolP("yes", "y", false, i18n.T("answerYes"))
}