github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dcs/v2/flavors/results.go (about) 1 package flavors 2 3 import ( 4 "github.com/chnsz/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 ReplicaCount int `json:"replica_count"` 15 IsDes bool `json:"is_dec"` 16 Capacity []string `json:"capacity"` 17 BillingMode []string `json:"billing_mode"` 18 ProductType string `json:"product_type"` 19 CPUType string `json:"cpu_type"` 20 StorageType string `json:"storage_type"` 21 PricingType string `json:"pricing_type"` 22 ServiceTypeCode string `json:"cloud_service_type_code"` 23 ResourceTypeCode string `json:"cloud_resource_type_code"` 24 Attributes []AttrsObject `json:"attrs"` 25 AvailableZones []FlavorAzObject `json:"flavors_available_zones"` 26 } 27 28 // AttrsObject contains attributes of the flavor 29 type AttrsObject struct { 30 Capacity string `json:"capacity"` 31 Name string `json:"name"` 32 Value string `json:"value"` 33 } 34 35 // FlavorAzObject contains information of the available zones 36 type FlavorAzObject struct { 37 Capacity string `json:"capacity"` 38 AzCodes []string `json:"az_codes"` 39 } 40 41 // ListResult contains the body of getting detailed 42 type ListResult struct { 43 golangsdk.Result 44 } 45 46 // Extract from ListResult 47 func (r ListResult) Extract() ([]Flavor, error) { 48 var s struct { 49 Flavors []Flavor `json:"flavors"` 50 } 51 err := r.Result.ExtractInto(&s) 52 return s.Flavors, err 53 }