github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v1/configurations/list.go (about) 1 package configurations 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ListOpts struct { 9 // Specifies the AS configuration name. 10 // Supports fuzzy search. 11 Name string `q:"scaling_configuration_name"` 12 // Specifies the image ID. It is same as imageRef. 13 ImageID string `q:"image_id"` 14 // Specifies the start line number. The default value is 0. The minimum parameter value is 0. 15 StartNumber int `q:"start_number"` 16 // Specifies the number of query records. The default value is 20. The value range is 0 to 100. 17 Limit int `q:"limit"` 18 } 19 20 func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListScalingConfigsResponse, error) { 21 url, err := golangsdk.NewURLBuilder().WithEndpoints("scaling_configuration").WithQueryParams(&opts).Build() 22 if err != nil { 23 return nil, err 24 } 25 26 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 27 if err != nil { 28 return nil, err 29 } 30 31 var res ListScalingConfigsResponse 32 err = extract.Into(raw.Body, &res) 33 return &res, err 34 } 35 36 type ListScalingConfigsResponse struct { 37 TotalNumber int32 `json:"total_number,omitempty"` 38 StartNumber int32 `json:"start_number,omitempty"` 39 Limit int32 `json:"limit,omitempty"` 40 ScalingConfigurations []Configuration `json:"scaling_configurations,omitempty"` 41 }