-
Notifications
You must be signed in to change notification settings - Fork 218
/
cloud_client.go
303 lines (270 loc) · 11.5 KB
/
cloud_client.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
// Code generated by go-swagger; DO NOT EDIT.
package cloud
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new cloud API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for cloud API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
CloudTargetCollectionGet(params *CloudTargetCollectionGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetCollectionGetOK, error)
CloudTargetCreate(params *CloudTargetCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetCreateAccepted, error)
CloudTargetDelete(params *CloudTargetDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetDeleteAccepted, error)
CloudTargetGet(params *CloudTargetGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetGetOK, error)
CloudTargetModify(params *CloudTargetModifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetModifyAccepted, error)
SetTransport(transport runtime.ClientTransport)
}
/*
CloudTargetCollectionGet Retrieves the collection of cloud targets in the cluster.
### Related ONTAP commands
* `storage aggregate object-store config show`
*/
func (a *Client) CloudTargetCollectionGet(params *CloudTargetCollectionGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetCollectionGetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCloudTargetCollectionGetParams()
}
op := &runtime.ClientOperation{
ID: "cloud_target_collection_get",
Method: "GET",
PathPattern: "/cloud/targets",
ProducesMediaTypes: []string{"application/hal+json", "application/json"},
ConsumesMediaTypes: []string{"application/hal+json", "application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CloudTargetCollectionGetReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CloudTargetCollectionGetOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CloudTargetCollectionGetDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CloudTargetCreate Creates a cloud target.
### Required properties
* `name` - Name for the cloud target.
* `owner` - Owner of the target: _fabricpool_, _snapmirror_.
* `provider_type` - Type of cloud provider: _AWS_S3_, _Azure_Cloud_, _SGWS_, _IBM_COS_, _AliCloud_, _GoogleCloud_, _ONTAP_S3_.
* `server` - Fully qualified domain name of the object store server. Required when `provider_type` is one of the following: _SGWS_, _IBM_COS_, _AliCloud_.
* `container` - Data bucket/container name.
* `access_key` - Access key ID if `provider_type` is not _Azure_Cloud_ and `authentication_type` is _key_.
* `secret_password` - Secret access key if `provider_type` is not _Azure_Cloud_ and `authentication_type` is _key_.
* `azure_account` - Azure account if `provider_type` is _Azure_Cloud_.
* `azure_private_key` - Azure access key if `provider_type` is _Azure_Cloud_.
* `cap_url` - Full URL of the request to a CAP server for retrieving temporary credentials if `authentication_type` is _cap_.
* `snapmirror_use` - Use of the cloud target if `owner` is _snapmirror_: data, metadata.
### Recommended optional properties
* `authentication_type` - Authentication used to access the target: _key_, _cap_, _ec2_iam_, _gcp_sa_, _azure_msi_.
* `ssl_enabled` - SSL/HTTPS enabled or disabled.
* `port` - Port number of the object store that ONTAP uses when establishing a connection.
* `ipspace` - IPspace to use in order to reach the cloud target.
* `use_http_proxy` - Use the HTTP proxy when connecting to the object store server.
* `azure_sas_token` - Shared access signature to grant limited access to Azure storage account resources.
* `svm.name` or `svm.uuid` - Name or UUID of SVM if `owner` is _snapmirror_.
### Default property values
* `authentication_type`
- _ec2_iam_ - if running in Cloud Volumes ONTAP in AWS
- _gcp_sa_ - if running in Cloud Volumes ONTAP in GCP
- _azure_msi_ - if running in Cloud Volumes ONTAP in Azure
- _key_ - in all other cases.
* `server`
- _s3.amazonaws.com_ - if `provider_type` is _AWS_S3_
- _blob.core.windows.net_ - if `provider_type` is _Azure_Cloud_
- _storage.googleapis.com_ - if `provider_type` is _GoogleCloud_
* `ssl_enabled` - _true_
* `port`
- _443_ if `ssl_enabled` is _true_
- _80_ if `ssl_enabled` is _false_ and `provider_type` is not _SGWS_
- _8084_ if `ssl_enabled` is _false_ and `provider_type` is _SGWS_
* `ipspace` - _Default_
* `certificate_validation_enabled` - _true_
* `ignore_warnings` - _false_
* `check_only` - _false_
* `use_http_proxy` - _false_
* `server_side_encryption`
- _none_ - if `provider_type` is _ONTAP_S3_
- _sse_s3_ - if `provider_type` is not _ONTAP_S3_
* `url_style`
- _path_style_ - if `provider_type` is neither _AWS_S3_ nor _AliCloud_
- _virtual_hosted_style_ - if `provider_type` is either _AWS_S3 or _AliCloud__
### Related ONTAP commands
* `storage aggregate object-store config create`
*/
func (a *Client) CloudTargetCreate(params *CloudTargetCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetCreateAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCloudTargetCreateParams()
}
op := &runtime.ClientOperation{
ID: "cloud_target_create",
Method: "POST",
PathPattern: "/cloud/targets",
ProducesMediaTypes: []string{"application/hal+json", "application/json"},
ConsumesMediaTypes: []string{"application/hal+json", "application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CloudTargetCreateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CloudTargetCreateAccepted)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CloudTargetCreateDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CloudTargetDelete Deletes the cloud target specified by the UUID. This request starts a job and returns a link to that job.
### Related ONTAP commands
* `storage aggregate object-store config delete`
*/
func (a *Client) CloudTargetDelete(params *CloudTargetDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetDeleteAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCloudTargetDeleteParams()
}
op := &runtime.ClientOperation{
ID: "cloud_target_delete",
Method: "DELETE",
PathPattern: "/cloud/targets/{uuid}",
ProducesMediaTypes: []string{"application/hal+json", "application/json"},
ConsumesMediaTypes: []string{"application/hal+json", "application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CloudTargetDeleteReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CloudTargetDeleteAccepted)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CloudTargetDeleteDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CloudTargetGet Retrieves the cloud target specified by the UUID.
### Related ONTAP commands
* `storage aggregate object-store config show`
*/
func (a *Client) CloudTargetGet(params *CloudTargetGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetGetOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCloudTargetGetParams()
}
op := &runtime.ClientOperation{
ID: "cloud_target_get",
Method: "GET",
PathPattern: "/cloud/targets/{uuid}",
ProducesMediaTypes: []string{"application/hal+json", "application/json"},
ConsumesMediaTypes: []string{"application/hal+json", "application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CloudTargetGetReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CloudTargetGetOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CloudTargetGetDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
CloudTargetModify Updates the cloud target specified by the UUID with the fields in the body. This request starts a job and returns a link to that job.
### Related ONTAP commands
* `storage aggregate object-store config modify`
*/
func (a *Client) CloudTargetModify(params *CloudTargetModifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CloudTargetModifyAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCloudTargetModifyParams()
}
op := &runtime.ClientOperation{
ID: "cloud_target_modify",
Method: "PATCH",
PathPattern: "/cloud/targets/{uuid}",
ProducesMediaTypes: []string{"application/hal+json", "application/json"},
ConsumesMediaTypes: []string{"application/hal+json", "application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CloudTargetModifyReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CloudTargetModifyAccepted)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*CloudTargetModifyDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}