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/solutions/mgmt/2017-12-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 ApplicationDefinitionPatchable struct {
508
509 Tags map[string]*string `json:"tags"`
510 }
511
512
513 func (adp ApplicationDefinitionPatchable) MarshalJSON() ([]byte, error) {
514 objectMap := make(map[string]interface{})
515 if adp.Tags != nil {
516 objectMap["tags"] = adp.Tags
517 }
518 return json.Marshal(objectMap)
519 }
520
521
522 type ApplicationDefinitionProperties struct {
523
524 LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
525
526 DisplayName *string `json:"displayName,omitempty"`
527
528 IsEnabled *string `json:"isEnabled,omitempty"`
529
530 Authorizations *[]ApplicationProviderAuthorization `json:"authorizations,omitempty"`
531
532 Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
533
534 Description *string `json:"description,omitempty"`
535
536 PackageFileURI *string `json:"packageFileUri,omitempty"`
537
538 MainTemplate interface{} `json:"mainTemplate,omitempty"`
539
540 CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
541 }
542
543
544 type ApplicationListResult struct {
545 autorest.Response `json:"-"`
546
547 Value *[]Application `json:"value,omitempty"`
548
549 NextLink *string `json:"nextLink,omitempty"`
550 }
551
552
553 type ApplicationListResultIterator struct {
554 i int
555 page ApplicationListResultPage
556 }
557
558
559
560 func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
561 if tracing.IsEnabled() {
562 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
563 defer func() {
564 sc := -1
565 if iter.Response().Response.Response != nil {
566 sc = iter.Response().Response.Response.StatusCode
567 }
568 tracing.EndSpan(ctx, sc, err)
569 }()
570 }
571 iter.i++
572 if iter.i < len(iter.page.Values()) {
573 return nil
574 }
575 err = iter.page.NextWithContext(ctx)
576 if err != nil {
577 iter.i--
578 return err
579 }
580 iter.i = 0
581 return nil
582 }
583
584
585
586
587 func (iter *ApplicationListResultIterator) Next() error {
588 return iter.NextWithContext(context.Background())
589 }
590
591
592 func (iter ApplicationListResultIterator) NotDone() bool {
593 return iter.page.NotDone() && iter.i < len(iter.page.Values())
594 }
595
596
597 func (iter ApplicationListResultIterator) Response() ApplicationListResult {
598 return iter.page.Response()
599 }
600
601
602
603 func (iter ApplicationListResultIterator) Value() Application {
604 if !iter.page.NotDone() {
605 return Application{}
606 }
607 return iter.page.Values()[iter.i]
608 }
609
610
611 func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
612 return ApplicationListResultIterator{page: page}
613 }
614
615
616 func (alr ApplicationListResult) IsEmpty() bool {
617 return alr.Value == nil || len(*alr.Value) == 0
618 }
619
620
621 func (alr ApplicationListResult) hasNextLink() bool {
622 return alr.NextLink != nil && len(*alr.NextLink) != 0
623 }
624
625
626
627 func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
628 if !alr.hasNextLink() {
629 return nil, nil
630 }
631 return autorest.Prepare((&http.Request{}).WithContext(ctx),
632 autorest.AsJSON(),
633 autorest.AsGet(),
634 autorest.WithBaseURL(to.String(alr.NextLink)))
635 }
636
637
638 type ApplicationListResultPage struct {
639 fn func(context.Context, ApplicationListResult) (ApplicationListResult, error)
640 alr ApplicationListResult
641 }
642
643
644
645 func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
646 if tracing.IsEnabled() {
647 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
648 defer func() {
649 sc := -1
650 if page.Response().Response.Response != nil {
651 sc = page.Response().Response.Response.StatusCode
652 }
653 tracing.EndSpan(ctx, sc, err)
654 }()
655 }
656 for {
657 next, err := page.fn(ctx, page.alr)
658 if err != nil {
659 return err
660 }
661 page.alr = next
662 if !next.hasNextLink() || !next.IsEmpty() {
663 break
664 }
665 }
666 return nil
667 }
668
669
670
671
672 func (page *ApplicationListResultPage) Next() error {
673 return page.NextWithContext(context.Background())
674 }
675
676
677 func (page ApplicationListResultPage) NotDone() bool {
678 return !page.alr.IsEmpty()
679 }
680
681
682 func (page ApplicationListResultPage) Response() ApplicationListResult {
683 return page.alr
684 }
685
686
687 func (page ApplicationListResultPage) Values() []Application {
688 if page.alr.IsEmpty() {
689 return nil
690 }
691 return *page.alr.Value
692 }
693
694
695 func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
696 return ApplicationListResultPage{
697 fn: getNextPage,
698 alr: cur,
699 }
700 }
701
702
703 type ApplicationPatchable struct {
704 autorest.Response `json:"-"`
705
706 *ApplicationPropertiesPatchable `json:"properties,omitempty"`
707
708 Plan *PlanPatchable `json:"plan,omitempty"`
709
710 Kind *string `json:"kind,omitempty"`
711
712 ManagedBy *string `json:"managedBy,omitempty"`
713
714 Sku *Sku `json:"sku,omitempty"`
715
716 Identity *Identity `json:"identity,omitempty"`
717
718 ID *string `json:"id,omitempty"`
719
720 Name *string `json:"name,omitempty"`
721
722 Type *string `json:"type,omitempty"`
723
724 Location *string `json:"location,omitempty"`
725
726 Tags map[string]*string `json:"tags"`
727 }
728
729
730 func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
731 objectMap := make(map[string]interface{})
732 if ap.ApplicationPropertiesPatchable != nil {
733 objectMap["properties"] = ap.ApplicationPropertiesPatchable
734 }
735 if ap.Plan != nil {
736 objectMap["plan"] = ap.Plan
737 }
738 if ap.Kind != nil {
739 objectMap["kind"] = ap.Kind
740 }
741 if ap.ManagedBy != nil {
742 objectMap["managedBy"] = ap.ManagedBy
743 }
744 if ap.Sku != nil {
745 objectMap["sku"] = ap.Sku
746 }
747 if ap.Identity != nil {
748 objectMap["identity"] = ap.Identity
749 }
750 if ap.Location != nil {
751 objectMap["location"] = ap.Location
752 }
753 if ap.Tags != nil {
754 objectMap["tags"] = ap.Tags
755 }
756 return json.Marshal(objectMap)
757 }
758
759
760 func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
761 var m map[string]*json.RawMessage
762 err := json.Unmarshal(body, &m)
763 if err != nil {
764 return err
765 }
766 for k, v := range m {
767 switch k {
768 case "properties":
769 if v != nil {
770 var applicationPropertiesPatchable ApplicationPropertiesPatchable
771 err = json.Unmarshal(*v, &applicationPropertiesPatchable)
772 if err != nil {
773 return err
774 }
775 ap.ApplicationPropertiesPatchable = &applicationPropertiesPatchable
776 }
777 case "plan":
778 if v != nil {
779 var plan PlanPatchable
780 err = json.Unmarshal(*v, &plan)
781 if err != nil {
782 return err
783 }
784 ap.Plan = &plan
785 }
786 case "kind":
787 if v != nil {
788 var kind string
789 err = json.Unmarshal(*v, &kind)
790 if err != nil {
791 return err
792 }
793 ap.Kind = &kind
794 }
795 case "managedBy":
796 if v != nil {
797 var managedBy string
798 err = json.Unmarshal(*v, &managedBy)
799 if err != nil {
800 return err
801 }
802 ap.ManagedBy = &managedBy
803 }
804 case "sku":
805 if v != nil {
806 var sku Sku
807 err = json.Unmarshal(*v, &sku)
808 if err != nil {
809 return err
810 }
811 ap.Sku = &sku
812 }
813 case "identity":
814 if v != nil {
815 var identity Identity
816 err = json.Unmarshal(*v, &identity)
817 if err != nil {
818 return err
819 }
820 ap.Identity = &identity
821 }
822 case "id":
823 if v != nil {
824 var ID string
825 err = json.Unmarshal(*v, &ID)
826 if err != nil {
827 return err
828 }
829 ap.ID = &ID
830 }
831 case "name":
832 if v != nil {
833 var name string
834 err = json.Unmarshal(*v, &name)
835 if err != nil {
836 return err
837 }
838 ap.Name = &name
839 }
840 case "type":
841 if v != nil {
842 var typeVar string
843 err = json.Unmarshal(*v, &typeVar)
844 if err != nil {
845 return err
846 }
847 ap.Type = &typeVar
848 }
849 case "location":
850 if v != nil {
851 var location string
852 err = json.Unmarshal(*v, &location)
853 if err != nil {
854 return err
855 }
856 ap.Location = &location
857 }
858 case "tags":
859 if v != nil {
860 var tags map[string]*string
861 err = json.Unmarshal(*v, &tags)
862 if err != nil {
863 return err
864 }
865 ap.Tags = tags
866 }
867 }
868 }
869
870 return nil
871 }
872
873
874 type ApplicationProperties struct {
875
876 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
877
878 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
879
880 Parameters interface{} `json:"parameters,omitempty"`
881
882 Outputs interface{} `json:"outputs,omitempty"`
883
884 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
885
886 UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
887 }
888
889
890 func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
891 objectMap := make(map[string]interface{})
892 if ap.ManagedResourceGroupID != nil {
893 objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
894 }
895 if ap.ApplicationDefinitionID != nil {
896 objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
897 }
898 if ap.Parameters != nil {
899 objectMap["parameters"] = ap.Parameters
900 }
901 if ap.UIDefinitionURI != nil {
902 objectMap["uiDefinitionUri"] = ap.UIDefinitionURI
903 }
904 return json.Marshal(objectMap)
905 }
906
907
908 type ApplicationPropertiesPatchable struct {
909
910 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
911
912 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
913
914 Parameters interface{} `json:"parameters,omitempty"`
915
916 Outputs interface{} `json:"outputs,omitempty"`
917
918 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
919
920 UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
921 }
922
923
924 func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
925 objectMap := make(map[string]interface{})
926 if app.ManagedResourceGroupID != nil {
927 objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
928 }
929 if app.ApplicationDefinitionID != nil {
930 objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
931 }
932 if app.Parameters != nil {
933 objectMap["parameters"] = app.Parameters
934 }
935 if app.UIDefinitionURI != nil {
936 objectMap["uiDefinitionUri"] = app.UIDefinitionURI
937 }
938 return json.Marshal(objectMap)
939 }
940
941
942 type ApplicationProviderAuthorization struct {
943
944 PrincipalID *string `json:"principalId,omitempty"`
945
946 RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
947 }
948
949
950
951 type ApplicationsCreateOrUpdateByIDFuture struct {
952 azure.FutureAPI
953
954
955 Result func(ApplicationsClient) (Application, error)
956 }
957
958
959 func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
960 var azFuture azure.Future
961 if err := json.Unmarshal(body, &azFuture); err != nil {
962 return err
963 }
964 future.FutureAPI = &azFuture
965 future.Result = future.result
966 return nil
967 }
968
969
970 func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
971 var done bool
972 done, err = future.DoneWithContext(context.Background(), client)
973 if err != nil {
974 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
975 return
976 }
977 if !done {
978 a.Response.Response = future.Response()
979 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
980 return
981 }
982 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
983 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
984 a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
985 if err != nil {
986 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
987 }
988 }
989 return
990 }
991
992
993
994 type ApplicationsCreateOrUpdateFuture struct {
995 azure.FutureAPI
996
997
998 Result func(ApplicationsClient) (Application, error)
999 }
1000
1001
1002 func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1003 var azFuture azure.Future
1004 if err := json.Unmarshal(body, &azFuture); err != nil {
1005 return err
1006 }
1007 future.FutureAPI = &azFuture
1008 future.Result = future.result
1009 return nil
1010 }
1011
1012
1013 func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
1014 var done bool
1015 done, err = future.DoneWithContext(context.Background(), client)
1016 if err != nil {
1017 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1018 return
1019 }
1020 if !done {
1021 a.Response.Response = future.Response()
1022 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
1023 return
1024 }
1025 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1026 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1027 a, err = client.CreateOrUpdateResponder(a.Response.Response)
1028 if err != nil {
1029 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
1030 }
1031 }
1032 return
1033 }
1034
1035
1036
1037 type ApplicationsDeleteByIDFuture struct {
1038 azure.FutureAPI
1039
1040
1041 Result func(ApplicationsClient) (autorest.Response, error)
1042 }
1043
1044
1045 func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
1046 var azFuture azure.Future
1047 if err := json.Unmarshal(body, &azFuture); err != nil {
1048 return err
1049 }
1050 future.FutureAPI = &azFuture
1051 future.Result = future.result
1052 return nil
1053 }
1054
1055
1056 func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1057 var done bool
1058 done, err = future.DoneWithContext(context.Background(), client)
1059 if err != nil {
1060 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
1061 return
1062 }
1063 if !done {
1064 ar.Response = future.Response()
1065 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
1066 return
1067 }
1068 ar.Response = future.Response()
1069 return
1070 }
1071
1072
1073
1074 type ApplicationsDeleteFuture struct {
1075 azure.FutureAPI
1076
1077
1078 Result func(ApplicationsClient) (autorest.Response, error)
1079 }
1080
1081
1082 func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
1083 var azFuture azure.Future
1084 if err := json.Unmarshal(body, &azFuture); err != nil {
1085 return err
1086 }
1087 future.FutureAPI = &azFuture
1088 future.Result = future.result
1089 return nil
1090 }
1091
1092
1093 func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1094 var done bool
1095 done, err = future.DoneWithContext(context.Background(), client)
1096 if err != nil {
1097 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
1098 return
1099 }
1100 if !done {
1101 ar.Response = future.Response()
1102 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
1103 return
1104 }
1105 ar.Response = future.Response()
1106 return
1107 }
1108
1109
1110
1111 type ApplicationsUpdateByIDFuture struct {
1112 azure.FutureAPI
1113
1114
1115 Result func(ApplicationsClient) (ApplicationPatchable, error)
1116 }
1117
1118
1119 func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
1120 var azFuture azure.Future
1121 if err := json.Unmarshal(body, &azFuture); err != nil {
1122 return err
1123 }
1124 future.FutureAPI = &azFuture
1125 future.Result = future.result
1126 return nil
1127 }
1128
1129
1130 func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
1131 var done bool
1132 done, err = future.DoneWithContext(context.Background(), client)
1133 if err != nil {
1134 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
1135 return
1136 }
1137 if !done {
1138 ap.Response.Response = future.Response()
1139 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
1140 return
1141 }
1142 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1143 if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
1144 ap, err = client.UpdateByIDResponder(ap.Response.Response)
1145 if err != nil {
1146 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
1147 }
1148 }
1149 return
1150 }
1151
1152
1153
1154 type ApplicationsUpdateFuture struct {
1155 azure.FutureAPI
1156
1157
1158 Result func(ApplicationsClient) (ApplicationPatchable, error)
1159 }
1160
1161
1162 func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error {
1163 var azFuture azure.Future
1164 if err := json.Unmarshal(body, &azFuture); err != nil {
1165 return err
1166 }
1167 future.FutureAPI = &azFuture
1168 future.Result = future.result
1169 return nil
1170 }
1171
1172
1173 func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
1174 var done bool
1175 done, err = future.DoneWithContext(context.Background(), client)
1176 if err != nil {
1177 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure")
1178 return
1179 }
1180 if !done {
1181 ap.Response.Response = future.Response()
1182 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateFuture")
1183 return
1184 }
1185 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1186 if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
1187 ap, err = client.UpdateResponder(ap.Response.Response)
1188 if err != nil {
1189 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request")
1190 }
1191 }
1192 return
1193 }
1194
1195
1196 type ErrorAdditionalInfo struct {
1197
1198 Type *string `json:"type,omitempty"`
1199
1200 Info interface{} `json:"info,omitempty"`
1201 }
1202
1203
1204 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
1205 objectMap := make(map[string]interface{})
1206 return json.Marshal(objectMap)
1207 }
1208
1209
1210 type ErrorDetail struct {
1211
1212 Code *string `json:"code,omitempty"`
1213
1214 Message *string `json:"message,omitempty"`
1215
1216 Target *string `json:"target,omitempty"`
1217
1218 Details *[]ErrorDetail `json:"details,omitempty"`
1219
1220 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
1221 }
1222
1223
1224 func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
1225 objectMap := make(map[string]interface{})
1226 return json.Marshal(objectMap)
1227 }
1228
1229
1230
1231 type ErrorResponse struct {
1232
1233 Error *ErrorDetail `json:"error,omitempty"`
1234 }
1235
1236
1237 type GenericResource struct {
1238
1239 ManagedBy *string `json:"managedBy,omitempty"`
1240
1241 Sku *Sku `json:"sku,omitempty"`
1242
1243 Identity *Identity `json:"identity,omitempty"`
1244
1245 ID *string `json:"id,omitempty"`
1246
1247 Name *string `json:"name,omitempty"`
1248
1249 Type *string `json:"type,omitempty"`
1250
1251 Location *string `json:"location,omitempty"`
1252
1253 Tags map[string]*string `json:"tags"`
1254 }
1255
1256
1257 func (gr GenericResource) MarshalJSON() ([]byte, error) {
1258 objectMap := make(map[string]interface{})
1259 if gr.ManagedBy != nil {
1260 objectMap["managedBy"] = gr.ManagedBy
1261 }
1262 if gr.Sku != nil {
1263 objectMap["sku"] = gr.Sku
1264 }
1265 if gr.Identity != nil {
1266 objectMap["identity"] = gr.Identity
1267 }
1268 if gr.Location != nil {
1269 objectMap["location"] = gr.Location
1270 }
1271 if gr.Tags != nil {
1272 objectMap["tags"] = gr.Tags
1273 }
1274 return json.Marshal(objectMap)
1275 }
1276
1277
1278 type Identity struct {
1279
1280 PrincipalID *string `json:"principalId,omitempty"`
1281
1282 TenantID *string `json:"tenantId,omitempty"`
1283
1284 Type ResourceIdentityType `json:"type,omitempty"`
1285 }
1286
1287
1288 func (i Identity) MarshalJSON() ([]byte, error) {
1289 objectMap := make(map[string]interface{})
1290 if i.Type != "" {
1291 objectMap["type"] = i.Type
1292 }
1293 return json.Marshal(objectMap)
1294 }
1295
1296
1297 type Operation struct {
1298
1299 Name *string `json:"name,omitempty"`
1300
1301 IsDataAction *bool `json:"isDataAction,omitempty"`
1302
1303 Display *OperationDisplay `json:"display,omitempty"`
1304
1305 Origin Origin `json:"origin,omitempty"`
1306
1307 ActionType ActionType `json:"actionType,omitempty"`
1308 }
1309
1310
1311 func (o Operation) MarshalJSON() ([]byte, error) {
1312 objectMap := make(map[string]interface{})
1313 if o.Display != nil {
1314 objectMap["display"] = o.Display
1315 }
1316 return json.Marshal(objectMap)
1317 }
1318
1319
1320 type OperationDisplay struct {
1321
1322 Provider *string `json:"provider,omitempty"`
1323
1324 Resource *string `json:"resource,omitempty"`
1325
1326 Operation *string `json:"operation,omitempty"`
1327
1328 Description *string `json:"description,omitempty"`
1329 }
1330
1331
1332 func (o OperationDisplay) MarshalJSON() ([]byte, error) {
1333 objectMap := make(map[string]interface{})
1334 return json.Marshal(objectMap)
1335 }
1336
1337
1338
1339 type OperationListResult struct {
1340 autorest.Response `json:"-"`
1341
1342 Value *[]Operation `json:"value,omitempty"`
1343
1344 NextLink *string `json:"nextLink,omitempty"`
1345 }
1346
1347
1348 func (olr OperationListResult) MarshalJSON() ([]byte, error) {
1349 objectMap := make(map[string]interface{})
1350 return json.Marshal(objectMap)
1351 }
1352
1353
1354 type OperationListResultIterator struct {
1355 i int
1356 page OperationListResultPage
1357 }
1358
1359
1360
1361 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1362 if tracing.IsEnabled() {
1363 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1364 defer func() {
1365 sc := -1
1366 if iter.Response().Response.Response != nil {
1367 sc = iter.Response().Response.Response.StatusCode
1368 }
1369 tracing.EndSpan(ctx, sc, err)
1370 }()
1371 }
1372 iter.i++
1373 if iter.i < len(iter.page.Values()) {
1374 return nil
1375 }
1376 err = iter.page.NextWithContext(ctx)
1377 if err != nil {
1378 iter.i--
1379 return err
1380 }
1381 iter.i = 0
1382 return nil
1383 }
1384
1385
1386
1387
1388 func (iter *OperationListResultIterator) Next() error {
1389 return iter.NextWithContext(context.Background())
1390 }
1391
1392
1393 func (iter OperationListResultIterator) NotDone() bool {
1394 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1395 }
1396
1397
1398 func (iter OperationListResultIterator) Response() OperationListResult {
1399 return iter.page.Response()
1400 }
1401
1402
1403
1404 func (iter OperationListResultIterator) Value() Operation {
1405 if !iter.page.NotDone() {
1406 return Operation{}
1407 }
1408 return iter.page.Values()[iter.i]
1409 }
1410
1411
1412 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1413 return OperationListResultIterator{page: page}
1414 }
1415
1416
1417 func (olr OperationListResult) IsEmpty() bool {
1418 return olr.Value == nil || len(*olr.Value) == 0
1419 }
1420
1421
1422 func (olr OperationListResult) hasNextLink() bool {
1423 return olr.NextLink != nil && len(*olr.NextLink) != 0
1424 }
1425
1426
1427
1428 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1429 if !olr.hasNextLink() {
1430 return nil, nil
1431 }
1432 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1433 autorest.AsJSON(),
1434 autorest.AsGet(),
1435 autorest.WithBaseURL(to.String(olr.NextLink)))
1436 }
1437
1438
1439 type OperationListResultPage struct {
1440 fn func(context.Context, OperationListResult) (OperationListResult, error)
1441 olr OperationListResult
1442 }
1443
1444
1445
1446 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1447 if tracing.IsEnabled() {
1448 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1449 defer func() {
1450 sc := -1
1451 if page.Response().Response.Response != nil {
1452 sc = page.Response().Response.Response.StatusCode
1453 }
1454 tracing.EndSpan(ctx, sc, err)
1455 }()
1456 }
1457 for {
1458 next, err := page.fn(ctx, page.olr)
1459 if err != nil {
1460 return err
1461 }
1462 page.olr = next
1463 if !next.hasNextLink() || !next.IsEmpty() {
1464 break
1465 }
1466 }
1467 return nil
1468 }
1469
1470
1471
1472
1473 func (page *OperationListResultPage) Next() error {
1474 return page.NextWithContext(context.Background())
1475 }
1476
1477
1478 func (page OperationListResultPage) NotDone() bool {
1479 return !page.olr.IsEmpty()
1480 }
1481
1482
1483 func (page OperationListResultPage) Response() OperationListResult {
1484 return page.olr
1485 }
1486
1487
1488 func (page OperationListResultPage) Values() []Operation {
1489 if page.olr.IsEmpty() {
1490 return nil
1491 }
1492 return *page.olr.Value
1493 }
1494
1495
1496 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1497 return OperationListResultPage{
1498 fn: getNextPage,
1499 olr: cur,
1500 }
1501 }
1502
1503
1504 type Plan struct {
1505
1506 Name *string `json:"name,omitempty"`
1507
1508 Publisher *string `json:"publisher,omitempty"`
1509
1510 Product *string `json:"product,omitempty"`
1511
1512 PromotionCode *string `json:"promotionCode,omitempty"`
1513
1514 Version *string `json:"version,omitempty"`
1515 }
1516
1517
1518 type PlanPatchable struct {
1519
1520 Name *string `json:"name,omitempty"`
1521
1522 Publisher *string `json:"publisher,omitempty"`
1523
1524 Product *string `json:"product,omitempty"`
1525
1526 PromotionCode *string `json:"promotionCode,omitempty"`
1527
1528 Version *string `json:"version,omitempty"`
1529 }
1530
1531
1532 type Resource struct {
1533
1534 ID *string `json:"id,omitempty"`
1535
1536 Name *string `json:"name,omitempty"`
1537
1538 Type *string `json:"type,omitempty"`
1539
1540 Location *string `json:"location,omitempty"`
1541
1542 Tags map[string]*string `json:"tags"`
1543 }
1544
1545
1546 func (r Resource) MarshalJSON() ([]byte, error) {
1547 objectMap := make(map[string]interface{})
1548 if r.Location != nil {
1549 objectMap["location"] = r.Location
1550 }
1551 if r.Tags != nil {
1552 objectMap["tags"] = r.Tags
1553 }
1554 return json.Marshal(objectMap)
1555 }
1556
1557
1558 type Sku struct {
1559
1560 Name *string `json:"name,omitempty"`
1561
1562 Tier *string `json:"tier,omitempty"`
1563
1564 Size *string `json:"size,omitempty"`
1565
1566 Family *string `json:"family,omitempty"`
1567
1568 Model *string `json:"model,omitempty"`
1569
1570 Capacity *int32 `json:"capacity,omitempty"`
1571 }
1572
View as plain text