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