github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/others/ListAvailableZones.go (about) 1 package others 2 3 import ( 4 "strings" 5 6 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 7 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 8 ) 9 10 func ListAvailableZones(client *golangsdk.ServiceClient) (*AvailableZonesResponse, error) { 11 // remove projectId from endpoint 12 raw, err := client.Get(strings.Replace(client.ServiceURL("availableZones"), "/"+client.ProjectID, "", -1), nil, nil) 13 if err != nil { 14 return nil, err 15 } 16 17 var res AvailableZonesResponse 18 err = extract.Into(raw.Body, &res) 19 return &res, err 20 } 21 22 type AvailableZonesResponse struct { 23 RegionID string `json:"regionId"` 24 AvailableZones []AvailableZone `json:"available_zones"` 25 } 26 27 type AvailableZone struct { 28 ID string `json:"id"` 29 Code string `json:"code"` 30 Name string `json:"name"` 31 // Port number of the AZ. 32 Port string `json:"port"` 33 // An indicator of whether there are available Redis 3.0 resources in the AZ. 34 // true: There are available resources in the AZ. 35 // false: There are no available resources in the AZ. 36 ResourceAvailability string `json:"resource_availability"` 37 // An indicator of whether there are available Redis 4.0 and 5.0 resources in the AZ. 38 ResourceAvailabilityDcs2 string `json:"resource_availability_dcs2"` 39 }