github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/ShowFlavors.go (about) 1 package v3 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ShowFlavorsOpts struct { 9 // DB engine. 10 DatabaseName string 11 // DB engine version. Currently, only MySQL 8.0 is supported. 12 VersionName string `q:"version_name"` 13 // AZ mode. Its value can be single or multi and is case-insensitive. 14 AvailabilityZoneMode string `q:"availability_zone_mode"` 15 // Specification code. 16 SpecCode string `q:"spec_code"` 17 } 18 19 func ShowGaussMySqlFlavors(client *golangsdk.ServiceClient, opts ShowFlavorsOpts) ([]MysqlFlavorsInfo, error) { 20 url, err := golangsdk.NewURLBuilder().WithEndpoints("flavors", opts.DatabaseName).WithQueryParams(&opts).Build() 21 if err != nil { 22 return nil, err 23 } 24 25 // GET https://{Endpoint}/mysql/v3/{project_id}/flavors/{database_name} 26 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 27 if err != nil { 28 return nil, err 29 } 30 31 var res []MysqlFlavorsInfo 32 err = extract.IntoSlicePtr(raw.Body, &res, "flavors") 33 return res, err 34 } 35 36 type MysqlFlavorsInfo struct { 37 // Number of vCPUs. For example, the value 1 indicates 1 vCPU. 38 Vcpus string `json:"vcpus"` 39 // Memory size in GB 40 Ram string `json:"ram"` 41 // Specification type. The value can be arm 42 Type string `json:"type"` 43 // Specification ID. The value must be unique. 44 Id string `json:"id"` 45 // Resource specification code. Its value is same as the value of flavor_ref, for example, gaussdb.mysql.4xlarge.arm.8. 46 SpecCode string `json:"spec_code"` 47 // DB version number. 48 VersionName string `json:"version_name"` 49 // Instance type. Currently, its value can only be Cluster. 50 InstanceMode string `json:"instance_mode"` 51 // Specification status in an AZ. Its value can be any of the following: 52 // normal: on sale. 53 // unsupported: Not supported. 54 // sellout: sold out. 55 AzStatus map[string]string `json:"az_status"` 56 }