github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/css/v1/snapshots/PolicyGet.go (about) 1 package snapshots 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 // PolicyGet retrieves the snapshot policy with the provided cluster ID. 9 // To extract the snapshot policy object from the response, call the Extract method on the GetResult. 10 func PolicyGet(client *golangsdk.ServiceClient, clusterId string) (*Policy, error) { 11 raw, err := client.Get(client.ServiceURL("clusters", clusterId, "index_snapshot/policy"), nil, nil) 12 if err != nil { 13 return nil, err 14 } 15 16 var res Policy 17 err = extract.Into(raw.Body, &res) 18 return &res, err 19 } 20 21 // Policy contains all the information associated with a snapshot policy. 22 type Policy struct { 23 KeepDay int `json:"keepday"` 24 Period string `json:"period"` 25 Prefix string `json:"prefix"` 26 Bucket string `json:"bucket"` 27 BasePath string `json:"basePath"` 28 Agency string `json:"agency"` 29 Enable string `json:"enable"` 30 SnapshotCmkID string `json:"snapshotCmkId"` 31 }