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/2017-09-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 UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
1031 }
1032
1033
1034 func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
1035 objectMap := make(map[string]interface{})
1036 if ap.ManagedResourceGroupID != nil {
1037 objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
1038 }
1039 if ap.ApplicationDefinitionID != nil {
1040 objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
1041 }
1042 if ap.Parameters != nil {
1043 objectMap["parameters"] = ap.Parameters
1044 }
1045 if ap.UIDefinitionURI != nil {
1046 objectMap["uiDefinitionUri"] = ap.UIDefinitionURI
1047 }
1048 return json.Marshal(objectMap)
1049 }
1050
1051
1052 type ApplicationPropertiesPatchable struct {
1053
1054 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
1055
1056 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
1057
1058 Parameters interface{} `json:"parameters,omitempty"`
1059
1060 Outputs interface{} `json:"outputs,omitempty"`
1061
1062 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1063
1064 UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
1065 }
1066
1067
1068 func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
1069 objectMap := make(map[string]interface{})
1070 if app.ManagedResourceGroupID != nil {
1071 objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
1072 }
1073 if app.ApplicationDefinitionID != nil {
1074 objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
1075 }
1076 if app.Parameters != nil {
1077 objectMap["parameters"] = app.Parameters
1078 }
1079 if app.UIDefinitionURI != nil {
1080 objectMap["uiDefinitionUri"] = app.UIDefinitionURI
1081 }
1082 return json.Marshal(objectMap)
1083 }
1084
1085
1086 type ApplicationProviderAuthorization struct {
1087
1088 PrincipalID *string `json:"principalId,omitempty"`
1089
1090 RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
1091 }
1092
1093
1094
1095 type ApplicationsCreateOrUpdateByIDFuture struct {
1096 azure.FutureAPI
1097
1098
1099 Result func(ApplicationsClient) (Application, error)
1100 }
1101
1102
1103 func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
1104 var azFuture azure.Future
1105 if err := json.Unmarshal(body, &azFuture); err != nil {
1106 return err
1107 }
1108 future.FutureAPI = &azFuture
1109 future.Result = future.result
1110 return nil
1111 }
1112
1113
1114 func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
1115 var done bool
1116 done, err = future.DoneWithContext(context.Background(), client)
1117 if err != nil {
1118 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
1119 return
1120 }
1121 if !done {
1122 a.Response.Response = future.Response()
1123 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
1124 return
1125 }
1126 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1127 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1128 a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
1129 if err != nil {
1130 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
1131 }
1132 }
1133 return
1134 }
1135
1136
1137
1138 type ApplicationsCreateOrUpdateFuture struct {
1139 azure.FutureAPI
1140
1141
1142 Result func(ApplicationsClient) (Application, error)
1143 }
1144
1145
1146 func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1147 var azFuture azure.Future
1148 if err := json.Unmarshal(body, &azFuture); err != nil {
1149 return err
1150 }
1151 future.FutureAPI = &azFuture
1152 future.Result = future.result
1153 return nil
1154 }
1155
1156
1157 func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
1158 var done bool
1159 done, err = future.DoneWithContext(context.Background(), client)
1160 if err != nil {
1161 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1162 return
1163 }
1164 if !done {
1165 a.Response.Response = future.Response()
1166 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
1167 return
1168 }
1169 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1170 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1171 a, err = client.CreateOrUpdateResponder(a.Response.Response)
1172 if err != nil {
1173 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
1174 }
1175 }
1176 return
1177 }
1178
1179
1180
1181 type ApplicationsDeleteByIDFuture struct {
1182 azure.FutureAPI
1183
1184
1185 Result func(ApplicationsClient) (autorest.Response, error)
1186 }
1187
1188
1189 func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
1190 var azFuture azure.Future
1191 if err := json.Unmarshal(body, &azFuture); err != nil {
1192 return err
1193 }
1194 future.FutureAPI = &azFuture
1195 future.Result = future.result
1196 return nil
1197 }
1198
1199
1200 func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1201 var done bool
1202 done, err = future.DoneWithContext(context.Background(), client)
1203 if err != nil {
1204 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
1205 return
1206 }
1207 if !done {
1208 ar.Response = future.Response()
1209 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
1210 return
1211 }
1212 ar.Response = future.Response()
1213 return
1214 }
1215
1216
1217
1218 type ApplicationsDeleteFuture struct {
1219 azure.FutureAPI
1220
1221
1222 Result func(ApplicationsClient) (autorest.Response, error)
1223 }
1224
1225
1226 func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
1227 var azFuture azure.Future
1228 if err := json.Unmarshal(body, &azFuture); err != nil {
1229 return err
1230 }
1231 future.FutureAPI = &azFuture
1232 future.Result = future.result
1233 return nil
1234 }
1235
1236
1237 func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1238 var done bool
1239 done, err = future.DoneWithContext(context.Background(), client)
1240 if err != nil {
1241 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
1242 return
1243 }
1244 if !done {
1245 ar.Response = future.Response()
1246 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
1247 return
1248 }
1249 ar.Response = future.Response()
1250 return
1251 }
1252
1253
1254
1255 type ErrorResponse struct {
1256
1257 HTTPStatus *string `json:"httpStatus,omitempty"`
1258
1259 ErrorCode *string `json:"errorCode,omitempty"`
1260
1261 ErrorMessage *string `json:"errorMessage,omitempty"`
1262 }
1263
1264
1265 type GenericResource struct {
1266
1267 ManagedBy *string `json:"managedBy,omitempty"`
1268
1269 Sku *Sku `json:"sku,omitempty"`
1270
1271 Identity *Identity `json:"identity,omitempty"`
1272
1273 ID *string `json:"id,omitempty"`
1274
1275 Name *string `json:"name,omitempty"`
1276
1277 Type *string `json:"type,omitempty"`
1278
1279 Location *string `json:"location,omitempty"`
1280
1281 Tags map[string]*string `json:"tags"`
1282 }
1283
1284
1285 func (gr GenericResource) MarshalJSON() ([]byte, error) {
1286 objectMap := make(map[string]interface{})
1287 if gr.ManagedBy != nil {
1288 objectMap["managedBy"] = gr.ManagedBy
1289 }
1290 if gr.Sku != nil {
1291 objectMap["sku"] = gr.Sku
1292 }
1293 if gr.Identity != nil {
1294 objectMap["identity"] = gr.Identity
1295 }
1296 if gr.Location != nil {
1297 objectMap["location"] = gr.Location
1298 }
1299 if gr.Tags != nil {
1300 objectMap["tags"] = gr.Tags
1301 }
1302 return json.Marshal(objectMap)
1303 }
1304
1305
1306 type Identity struct {
1307
1308 PrincipalID *string `json:"principalId,omitempty"`
1309
1310 TenantID *string `json:"tenantId,omitempty"`
1311
1312 Type ResourceIdentityType `json:"type,omitempty"`
1313 }
1314
1315
1316 func (i Identity) MarshalJSON() ([]byte, error) {
1317 objectMap := make(map[string]interface{})
1318 if i.Type != "" {
1319 objectMap["type"] = i.Type
1320 }
1321 return json.Marshal(objectMap)
1322 }
1323
1324
1325 type Plan struct {
1326
1327 Name *string `json:"name,omitempty"`
1328
1329 Publisher *string `json:"publisher,omitempty"`
1330
1331 Product *string `json:"product,omitempty"`
1332
1333 PromotionCode *string `json:"promotionCode,omitempty"`
1334
1335 Version *string `json:"version,omitempty"`
1336 }
1337
1338
1339 type PlanPatchable struct {
1340
1341 Name *string `json:"name,omitempty"`
1342
1343 Publisher *string `json:"publisher,omitempty"`
1344
1345 Product *string `json:"product,omitempty"`
1346
1347 PromotionCode *string `json:"promotionCode,omitempty"`
1348
1349 Version *string `json:"version,omitempty"`
1350 }
1351
1352
1353 type Resource struct {
1354
1355 ID *string `json:"id,omitempty"`
1356
1357 Name *string `json:"name,omitempty"`
1358
1359 Type *string `json:"type,omitempty"`
1360
1361 Location *string `json:"location,omitempty"`
1362
1363 Tags map[string]*string `json:"tags"`
1364 }
1365
1366
1367 func (r Resource) MarshalJSON() ([]byte, error) {
1368 objectMap := make(map[string]interface{})
1369 if r.Location != nil {
1370 objectMap["location"] = r.Location
1371 }
1372 if r.Tags != nil {
1373 objectMap["tags"] = r.Tags
1374 }
1375 return json.Marshal(objectMap)
1376 }
1377
1378
1379 type Sku struct {
1380
1381 Name *string `json:"name,omitempty"`
1382
1383 Tier *string `json:"tier,omitempty"`
1384
1385 Size *string `json:"size,omitempty"`
1386
1387 Family *string `json:"family,omitempty"`
1388
1389 Model *string `json:"model,omitempty"`
1390
1391 Capacity *int32 `json:"capacity,omitempty"`
1392 }
1393
View as plain text