1 package storagesync
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 type CloudEndpointsClient struct {
20 BaseClient
21 }
22
23
24 func NewCloudEndpointsClient(subscriptionID string) CloudEndpointsClient {
25 return NewCloudEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewCloudEndpointsClientWithBaseURI(baseURI string, subscriptionID string) CloudEndpointsClient {
31 return CloudEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39
40
41 func (client CloudEndpointsClient) Create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters CloudEndpointCreateParameters) (result CloudEndpointsCreateFuture, err error) {
42 if tracing.IsEnabled() {
43 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.Create")
44 defer func() {
45 sc := -1
46 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
47 sc = result.FutureAPI.Response().StatusCode
48 }
49 tracing.EndSpan(ctx, sc, err)
50 }()
51 }
52 if err := validation.Validate([]validation.Validation{
53 {TargetValue: client.SubscriptionID,
54 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
55 {TargetValue: resourceGroupName,
56 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
57 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
58 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
59 return result, validation.NewError("storagesync.CloudEndpointsClient", "Create", err.Error())
60 }
61
62 req, err := client.CreatePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
63 if err != nil {
64 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Create", nil, "Failure preparing request")
65 return
66 }
67
68 result, err = client.CreateSender(req)
69 if err != nil {
70 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Create", result.Response(), "Failure sending request")
71 return
72 }
73
74 return
75 }
76
77
78 func (client CloudEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters CloudEndpointCreateParameters) (*http.Request, error) {
79 pathParameters := map[string]interface{}{
80 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
81 "resourceGroupName": autorest.Encode("path", resourceGroupName),
82 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
83 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
84 "syncGroupName": autorest.Encode("path", syncGroupName),
85 }
86
87 const APIVersion = "2019-06-01"
88 queryParameters := map[string]interface{}{
89 "api-version": APIVersion,
90 }
91
92 preparer := autorest.CreatePreparer(
93 autorest.AsContentType("application/json; charset=utf-8"),
94 autorest.AsPut(),
95 autorest.WithBaseURL(client.BaseURI),
96 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", pathParameters),
97 autorest.WithJSON(parameters),
98 autorest.WithQueryParameters(queryParameters))
99 return preparer.Prepare((&http.Request{}).WithContext(ctx))
100 }
101
102
103
104 func (client CloudEndpointsClient) CreateSender(req *http.Request) (future CloudEndpointsCreateFuture, err error) {
105 var resp *http.Response
106 future.FutureAPI = &azure.Future{}
107 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
108 if err != nil {
109 return
110 }
111 var azf azure.Future
112 azf, err = azure.NewFutureFromResponse(resp)
113 future.FutureAPI = &azf
114 future.Result = future.result
115 return
116 }
117
118
119
120 func (client CloudEndpointsClient) CreateResponder(resp *http.Response) (result CloudEndpoint, err error) {
121 err = autorest.Respond(
122 resp,
123 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
124 autorest.ByUnmarshallingJSON(&result),
125 autorest.ByClosing())
126 result.Response = autorest.Response{Response: resp}
127 return
128 }
129
130
131
132
133
134
135
136 func (client CloudEndpointsClient) Delete(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (result CloudEndpointsDeleteFuture, err error) {
137 if tracing.IsEnabled() {
138 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.Delete")
139 defer func() {
140 sc := -1
141 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
142 sc = result.FutureAPI.Response().StatusCode
143 }
144 tracing.EndSpan(ctx, sc, err)
145 }()
146 }
147 if err := validation.Validate([]validation.Validation{
148 {TargetValue: client.SubscriptionID,
149 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
150 {TargetValue: resourceGroupName,
151 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
152 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
153 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
154 return result, validation.NewError("storagesync.CloudEndpointsClient", "Delete", err.Error())
155 }
156
157 req, err := client.DeletePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName)
158 if err != nil {
159 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Delete", nil, "Failure preparing request")
160 return
161 }
162
163 result, err = client.DeleteSender(req)
164 if err != nil {
165 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Delete", result.Response(), "Failure sending request")
166 return
167 }
168
169 return
170 }
171
172
173 func (client CloudEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (*http.Request, error) {
174 pathParameters := map[string]interface{}{
175 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
176 "resourceGroupName": autorest.Encode("path", resourceGroupName),
177 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
178 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
179 "syncGroupName": autorest.Encode("path", syncGroupName),
180 }
181
182 const APIVersion = "2019-06-01"
183 queryParameters := map[string]interface{}{
184 "api-version": APIVersion,
185 }
186
187 preparer := autorest.CreatePreparer(
188 autorest.AsDelete(),
189 autorest.WithBaseURL(client.BaseURI),
190 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", pathParameters),
191 autorest.WithQueryParameters(queryParameters))
192 return preparer.Prepare((&http.Request{}).WithContext(ctx))
193 }
194
195
196
197 func (client CloudEndpointsClient) DeleteSender(req *http.Request) (future CloudEndpointsDeleteFuture, err error) {
198 var resp *http.Response
199 future.FutureAPI = &azure.Future{}
200 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
201 if err != nil {
202 return
203 }
204 var azf azure.Future
205 azf, err = azure.NewFutureFromResponse(resp)
206 future.FutureAPI = &azf
207 future.Result = future.result
208 return
209 }
210
211
212
213 func (client CloudEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
214 err = autorest.Respond(
215 resp,
216 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
217 autorest.ByClosing())
218 result.Response = resp
219 return
220 }
221
222
223
224
225
226
227
228 func (client CloudEndpointsClient) Get(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (result CloudEndpoint, err error) {
229 if tracing.IsEnabled() {
230 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.Get")
231 defer func() {
232 sc := -1
233 if result.Response.Response != nil {
234 sc = result.Response.Response.StatusCode
235 }
236 tracing.EndSpan(ctx, sc, err)
237 }()
238 }
239 if err := validation.Validate([]validation.Validation{
240 {TargetValue: client.SubscriptionID,
241 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
242 {TargetValue: resourceGroupName,
243 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
244 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
245 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
246 return result, validation.NewError("storagesync.CloudEndpointsClient", "Get", err.Error())
247 }
248
249 req, err := client.GetPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName)
250 if err != nil {
251 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Get", nil, "Failure preparing request")
252 return
253 }
254
255 resp, err := client.GetSender(req)
256 if err != nil {
257 result.Response = autorest.Response{Response: resp}
258 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Get", resp, "Failure sending request")
259 return
260 }
261
262 result, err = client.GetResponder(resp)
263 if err != nil {
264 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Get", resp, "Failure responding to request")
265 return
266 }
267
268 return
269 }
270
271
272 func (client CloudEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (*http.Request, error) {
273 pathParameters := map[string]interface{}{
274 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
275 "resourceGroupName": autorest.Encode("path", resourceGroupName),
276 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
277 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
278 "syncGroupName": autorest.Encode("path", syncGroupName),
279 }
280
281 const APIVersion = "2019-06-01"
282 queryParameters := map[string]interface{}{
283 "api-version": APIVersion,
284 }
285
286 preparer := autorest.CreatePreparer(
287 autorest.AsGet(),
288 autorest.WithBaseURL(client.BaseURI),
289 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", pathParameters),
290 autorest.WithQueryParameters(queryParameters))
291 return preparer.Prepare((&http.Request{}).WithContext(ctx))
292 }
293
294
295
296 func (client CloudEndpointsClient) GetSender(req *http.Request) (*http.Response, error) {
297 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
298 }
299
300
301
302 func (client CloudEndpointsClient) GetResponder(resp *http.Response) (result CloudEndpoint, err error) {
303 err = autorest.Respond(
304 resp,
305 azure.WithErrorUnlessStatusCode(http.StatusOK),
306 autorest.ByUnmarshallingJSON(&result),
307 autorest.ByClosing())
308 result.Response = autorest.Response{Response: resp}
309 return
310 }
311
312
313
314
315
316
317 func (client CloudEndpointsClient) ListBySyncGroup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string) (result CloudEndpointArray, err error) {
318 if tracing.IsEnabled() {
319 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.ListBySyncGroup")
320 defer func() {
321 sc := -1
322 if result.Response.Response != nil {
323 sc = result.Response.Response.StatusCode
324 }
325 tracing.EndSpan(ctx, sc, err)
326 }()
327 }
328 if err := validation.Validate([]validation.Validation{
329 {TargetValue: client.SubscriptionID,
330 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
331 {TargetValue: resourceGroupName,
332 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
333 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
334 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
335 return result, validation.NewError("storagesync.CloudEndpointsClient", "ListBySyncGroup", err.Error())
336 }
337
338 req, err := client.ListBySyncGroupPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName)
339 if err != nil {
340 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "ListBySyncGroup", nil, "Failure preparing request")
341 return
342 }
343
344 resp, err := client.ListBySyncGroupSender(req)
345 if err != nil {
346 result.Response = autorest.Response{Response: resp}
347 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "ListBySyncGroup", resp, "Failure sending request")
348 return
349 }
350
351 result, err = client.ListBySyncGroupResponder(resp)
352 if err != nil {
353 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "ListBySyncGroup", resp, "Failure responding to request")
354 return
355 }
356
357 return
358 }
359
360
361 func (client CloudEndpointsClient) ListBySyncGroupPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string) (*http.Request, error) {
362 pathParameters := map[string]interface{}{
363 "resourceGroupName": autorest.Encode("path", resourceGroupName),
364 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
365 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
366 "syncGroupName": autorest.Encode("path", syncGroupName),
367 }
368
369 const APIVersion = "2019-06-01"
370 queryParameters := map[string]interface{}{
371 "api-version": APIVersion,
372 }
373
374 preparer := autorest.CreatePreparer(
375 autorest.AsGet(),
376 autorest.WithBaseURL(client.BaseURI),
377 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints", pathParameters),
378 autorest.WithQueryParameters(queryParameters))
379 return preparer.Prepare((&http.Request{}).WithContext(ctx))
380 }
381
382
383
384 func (client CloudEndpointsClient) ListBySyncGroupSender(req *http.Request) (*http.Response, error) {
385 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
386 }
387
388
389
390 func (client CloudEndpointsClient) ListBySyncGroupResponder(resp *http.Response) (result CloudEndpointArray, err error) {
391 err = autorest.Respond(
392 resp,
393 azure.WithErrorUnlessStatusCode(http.StatusOK),
394 autorest.ByUnmarshallingJSON(&result),
395 autorest.ByClosing())
396 result.Response = autorest.Response{Response: resp}
397 return
398 }
399
400
401
402
403
404
405
406
407 func (client CloudEndpointsClient) PostBackup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (result CloudEndpointsPostBackupFuture, err error) {
408 if tracing.IsEnabled() {
409 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.PostBackup")
410 defer func() {
411 sc := -1
412 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
413 sc = result.FutureAPI.Response().StatusCode
414 }
415 tracing.EndSpan(ctx, sc, err)
416 }()
417 }
418 if err := validation.Validate([]validation.Validation{
419 {TargetValue: client.SubscriptionID,
420 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
421 {TargetValue: resourceGroupName,
422 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
423 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
424 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
425 return result, validation.NewError("storagesync.CloudEndpointsClient", "PostBackup", err.Error())
426 }
427
428 req, err := client.PostBackupPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
429 if err != nil {
430 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PostBackup", nil, "Failure preparing request")
431 return
432 }
433
434 result, err = client.PostBackupSender(req)
435 if err != nil {
436 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PostBackup", result.Response(), "Failure sending request")
437 return
438 }
439
440 return
441 }
442
443
444 func (client CloudEndpointsClient) PostBackupPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (*http.Request, error) {
445 pathParameters := map[string]interface{}{
446 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
447 "resourceGroupName": autorest.Encode("path", resourceGroupName),
448 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
449 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
450 "syncGroupName": autorest.Encode("path", syncGroupName),
451 }
452
453 const APIVersion = "2019-06-01"
454 queryParameters := map[string]interface{}{
455 "api-version": APIVersion,
456 }
457
458 preparer := autorest.CreatePreparer(
459 autorest.AsContentType("application/json; charset=utf-8"),
460 autorest.AsPost(),
461 autorest.WithBaseURL(client.BaseURI),
462 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup", pathParameters),
463 autorest.WithJSON(parameters),
464 autorest.WithQueryParameters(queryParameters))
465 return preparer.Prepare((&http.Request{}).WithContext(ctx))
466 }
467
468
469
470 func (client CloudEndpointsClient) PostBackupSender(req *http.Request) (future CloudEndpointsPostBackupFuture, err error) {
471 var resp *http.Response
472 future.FutureAPI = &azure.Future{}
473 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
474 if err != nil {
475 return
476 }
477 var azf azure.Future
478 azf, err = azure.NewFutureFromResponse(resp)
479 future.FutureAPI = &azf
480 future.Result = future.result
481 return
482 }
483
484
485
486 func (client CloudEndpointsClient) PostBackupResponder(resp *http.Response) (result PostBackupResponse, err error) {
487 err = autorest.Respond(
488 resp,
489 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
490 autorest.ByUnmarshallingJSON(&result),
491 autorest.ByClosing())
492 result.Response = autorest.Response{Response: resp}
493 return
494 }
495
496
497
498
499
500
501
502
503 func (client CloudEndpointsClient) PostRestore(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PostRestoreRequest) (result CloudEndpointsPostRestoreFuture, err error) {
504 if tracing.IsEnabled() {
505 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.PostRestore")
506 defer func() {
507 sc := -1
508 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
509 sc = result.FutureAPI.Response().StatusCode
510 }
511 tracing.EndSpan(ctx, sc, err)
512 }()
513 }
514 if err := validation.Validate([]validation.Validation{
515 {TargetValue: client.SubscriptionID,
516 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
517 {TargetValue: resourceGroupName,
518 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
519 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
520 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
521 return result, validation.NewError("storagesync.CloudEndpointsClient", "PostRestore", err.Error())
522 }
523
524 req, err := client.PostRestorePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
525 if err != nil {
526 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PostRestore", nil, "Failure preparing request")
527 return
528 }
529
530 result, err = client.PostRestoreSender(req)
531 if err != nil {
532 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PostRestore", result.Response(), "Failure sending request")
533 return
534 }
535
536 return
537 }
538
539
540 func (client CloudEndpointsClient) PostRestorePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PostRestoreRequest) (*http.Request, error) {
541 pathParameters := map[string]interface{}{
542 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
543 "resourceGroupName": autorest.Encode("path", resourceGroupName),
544 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
545 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
546 "syncGroupName": autorest.Encode("path", syncGroupName),
547 }
548
549 const APIVersion = "2019-06-01"
550 queryParameters := map[string]interface{}{
551 "api-version": APIVersion,
552 }
553
554 preparer := autorest.CreatePreparer(
555 autorest.AsContentType("application/json; charset=utf-8"),
556 autorest.AsPost(),
557 autorest.WithBaseURL(client.BaseURI),
558 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore", pathParameters),
559 autorest.WithJSON(parameters),
560 autorest.WithQueryParameters(queryParameters))
561 return preparer.Prepare((&http.Request{}).WithContext(ctx))
562 }
563
564
565
566 func (client CloudEndpointsClient) PostRestoreSender(req *http.Request) (future CloudEndpointsPostRestoreFuture, err error) {
567 var resp *http.Response
568 future.FutureAPI = &azure.Future{}
569 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
570 if err != nil {
571 return
572 }
573 var azf azure.Future
574 azf, err = azure.NewFutureFromResponse(resp)
575 future.FutureAPI = &azf
576 future.Result = future.result
577 return
578 }
579
580
581
582 func (client CloudEndpointsClient) PostRestoreResponder(resp *http.Response) (result autorest.Response, err error) {
583 err = autorest.Respond(
584 resp,
585 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
586 autorest.ByClosing())
587 result.Response = resp
588 return
589 }
590
591
592
593
594
595
596
597
598 func (client CloudEndpointsClient) PreBackup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (result CloudEndpointsPreBackupFuture, err error) {
599 if tracing.IsEnabled() {
600 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.PreBackup")
601 defer func() {
602 sc := -1
603 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
604 sc = result.FutureAPI.Response().StatusCode
605 }
606 tracing.EndSpan(ctx, sc, err)
607 }()
608 }
609 if err := validation.Validate([]validation.Validation{
610 {TargetValue: client.SubscriptionID,
611 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
612 {TargetValue: resourceGroupName,
613 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
614 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
615 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
616 return result, validation.NewError("storagesync.CloudEndpointsClient", "PreBackup", err.Error())
617 }
618
619 req, err := client.PreBackupPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
620 if err != nil {
621 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PreBackup", nil, "Failure preparing request")
622 return
623 }
624
625 result, err = client.PreBackupSender(req)
626 if err != nil {
627 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PreBackup", result.Response(), "Failure sending request")
628 return
629 }
630
631 return
632 }
633
634
635 func (client CloudEndpointsClient) PreBackupPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (*http.Request, error) {
636 pathParameters := map[string]interface{}{
637 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
638 "resourceGroupName": autorest.Encode("path", resourceGroupName),
639 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
640 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
641 "syncGroupName": autorest.Encode("path", syncGroupName),
642 }
643
644 const APIVersion = "2019-06-01"
645 queryParameters := map[string]interface{}{
646 "api-version": APIVersion,
647 }
648
649 preparer := autorest.CreatePreparer(
650 autorest.AsContentType("application/json; charset=utf-8"),
651 autorest.AsPost(),
652 autorest.WithBaseURL(client.BaseURI),
653 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup", pathParameters),
654 autorest.WithJSON(parameters),
655 autorest.WithQueryParameters(queryParameters))
656 return preparer.Prepare((&http.Request{}).WithContext(ctx))
657 }
658
659
660
661 func (client CloudEndpointsClient) PreBackupSender(req *http.Request) (future CloudEndpointsPreBackupFuture, err error) {
662 var resp *http.Response
663 future.FutureAPI = &azure.Future{}
664 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
665 if err != nil {
666 return
667 }
668 var azf azure.Future
669 azf, err = azure.NewFutureFromResponse(resp)
670 future.FutureAPI = &azf
671 future.Result = future.result
672 return
673 }
674
675
676
677 func (client CloudEndpointsClient) PreBackupResponder(resp *http.Response) (result autorest.Response, err error) {
678 err = autorest.Respond(
679 resp,
680 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
681 autorest.ByClosing())
682 result.Response = resp
683 return
684 }
685
686
687
688
689
690
691
692
693 func (client CloudEndpointsClient) PreRestore(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PreRestoreRequest) (result CloudEndpointsPreRestoreFuture, err error) {
694 if tracing.IsEnabled() {
695 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.PreRestore")
696 defer func() {
697 sc := -1
698 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
699 sc = result.FutureAPI.Response().StatusCode
700 }
701 tracing.EndSpan(ctx, sc, err)
702 }()
703 }
704 if err := validation.Validate([]validation.Validation{
705 {TargetValue: client.SubscriptionID,
706 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
707 {TargetValue: resourceGroupName,
708 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
709 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
710 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
711 return result, validation.NewError("storagesync.CloudEndpointsClient", "PreRestore", err.Error())
712 }
713
714 req, err := client.PreRestorePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
715 if err != nil {
716 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PreRestore", nil, "Failure preparing request")
717 return
718 }
719
720 result, err = client.PreRestoreSender(req)
721 if err != nil {
722 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "PreRestore", result.Response(), "Failure sending request")
723 return
724 }
725
726 return
727 }
728
729
730 func (client CloudEndpointsClient) PreRestorePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters PreRestoreRequest) (*http.Request, error) {
731 pathParameters := map[string]interface{}{
732 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
733 "resourceGroupName": autorest.Encode("path", resourceGroupName),
734 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
735 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
736 "syncGroupName": autorest.Encode("path", syncGroupName),
737 }
738
739 const APIVersion = "2019-06-01"
740 queryParameters := map[string]interface{}{
741 "api-version": APIVersion,
742 }
743
744 preparer := autorest.CreatePreparer(
745 autorest.AsContentType("application/json; charset=utf-8"),
746 autorest.AsPost(),
747 autorest.WithBaseURL(client.BaseURI),
748 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore", pathParameters),
749 autorest.WithJSON(parameters),
750 autorest.WithQueryParameters(queryParameters))
751 return preparer.Prepare((&http.Request{}).WithContext(ctx))
752 }
753
754
755
756 func (client CloudEndpointsClient) PreRestoreSender(req *http.Request) (future CloudEndpointsPreRestoreFuture, err error) {
757 var resp *http.Response
758 future.FutureAPI = &azure.Future{}
759 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
760 if err != nil {
761 return
762 }
763 var azf azure.Future
764 azf, err = azure.NewFutureFromResponse(resp)
765 future.FutureAPI = &azf
766 future.Result = future.result
767 return
768 }
769
770
771
772 func (client CloudEndpointsClient) PreRestoreResponder(resp *http.Response) (result autorest.Response, err error) {
773 err = autorest.Respond(
774 resp,
775 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
776 autorest.ByClosing())
777 result.Response = resp
778 return
779 }
780
781
782
783
784
785
786
787 func (client CloudEndpointsClient) Restoreheartbeat(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (result autorest.Response, err error) {
788 if tracing.IsEnabled() {
789 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.Restoreheartbeat")
790 defer func() {
791 sc := -1
792 if result.Response != nil {
793 sc = result.Response.StatusCode
794 }
795 tracing.EndSpan(ctx, sc, err)
796 }()
797 }
798 if err := validation.Validate([]validation.Validation{
799 {TargetValue: client.SubscriptionID,
800 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
801 {TargetValue: resourceGroupName,
802 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
803 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
804 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
805 return result, validation.NewError("storagesync.CloudEndpointsClient", "Restoreheartbeat", err.Error())
806 }
807
808 req, err := client.RestoreheartbeatPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName)
809 if err != nil {
810 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Restoreheartbeat", nil, "Failure preparing request")
811 return
812 }
813
814 resp, err := client.RestoreheartbeatSender(req)
815 if err != nil {
816 result.Response = resp
817 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Restoreheartbeat", resp, "Failure sending request")
818 return
819 }
820
821 result, err = client.RestoreheartbeatResponder(resp)
822 if err != nil {
823 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "Restoreheartbeat", resp, "Failure responding to request")
824 return
825 }
826
827 return
828 }
829
830
831 func (client CloudEndpointsClient) RestoreheartbeatPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string) (*http.Request, error) {
832 pathParameters := map[string]interface{}{
833 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
834 "resourceGroupName": autorest.Encode("path", resourceGroupName),
835 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
836 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
837 "syncGroupName": autorest.Encode("path", syncGroupName),
838 }
839
840 const APIVersion = "2019-06-01"
841 queryParameters := map[string]interface{}{
842 "api-version": APIVersion,
843 }
844
845 preparer := autorest.CreatePreparer(
846 autorest.AsPost(),
847 autorest.WithBaseURL(client.BaseURI),
848 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat", pathParameters),
849 autorest.WithQueryParameters(queryParameters))
850 return preparer.Prepare((&http.Request{}).WithContext(ctx))
851 }
852
853
854
855 func (client CloudEndpointsClient) RestoreheartbeatSender(req *http.Request) (*http.Response, error) {
856 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
857 }
858
859
860
861 func (client CloudEndpointsClient) RestoreheartbeatResponder(resp *http.Response) (result autorest.Response, err error) {
862 err = autorest.Respond(
863 resp,
864 azure.WithErrorUnlessStatusCode(http.StatusOK),
865 autorest.ByClosing())
866 result.Response = resp
867 return
868 }
869
870
871
872
873
874
875
876
877
878 func (client CloudEndpointsClient) TriggerChangeDetection(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters TriggerChangeDetectionParameters) (result CloudEndpointsTriggerChangeDetectionFuture, err error) {
879 if tracing.IsEnabled() {
880 ctx = tracing.StartSpan(ctx, fqdn+"/CloudEndpointsClient.TriggerChangeDetection")
881 defer func() {
882 sc := -1
883 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
884 sc = result.FutureAPI.Response().StatusCode
885 }
886 tracing.EndSpan(ctx, sc, err)
887 }()
888 }
889 if err := validation.Validate([]validation.Validation{
890 {TargetValue: client.SubscriptionID,
891 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
892 {TargetValue: resourceGroupName,
893 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
894 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
895 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
896 return result, validation.NewError("storagesync.CloudEndpointsClient", "TriggerChangeDetection", err.Error())
897 }
898
899 req, err := client.TriggerChangeDetectionPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)
900 if err != nil {
901 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "TriggerChangeDetection", nil, "Failure preparing request")
902 return
903 }
904
905 result, err = client.TriggerChangeDetectionSender(req)
906 if err != nil {
907 err = autorest.NewErrorWithError(err, "storagesync.CloudEndpointsClient", "TriggerChangeDetection", result.Response(), "Failure sending request")
908 return
909 }
910
911 return
912 }
913
914
915 func (client CloudEndpointsClient) TriggerChangeDetectionPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters TriggerChangeDetectionParameters) (*http.Request, error) {
916 pathParameters := map[string]interface{}{
917 "cloudEndpointName": autorest.Encode("path", cloudEndpointName),
918 "resourceGroupName": autorest.Encode("path", resourceGroupName),
919 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
920 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
921 "syncGroupName": autorest.Encode("path", syncGroupName),
922 }
923
924 const APIVersion = "2019-06-01"
925 queryParameters := map[string]interface{}{
926 "api-version": APIVersion,
927 }
928
929 preparer := autorest.CreatePreparer(
930 autorest.AsContentType("application/json; charset=utf-8"),
931 autorest.AsPost(),
932 autorest.WithBaseURL(client.BaseURI),
933 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection", pathParameters),
934 autorest.WithJSON(parameters),
935 autorest.WithQueryParameters(queryParameters))
936 return preparer.Prepare((&http.Request{}).WithContext(ctx))
937 }
938
939
940
941 func (client CloudEndpointsClient) TriggerChangeDetectionSender(req *http.Request) (future CloudEndpointsTriggerChangeDetectionFuture, err error) {
942 var resp *http.Response
943 future.FutureAPI = &azure.Future{}
944 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
945 if err != nil {
946 return
947 }
948 var azf azure.Future
949 azf, err = azure.NewFutureFromResponse(resp)
950 future.FutureAPI = &azf
951 future.Result = future.result
952 return
953 }
954
955
956
957 func (client CloudEndpointsClient) TriggerChangeDetectionResponder(resp *http.Response) (result autorest.Response, err error) {
958 err = autorest.Respond(
959 resp,
960 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
961 autorest.ByClosing())
962 result.Response = resp
963 return
964 }
965
View as plain text