-
Notifications
You must be signed in to change notification settings - Fork 1
/
certificates.go
44 lines (37 loc) · 1.18 KB
/
certificates.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
package digicert
import (
"fmt"
)
type Certificate struct {
ID int `json:"id,omitempty"`
CommonName string `json:"common_name"`
DNSNames []string `json:"dns_names,omitempty"`
CSR string `json:"csr"`
OrganizationUnits []string `json:"organization_units,omitempty"`
ServerPlatform struct {
ID int `json:"id"`
} `json:"server_platform,omitempty"`
SignatureHash string `json:"signature_hash"`
ProfileOption string `json:"profile_option,omitempty"`
Thumbprint string `json:"thumbprint,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
}
func (o Certificate) String() string {
return Stringify(o)
}
type PEM struct {
SubjectCommonName string `json:"subject_common_name"`
PEM string `json:"pem"`
}
type PEMBundle struct {
PEMs []*PEM `json:"intermediates"`
}
type CertificatesService service
func (s *CertificatesService) GetPEMBundle(cert_id int) (*PEMBundle, *Response, error) {
bundle := &PEMBundle{PEMs: make([]*PEM, 0)}
resp, err := executeAction(s.client, "GET", fmt.Sprintf("certificate/%d/chain", cert_id), nil, bundle)
if err != nil {
return nil, resp, err
}
return bundle, resp, nil
}