github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/ces/v1/alarms/list_alarms.go (about) 1 package alarms 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 type ListAlarmsOpts struct { 9 // The value ranges from 1 to 100, and is 100 by default. 10 // This parameter is used to limit the number of query results. 11 Limit int `q:"limit"` 12 // Specifies the result sorting method, which is sorted by timestamp. 13 // The default value is desc. 14 // asc: The query results are displayed in the ascending order. 15 // desc: The query results are displayed in the descending order. 16 Order string `q:"order"` 17 // Specifies the first queried alarm to be displayed on a page. 18 Start string `q:"start"` 19 } 20 21 func ListAlarms(client *golangsdk.ServiceClient, opts ListAlarmsOpts) (*ListAlarmsResponse, error) { 22 url, err := golangsdk.NewURLBuilder().WithEndpoints("alarms").WithQueryParams(&opts).Build() 23 if err != nil { 24 return nil, err 25 } 26 27 // GET /V1.0/{project_id}/alarms 28 raw, err := client.Get(client.ServiceURL(url.String()), nil, nil) 29 if err != nil { 30 return nil, err 31 } 32 33 var s ListAlarmsResponse 34 err = extract.Into(raw.Body, &s) 35 return &s, err 36 }