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 ServerEndpointsClient struct {
20 BaseClient
21 }
22
23
24 func NewServerEndpointsClient(subscriptionID string) ServerEndpointsClient {
25 return NewServerEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewServerEndpointsClientWithBaseURI(baseURI string, subscriptionID string) ServerEndpointsClient {
31 return ServerEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39
40
41 func (client ServerEndpointsClient) Create(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointCreateParameters) (result ServerEndpointsCreateFuture, err error) {
42 if tracing.IsEnabled() {
43 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.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}}},
59 {TargetValue: parameters,
60 Constraints: []validation.Constraint{{Target: "parameters.ServerEndpointCreateParametersProperties", Name: validation.Null, Rule: false,
61 Chain: []validation.Constraint{{Target: "parameters.ServerEndpointCreateParametersProperties.VolumeFreeSpacePercent", Name: validation.Null, Rule: false,
62 Chain: []validation.Constraint{{Target: "parameters.ServerEndpointCreateParametersProperties.VolumeFreeSpacePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil},
63 {Target: "parameters.ServerEndpointCreateParametersProperties.VolumeFreeSpacePercent", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
64 }},
65 {Target: "parameters.ServerEndpointCreateParametersProperties.TierFilesOlderThanDays", Name: validation.Null, Rule: false,
66 Chain: []validation.Constraint{{Target: "parameters.ServerEndpointCreateParametersProperties.TierFilesOlderThanDays", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil},
67 {Target: "parameters.ServerEndpointCreateParametersProperties.TierFilesOlderThanDays", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
68 }},
69 }}}}}); err != nil {
70 return result, validation.NewError("storagesync.ServerEndpointsClient", "Create", err.Error())
71 }
72
73 req, err := client.CreatePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters)
74 if err != nil {
75 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Create", nil, "Failure preparing request")
76 return
77 }
78
79 result, err = client.CreateSender(req)
80 if err != nil {
81 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Create", result.Response(), "Failure sending request")
82 return
83 }
84
85 return
86 }
87
88
89 func (client ServerEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters ServerEndpointCreateParameters) (*http.Request, error) {
90 pathParameters := map[string]interface{}{
91 "resourceGroupName": autorest.Encode("path", resourceGroupName),
92 "serverEndpointName": autorest.Encode("path", serverEndpointName),
93 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
94 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
95 "syncGroupName": autorest.Encode("path", syncGroupName),
96 }
97
98 const APIVersion = "2018-07-01"
99 queryParameters := map[string]interface{}{
100 "api-version": APIVersion,
101 }
102
103 preparer := autorest.CreatePreparer(
104 autorest.AsContentType("application/json; charset=utf-8"),
105 autorest.AsPut(),
106 autorest.WithBaseURL(client.BaseURI),
107 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", pathParameters),
108 autorest.WithJSON(parameters),
109 autorest.WithQueryParameters(queryParameters))
110 return preparer.Prepare((&http.Request{}).WithContext(ctx))
111 }
112
113
114
115 func (client ServerEndpointsClient) CreateSender(req *http.Request) (future ServerEndpointsCreateFuture, err error) {
116 var resp *http.Response
117 future.FutureAPI = &azure.Future{}
118 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
119 if err != nil {
120 return
121 }
122 var azf azure.Future
123 azf, err = azure.NewFutureFromResponse(resp)
124 future.FutureAPI = &azf
125 future.Result = future.result
126 return
127 }
128
129
130
131 func (client ServerEndpointsClient) CreateResponder(resp *http.Response) (result ServerEndpoint, err error) {
132 err = autorest.Respond(
133 resp,
134 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
135 autorest.ByUnmarshallingJSON(&result),
136 autorest.ByClosing())
137 result.Response = autorest.Response{Response: resp}
138 return
139 }
140
141
142
143
144
145
146
147 func (client ServerEndpointsClient) Delete(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string) (result ServerEndpointsDeleteFuture, err error) {
148 if tracing.IsEnabled() {
149 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.Delete")
150 defer func() {
151 sc := -1
152 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
153 sc = result.FutureAPI.Response().StatusCode
154 }
155 tracing.EndSpan(ctx, sc, err)
156 }()
157 }
158 if err := validation.Validate([]validation.Validation{
159 {TargetValue: client.SubscriptionID,
160 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
161 {TargetValue: resourceGroupName,
162 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
163 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
164 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
165 return result, validation.NewError("storagesync.ServerEndpointsClient", "Delete", err.Error())
166 }
167
168 req, err := client.DeletePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName)
169 if err != nil {
170 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Delete", nil, "Failure preparing request")
171 return
172 }
173
174 result, err = client.DeleteSender(req)
175 if err != nil {
176 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Delete", result.Response(), "Failure sending request")
177 return
178 }
179
180 return
181 }
182
183
184 func (client ServerEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string) (*http.Request, error) {
185 pathParameters := map[string]interface{}{
186 "resourceGroupName": autorest.Encode("path", resourceGroupName),
187 "serverEndpointName": autorest.Encode("path", serverEndpointName),
188 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
189 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
190 "syncGroupName": autorest.Encode("path", syncGroupName),
191 }
192
193 const APIVersion = "2018-07-01"
194 queryParameters := map[string]interface{}{
195 "api-version": APIVersion,
196 }
197
198 preparer := autorest.CreatePreparer(
199 autorest.AsDelete(),
200 autorest.WithBaseURL(client.BaseURI),
201 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", pathParameters),
202 autorest.WithQueryParameters(queryParameters))
203 return preparer.Prepare((&http.Request{}).WithContext(ctx))
204 }
205
206
207
208 func (client ServerEndpointsClient) DeleteSender(req *http.Request) (future ServerEndpointsDeleteFuture, err error) {
209 var resp *http.Response
210 future.FutureAPI = &azure.Future{}
211 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
212 if err != nil {
213 return
214 }
215 var azf azure.Future
216 azf, err = azure.NewFutureFromResponse(resp)
217 future.FutureAPI = &azf
218 future.Result = future.result
219 return
220 }
221
222
223
224 func (client ServerEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
225 err = autorest.Respond(
226 resp,
227 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
228 autorest.ByClosing())
229 result.Response = resp
230 return
231 }
232
233
234
235
236
237
238
239 func (client ServerEndpointsClient) Get(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string) (result ServerEndpoint, err error) {
240 if tracing.IsEnabled() {
241 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.Get")
242 defer func() {
243 sc := -1
244 if result.Response.Response != nil {
245 sc = result.Response.Response.StatusCode
246 }
247 tracing.EndSpan(ctx, sc, err)
248 }()
249 }
250 if err := validation.Validate([]validation.Validation{
251 {TargetValue: client.SubscriptionID,
252 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
253 {TargetValue: resourceGroupName,
254 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
255 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
256 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
257 return result, validation.NewError("storagesync.ServerEndpointsClient", "Get", err.Error())
258 }
259
260 req, err := client.GetPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName)
261 if err != nil {
262 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Get", nil, "Failure preparing request")
263 return
264 }
265
266 resp, err := client.GetSender(req)
267 if err != nil {
268 result.Response = autorest.Response{Response: resp}
269 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Get", resp, "Failure sending request")
270 return
271 }
272
273 result, err = client.GetResponder(resp)
274 if err != nil {
275 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Get", resp, "Failure responding to request")
276 return
277 }
278
279 return
280 }
281
282
283 func (client ServerEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string) (*http.Request, error) {
284 pathParameters := map[string]interface{}{
285 "resourceGroupName": autorest.Encode("path", resourceGroupName),
286 "serverEndpointName": autorest.Encode("path", serverEndpointName),
287 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
288 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
289 "syncGroupName": autorest.Encode("path", syncGroupName),
290 }
291
292 const APIVersion = "2018-07-01"
293 queryParameters := map[string]interface{}{
294 "api-version": APIVersion,
295 }
296
297 preparer := autorest.CreatePreparer(
298 autorest.AsGet(),
299 autorest.WithBaseURL(client.BaseURI),
300 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", pathParameters),
301 autorest.WithQueryParameters(queryParameters))
302 return preparer.Prepare((&http.Request{}).WithContext(ctx))
303 }
304
305
306
307 func (client ServerEndpointsClient) GetSender(req *http.Request) (*http.Response, error) {
308 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
309 }
310
311
312
313 func (client ServerEndpointsClient) GetResponder(resp *http.Response) (result ServerEndpoint, err error) {
314 err = autorest.Respond(
315 resp,
316 azure.WithErrorUnlessStatusCode(http.StatusOK),
317 autorest.ByUnmarshallingJSON(&result),
318 autorest.ByClosing())
319 result.Response = autorest.Response{Response: resp}
320 return
321 }
322
323
324
325
326
327
328 func (client ServerEndpointsClient) ListBySyncGroup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string) (result ServerEndpointArray, err error) {
329 if tracing.IsEnabled() {
330 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.ListBySyncGroup")
331 defer func() {
332 sc := -1
333 if result.Response.Response != nil {
334 sc = result.Response.Response.StatusCode
335 }
336 tracing.EndSpan(ctx, sc, err)
337 }()
338 }
339 if err := validation.Validate([]validation.Validation{
340 {TargetValue: client.SubscriptionID,
341 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
342 {TargetValue: resourceGroupName,
343 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
344 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
345 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
346 return result, validation.NewError("storagesync.ServerEndpointsClient", "ListBySyncGroup", err.Error())
347 }
348
349 req, err := client.ListBySyncGroupPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName)
350 if err != nil {
351 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "ListBySyncGroup", nil, "Failure preparing request")
352 return
353 }
354
355 resp, err := client.ListBySyncGroupSender(req)
356 if err != nil {
357 result.Response = autorest.Response{Response: resp}
358 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "ListBySyncGroup", resp, "Failure sending request")
359 return
360 }
361
362 result, err = client.ListBySyncGroupResponder(resp)
363 if err != nil {
364 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "ListBySyncGroup", resp, "Failure responding to request")
365 return
366 }
367
368 return
369 }
370
371
372 func (client ServerEndpointsClient) ListBySyncGroupPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string) (*http.Request, error) {
373 pathParameters := map[string]interface{}{
374 "resourceGroupName": autorest.Encode("path", resourceGroupName),
375 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
376 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
377 "syncGroupName": autorest.Encode("path", syncGroupName),
378 }
379
380 const APIVersion = "2018-07-01"
381 queryParameters := map[string]interface{}{
382 "api-version": APIVersion,
383 }
384
385 preparer := autorest.CreatePreparer(
386 autorest.AsGet(),
387 autorest.WithBaseURL(client.BaseURI),
388 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints", pathParameters),
389 autorest.WithQueryParameters(queryParameters))
390 return preparer.Prepare((&http.Request{}).WithContext(ctx))
391 }
392
393
394
395 func (client ServerEndpointsClient) ListBySyncGroupSender(req *http.Request) (*http.Response, error) {
396 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
397 }
398
399
400
401 func (client ServerEndpointsClient) ListBySyncGroupResponder(resp *http.Response) (result ServerEndpointArray, err error) {
402 err = autorest.Respond(
403 resp,
404 azure.WithErrorUnlessStatusCode(http.StatusOK),
405 autorest.ByUnmarshallingJSON(&result),
406 autorest.ByClosing())
407 result.Response = autorest.Response{Response: resp}
408 return
409 }
410
411
412
413
414
415
416
417
418 func (client ServerEndpointsClient) RecallAction(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters RecallActionParameters) (result ServerEndpointsRecallActionFuture, err error) {
419 if tracing.IsEnabled() {
420 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.RecallAction")
421 defer func() {
422 sc := -1
423 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
424 sc = result.FutureAPI.Response().StatusCode
425 }
426 tracing.EndSpan(ctx, sc, err)
427 }()
428 }
429 if err := validation.Validate([]validation.Validation{
430 {TargetValue: client.SubscriptionID,
431 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
432 {TargetValue: resourceGroupName,
433 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
434 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
435 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
436 return result, validation.NewError("storagesync.ServerEndpointsClient", "RecallAction", err.Error())
437 }
438
439 req, err := client.RecallActionPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters)
440 if err != nil {
441 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "RecallAction", nil, "Failure preparing request")
442 return
443 }
444
445 result, err = client.RecallActionSender(req)
446 if err != nil {
447 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "RecallAction", result.Response(), "Failure sending request")
448 return
449 }
450
451 return
452 }
453
454
455 func (client ServerEndpointsClient) RecallActionPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters RecallActionParameters) (*http.Request, error) {
456 pathParameters := map[string]interface{}{
457 "resourceGroupName": autorest.Encode("path", resourceGroupName),
458 "serverEndpointName": autorest.Encode("path", serverEndpointName),
459 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
460 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
461 "syncGroupName": autorest.Encode("path", syncGroupName),
462 }
463
464 const APIVersion = "2018-07-01"
465 queryParameters := map[string]interface{}{
466 "api-version": APIVersion,
467 }
468
469 preparer := autorest.CreatePreparer(
470 autorest.AsContentType("application/json; charset=utf-8"),
471 autorest.AsPost(),
472 autorest.WithBaseURL(client.BaseURI),
473 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction", pathParameters),
474 autorest.WithJSON(parameters),
475 autorest.WithQueryParameters(queryParameters))
476 return preparer.Prepare((&http.Request{}).WithContext(ctx))
477 }
478
479
480
481 func (client ServerEndpointsClient) RecallActionSender(req *http.Request) (future ServerEndpointsRecallActionFuture, err error) {
482 var resp *http.Response
483 future.FutureAPI = &azure.Future{}
484 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
485 if err != nil {
486 return
487 }
488 var azf azure.Future
489 azf, err = azure.NewFutureFromResponse(resp)
490 future.FutureAPI = &azf
491 future.Result = future.result
492 return
493 }
494
495
496
497 func (client ServerEndpointsClient) RecallActionResponder(resp *http.Response) (result autorest.Response, err error) {
498 err = autorest.Respond(
499 resp,
500 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
501 autorest.ByClosing())
502 result.Response = resp
503 return
504 }
505
506
507
508
509
510
511
512
513 func (client ServerEndpointsClient) Update(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters *ServerEndpointUpdateParameters) (result ServerEndpointsUpdateFuture, err error) {
514 if tracing.IsEnabled() {
515 ctx = tracing.StartSpan(ctx, fqdn+"/ServerEndpointsClient.Update")
516 defer func() {
517 sc := -1
518 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
519 sc = result.FutureAPI.Response().StatusCode
520 }
521 tracing.EndSpan(ctx, sc, err)
522 }()
523 }
524 if err := validation.Validate([]validation.Validation{
525 {TargetValue: client.SubscriptionID,
526 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
527 {TargetValue: resourceGroupName,
528 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
529 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
530 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
531 return result, validation.NewError("storagesync.ServerEndpointsClient", "Update", err.Error())
532 }
533
534 req, err := client.UpdatePreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters)
535 if err != nil {
536 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Update", nil, "Failure preparing request")
537 return
538 }
539
540 result, err = client.UpdateSender(req)
541 if err != nil {
542 err = autorest.NewErrorWithError(err, "storagesync.ServerEndpointsClient", "Update", result.Response(), "Failure sending request")
543 return
544 }
545
546 return
547 }
548
549
550 func (client ServerEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, serverEndpointName string, parameters *ServerEndpointUpdateParameters) (*http.Request, error) {
551 pathParameters := map[string]interface{}{
552 "resourceGroupName": autorest.Encode("path", resourceGroupName),
553 "serverEndpointName": autorest.Encode("path", serverEndpointName),
554 "storageSyncServiceName": autorest.Encode("path", storageSyncServiceName),
555 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
556 "syncGroupName": autorest.Encode("path", syncGroupName),
557 }
558
559 const APIVersion = "2018-07-01"
560 queryParameters := map[string]interface{}{
561 "api-version": APIVersion,
562 }
563
564 preparer := autorest.CreatePreparer(
565 autorest.AsContentType("application/json; charset=utf-8"),
566 autorest.AsPatch(),
567 autorest.WithBaseURL(client.BaseURI),
568 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", pathParameters),
569 autorest.WithQueryParameters(queryParameters))
570 if parameters != nil {
571 preparer = autorest.DecoratePreparer(preparer,
572 autorest.WithJSON(parameters))
573 }
574 return preparer.Prepare((&http.Request{}).WithContext(ctx))
575 }
576
577
578
579 func (client ServerEndpointsClient) UpdateSender(req *http.Request) (future ServerEndpointsUpdateFuture, err error) {
580 var resp *http.Response
581 future.FutureAPI = &azure.Future{}
582 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
583 if err != nil {
584 return
585 }
586 var azf azure.Future
587 azf, err = azure.NewFutureFromResponse(resp)
588 future.FutureAPI = &azf
589 future.Result = future.result
590 return
591 }
592
593
594
595 func (client ServerEndpointsClient) UpdateResponder(resp *http.Response) (result ServerEndpoint, err error) {
596 err = autorest.Respond(
597 resp,
598 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
599 autorest.ByUnmarshallingJSON(&result),
600 autorest.ByClosing())
601 result.Response = autorest.Response{Response: resp}
602 return
603 }
604
View as plain text