github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/certificates/List.go (about) 1 package certificates 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) ([]Certificates, error) { 9 query, err := golangsdk.BuildQueryString(opts) 10 if err != nil { 11 return nil, err 12 } 13 14 // GET /v1/{project_id}/waf/certificate 15 url := client.ServiceURL("waf", "certificate") + query.String() 16 raw, err := client.Get(url, nil, nil) 17 if err != nil { 18 return nil, err 19 } 20 21 var res []Certificates 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 Name string `q:"name,omitempty"` 34 // Whether to obtain the domain name associated with the certificate. 35 // The value can be true or false. 36 // true: When a certificate is queried, the domain name associated with the certificate is also queried. 37 // The returned certificate information contains the associated domain name. 38 // false: When a certificate is queried, the domain name associated with the certificate is not queried. 39 // The returned certificate information does not contain the associated domain name. 40 // Default value: false 41 // Default: false 42 Host *bool `q:"host,omitempty"` 43 // Certificate status. The value can be: 44 // 0: The certificate is valid. 45 // 1: The certificate has expired.2: The certificate will expire within one month. 46 ExpirationStatus int `q:"exp_status,omitempty"` 47 } 48 49 type Certificates struct { 50 // Certificate ID. 51 ID string `json:"id"` 52 // Certificate name. 53 Name string `json:"name"` 54 // Timestamp when the certificate is uploaded. 55 CreatedAt int64 `json:"timestamp"` 56 }