github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/dcs/v2/flavors/results.go (about) 1 package flavors 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 ) 6 7 // Flavor for dcs 8 type Flavor struct { 9 SpecCode string `json:"spec_code"` 10 CacheMode string `json:"cache_mode"` 11 Engine string `json:"engine"` 12 EngineVersion string `json:"engine_version"` 13 TenantIPCount int `json:"tenant_ip_count"` 14 IsDes bool `json:"is_dec"` 15 Capacity []string `json:"capacity"` 16 BillingMode []string `json:"billing_mode"` 17 ProductType string `json:"product_type"` 18 CPUType string `json:"cpu_type"` 19 StorageType string `json:"storage_type"` 20 PricingType string `json:"pricing_type"` 21 ServiceTypeCode string `json:"cloud_service_type_code"` 22 ResourceTypeCode string `json:"cloud_resource_type_code"` 23 Attributes []AttrsObject `json:"attrs"` 24 AvailableZones []FlavorAzObject `json:"flavors_available_zones"` 25 } 26 27 // AttrsObject contains attributes of the flavor 28 type AttrsObject struct { 29 Capacity string `json:"capacity"` 30 Name string `json:"name"` 31 Value string `json:"value"` 32 } 33 34 // FlavorAzObject contains information of the available zones 35 type FlavorAzObject struct { 36 Capacity string `json:"capacity"` 37 AzCodes []string `json:"az_codes"` 38 } 39 40 // ListResult contains the body of getting detailed 41 type ListResult struct { 42 golangsdk.Result 43 } 44 45 // Extract from ListResult 46 func (r ListResult) Extract() ([]Flavor, error) { 47 var s struct { 48 Flavors []Flavor `json:"flavors"` 49 } 50 err := r.Result.ExtractInto(&s) 51 return s.Flavors, err 52 }