-
Notifications
You must be signed in to change notification settings - Fork 7
/
Get.go
45 lines (40 loc) · 1.37 KB
/
Get.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
42
43
44
45
package certificates
import (
"github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
)
func Get(client *golangsdk.ServiceClient, id string) (*Certificate, error) {
// GET /v1/{project_id}/waf/certificate/{certificate_id}
raw, err := client.Get(client.ServiceURL("waf", "certificate", id), nil, nil)
if err != nil {
return nil, err
}
var res Certificate
return &res, extract.Into(raw.Body, &res)
}
type Certificate struct {
// Certificate ID.
ID string `json:"id"`
// Certificate name.
Name string `json:"name"`
// Certificate file in PEM format.
Content string `json:"content"`
// Private key of the certificate in PEM format.
Key string `json:"key"`
// Timestamp when the certificate expire.
ExpireAt int64 `json:"expire_time"`
// Timestamp when the certificate is uploaded.
CreatedAt int64 `json:"timestamp"`
// Domain name associated with the certificate.
// This parameter is returned to the response body only when the value of host in the URL request is true.
BoundHosts []Hosts `json:"bind_host"`
}
type Hosts struct {
// Domain name ID.
// It is the unique identifier generated by WAF for a domain name when you add the domain name to WAF.
ID string `json:"id"`
// Domain name.
Hostname string `json:"hostname"`
// WAF mode of the domain name. The value is premium.
WafType string `json:"waf_type"`
}