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