github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/hosts/List.go (about) 1 package hosts 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Host, error) { 9 query, err := golangsdk.BuildQueryString(opts) 10 if err != nil { 11 return nil, err 12 } 13 14 // GET /v1/{project_id}/premium-waf/host 15 url := client.ServiceURL("premium-waf", "host") + query.String() 16 raw, err := client.Get(url, nil, nil) 17 if err != nil { 18 return nil, err 19 } 20 21 var res []Host 22 err = extract.IntoSlicePtr(raw.Body, &res, "items") 23 return res, err 24 } 25 26 type ListOpts struct { 27 // Number of records on each page. 28 // The maximum value is 100. Default value: 10 29 PageSize string `q:"pageSize,omitempty"` 30 // Current page number 31 Page string `q:"page,omitempty"` 32 // Domain name 33 Hostname string `q:"hostname,omitempty"` 34 // Policy Name 35 PolicyName string `q:"policyname,omitempty"` 36 // WAF status of the protected domain name. The value can be: 37 // -1: Bypassed. Requests are directly sent to the backend servers without passing through WAF. 38 // 0: Suspended. WAF only forwards requests for the domain name but does not detect attacks. 39 // 1: Enabled. WAF detects attacks based on the configured policy. 40 ProtectStatus int `q:"protect_status,omitempty"` 41 }