github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/policies/List.go (about) 1 package policies 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) ([]Policy, error) { 9 query, err := golangsdk.BuildQueryString(opts) 10 if err != nil { 11 return nil, err 12 } 13 14 // GET /v1/{project_id}/waf/policy 15 url := client.ServiceURL("waf", "policy") + query.String() 16 raw, err := client.Get(url, nil, nil) 17 if err != nil { 18 return nil, err 19 } 20 21 var res []Policy 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. If this parameter is not specified, the default value -1 is used. 29 // All policies are queried regardless of the value of Page 30 PageSize string `q:"pageSize,omitempty"` 31 // Page. Default value: 1 32 Page string `q:"page,omitempty"` 33 // Policy name. Fuzzy search is supported. 34 Name string `q:"name,omitempty"` 35 } 36 37 type Certificates struct { 38 // Certificate ID. 39 ID string `json:"id"` 40 // Certificate name. 41 Name string `json:"name"` 42 // Timestamp when the certificate is uploaded. 43 CreatedAt int64 `json:"timestamp"` 44 }