-
Notifications
You must be signed in to change notification settings - Fork 3
/
apis.go
234 lines (218 loc) · 6.38 KB
/
apis.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// Copyright 2015 Chen Xianren. All rights reserved.
// Code generated by openapi-meta; DO NOT EDIT
package ossadmin // import "github.com/cxr29/aliyun-openapi-go-sdk/apis/ossadmin/v20140326"
import (
"errors"
"fmt"
"github.com/cxr29/aliyun-openapi-go-sdk"
)
var (
_ = errors.New("")
_ = fmt.Sprint("")
)
type API struct {
openapi.Service
}
func New(accessKeyId, accessKeySecret string) API {
return API{openapi.NewService(accessKeyId, accessKeySecret)}
}
func NewParams() openapi.Params {
args := openapi.NewParams()
args.Product = Product
args.Style = Style
args.Version = Version
return args
}
const (
Product = "OssAdmin"
Style = "RPC"
Version = "2014-03-26"
)
// RestartOss version 2014-03-26
//
// optional parameters:
// name: OwnerAccount, type: string
// name: OwnerId, type: int64
// name: ResourceOwnerAccount, type: string
// name: ResourceOwnerId, type: int64
// name: _method, type: string, optional values: GET|POST
// name: _region, type: string
// name: _scheme, type: string, optional values: http|https
// name: region, type: string
func (api API) RestartOss(optional openapi.M) (*RestartOssResponse, error) {
args := NewParams()
args.Query.Set("Action", "restartOss")
if v, ok := optional["OwnerAccount"]; ok {
if OwnerAccount, ok := v.(string); ok {
args.Query.Set("OwnerAccount", OwnerAccount)
} else {
return nil, errors.New("OwnerAccount must be string")
}
}
if v, ok := optional["OwnerId"]; ok {
if OwnerId, ok := v.(int64); ok {
args.Query.Set("OwnerId", fmt.Sprint(OwnerId))
} else {
return nil, errors.New("OwnerId must be int64")
}
}
if v, ok := optional["ResourceOwnerAccount"]; ok {
if ResourceOwnerAccount, ok := v.(string); ok {
args.Query.Set("ResourceOwnerAccount", ResourceOwnerAccount)
} else {
return nil, errors.New("ResourceOwnerAccount must be string")
}
}
if v, ok := optional["ResourceOwnerId"]; ok {
if ResourceOwnerId, ok := v.(int64); ok {
args.Query.Set("ResourceOwnerId", fmt.Sprint(ResourceOwnerId))
} else {
return nil, errors.New("ResourceOwnerId must be int64")
}
}
if v, ok := optional["_method"]; ok {
if s, ok := v.(string); ok {
if !openapi.IsIn(s, "GET|POST") {
return nil, errors.New("_method must be GET|POST")
}
args.Method = s
} else {
return nil, errors.New("_method must be string")
}
}
if v, ok := optional["_region"]; ok {
if s, ok := v.(string); ok {
args.Region = s
} else {
return nil, errors.New("_region must be string")
}
}
if v, ok := optional["_scheme"]; ok {
if s, ok := v.(string); ok {
if !openapi.IsIn(s, "http|https") {
return nil, errors.New("_scheme must be http|https")
}
args.Scheme = s
} else {
return nil, errors.New("_scheme must be string")
}
}
if v, ok := optional["region"]; ok {
if region, ok := v.(string); ok {
args.Query.Set("region", region)
} else {
return nil, errors.New("region must be string")
}
}
result := new(RestartOssResponse)
if err := api.Service.Do(result, args); err != nil {
return nil, err
}
return result, nil
}
// RestartOssResponse represents the response of the api RestartOss.
type RestartOssResponse struct {
AliUid int64 `json:"aliUid" xml:"aliUid"`
Code string
EndTime string `json:"endTime" xml:"endTime"`
InstacneStatus string `json:"instacneStatus" xml:"instacneStatus"`
InstanceId string `json:"instanceId" xml:"instanceId"`
InstanceName string `json:"instanceName" xml:"instanceName"`
Message string
StartTime string `json:"startTime" xml:"startTime"`
Success bool
}
// StopOss version 2014-03-26
//
// optional parameters:
// name: OwnerAccount, type: string
// name: OwnerId, type: int64
// name: ResourceOwnerAccount, type: string
// name: ResourceOwnerId, type: int64
// name: _method, type: string, optional values: GET|POST
// name: _region, type: string
// name: _scheme, type: string, optional values: http|https
// name: region, type: string
func (api API) StopOss(optional openapi.M) (*StopOssResponse, error) {
args := NewParams()
args.Query.Set("Action", "stopOss")
if v, ok := optional["OwnerAccount"]; ok {
if OwnerAccount, ok := v.(string); ok {
args.Query.Set("OwnerAccount", OwnerAccount)
} else {
return nil, errors.New("OwnerAccount must be string")
}
}
if v, ok := optional["OwnerId"]; ok {
if OwnerId, ok := v.(int64); ok {
args.Query.Set("OwnerId", fmt.Sprint(OwnerId))
} else {
return nil, errors.New("OwnerId must be int64")
}
}
if v, ok := optional["ResourceOwnerAccount"]; ok {
if ResourceOwnerAccount, ok := v.(string); ok {
args.Query.Set("ResourceOwnerAccount", ResourceOwnerAccount)
} else {
return nil, errors.New("ResourceOwnerAccount must be string")
}
}
if v, ok := optional["ResourceOwnerId"]; ok {
if ResourceOwnerId, ok := v.(int64); ok {
args.Query.Set("ResourceOwnerId", fmt.Sprint(ResourceOwnerId))
} else {
return nil, errors.New("ResourceOwnerId must be int64")
}
}
if v, ok := optional["_method"]; ok {
if s, ok := v.(string); ok {
if !openapi.IsIn(s, "GET|POST") {
return nil, errors.New("_method must be GET|POST")
}
args.Method = s
} else {
return nil, errors.New("_method must be string")
}
}
if v, ok := optional["_region"]; ok {
if s, ok := v.(string); ok {
args.Region = s
} else {
return nil, errors.New("_region must be string")
}
}
if v, ok := optional["_scheme"]; ok {
if s, ok := v.(string); ok {
if !openapi.IsIn(s, "http|https") {
return nil, errors.New("_scheme must be http|https")
}
args.Scheme = s
} else {
return nil, errors.New("_scheme must be string")
}
}
if v, ok := optional["region"]; ok {
if region, ok := v.(string); ok {
args.Query.Set("region", region)
} else {
return nil, errors.New("region must be string")
}
}
result := new(StopOssResponse)
if err := api.Service.Do(result, args); err != nil {
return nil, err
}
return result, nil
}
// StopOssResponse represents the response of the api StopOss.
type StopOssResponse struct {
AliUid int64 `json:"aliUid" xml:"aliUid"`
Code string
EndTime string `json:"endTime" xml:"endTime"`
InstacneStatus string `json:"instacneStatus" xml:"instacneStatus"`
InstanceId string `json:"instanceId" xml:"instanceId"`
InstanceName string `json:"instanceName" xml:"instanceName"`
Message string
StartTime string `json:"startTime" xml:"startTime"`
Success bool
}