github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/flavors/List.go (about) 1 package flavors 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ListFlavorOpts struct { 9 // Index offset. 10 // If offset is set to N, the resource query starts from the N+1 piece of data. The default value is 0, indicating that the query starts from the first piece of data. 11 // The value must be a positive integer. 12 Offset int `q:"offset"` 13 // Maximum number of specifications that can be queried 14 // Value range: 1-100 15 // If this parameter is not transferred, the first 100 pieces of specification information can be queried by default. 16 Limit int `q:"limit"` 17 // Specifies the database type. The value is DDS-Community. 18 EngineName string `q:"engine_name"` 19 // DB version number. 20 EngineVersion string `q:"engine_version"` 21 } 22 23 func List(client *golangsdk.ServiceClient, opts ListFlavorOpts) (*ListResponse, error) { 24 url, err := golangsdk.NewURLBuilder().WithEndpoints("flavors").WithQueryParams(&opts).Build() 25 if err != nil { 26 return nil, err 27 } 28 29 // GET https://{Endpoint}/v3.1/{project_id}/flavors 30 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 31 if err != nil { 32 return nil, err 33 } 34 35 var res ListResponse 36 err = extract.Into(raw.Body, &res) 37 return &res, err 38 } 39 40 type ListResponse struct { 41 Flavors []FlavorResponse `json:"flavors"` 42 TotalCount int `json:"total_count"` 43 } 44 45 type FlavorResponse struct { 46 // Indicates the engine name. 47 EngineName string `json:"engine_name"` 48 // Indicates the node type. DDS contains the following types of nodes: 49 // 50 // mongos 51 // shard 52 // config 53 // replica 54 // single 55 Type string `json:"type"` 56 // Indicates the number of vCPUs. 57 Vcpus string `json:"vcpus"` 58 // Indicates the memory size in gigabyte (GB). 59 Ram string `json:"ram"` 60 // Indicates the resource specification code. 61 // 62 // Example: dds.mongodb.s2.xlarge.4.shard 63 // 64 // NOTE: 65 // dds.mongodb: indicates the DDS service. 66 // s2.xlarge.4: indicates the performance specification, which is high memory. 67 // shard: indicates the node type. 68 // When querying the specifications, check whether the specifications are of the same series. The specification series includes general-purpose (s6), enhanced (c3), and enhanced II (c6). 69 SpecCode string `json:"spec_code"` 70 // Indicates the status of specifications in an AZ. Its value can be any of the following: 71 // 72 // normal: indicates that the specifications are on sale. 73 // unsupported: indicates that the DB instance specifications are not supported. 74 // sellout: indicates the specifications are sold out. 75 // NOTE: 76 // ReplicaSet flavors supports cross AZ creation in case "eu-de-01,eu-de-02,eu-de-03": "normal". 77 AZStatus map[string]string `json:"az_status"` 78 // Database versions 79 // 80 // For example, DDS mongos node, {"3.4", "4.0"} 81 EngineVersions []string `json:"engine_versions"` 82 }