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