This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
results.go
108 lines (95 loc) · 3.03 KB
/
results.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package certificates
import (
"github.com/huaweicloud/golangsdk"
)
/*
Part 1:
The response of the import operation.
*/
// The struct defines the information about the imported certificate.
type CertificateImportInfo struct {
CertificateId string `json:"certificate_id"`
}
type ImportResult struct {
golangsdk.Result
}
func (r ImportResult) Extract() (*CertificateImportInfo, error) {
var s CertificateImportInfo
err := r.ExtractInto(&s)
return &s, err
}
/*
Part 2:
The response from query escrowed certificate.
*/
// This struct defines the authentication information of the domain.
// API that will be used to Obtain Certificate Information
type Authentification struct {
RecordName string `json:"record_name"`
RecordType string `json:"record_type"`
RecordValue string `json:"record_value"`
Domain string `json:"domain"`
}
// The struct defines the detail information about the escrow certificate information.
type CertificateEscrowInfo struct {
Id string `json:"id"`
Status string `json:"status"`
OrderId string `json:"order_id"`
Name string `json:"name"`
CertificateType string `json:"type"`
Brand string `json:"brand"`
PushSupport string `json:"push_support"`
RevokeReason string `json:"revoke_reason"`
SignatureAlgrithm string `json:"signature_algrithm"`
IssueTime string `json:"issue_time"`
NotBefore string `json:"not_before"`
NotAfter string `json:"not_after"`
ValidityPeriod int `json:"validity_period,omitempty"`
ValidationMethod string `json:"validation_method"`
DomainType string `json:"domain_type"`
Domain string `json:"domain"`
Sans string `json:"sans"`
DomainCount int `json:"domain_count,omitempty"`
WildcardCount int `json:"wildcard_count,omitempty"`
Authentifications []Authentification `json:"authentification,omitempty"`
}
type GetResult struct {
golangsdk.Result
}
func (r GetResult) Extract() (*CertificateEscrowInfo, error) {
var s CertificateEscrowInfo
err := r.ExtractInto(&s)
return &s, err
}
/*
-- Part 3:
-- The response from exported certificate.
*/
// The struct defines the detail information about the imported certificate.
type CertificateDetail struct {
Certificate string `json:"certificate" required:"true"`
CertificateChain string `json:"certificate_chain" required:"true"`
PrivateKey string `json:"private_key" required:"true"`
}
func (r ExportResult) Extract() (*CertificateDetail, error) {
var s CertificateDetail
err := r.ExtractInto(&s)
return &s, err
}
type ExportResult struct {
golangsdk.Result
}
/*
Part 4:
The response from pushing certificate.
*/
type PushResult struct {
golangsdk.ErrResult
}
/*
Part 5:
The response from deleting certificate.
*/
type DeleteResult struct {
golangsdk.ErrResult
}