1 package managedapplications
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/azure"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-06-01/managedapplications"
21
22
23 type Application struct {
24 autorest.Response `json:"-"`
25
26 *ApplicationProperties `json:"properties,omitempty"`
27
28 Plan *Plan `json:"plan,omitempty"`
29
30 Kind *string `json:"kind,omitempty"`
31
32 ManagedBy *string `json:"managedBy,omitempty"`
33
34 Sku *Sku `json:"sku,omitempty"`
35
36 Identity *Identity `json:"identity,omitempty"`
37
38 ID *string `json:"id,omitempty"`
39
40 Name *string `json:"name,omitempty"`
41
42 Type *string `json:"type,omitempty"`
43
44 Location *string `json:"location,omitempty"`
45
46 Tags map[string]*string `json:"tags"`
47 }
48
49
50 func (a Application) MarshalJSON() ([]byte, error) {
51 objectMap := make(map[string]interface{})
52 if a.ApplicationProperties != nil {
53 objectMap["properties"] = a.ApplicationProperties
54 }
55 if a.Plan != nil {
56 objectMap["plan"] = a.Plan
57 }
58 if a.Kind != nil {
59 objectMap["kind"] = a.Kind
60 }
61 if a.ManagedBy != nil {
62 objectMap["managedBy"] = a.ManagedBy
63 }
64 if a.Sku != nil {
65 objectMap["sku"] = a.Sku
66 }
67 if a.Identity != nil {
68 objectMap["identity"] = a.Identity
69 }
70 if a.Location != nil {
71 objectMap["location"] = a.Location
72 }
73 if a.Tags != nil {
74 objectMap["tags"] = a.Tags
75 }
76 return json.Marshal(objectMap)
77 }
78
79
80 func (a *Application) UnmarshalJSON(body []byte) error {
81 var m map[string]*json.RawMessage
82 err := json.Unmarshal(body, &m)
83 if err != nil {
84 return err
85 }
86 for k, v := range m {
87 switch k {
88 case "properties":
89 if v != nil {
90 var applicationProperties ApplicationProperties
91 err = json.Unmarshal(*v, &applicationProperties)
92 if err != nil {
93 return err
94 }
95 a.ApplicationProperties = &applicationProperties
96 }
97 case "plan":
98 if v != nil {
99 var plan Plan
100 err = json.Unmarshal(*v, &plan)
101 if err != nil {
102 return err
103 }
104 a.Plan = &plan
105 }
106 case "kind":
107 if v != nil {
108 var kind string
109 err = json.Unmarshal(*v, &kind)
110 if err != nil {
111 return err
112 }
113 a.Kind = &kind
114 }
115 case "managedBy":
116 if v != nil {
117 var managedBy string
118 err = json.Unmarshal(*v, &managedBy)
119 if err != nil {
120 return err
121 }
122 a.ManagedBy = &managedBy
123 }
124 case "sku":
125 if v != nil {
126 var sku Sku
127 err = json.Unmarshal(*v, &sku)
128 if err != nil {
129 return err
130 }
131 a.Sku = &sku
132 }
133 case "identity":
134 if v != nil {
135 var identity Identity
136 err = json.Unmarshal(*v, &identity)
137 if err != nil {
138 return err
139 }
140 a.Identity = &identity
141 }
142 case "id":
143 if v != nil {
144 var ID string
145 err = json.Unmarshal(*v, &ID)
146 if err != nil {
147 return err
148 }
149 a.ID = &ID
150 }
151 case "name":
152 if v != nil {
153 var name string
154 err = json.Unmarshal(*v, &name)
155 if err != nil {
156 return err
157 }
158 a.Name = &name
159 }
160 case "type":
161 if v != nil {
162 var typeVar string
163 err = json.Unmarshal(*v, &typeVar)
164 if err != nil {
165 return err
166 }
167 a.Type = &typeVar
168 }
169 case "location":
170 if v != nil {
171 var location string
172 err = json.Unmarshal(*v, &location)
173 if err != nil {
174 return err
175 }
176 a.Location = &location
177 }
178 case "tags":
179 if v != nil {
180 var tags map[string]*string
181 err = json.Unmarshal(*v, &tags)
182 if err != nil {
183 return err
184 }
185 a.Tags = tags
186 }
187 }
188 }
189
190 return nil
191 }
192
193
194 type ApplicationArtifact struct {
195
196 Name *string `json:"name,omitempty"`
197
198 URI *string `json:"uri,omitempty"`
199
200 Type ApplicationArtifactType `json:"type,omitempty"`
201 }
202
203
204 type ApplicationDefinition struct {
205 autorest.Response `json:"-"`
206
207 *ApplicationDefinitionProperties `json:"properties,omitempty"`
208
209 ManagedBy *string `json:"managedBy,omitempty"`
210
211 Sku *Sku `json:"sku,omitempty"`
212
213 Identity *Identity `json:"identity,omitempty"`
214
215 ID *string `json:"id,omitempty"`
216
217 Name *string `json:"name,omitempty"`
218
219 Type *string `json:"type,omitempty"`
220
221 Location *string `json:"location,omitempty"`
222
223 Tags map[string]*string `json:"tags"`
224 }
225
226
227 func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
228 objectMap := make(map[string]interface{})
229 if ad.ApplicationDefinitionProperties != nil {
230 objectMap["properties"] = ad.ApplicationDefinitionProperties
231 }
232 if ad.ManagedBy != nil {
233 objectMap["managedBy"] = ad.ManagedBy
234 }
235 if ad.Sku != nil {
236 objectMap["sku"] = ad.Sku
237 }
238 if ad.Identity != nil {
239 objectMap["identity"] = ad.Identity
240 }
241 if ad.Location != nil {
242 objectMap["location"] = ad.Location
243 }
244 if ad.Tags != nil {
245 objectMap["tags"] = ad.Tags
246 }
247 return json.Marshal(objectMap)
248 }
249
250
251 func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
252 var m map[string]*json.RawMessage
253 err := json.Unmarshal(body, &m)
254 if err != nil {
255 return err
256 }
257 for k, v := range m {
258 switch k {
259 case "properties":
260 if v != nil {
261 var applicationDefinitionProperties ApplicationDefinitionProperties
262 err = json.Unmarshal(*v, &applicationDefinitionProperties)
263 if err != nil {
264 return err
265 }
266 ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
267 }
268 case "managedBy":
269 if v != nil {
270 var managedBy string
271 err = json.Unmarshal(*v, &managedBy)
272 if err != nil {
273 return err
274 }
275 ad.ManagedBy = &managedBy
276 }
277 case "sku":
278 if v != nil {
279 var sku Sku
280 err = json.Unmarshal(*v, &sku)
281 if err != nil {
282 return err
283 }
284 ad.Sku = &sku
285 }
286 case "identity":
287 if v != nil {
288 var identity Identity
289 err = json.Unmarshal(*v, &identity)
290 if err != nil {
291 return err
292 }
293 ad.Identity = &identity
294 }
295 case "id":
296 if v != nil {
297 var ID string
298 err = json.Unmarshal(*v, &ID)
299 if err != nil {
300 return err
301 }
302 ad.ID = &ID
303 }
304 case "name":
305 if v != nil {
306 var name string
307 err = json.Unmarshal(*v, &name)
308 if err != nil {
309 return err
310 }
311 ad.Name = &name
312 }
313 case "type":
314 if v != nil {
315 var typeVar string
316 err = json.Unmarshal(*v, &typeVar)
317 if err != nil {
318 return err
319 }
320 ad.Type = &typeVar
321 }
322 case "location":
323 if v != nil {
324 var location string
325 err = json.Unmarshal(*v, &location)
326 if err != nil {
327 return err
328 }
329 ad.Location = &location
330 }
331 case "tags":
332 if v != nil {
333 var tags map[string]*string
334 err = json.Unmarshal(*v, &tags)
335 if err != nil {
336 return err
337 }
338 ad.Tags = tags
339 }
340 }
341 }
342
343 return nil
344 }
345
346
347 type ApplicationDefinitionListResult struct {
348 autorest.Response `json:"-"`
349
350 Value *[]ApplicationDefinition `json:"value,omitempty"`
351
352 NextLink *string `json:"nextLink,omitempty"`
353 }
354
355
356
357 type ApplicationDefinitionListResultIterator struct {
358 i int
359 page ApplicationDefinitionListResultPage
360 }
361
362
363
364 func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
365 if tracing.IsEnabled() {
366 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
367 defer func() {
368 sc := -1
369 if iter.Response().Response.Response != nil {
370 sc = iter.Response().Response.Response.StatusCode
371 }
372 tracing.EndSpan(ctx, sc, err)
373 }()
374 }
375 iter.i++
376 if iter.i < len(iter.page.Values()) {
377 return nil
378 }
379 err = iter.page.NextWithContext(ctx)
380 if err != nil {
381 iter.i--
382 return err
383 }
384 iter.i = 0
385 return nil
386 }
387
388
389
390
391 func (iter *ApplicationDefinitionListResultIterator) Next() error {
392 return iter.NextWithContext(context.Background())
393 }
394
395
396 func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
397 return iter.page.NotDone() && iter.i < len(iter.page.Values())
398 }
399
400
401 func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
402 return iter.page.Response()
403 }
404
405
406
407 func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
408 if !iter.page.NotDone() {
409 return ApplicationDefinition{}
410 }
411 return iter.page.Values()[iter.i]
412 }
413
414
415 func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
416 return ApplicationDefinitionListResultIterator{page: page}
417 }
418
419
420 func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
421 return adlr.Value == nil || len(*adlr.Value) == 0
422 }
423
424
425 func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
426 return adlr.NextLink != nil && len(*adlr.NextLink) != 0
427 }
428
429
430
431 func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
432 if !adlr.hasNextLink() {
433 return nil, nil
434 }
435 return autorest.Prepare((&http.Request{}).WithContext(ctx),
436 autorest.AsJSON(),
437 autorest.AsGet(),
438 autorest.WithBaseURL(to.String(adlr.NextLink)))
439 }
440
441
442 type ApplicationDefinitionListResultPage struct {
443 fn func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
444 adlr ApplicationDefinitionListResult
445 }
446
447
448
449 func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
450 if tracing.IsEnabled() {
451 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
452 defer func() {
453 sc := -1
454 if page.Response().Response.Response != nil {
455 sc = page.Response().Response.Response.StatusCode
456 }
457 tracing.EndSpan(ctx, sc, err)
458 }()
459 }
460 for {
461 next, err := page.fn(ctx, page.adlr)
462 if err != nil {
463 return err
464 }
465 page.adlr = next
466 if !next.hasNextLink() || !next.IsEmpty() {
467 break
468 }
469 }
470 return nil
471 }
472
473
474
475
476 func (page *ApplicationDefinitionListResultPage) Next() error {
477 return page.NextWithContext(context.Background())
478 }
479
480
481 func (page ApplicationDefinitionListResultPage) NotDone() bool {
482 return !page.adlr.IsEmpty()
483 }
484
485
486 func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
487 return page.adlr
488 }
489
490
491 func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
492 if page.adlr.IsEmpty() {
493 return nil
494 }
495 return *page.adlr.Value
496 }
497
498
499 func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
500 return ApplicationDefinitionListResultPage{
501 fn: getNextPage,
502 adlr: cur,
503 }
504 }
505
506
507 type ApplicationDefinitionProperties struct {
508
509 LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
510
511 DisplayName *string `json:"displayName,omitempty"`
512
513 IsEnabled *string `json:"isEnabled,omitempty"`
514
515 Authorizations *[]ApplicationProviderAuthorization `json:"authorizations,omitempty"`
516
517 Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
518
519 Description *string `json:"description,omitempty"`
520
521 PackageFileURI *string `json:"packageFileUri,omitempty"`
522
523 MainTemplate interface{} `json:"mainTemplate,omitempty"`
524
525 CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
526 }
527
528
529
530 type ApplicationDefinitionsCreateOrUpdateByIDFuture struct {
531 azure.FutureAPI
532
533
534 Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
535 }
536
537
538 func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
539 var azFuture azure.Future
540 if err := json.Unmarshal(body, &azFuture); err != nil {
541 return err
542 }
543 future.FutureAPI = &azFuture
544 future.Result = future.result
545 return nil
546 }
547
548
549 func (future *ApplicationDefinitionsCreateOrUpdateByIDFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) {
550 var done bool
551 done, err = future.DoneWithContext(context.Background(), client)
552 if err != nil {
553 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
554 return
555 }
556 if !done {
557 ad.Response.Response = future.Response()
558 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture")
559 return
560 }
561 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
562 if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent {
563 ad, err = client.CreateOrUpdateByIDResponder(ad.Response.Response)
564 if err != nil {
565 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateByIDFuture", "Result", ad.Response.Response, "Failure responding to request")
566 }
567 }
568 return
569 }
570
571
572
573 type ApplicationDefinitionsCreateOrUpdateFuture struct {
574 azure.FutureAPI
575
576
577 Result func(ApplicationDefinitionsClient) (ApplicationDefinition, error)
578 }
579
580
581 func (future *ApplicationDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
582 var azFuture azure.Future
583 if err := json.Unmarshal(body, &azFuture); err != nil {
584 return err
585 }
586 future.FutureAPI = &azFuture
587 future.Result = future.result
588 return nil
589 }
590
591
592 func (future *ApplicationDefinitionsCreateOrUpdateFuture) result(client ApplicationDefinitionsClient) (ad ApplicationDefinition, err error) {
593 var done bool
594 done, err = future.DoneWithContext(context.Background(), client)
595 if err != nil {
596 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
597 return
598 }
599 if !done {
600 ad.Response.Response = future.Response()
601 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsCreateOrUpdateFuture")
602 return
603 }
604 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
605 if ad.Response.Response, err = future.GetResult(sender); err == nil && ad.Response.Response.StatusCode != http.StatusNoContent {
606 ad, err = client.CreateOrUpdateResponder(ad.Response.Response)
607 if err != nil {
608 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsCreateOrUpdateFuture", "Result", ad.Response.Response, "Failure responding to request")
609 }
610 }
611 return
612 }
613
614
615
616 type ApplicationDefinitionsDeleteByIDFuture struct {
617 azure.FutureAPI
618
619
620 Result func(ApplicationDefinitionsClient) (autorest.Response, error)
621 }
622
623
624 func (future *ApplicationDefinitionsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
625 var azFuture azure.Future
626 if err := json.Unmarshal(body, &azFuture); err != nil {
627 return err
628 }
629 future.FutureAPI = &azFuture
630 future.Result = future.result
631 return nil
632 }
633
634
635 func (future *ApplicationDefinitionsDeleteByIDFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) {
636 var done bool
637 done, err = future.DoneWithContext(context.Background(), client)
638 if err != nil {
639 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
640 return
641 }
642 if !done {
643 ar.Response = future.Response()
644 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteByIDFuture")
645 return
646 }
647 ar.Response = future.Response()
648 return
649 }
650
651
652
653 type ApplicationDefinitionsDeleteFuture struct {
654 azure.FutureAPI
655
656
657 Result func(ApplicationDefinitionsClient) (autorest.Response, error)
658 }
659
660
661 func (future *ApplicationDefinitionsDeleteFuture) UnmarshalJSON(body []byte) error {
662 var azFuture azure.Future
663 if err := json.Unmarshal(body, &azFuture); err != nil {
664 return err
665 }
666 future.FutureAPI = &azFuture
667 future.Result = future.result
668 return nil
669 }
670
671
672 func (future *ApplicationDefinitionsDeleteFuture) result(client ApplicationDefinitionsClient) (ar autorest.Response, err error) {
673 var done bool
674 done, err = future.DoneWithContext(context.Background(), client)
675 if err != nil {
676 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure")
677 return
678 }
679 if !done {
680 ar.Response = future.Response()
681 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationDefinitionsDeleteFuture")
682 return
683 }
684 ar.Response = future.Response()
685 return
686 }
687
688
689 type ApplicationListResult struct {
690 autorest.Response `json:"-"`
691
692 Value *[]Application `json:"value,omitempty"`
693
694 NextLink *string `json:"nextLink,omitempty"`
695 }
696
697
698 type ApplicationListResultIterator struct {
699 i int
700 page ApplicationListResultPage
701 }
702
703
704
705 func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
706 if tracing.IsEnabled() {
707 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
708 defer func() {
709 sc := -1
710 if iter.Response().Response.Response != nil {
711 sc = iter.Response().Response.Response.StatusCode
712 }
713 tracing.EndSpan(ctx, sc, err)
714 }()
715 }
716 iter.i++
717 if iter.i < len(iter.page.Values()) {
718 return nil
719 }
720 err = iter.page.NextWithContext(ctx)
721 if err != nil {
722 iter.i--
723 return err
724 }
725 iter.i = 0
726 return nil
727 }
728
729
730
731
732 func (iter *ApplicationListResultIterator) Next() error {
733 return iter.NextWithContext(context.Background())
734 }
735
736
737 func (iter ApplicationListResultIterator) NotDone() bool {
738 return iter.page.NotDone() && iter.i < len(iter.page.Values())
739 }
740
741
742 func (iter ApplicationListResultIterator) Response() ApplicationListResult {
743 return iter.page.Response()
744 }
745
746
747
748 func (iter ApplicationListResultIterator) Value() Application {
749 if !iter.page.NotDone() {
750 return Application{}
751 }
752 return iter.page.Values()[iter.i]
753 }
754
755
756 func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
757 return ApplicationListResultIterator{page: page}
758 }
759
760
761 func (alr ApplicationListResult) IsEmpty() bool {
762 return alr.Value == nil || len(*alr.Value) == 0
763 }
764
765
766 func (alr ApplicationListResult) hasNextLink() bool {
767 return alr.NextLink != nil && len(*alr.NextLink) != 0
768 }
769
770
771
772 func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
773 if !alr.hasNextLink() {
774 return nil, nil
775 }
776 return autorest.Prepare((&http.Request{}).WithContext(ctx),
777 autorest.AsJSON(),
778 autorest.AsGet(),
779 autorest.WithBaseURL(to.String(alr.NextLink)))
780 }
781
782
783 type ApplicationListResultPage struct {
784 fn func(context.Context, ApplicationListResult) (ApplicationListResult, error)
785 alr ApplicationListResult
786 }
787
788
789
790 func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
791 if tracing.IsEnabled() {
792 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
793 defer func() {
794 sc := -1
795 if page.Response().Response.Response != nil {
796 sc = page.Response().Response.Response.StatusCode
797 }
798 tracing.EndSpan(ctx, sc, err)
799 }()
800 }
801 for {
802 next, err := page.fn(ctx, page.alr)
803 if err != nil {
804 return err
805 }
806 page.alr = next
807 if !next.hasNextLink() || !next.IsEmpty() {
808 break
809 }
810 }
811 return nil
812 }
813
814
815
816
817 func (page *ApplicationListResultPage) Next() error {
818 return page.NextWithContext(context.Background())
819 }
820
821
822 func (page ApplicationListResultPage) NotDone() bool {
823 return !page.alr.IsEmpty()
824 }
825
826
827 func (page ApplicationListResultPage) Response() ApplicationListResult {
828 return page.alr
829 }
830
831
832 func (page ApplicationListResultPage) Values() []Application {
833 if page.alr.IsEmpty() {
834 return nil
835 }
836 return *page.alr.Value
837 }
838
839
840 func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
841 return ApplicationListResultPage{
842 fn: getNextPage,
843 alr: cur,
844 }
845 }
846
847
848 type ApplicationPatchable struct {
849
850 *ApplicationPropertiesPatchable `json:"properties,omitempty"`
851
852 Plan *PlanPatchable `json:"plan,omitempty"`
853
854 Kind *string `json:"kind,omitempty"`
855
856 ManagedBy *string `json:"managedBy,omitempty"`
857
858 Sku *Sku `json:"sku,omitempty"`
859
860 Identity *Identity `json:"identity,omitempty"`
861
862 ID *string `json:"id,omitempty"`
863
864 Name *string `json:"name,omitempty"`
865
866 Type *string `json:"type,omitempty"`
867
868 Location *string `json:"location,omitempty"`
869
870 Tags map[string]*string `json:"tags"`
871 }
872
873
874 func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
875 objectMap := make(map[string]interface{})
876 if ap.ApplicationPropertiesPatchable != nil {
877 objectMap["properties"] = ap.ApplicationPropertiesPatchable
878 }
879 if ap.Plan != nil {
880 objectMap["plan"] = ap.Plan
881 }
882 if ap.Kind != nil {
883 objectMap["kind"] = ap.Kind
884 }
885 if ap.ManagedBy != nil {
886 objectMap["managedBy"] = ap.ManagedBy
887 }
888 if ap.Sku != nil {
889 objectMap["sku"] = ap.Sku
890 }
891 if ap.Identity != nil {
892 objectMap["identity"] = ap.Identity
893 }
894 if ap.Location != nil {
895 objectMap["location"] = ap.Location
896 }
897 if ap.Tags != nil {
898 objectMap["tags"] = ap.Tags
899 }
900 return json.Marshal(objectMap)
901 }
902
903
904 func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
905 var m map[string]*json.RawMessage
906 err := json.Unmarshal(body, &m)
907 if err != nil {
908 return err
909 }
910 for k, v := range m {
911 switch k {
912 case "properties":
913 if v != nil {
914 var applicationPropertiesPatchable ApplicationPropertiesPatchable
915 err = json.Unmarshal(*v, &applicationPropertiesPatchable)
916 if err != nil {
917 return err
918 }
919 ap.ApplicationPropertiesPatchable = &applicationPropertiesPatchable
920 }
921 case "plan":
922 if v != nil {
923 var plan PlanPatchable
924 err = json.Unmarshal(*v, &plan)
925 if err != nil {
926 return err
927 }
928 ap.Plan = &plan
929 }
930 case "kind":
931 if v != nil {
932 var kind string
933 err = json.Unmarshal(*v, &kind)
934 if err != nil {
935 return err
936 }
937 ap.Kind = &kind
938 }
939 case "managedBy":
940 if v != nil {
941 var managedBy string
942 err = json.Unmarshal(*v, &managedBy)
943 if err != nil {
944 return err
945 }
946 ap.ManagedBy = &managedBy
947 }
948 case "sku":
949 if v != nil {
950 var sku Sku
951 err = json.Unmarshal(*v, &sku)
952 if err != nil {
953 return err
954 }
955 ap.Sku = &sku
956 }
957 case "identity":
958 if v != nil {
959 var identity Identity
960 err = json.Unmarshal(*v, &identity)
961 if err != nil {
962 return err
963 }
964 ap.Identity = &identity
965 }
966 case "id":
967 if v != nil {
968 var ID string
969 err = json.Unmarshal(*v, &ID)
970 if err != nil {
971 return err
972 }
973 ap.ID = &ID
974 }
975 case "name":
976 if v != nil {
977 var name string
978 err = json.Unmarshal(*v, &name)
979 if err != nil {
980 return err
981 }
982 ap.Name = &name
983 }
984 case "type":
985 if v != nil {
986 var typeVar string
987 err = json.Unmarshal(*v, &typeVar)
988 if err != nil {
989 return err
990 }
991 ap.Type = &typeVar
992 }
993 case "location":
994 if v != nil {
995 var location string
996 err = json.Unmarshal(*v, &location)
997 if err != nil {
998 return err
999 }
1000 ap.Location = &location
1001 }
1002 case "tags":
1003 if v != nil {
1004 var tags map[string]*string
1005 err = json.Unmarshal(*v, &tags)
1006 if err != nil {
1007 return err
1008 }
1009 ap.Tags = tags
1010 }
1011 }
1012 }
1013
1014 return nil
1015 }
1016
1017
1018 type ApplicationProperties struct {
1019
1020 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
1021
1022 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
1023
1024 Parameters interface{} `json:"parameters,omitempty"`
1025
1026 Outputs interface{} `json:"outputs,omitempty"`
1027
1028 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1029 }
1030
1031
1032 func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
1033 objectMap := make(map[string]interface{})
1034 if ap.ManagedResourceGroupID != nil {
1035 objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
1036 }
1037 if ap.ApplicationDefinitionID != nil {
1038 objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
1039 }
1040 if ap.Parameters != nil {
1041 objectMap["parameters"] = ap.Parameters
1042 }
1043 return json.Marshal(objectMap)
1044 }
1045
1046
1047 type ApplicationPropertiesPatchable struct {
1048
1049 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
1050
1051 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
1052
1053 Parameters interface{} `json:"parameters,omitempty"`
1054
1055 Outputs interface{} `json:"outputs,omitempty"`
1056
1057 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1058 }
1059
1060
1061 func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
1062 objectMap := make(map[string]interface{})
1063 if app.ManagedResourceGroupID != nil {
1064 objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
1065 }
1066 if app.ApplicationDefinitionID != nil {
1067 objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
1068 }
1069 if app.Parameters != nil {
1070 objectMap["parameters"] = app.Parameters
1071 }
1072 return json.Marshal(objectMap)
1073 }
1074
1075
1076 type ApplicationProviderAuthorization struct {
1077
1078 PrincipalID *string `json:"principalId,omitempty"`
1079
1080 RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
1081 }
1082
1083
1084
1085 type ApplicationsCreateOrUpdateByIDFuture struct {
1086 azure.FutureAPI
1087
1088
1089 Result func(ApplicationsClient) (Application, error)
1090 }
1091
1092
1093 func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
1094 var azFuture azure.Future
1095 if err := json.Unmarshal(body, &azFuture); err != nil {
1096 return err
1097 }
1098 future.FutureAPI = &azFuture
1099 future.Result = future.result
1100 return nil
1101 }
1102
1103
1104 func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
1105 var done bool
1106 done, err = future.DoneWithContext(context.Background(), client)
1107 if err != nil {
1108 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
1109 return
1110 }
1111 if !done {
1112 a.Response.Response = future.Response()
1113 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
1114 return
1115 }
1116 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1117 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1118 a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
1119 if err != nil {
1120 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
1121 }
1122 }
1123 return
1124 }
1125
1126
1127
1128 type ApplicationsCreateOrUpdateFuture struct {
1129 azure.FutureAPI
1130
1131
1132 Result func(ApplicationsClient) (Application, error)
1133 }
1134
1135
1136 func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1137 var azFuture azure.Future
1138 if err := json.Unmarshal(body, &azFuture); err != nil {
1139 return err
1140 }
1141 future.FutureAPI = &azFuture
1142 future.Result = future.result
1143 return nil
1144 }
1145
1146
1147 func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
1148 var done bool
1149 done, err = future.DoneWithContext(context.Background(), client)
1150 if err != nil {
1151 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1152 return
1153 }
1154 if !done {
1155 a.Response.Response = future.Response()
1156 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
1157 return
1158 }
1159 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1160 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1161 a, err = client.CreateOrUpdateResponder(a.Response.Response)
1162 if err != nil {
1163 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
1164 }
1165 }
1166 return
1167 }
1168
1169
1170
1171 type ApplicationsDeleteByIDFuture struct {
1172 azure.FutureAPI
1173
1174
1175 Result func(ApplicationsClient) (autorest.Response, error)
1176 }
1177
1178
1179 func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
1180 var azFuture azure.Future
1181 if err := json.Unmarshal(body, &azFuture); err != nil {
1182 return err
1183 }
1184 future.FutureAPI = &azFuture
1185 future.Result = future.result
1186 return nil
1187 }
1188
1189
1190 func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1191 var done bool
1192 done, err = future.DoneWithContext(context.Background(), client)
1193 if err != nil {
1194 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
1195 return
1196 }
1197 if !done {
1198 ar.Response = future.Response()
1199 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
1200 return
1201 }
1202 ar.Response = future.Response()
1203 return
1204 }
1205
1206
1207
1208 type ApplicationsDeleteFuture struct {
1209 azure.FutureAPI
1210
1211
1212 Result func(ApplicationsClient) (autorest.Response, error)
1213 }
1214
1215
1216 func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
1217 var azFuture azure.Future
1218 if err := json.Unmarshal(body, &azFuture); err != nil {
1219 return err
1220 }
1221 future.FutureAPI = &azFuture
1222 future.Result = future.result
1223 return nil
1224 }
1225
1226
1227 func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1228 var done bool
1229 done, err = future.DoneWithContext(context.Background(), client)
1230 if err != nil {
1231 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
1232 return
1233 }
1234 if !done {
1235 ar.Response = future.Response()
1236 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
1237 return
1238 }
1239 ar.Response = future.Response()
1240 return
1241 }
1242
1243
1244
1245 type ErrorResponse struct {
1246
1247 HTTPStatus *string `json:"httpStatus,omitempty"`
1248
1249 ErrorCode *string `json:"errorCode,omitempty"`
1250
1251 ErrorMessage *string `json:"errorMessage,omitempty"`
1252 }
1253
1254
1255 type GenericResource struct {
1256
1257 ManagedBy *string `json:"managedBy,omitempty"`
1258
1259 Sku *Sku `json:"sku,omitempty"`
1260
1261 Identity *Identity `json:"identity,omitempty"`
1262
1263 ID *string `json:"id,omitempty"`
1264
1265 Name *string `json:"name,omitempty"`
1266
1267 Type *string `json:"type,omitempty"`
1268
1269 Location *string `json:"location,omitempty"`
1270
1271 Tags map[string]*string `json:"tags"`
1272 }
1273
1274
1275 func (gr GenericResource) MarshalJSON() ([]byte, error) {
1276 objectMap := make(map[string]interface{})
1277 if gr.ManagedBy != nil {
1278 objectMap["managedBy"] = gr.ManagedBy
1279 }
1280 if gr.Sku != nil {
1281 objectMap["sku"] = gr.Sku
1282 }
1283 if gr.Identity != nil {
1284 objectMap["identity"] = gr.Identity
1285 }
1286 if gr.Location != nil {
1287 objectMap["location"] = gr.Location
1288 }
1289 if gr.Tags != nil {
1290 objectMap["tags"] = gr.Tags
1291 }
1292 return json.Marshal(objectMap)
1293 }
1294
1295
1296 type Identity struct {
1297
1298 PrincipalID *string `json:"principalId,omitempty"`
1299
1300 TenantID *string `json:"tenantId,omitempty"`
1301
1302 Type ResourceIdentityType `json:"type,omitempty"`
1303 }
1304
1305
1306 func (i Identity) MarshalJSON() ([]byte, error) {
1307 objectMap := make(map[string]interface{})
1308 if i.Type != "" {
1309 objectMap["type"] = i.Type
1310 }
1311 return json.Marshal(objectMap)
1312 }
1313
1314
1315 type Operation struct {
1316
1317 Name *string `json:"name,omitempty"`
1318
1319 Display *OperationDisplay `json:"display,omitempty"`
1320 }
1321
1322
1323 type OperationDisplay struct {
1324
1325 Provider *string `json:"provider,omitempty"`
1326
1327 Resource *string `json:"resource,omitempty"`
1328
1329 Operation *string `json:"operation,omitempty"`
1330 }
1331
1332
1333
1334 type OperationListResult struct {
1335 autorest.Response `json:"-"`
1336
1337 Value *[]Operation `json:"value,omitempty"`
1338
1339 NextLink *string `json:"nextLink,omitempty"`
1340 }
1341
1342
1343 type OperationListResultIterator struct {
1344 i int
1345 page OperationListResultPage
1346 }
1347
1348
1349
1350 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1351 if tracing.IsEnabled() {
1352 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1353 defer func() {
1354 sc := -1
1355 if iter.Response().Response.Response != nil {
1356 sc = iter.Response().Response.Response.StatusCode
1357 }
1358 tracing.EndSpan(ctx, sc, err)
1359 }()
1360 }
1361 iter.i++
1362 if iter.i < len(iter.page.Values()) {
1363 return nil
1364 }
1365 err = iter.page.NextWithContext(ctx)
1366 if err != nil {
1367 iter.i--
1368 return err
1369 }
1370 iter.i = 0
1371 return nil
1372 }
1373
1374
1375
1376
1377 func (iter *OperationListResultIterator) Next() error {
1378 return iter.NextWithContext(context.Background())
1379 }
1380
1381
1382 func (iter OperationListResultIterator) NotDone() bool {
1383 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1384 }
1385
1386
1387 func (iter OperationListResultIterator) Response() OperationListResult {
1388 return iter.page.Response()
1389 }
1390
1391
1392
1393 func (iter OperationListResultIterator) Value() Operation {
1394 if !iter.page.NotDone() {
1395 return Operation{}
1396 }
1397 return iter.page.Values()[iter.i]
1398 }
1399
1400
1401 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1402 return OperationListResultIterator{page: page}
1403 }
1404
1405
1406 func (olr OperationListResult) IsEmpty() bool {
1407 return olr.Value == nil || len(*olr.Value) == 0
1408 }
1409
1410
1411 func (olr OperationListResult) hasNextLink() bool {
1412 return olr.NextLink != nil && len(*olr.NextLink) != 0
1413 }
1414
1415
1416
1417 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1418 if !olr.hasNextLink() {
1419 return nil, nil
1420 }
1421 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1422 autorest.AsJSON(),
1423 autorest.AsGet(),
1424 autorest.WithBaseURL(to.String(olr.NextLink)))
1425 }
1426
1427
1428 type OperationListResultPage struct {
1429 fn func(context.Context, OperationListResult) (OperationListResult, error)
1430 olr OperationListResult
1431 }
1432
1433
1434
1435 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1436 if tracing.IsEnabled() {
1437 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1438 defer func() {
1439 sc := -1
1440 if page.Response().Response.Response != nil {
1441 sc = page.Response().Response.Response.StatusCode
1442 }
1443 tracing.EndSpan(ctx, sc, err)
1444 }()
1445 }
1446 for {
1447 next, err := page.fn(ctx, page.olr)
1448 if err != nil {
1449 return err
1450 }
1451 page.olr = next
1452 if !next.hasNextLink() || !next.IsEmpty() {
1453 break
1454 }
1455 }
1456 return nil
1457 }
1458
1459
1460
1461
1462 func (page *OperationListResultPage) Next() error {
1463 return page.NextWithContext(context.Background())
1464 }
1465
1466
1467 func (page OperationListResultPage) NotDone() bool {
1468 return !page.olr.IsEmpty()
1469 }
1470
1471
1472 func (page OperationListResultPage) Response() OperationListResult {
1473 return page.olr
1474 }
1475
1476
1477 func (page OperationListResultPage) Values() []Operation {
1478 if page.olr.IsEmpty() {
1479 return nil
1480 }
1481 return *page.olr.Value
1482 }
1483
1484
1485 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1486 return OperationListResultPage{
1487 fn: getNextPage,
1488 olr: cur,
1489 }
1490 }
1491
1492
1493 type Plan struct {
1494
1495 Name *string `json:"name,omitempty"`
1496
1497 Publisher *string `json:"publisher,omitempty"`
1498
1499 Product *string `json:"product,omitempty"`
1500
1501 PromotionCode *string `json:"promotionCode,omitempty"`
1502
1503 Version *string `json:"version,omitempty"`
1504 }
1505
1506
1507 type PlanPatchable struct {
1508
1509 Name *string `json:"name,omitempty"`
1510
1511 Publisher *string `json:"publisher,omitempty"`
1512
1513 Product *string `json:"product,omitempty"`
1514
1515 PromotionCode *string `json:"promotionCode,omitempty"`
1516
1517 Version *string `json:"version,omitempty"`
1518 }
1519
1520
1521 type Resource struct {
1522
1523 ID *string `json:"id,omitempty"`
1524
1525 Name *string `json:"name,omitempty"`
1526
1527 Type *string `json:"type,omitempty"`
1528
1529 Location *string `json:"location,omitempty"`
1530
1531 Tags map[string]*string `json:"tags"`
1532 }
1533
1534
1535 func (r Resource) MarshalJSON() ([]byte, error) {
1536 objectMap := make(map[string]interface{})
1537 if r.Location != nil {
1538 objectMap["location"] = r.Location
1539 }
1540 if r.Tags != nil {
1541 objectMap["tags"] = r.Tags
1542 }
1543 return json.Marshal(objectMap)
1544 }
1545
1546
1547 type Sku struct {
1548
1549 Name *string `json:"name,omitempty"`
1550
1551 Tier *string `json:"tier,omitempty"`
1552
1553 Size *string `json:"size,omitempty"`
1554
1555 Family *string `json:"family,omitempty"`
1556
1557 Model *string `json:"model,omitempty"`
1558
1559 Capacity *int32 `json:"capacity,omitempty"`
1560 }
1561
View as plain text