forked from denverdino/aliyungo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
certificates.go
120 lines (105 loc) · 3.87 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
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
109
110
111
112
113
114
115
116
117
118
119
120
package slb
import "github.com/reedchan7/aliyungo/common"
type UploadServerCertificateArgs struct {
RegionId common.Region
ServerCertificate string
ServerCertificateName string
PrivateKey string
}
type UploadServerCertificateResponse struct {
common.Response
ServerCertificateId string
ServerCertificateName string
Fingerprint string
}
// UploadServerCertificate Upload server certificate
//
// You can read doc at http://docs.aliyun.com/#pub/slb/api-reference/api-servercertificate&UploadServerCertificate
func (client *Client) UploadServerCertificate(args *UploadServerCertificateArgs) (response *UploadServerCertificateResponse, err error) {
response = &UploadServerCertificateResponse{}
err = client.Invoke("UploadServerCertificate", args, response)
if err != nil {
return nil, err
}
return response, err
}
type DeleteServerCertificateArgs struct {
RegionId common.Region
ServerCertificateId string
}
type DeleteServerCertificateResponse struct {
common.Response
}
// DeleteServerCertificate Delete server certificate
//
// You can read doc at http://docs.aliyun.com/#pub/slb/api-reference/api-servercertificate&DeleteServerCertificate
func (client *Client) DeleteServerCertificate(regionId common.Region, serverCertificateId string) (err error) {
args := &DeleteServerCertificateArgs{
RegionId: regionId,
ServerCertificateId: serverCertificateId,
}
response := &DeleteServerCertificateResponse{}
return client.Invoke("DeleteServerCertificate", args, response)
}
type SetServerCertificateNameArgs struct {
RegionId common.Region
ServerCertificateId string
ServerCertificateName string
}
type SetServerCertificateNameResponse struct {
common.Response
}
// SetServerCertificateName Set name of server certificate
//
// You can read doc at http://docs.aliyun.com/#pub/slb/api-reference/api-servercertificate&SetServerCertificateName
func (client *Client) SetServerCertificateName(regionId common.Region, serverCertificateId string, name string) (err error) {
args := &SetServerCertificateNameArgs{
RegionId: regionId,
ServerCertificateId: serverCertificateId,
ServerCertificateName: name,
}
response := &SetServerCertificateNameResponse{}
return client.Invoke("SetServerCertificateName", args, response)
}
type DescribeServerCertificatesArgs struct {
RegionId common.Region
ServerCertificateId string
}
type ServerCertificateType struct {
RegionId common.Region
ServerCertificateId string
ServerCertificateName string
Fingerprint string
}
type DescribeServerCertificatesResponse struct {
common.Response
ServerCertificates struct {
ServerCertificate []ServerCertificateType
}
}
// DescribeServerCertificates Describe server certificates
//
// You can read doc at http://docs.aliyun.com/#pub/slb/api-reference/api-servercertificate&DescribeServerCertificates
func (client *Client) DescribeServerCertificatesArgs(regionId common.Region, serverCertificateId string) (serverCertificates []ServerCertificateType, err error) {
args := &DescribeServerCertificatesArgs{
RegionId: regionId,
ServerCertificateId: serverCertificateId,
}
response := &DescribeServerCertificatesResponse{}
err = client.Invoke("DescribeServerCertificates", args, response)
if err != nil {
return nil, err
}
return response.ServerCertificates.ServerCertificate, err
}
// DescribeServerCertificates Describe server certificates
//
// You can read doc at http://docs.aliyun.com/#pub/slb/api-reference/api-servercertificate&DescribeServerCertificates
func (client *Client) DescribeServerCertificates(args *DescribeServerCertificatesArgs) (response *DescribeServerCertificatesResponse, err error) {
response = &DescribeServerCertificatesResponse{}
err = client.Invoke("DescribeServerCertificates", args, response)
if err != nil {
return nil, err
}
return response, err
}