1 package workspaces
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
20 type Client struct {
21 BaseClient
22 }
23
24
25 func NewClient(subscriptionID string) Client {
26 return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
27 }
28
29
30
31 func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
32 return Client{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40 func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (result Workspace, err error) {
41 if tracing.IsEnabled() {
42 ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate")
43 defer func() {
44 sc := -1
45 if result.Response.Response != nil {
46 sc = result.Response.Response.StatusCode
47 }
48 tracing.EndSpan(ctx, sc, err)
49 }()
50 }
51 if err := validation.Validate([]validation.Validation{
52 {TargetValue: parameters,
53 Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false,
54 Chain: []validation.Constraint{{Target: "parameters.Properties.UserStorageAccountID", Name: validation.Null, Rule: true, Chain: nil},
55 {Target: "parameters.Properties.OwnerEmail", Name: validation.Null, Rule: true, Chain: nil},
56 }}}}}); err != nil {
57 return result, validation.NewError("workspaces.Client", "CreateOrUpdate", err.Error())
58 }
59
60 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters)
61 if err != nil {
62 err = autorest.NewErrorWithError(err, "workspaces.Client", "CreateOrUpdate", nil, "Failure preparing request")
63 return
64 }
65
66 resp, err := client.CreateOrUpdateSender(req)
67 if err != nil {
68 result.Response = autorest.Response{Response: resp}
69 err = autorest.NewErrorWithError(err, "workspaces.Client", "CreateOrUpdate", resp, "Failure sending request")
70 return
71 }
72
73 result, err = client.CreateOrUpdateResponder(resp)
74 if err != nil {
75 err = autorest.NewErrorWithError(err, "workspaces.Client", "CreateOrUpdate", resp, "Failure responding to request")
76 return
77 }
78
79 return
80 }
81
82
83 func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (*http.Request, error) {
84 pathParameters := map[string]interface{}{
85 "resourceGroupName": autorest.Encode("path", resourceGroupName),
86 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
87 "workspaceName": autorest.Encode("path", workspaceName),
88 }
89
90 const APIVersion = "2019-10-01"
91 queryParameters := map[string]interface{}{
92 "api-version": APIVersion,
93 }
94
95 preparer := autorest.CreatePreparer(
96 autorest.AsContentType("application/json; charset=utf-8"),
97 autorest.AsPut(),
98 autorest.WithBaseURL(client.BaseURI),
99 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}", pathParameters),
100 autorest.WithJSON(parameters),
101 autorest.WithQueryParameters(queryParameters))
102 return preparer.Prepare((&http.Request{}).WithContext(ctx))
103 }
104
105
106
107 func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
108 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
109 }
110
111
112
113 func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) {
114 err = autorest.Respond(
115 resp,
116 azure.WithErrorUnlessStatusCode(http.StatusOK),
117 autorest.ByUnmarshallingJSON(&result),
118 autorest.ByClosing())
119 result.Response = autorest.Response{Response: resp}
120 return
121 }
122
123
124
125
126
127 func (client Client) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) {
128 if tracing.IsEnabled() {
129 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete")
130 defer func() {
131 sc := -1
132 if result.Response != nil {
133 sc = result.Response.StatusCode
134 }
135 tracing.EndSpan(ctx, sc, err)
136 }()
137 }
138 req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName)
139 if err != nil {
140 err = autorest.NewErrorWithError(err, "workspaces.Client", "Delete", nil, "Failure preparing request")
141 return
142 }
143
144 resp, err := client.DeleteSender(req)
145 if err != nil {
146 result.Response = resp
147 err = autorest.NewErrorWithError(err, "workspaces.Client", "Delete", resp, "Failure sending request")
148 return
149 }
150
151 result, err = client.DeleteResponder(resp)
152 if err != nil {
153 err = autorest.NewErrorWithError(err, "workspaces.Client", "Delete", resp, "Failure responding to request")
154 return
155 }
156
157 return
158 }
159
160
161 func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) {
162 pathParameters := map[string]interface{}{
163 "resourceGroupName": autorest.Encode("path", resourceGroupName),
164 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
165 "workspaceName": autorest.Encode("path", workspaceName),
166 }
167
168 const APIVersion = "2019-10-01"
169 queryParameters := map[string]interface{}{
170 "api-version": APIVersion,
171 }
172
173 preparer := autorest.CreatePreparer(
174 autorest.AsDelete(),
175 autorest.WithBaseURL(client.BaseURI),
176 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}", pathParameters),
177 autorest.WithQueryParameters(queryParameters))
178 return preparer.Prepare((&http.Request{}).WithContext(ctx))
179 }
180
181
182
183 func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
184 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
185 }
186
187
188
189 func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
190 err = autorest.Respond(
191 resp,
192 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
193 autorest.ByClosing())
194 result.Response = resp
195 return
196 }
197
198
199
200
201
202 func (client Client) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) {
203 if tracing.IsEnabled() {
204 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get")
205 defer func() {
206 sc := -1
207 if result.Response.Response != nil {
208 sc = result.Response.Response.StatusCode
209 }
210 tracing.EndSpan(ctx, sc, err)
211 }()
212 }
213 req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName)
214 if err != nil {
215 err = autorest.NewErrorWithError(err, "workspaces.Client", "Get", nil, "Failure preparing request")
216 return
217 }
218
219 resp, err := client.GetSender(req)
220 if err != nil {
221 result.Response = autorest.Response{Response: resp}
222 err = autorest.NewErrorWithError(err, "workspaces.Client", "Get", resp, "Failure sending request")
223 return
224 }
225
226 result, err = client.GetResponder(resp)
227 if err != nil {
228 err = autorest.NewErrorWithError(err, "workspaces.Client", "Get", resp, "Failure responding to request")
229 return
230 }
231
232 return
233 }
234
235
236 func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) {
237 pathParameters := map[string]interface{}{
238 "resourceGroupName": autorest.Encode("path", resourceGroupName),
239 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
240 "workspaceName": autorest.Encode("path", workspaceName),
241 }
242
243 const APIVersion = "2019-10-01"
244 queryParameters := map[string]interface{}{
245 "api-version": APIVersion,
246 }
247
248 preparer := autorest.CreatePreparer(
249 autorest.AsGet(),
250 autorest.WithBaseURL(client.BaseURI),
251 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}", pathParameters),
252 autorest.WithQueryParameters(queryParameters))
253 return preparer.Prepare((&http.Request{}).WithContext(ctx))
254 }
255
256
257
258 func (client Client) GetSender(req *http.Request) (*http.Response, error) {
259 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
260 }
261
262
263
264 func (client Client) GetResponder(resp *http.Response) (result Workspace, err error) {
265 err = autorest.Respond(
266 resp,
267 azure.WithErrorUnlessStatusCode(http.StatusOK),
268 autorest.ByUnmarshallingJSON(&result),
269 autorest.ByClosing())
270 result.Response = autorest.Response{Response: resp}
271 return
272 }
273
274
275 func (client Client) List(ctx context.Context) (result ListResultPage, err error) {
276 if tracing.IsEnabled() {
277 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
278 defer func() {
279 sc := -1
280 if result.lr.Response.Response != nil {
281 sc = result.lr.Response.Response.StatusCode
282 }
283 tracing.EndSpan(ctx, sc, err)
284 }()
285 }
286 result.fn = client.listNextResults
287 req, err := client.ListPreparer(ctx)
288 if err != nil {
289 err = autorest.NewErrorWithError(err, "workspaces.Client", "List", nil, "Failure preparing request")
290 return
291 }
292
293 resp, err := client.ListSender(req)
294 if err != nil {
295 result.lr.Response = autorest.Response{Response: resp}
296 err = autorest.NewErrorWithError(err, "workspaces.Client", "List", resp, "Failure sending request")
297 return
298 }
299
300 result.lr, err = client.ListResponder(resp)
301 if err != nil {
302 err = autorest.NewErrorWithError(err, "workspaces.Client", "List", resp, "Failure responding to request")
303 return
304 }
305 if result.lr.hasNextLink() && result.lr.IsEmpty() {
306 err = result.NextWithContext(ctx)
307 return
308 }
309
310 return
311 }
312
313
314 func (client Client) ListPreparer(ctx context.Context) (*http.Request, error) {
315 pathParameters := map[string]interface{}{
316 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
317 }
318
319 const APIVersion = "2019-10-01"
320 queryParameters := map[string]interface{}{
321 "api-version": APIVersion,
322 }
323
324 preparer := autorest.CreatePreparer(
325 autorest.AsGet(),
326 autorest.WithBaseURL(client.BaseURI),
327 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/workspaces", pathParameters),
328 autorest.WithQueryParameters(queryParameters))
329 return preparer.Prepare((&http.Request{}).WithContext(ctx))
330 }
331
332
333
334 func (client Client) ListSender(req *http.Request) (*http.Response, error) {
335 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
336 }
337
338
339
340 func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) {
341 err = autorest.Respond(
342 resp,
343 azure.WithErrorUnlessStatusCode(http.StatusOK),
344 autorest.ByUnmarshallingJSON(&result),
345 autorest.ByClosing())
346 result.Response = autorest.Response{Response: resp}
347 return
348 }
349
350
351 func (client Client) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) {
352 req, err := lastResults.listResultPreparer(ctx)
353 if err != nil {
354 return result, autorest.NewErrorWithError(err, "workspaces.Client", "listNextResults", nil, "Failure preparing next results request")
355 }
356 if req == nil {
357 return
358 }
359 resp, err := client.ListSender(req)
360 if err != nil {
361 result.Response = autorest.Response{Response: resp}
362 return result, autorest.NewErrorWithError(err, "workspaces.Client", "listNextResults", resp, "Failure sending next results request")
363 }
364 result, err = client.ListResponder(resp)
365 if err != nil {
366 err = autorest.NewErrorWithError(err, "workspaces.Client", "listNextResults", resp, "Failure responding to next results request")
367 }
368 return
369 }
370
371
372 func (client Client) ListComplete(ctx context.Context) (result ListResultIterator, err error) {
373 if tracing.IsEnabled() {
374 ctx = tracing.StartSpan(ctx, fqdn+"/Client.List")
375 defer func() {
376 sc := -1
377 if result.Response().Response.Response != nil {
378 sc = result.page.Response().Response.Response.StatusCode
379 }
380 tracing.EndSpan(ctx, sc, err)
381 }()
382 }
383 result.page, err = client.List(ctx)
384 return
385 }
386
387
388
389
390 func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) {
391 if tracing.IsEnabled() {
392 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup")
393 defer func() {
394 sc := -1
395 if result.lr.Response.Response != nil {
396 sc = result.lr.Response.Response.StatusCode
397 }
398 tracing.EndSpan(ctx, sc, err)
399 }()
400 }
401 result.fn = client.listByResourceGroupNextResults
402 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
403 if err != nil {
404 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListByResourceGroup", nil, "Failure preparing request")
405 return
406 }
407
408 resp, err := client.ListByResourceGroupSender(req)
409 if err != nil {
410 result.lr.Response = autorest.Response{Response: resp}
411 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListByResourceGroup", resp, "Failure sending request")
412 return
413 }
414
415 result.lr, err = client.ListByResourceGroupResponder(resp)
416 if err != nil {
417 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListByResourceGroup", resp, "Failure responding to request")
418 return
419 }
420 if result.lr.hasNextLink() && result.lr.IsEmpty() {
421 err = result.NextWithContext(ctx)
422 return
423 }
424
425 return
426 }
427
428
429 func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
430 pathParameters := map[string]interface{}{
431 "resourceGroupName": autorest.Encode("path", resourceGroupName),
432 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
433 }
434
435 const APIVersion = "2019-10-01"
436 queryParameters := map[string]interface{}{
437 "api-version": APIVersion,
438 }
439
440 preparer := autorest.CreatePreparer(
441 autorest.AsGet(),
442 autorest.WithBaseURL(client.BaseURI),
443 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces", pathParameters),
444 autorest.WithQueryParameters(queryParameters))
445 return preparer.Prepare((&http.Request{}).WithContext(ctx))
446 }
447
448
449
450 func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
451 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
452 }
453
454
455
456 func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
457 err = autorest.Respond(
458 resp,
459 azure.WithErrorUnlessStatusCode(http.StatusOK),
460 autorest.ByUnmarshallingJSON(&result),
461 autorest.ByClosing())
462 result.Response = autorest.Response{Response: resp}
463 return
464 }
465
466
467 func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) {
468 req, err := lastResults.listResultPreparer(ctx)
469 if err != nil {
470 return result, autorest.NewErrorWithError(err, "workspaces.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
471 }
472 if req == nil {
473 return
474 }
475 resp, err := client.ListByResourceGroupSender(req)
476 if err != nil {
477 result.Response = autorest.Response{Response: resp}
478 return result, autorest.NewErrorWithError(err, "workspaces.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request")
479 }
480 result, err = client.ListByResourceGroupResponder(resp)
481 if err != nil {
482 err = autorest.NewErrorWithError(err, "workspaces.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
483 }
484 return
485 }
486
487
488 func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) {
489 if tracing.IsEnabled() {
490 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup")
491 defer func() {
492 sc := -1
493 if result.Response().Response.Response != nil {
494 sc = result.page.Response().Response.Response.StatusCode
495 }
496 tracing.EndSpan(ctx, sc, err)
497 }()
498 }
499 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
500 return
501 }
502
503
504
505
506
507 func (client Client) ListWorkspaceKeys(ctx context.Context, workspaceName string, resourceGroupName string) (result KeysResponse, err error) {
508 if tracing.IsEnabled() {
509 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListWorkspaceKeys")
510 defer func() {
511 sc := -1
512 if result.Response.Response != nil {
513 sc = result.Response.Response.StatusCode
514 }
515 tracing.EndSpan(ctx, sc, err)
516 }()
517 }
518 req, err := client.ListWorkspaceKeysPreparer(ctx, workspaceName, resourceGroupName)
519 if err != nil {
520 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListWorkspaceKeys", nil, "Failure preparing request")
521 return
522 }
523
524 resp, err := client.ListWorkspaceKeysSender(req)
525 if err != nil {
526 result.Response = autorest.Response{Response: resp}
527 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListWorkspaceKeys", resp, "Failure sending request")
528 return
529 }
530
531 result, err = client.ListWorkspaceKeysResponder(resp)
532 if err != nil {
533 err = autorest.NewErrorWithError(err, "workspaces.Client", "ListWorkspaceKeys", resp, "Failure responding to request")
534 return
535 }
536
537 return
538 }
539
540
541 func (client Client) ListWorkspaceKeysPreparer(ctx context.Context, workspaceName string, resourceGroupName string) (*http.Request, error) {
542 pathParameters := map[string]interface{}{
543 "resourceGroupName": autorest.Encode("path", resourceGroupName),
544 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
545 "workspaceName": autorest.Encode("path", workspaceName),
546 }
547
548 const APIVersion = "2019-10-01"
549 queryParameters := map[string]interface{}{
550 "api-version": APIVersion,
551 }
552
553 preparer := autorest.CreatePreparer(
554 autorest.AsPost(),
555 autorest.WithBaseURL(client.BaseURI),
556 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}/listWorkspaceKeys", pathParameters),
557 autorest.WithQueryParameters(queryParameters))
558 return preparer.Prepare((&http.Request{}).WithContext(ctx))
559 }
560
561
562
563 func (client Client) ListWorkspaceKeysSender(req *http.Request) (*http.Response, error) {
564 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
565 }
566
567
568
569 func (client Client) ListWorkspaceKeysResponder(resp *http.Response) (result KeysResponse, err error) {
570 err = autorest.Respond(
571 resp,
572 azure.WithErrorUnlessStatusCode(http.StatusOK),
573 autorest.ByUnmarshallingJSON(&result),
574 autorest.ByClosing())
575 result.Response = autorest.Response{Response: resp}
576 return
577 }
578
579
580
581
582
583 func (client Client) ResyncStorageKeys(ctx context.Context, workspaceName string, resourceGroupName string) (result autorest.Response, err error) {
584 if tracing.IsEnabled() {
585 ctx = tracing.StartSpan(ctx, fqdn+"/Client.ResyncStorageKeys")
586 defer func() {
587 sc := -1
588 if result.Response != nil {
589 sc = result.Response.StatusCode
590 }
591 tracing.EndSpan(ctx, sc, err)
592 }()
593 }
594 req, err := client.ResyncStorageKeysPreparer(ctx, workspaceName, resourceGroupName)
595 if err != nil {
596 err = autorest.NewErrorWithError(err, "workspaces.Client", "ResyncStorageKeys", nil, "Failure preparing request")
597 return
598 }
599
600 resp, err := client.ResyncStorageKeysSender(req)
601 if err != nil {
602 result.Response = resp
603 err = autorest.NewErrorWithError(err, "workspaces.Client", "ResyncStorageKeys", resp, "Failure sending request")
604 return
605 }
606
607 result, err = client.ResyncStorageKeysResponder(resp)
608 if err != nil {
609 err = autorest.NewErrorWithError(err, "workspaces.Client", "ResyncStorageKeys", resp, "Failure responding to request")
610 return
611 }
612
613 return
614 }
615
616
617 func (client Client) ResyncStorageKeysPreparer(ctx context.Context, workspaceName string, resourceGroupName string) (*http.Request, error) {
618 pathParameters := map[string]interface{}{
619 "resourceGroupName": autorest.Encode("path", resourceGroupName),
620 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
621 "workspaceName": autorest.Encode("path", workspaceName),
622 }
623
624 const APIVersion = "2019-10-01"
625 queryParameters := map[string]interface{}{
626 "api-version": APIVersion,
627 }
628
629 preparer := autorest.CreatePreparer(
630 autorest.AsPost(),
631 autorest.WithBaseURL(client.BaseURI),
632 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}/resyncStorageKeys", pathParameters),
633 autorest.WithQueryParameters(queryParameters))
634 return preparer.Prepare((&http.Request{}).WithContext(ctx))
635 }
636
637
638
639 func (client Client) ResyncStorageKeysSender(req *http.Request) (*http.Response, error) {
640 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
641 }
642
643
644
645 func (client Client) ResyncStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) {
646 err = autorest.Respond(
647 resp,
648 azure.WithErrorUnlessStatusCode(http.StatusOK),
649 autorest.ByClosing())
650 result.Response = resp
651 return
652 }
653
654
655
656
657
658
659 func (client Client) Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters UpdateParameters) (result Workspace, err error) {
660 if tracing.IsEnabled() {
661 ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update")
662 defer func() {
663 sc := -1
664 if result.Response.Response != nil {
665 sc = result.Response.Response.StatusCode
666 }
667 tracing.EndSpan(ctx, sc, err)
668 }()
669 }
670 req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, parameters)
671 if err != nil {
672 err = autorest.NewErrorWithError(err, "workspaces.Client", "Update", nil, "Failure preparing request")
673 return
674 }
675
676 resp, err := client.UpdateSender(req)
677 if err != nil {
678 result.Response = autorest.Response{Response: resp}
679 err = autorest.NewErrorWithError(err, "workspaces.Client", "Update", resp, "Failure sending request")
680 return
681 }
682
683 result, err = client.UpdateResponder(resp)
684 if err != nil {
685 err = autorest.NewErrorWithError(err, "workspaces.Client", "Update", resp, "Failure responding to request")
686 return
687 }
688
689 return
690 }
691
692
693 func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters UpdateParameters) (*http.Request, error) {
694 pathParameters := map[string]interface{}{
695 "resourceGroupName": autorest.Encode("path", resourceGroupName),
696 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
697 "workspaceName": autorest.Encode("path", workspaceName),
698 }
699
700 const APIVersion = "2019-10-01"
701 queryParameters := map[string]interface{}{
702 "api-version": APIVersion,
703 }
704
705 preparer := autorest.CreatePreparer(
706 autorest.AsContentType("application/json; charset=utf-8"),
707 autorest.AsPatch(),
708 autorest.WithBaseURL(client.BaseURI),
709 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/workspaces/{workspaceName}", pathParameters),
710 autorest.WithJSON(parameters),
711 autorest.WithQueryParameters(queryParameters))
712 return preparer.Prepare((&http.Request{}).WithContext(ctx))
713 }
714
715
716
717 func (client Client) UpdateSender(req *http.Request) (*http.Response, error) {
718 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
719 }
720
721
722
723 func (client Client) UpdateResponder(resp *http.Response) (result Workspace, err error) {
724 err = autorest.Respond(
725 resp,
726 azure.WithErrorUnlessStatusCode(http.StatusOK),
727 autorest.ByUnmarshallingJSON(&result),
728 autorest.ByClosing())
729 result.Response = autorest.Response{Response: resp}
730 return
731 }
732
View as plain text