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/date"
15 "github.com/Azure/go-autorest/autorest/to"
16 "github.com/Azure/go-autorest/tracing"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/solutions/mgmt/2020-08-21-preview/managedapplications"
22
23
24 type AllowedUpgradePlansResult struct {
25 autorest.Response `json:"-"`
26
27 Value *[]Plan `json:"value,omitempty"`
28 }
29
30
31 type Application struct {
32 autorest.Response `json:"-"`
33
34 *ApplicationProperties `json:"properties,omitempty"`
35
36 Plan *Plan `json:"plan,omitempty"`
37
38 Kind *string `json:"kind,omitempty"`
39
40 Identity *Identity `json:"identity,omitempty"`
41
42 ManagedBy *string `json:"managedBy,omitempty"`
43
44 Sku *Sku `json:"sku,omitempty"`
45
46 ID *string `json:"id,omitempty"`
47
48 Name *string `json:"name,omitempty"`
49
50 Type *string `json:"type,omitempty"`
51
52 Location *string `json:"location,omitempty"`
53
54 Tags map[string]*string `json:"tags"`
55 }
56
57
58 func (a Application) MarshalJSON() ([]byte, error) {
59 objectMap := make(map[string]interface{})
60 if a.ApplicationProperties != nil {
61 objectMap["properties"] = a.ApplicationProperties
62 }
63 if a.Plan != nil {
64 objectMap["plan"] = a.Plan
65 }
66 if a.Kind != nil {
67 objectMap["kind"] = a.Kind
68 }
69 if a.Identity != nil {
70 objectMap["identity"] = a.Identity
71 }
72 if a.ManagedBy != nil {
73 objectMap["managedBy"] = a.ManagedBy
74 }
75 if a.Sku != nil {
76 objectMap["sku"] = a.Sku
77 }
78 if a.Location != nil {
79 objectMap["location"] = a.Location
80 }
81 if a.Tags != nil {
82 objectMap["tags"] = a.Tags
83 }
84 return json.Marshal(objectMap)
85 }
86
87
88 func (a *Application) UnmarshalJSON(body []byte) error {
89 var m map[string]*json.RawMessage
90 err := json.Unmarshal(body, &m)
91 if err != nil {
92 return err
93 }
94 for k, v := range m {
95 switch k {
96 case "properties":
97 if v != nil {
98 var applicationProperties ApplicationProperties
99 err = json.Unmarshal(*v, &applicationProperties)
100 if err != nil {
101 return err
102 }
103 a.ApplicationProperties = &applicationProperties
104 }
105 case "plan":
106 if v != nil {
107 var plan Plan
108 err = json.Unmarshal(*v, &plan)
109 if err != nil {
110 return err
111 }
112 a.Plan = &plan
113 }
114 case "kind":
115 if v != nil {
116 var kind string
117 err = json.Unmarshal(*v, &kind)
118 if err != nil {
119 return err
120 }
121 a.Kind = &kind
122 }
123 case "identity":
124 if v != nil {
125 var identity Identity
126 err = json.Unmarshal(*v, &identity)
127 if err != nil {
128 return err
129 }
130 a.Identity = &identity
131 }
132 case "managedBy":
133 if v != nil {
134 var managedBy string
135 err = json.Unmarshal(*v, &managedBy)
136 if err != nil {
137 return err
138 }
139 a.ManagedBy = &managedBy
140 }
141 case "sku":
142 if v != nil {
143 var sku Sku
144 err = json.Unmarshal(*v, &sku)
145 if err != nil {
146 return err
147 }
148 a.Sku = &sku
149 }
150 case "id":
151 if v != nil {
152 var ID string
153 err = json.Unmarshal(*v, &ID)
154 if err != nil {
155 return err
156 }
157 a.ID = &ID
158 }
159 case "name":
160 if v != nil {
161 var name string
162 err = json.Unmarshal(*v, &name)
163 if err != nil {
164 return err
165 }
166 a.Name = &name
167 }
168 case "type":
169 if v != nil {
170 var typeVar string
171 err = json.Unmarshal(*v, &typeVar)
172 if err != nil {
173 return err
174 }
175 a.Type = &typeVar
176 }
177 case "location":
178 if v != nil {
179 var location string
180 err = json.Unmarshal(*v, &location)
181 if err != nil {
182 return err
183 }
184 a.Location = &location
185 }
186 case "tags":
187 if v != nil {
188 var tags map[string]*string
189 err = json.Unmarshal(*v, &tags)
190 if err != nil {
191 return err
192 }
193 a.Tags = tags
194 }
195 }
196 }
197
198 return nil
199 }
200
201
202 type ApplicationArtifact struct {
203
204 Name ApplicationArtifactName `json:"name,omitempty"`
205
206 URI *string `json:"uri,omitempty"`
207
208 Type ApplicationArtifactType `json:"type,omitempty"`
209 }
210
211
212 type ApplicationAuthorization struct {
213
214 PrincipalID *string `json:"principalId,omitempty"`
215
216 RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
217 }
218
219
220 type ApplicationBillingDetailsDefinition struct {
221
222 ResourceUsageID *string `json:"resourceUsageId,omitempty"`
223 }
224
225
226
227 type ApplicationClientDetails struct {
228
229 Oid *string `json:"oid,omitempty"`
230
231 Puid *string `json:"puid,omitempty"`
232
233 ApplicationID *string `json:"applicationId,omitempty"`
234 }
235
236
237 type ApplicationDefinition struct {
238 autorest.Response `json:"-"`
239
240 *ApplicationDefinitionProperties `json:"properties,omitempty"`
241
242 ManagedBy *string `json:"managedBy,omitempty"`
243
244 Sku *Sku `json:"sku,omitempty"`
245
246 ID *string `json:"id,omitempty"`
247
248 Name *string `json:"name,omitempty"`
249
250 Type *string `json:"type,omitempty"`
251
252 Location *string `json:"location,omitempty"`
253
254 Tags map[string]*string `json:"tags"`
255 }
256
257
258 func (ad ApplicationDefinition) MarshalJSON() ([]byte, error) {
259 objectMap := make(map[string]interface{})
260 if ad.ApplicationDefinitionProperties != nil {
261 objectMap["properties"] = ad.ApplicationDefinitionProperties
262 }
263 if ad.ManagedBy != nil {
264 objectMap["managedBy"] = ad.ManagedBy
265 }
266 if ad.Sku != nil {
267 objectMap["sku"] = ad.Sku
268 }
269 if ad.Location != nil {
270 objectMap["location"] = ad.Location
271 }
272 if ad.Tags != nil {
273 objectMap["tags"] = ad.Tags
274 }
275 return json.Marshal(objectMap)
276 }
277
278
279 func (ad *ApplicationDefinition) UnmarshalJSON(body []byte) error {
280 var m map[string]*json.RawMessage
281 err := json.Unmarshal(body, &m)
282 if err != nil {
283 return err
284 }
285 for k, v := range m {
286 switch k {
287 case "properties":
288 if v != nil {
289 var applicationDefinitionProperties ApplicationDefinitionProperties
290 err = json.Unmarshal(*v, &applicationDefinitionProperties)
291 if err != nil {
292 return err
293 }
294 ad.ApplicationDefinitionProperties = &applicationDefinitionProperties
295 }
296 case "managedBy":
297 if v != nil {
298 var managedBy string
299 err = json.Unmarshal(*v, &managedBy)
300 if err != nil {
301 return err
302 }
303 ad.ManagedBy = &managedBy
304 }
305 case "sku":
306 if v != nil {
307 var sku Sku
308 err = json.Unmarshal(*v, &sku)
309 if err != nil {
310 return err
311 }
312 ad.Sku = &sku
313 }
314 case "id":
315 if v != nil {
316 var ID string
317 err = json.Unmarshal(*v, &ID)
318 if err != nil {
319 return err
320 }
321 ad.ID = &ID
322 }
323 case "name":
324 if v != nil {
325 var name string
326 err = json.Unmarshal(*v, &name)
327 if err != nil {
328 return err
329 }
330 ad.Name = &name
331 }
332 case "type":
333 if v != nil {
334 var typeVar string
335 err = json.Unmarshal(*v, &typeVar)
336 if err != nil {
337 return err
338 }
339 ad.Type = &typeVar
340 }
341 case "location":
342 if v != nil {
343 var location string
344 err = json.Unmarshal(*v, &location)
345 if err != nil {
346 return err
347 }
348 ad.Location = &location
349 }
350 case "tags":
351 if v != nil {
352 var tags map[string]*string
353 err = json.Unmarshal(*v, &tags)
354 if err != nil {
355 return err
356 }
357 ad.Tags = tags
358 }
359 }
360 }
361
362 return nil
363 }
364
365
366 type ApplicationDefinitionArtifact struct {
367
368 Name ApplicationDefinitionArtifactName `json:"name,omitempty"`
369
370 URI *string `json:"uri,omitempty"`
371
372 Type ApplicationArtifactType `json:"type,omitempty"`
373 }
374
375
376 type ApplicationDefinitionListResult struct {
377 autorest.Response `json:"-"`
378
379 Value *[]ApplicationDefinition `json:"value,omitempty"`
380
381 NextLink *string `json:"nextLink,omitempty"`
382 }
383
384
385
386 type ApplicationDefinitionListResultIterator struct {
387 i int
388 page ApplicationDefinitionListResultPage
389 }
390
391
392
393 func (iter *ApplicationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
394 if tracing.IsEnabled() {
395 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultIterator.NextWithContext")
396 defer func() {
397 sc := -1
398 if iter.Response().Response.Response != nil {
399 sc = iter.Response().Response.Response.StatusCode
400 }
401 tracing.EndSpan(ctx, sc, err)
402 }()
403 }
404 iter.i++
405 if iter.i < len(iter.page.Values()) {
406 return nil
407 }
408 err = iter.page.NextWithContext(ctx)
409 if err != nil {
410 iter.i--
411 return err
412 }
413 iter.i = 0
414 return nil
415 }
416
417
418
419
420 func (iter *ApplicationDefinitionListResultIterator) Next() error {
421 return iter.NextWithContext(context.Background())
422 }
423
424
425 func (iter ApplicationDefinitionListResultIterator) NotDone() bool {
426 return iter.page.NotDone() && iter.i < len(iter.page.Values())
427 }
428
429
430 func (iter ApplicationDefinitionListResultIterator) Response() ApplicationDefinitionListResult {
431 return iter.page.Response()
432 }
433
434
435
436 func (iter ApplicationDefinitionListResultIterator) Value() ApplicationDefinition {
437 if !iter.page.NotDone() {
438 return ApplicationDefinition{}
439 }
440 return iter.page.Values()[iter.i]
441 }
442
443
444 func NewApplicationDefinitionListResultIterator(page ApplicationDefinitionListResultPage) ApplicationDefinitionListResultIterator {
445 return ApplicationDefinitionListResultIterator{page: page}
446 }
447
448
449 func (adlr ApplicationDefinitionListResult) IsEmpty() bool {
450 return adlr.Value == nil || len(*adlr.Value) == 0
451 }
452
453
454 func (adlr ApplicationDefinitionListResult) hasNextLink() bool {
455 return adlr.NextLink != nil && len(*adlr.NextLink) != 0
456 }
457
458
459
460 func (adlr ApplicationDefinitionListResult) applicationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
461 if !adlr.hasNextLink() {
462 return nil, nil
463 }
464 return autorest.Prepare((&http.Request{}).WithContext(ctx),
465 autorest.AsJSON(),
466 autorest.AsGet(),
467 autorest.WithBaseURL(to.String(adlr.NextLink)))
468 }
469
470
471 type ApplicationDefinitionListResultPage struct {
472 fn func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)
473 adlr ApplicationDefinitionListResult
474 }
475
476
477
478 func (page *ApplicationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
479 if tracing.IsEnabled() {
480 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionListResultPage.NextWithContext")
481 defer func() {
482 sc := -1
483 if page.Response().Response.Response != nil {
484 sc = page.Response().Response.Response.StatusCode
485 }
486 tracing.EndSpan(ctx, sc, err)
487 }()
488 }
489 for {
490 next, err := page.fn(ctx, page.adlr)
491 if err != nil {
492 return err
493 }
494 page.adlr = next
495 if !next.hasNextLink() || !next.IsEmpty() {
496 break
497 }
498 }
499 return nil
500 }
501
502
503
504
505 func (page *ApplicationDefinitionListResultPage) Next() error {
506 return page.NextWithContext(context.Background())
507 }
508
509
510 func (page ApplicationDefinitionListResultPage) NotDone() bool {
511 return !page.adlr.IsEmpty()
512 }
513
514
515 func (page ApplicationDefinitionListResultPage) Response() ApplicationDefinitionListResult {
516 return page.adlr
517 }
518
519
520 func (page ApplicationDefinitionListResultPage) Values() []ApplicationDefinition {
521 if page.adlr.IsEmpty() {
522 return nil
523 }
524 return *page.adlr.Value
525 }
526
527
528 func NewApplicationDefinitionListResultPage(cur ApplicationDefinitionListResult, getNextPage func(context.Context, ApplicationDefinitionListResult) (ApplicationDefinitionListResult, error)) ApplicationDefinitionListResultPage {
529 return ApplicationDefinitionListResultPage{
530 fn: getNextPage,
531 adlr: cur,
532 }
533 }
534
535
536 type ApplicationDefinitionPatchable struct {
537
538 Tags map[string]*string `json:"tags"`
539 }
540
541
542 func (adp ApplicationDefinitionPatchable) MarshalJSON() ([]byte, error) {
543 objectMap := make(map[string]interface{})
544 if adp.Tags != nil {
545 objectMap["tags"] = adp.Tags
546 }
547 return json.Marshal(objectMap)
548 }
549
550
551 type ApplicationDefinitionProperties struct {
552
553 LockLevel ApplicationLockLevel `json:"lockLevel,omitempty"`
554
555 DisplayName *string `json:"displayName,omitempty"`
556
557 IsEnabled *bool `json:"isEnabled,omitempty"`
558
559 Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
560
561 Artifacts *[]ApplicationDefinitionArtifact `json:"artifacts,omitempty"`
562
563 Description *string `json:"description,omitempty"`
564
565 PackageFileURI *string `json:"packageFileUri,omitempty"`
566
567 StorageAccountID *string `json:"storageAccountId,omitempty"`
568
569 MainTemplate interface{} `json:"mainTemplate,omitempty"`
570
571 CreateUIDefinition interface{} `json:"createUiDefinition,omitempty"`
572
573 NotificationPolicy *ApplicationNotificationPolicy `json:"notificationPolicy,omitempty"`
574
575 LockingPolicy *ApplicationPackageLockingPolicyDefinition `json:"lockingPolicy,omitempty"`
576
577 DeploymentPolicy *ApplicationDeploymentPolicy `json:"deploymentPolicy,omitempty"`
578
579 ManagementPolicy *ApplicationManagementPolicy `json:"managementPolicy,omitempty"`
580
581 Policies *[]ApplicationPolicy `json:"policies,omitempty"`
582 }
583
584
585 type ApplicationDeploymentPolicy struct {
586
587 DeploymentMode DeploymentMode `json:"deploymentMode,omitempty"`
588 }
589
590
591 type ApplicationJitAccessPolicy struct {
592
593 JitAccessEnabled *bool `json:"jitAccessEnabled,omitempty"`
594
595 JitApprovalMode JitApprovalMode `json:"jitApprovalMode,omitempty"`
596
597 JitApprovers *[]JitApproverDefinition `json:"jitApprovers,omitempty"`
598
599 MaximumJitAccessDuration *string `json:"maximumJitAccessDuration,omitempty"`
600 }
601
602
603 type ApplicationListResult struct {
604 autorest.Response `json:"-"`
605
606 Value *[]Application `json:"value,omitempty"`
607
608 NextLink *string `json:"nextLink,omitempty"`
609 }
610
611
612 type ApplicationListResultIterator struct {
613 i int
614 page ApplicationListResultPage
615 }
616
617
618
619 func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) {
620 if tracing.IsEnabled() {
621 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext")
622 defer func() {
623 sc := -1
624 if iter.Response().Response.Response != nil {
625 sc = iter.Response().Response.Response.StatusCode
626 }
627 tracing.EndSpan(ctx, sc, err)
628 }()
629 }
630 iter.i++
631 if iter.i < len(iter.page.Values()) {
632 return nil
633 }
634 err = iter.page.NextWithContext(ctx)
635 if err != nil {
636 iter.i--
637 return err
638 }
639 iter.i = 0
640 return nil
641 }
642
643
644
645
646 func (iter *ApplicationListResultIterator) Next() error {
647 return iter.NextWithContext(context.Background())
648 }
649
650
651 func (iter ApplicationListResultIterator) NotDone() bool {
652 return iter.page.NotDone() && iter.i < len(iter.page.Values())
653 }
654
655
656 func (iter ApplicationListResultIterator) Response() ApplicationListResult {
657 return iter.page.Response()
658 }
659
660
661
662 func (iter ApplicationListResultIterator) Value() Application {
663 if !iter.page.NotDone() {
664 return Application{}
665 }
666 return iter.page.Values()[iter.i]
667 }
668
669
670 func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator {
671 return ApplicationListResultIterator{page: page}
672 }
673
674
675 func (alr ApplicationListResult) IsEmpty() bool {
676 return alr.Value == nil || len(*alr.Value) == 0
677 }
678
679
680 func (alr ApplicationListResult) hasNextLink() bool {
681 return alr.NextLink != nil && len(*alr.NextLink) != 0
682 }
683
684
685
686 func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) {
687 if !alr.hasNextLink() {
688 return nil, nil
689 }
690 return autorest.Prepare((&http.Request{}).WithContext(ctx),
691 autorest.AsJSON(),
692 autorest.AsGet(),
693 autorest.WithBaseURL(to.String(alr.NextLink)))
694 }
695
696
697 type ApplicationListResultPage struct {
698 fn func(context.Context, ApplicationListResult) (ApplicationListResult, error)
699 alr ApplicationListResult
700 }
701
702
703
704 func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) {
705 if tracing.IsEnabled() {
706 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext")
707 defer func() {
708 sc := -1
709 if page.Response().Response.Response != nil {
710 sc = page.Response().Response.Response.StatusCode
711 }
712 tracing.EndSpan(ctx, sc, err)
713 }()
714 }
715 for {
716 next, err := page.fn(ctx, page.alr)
717 if err != nil {
718 return err
719 }
720 page.alr = next
721 if !next.hasNextLink() || !next.IsEmpty() {
722 break
723 }
724 }
725 return nil
726 }
727
728
729
730
731 func (page *ApplicationListResultPage) Next() error {
732 return page.NextWithContext(context.Background())
733 }
734
735
736 func (page ApplicationListResultPage) NotDone() bool {
737 return !page.alr.IsEmpty()
738 }
739
740
741 func (page ApplicationListResultPage) Response() ApplicationListResult {
742 return page.alr
743 }
744
745
746 func (page ApplicationListResultPage) Values() []Application {
747 if page.alr.IsEmpty() {
748 return nil
749 }
750 return *page.alr.Value
751 }
752
753
754 func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage {
755 return ApplicationListResultPage{
756 fn: getNextPage,
757 alr: cur,
758 }
759 }
760
761
762 type ApplicationManagementPolicy struct {
763
764 Mode ApplicationManagementMode `json:"mode,omitempty"`
765 }
766
767
768 type ApplicationNotificationEndpoint struct {
769
770 URI *string `json:"uri,omitempty"`
771 }
772
773
774 type ApplicationNotificationPolicy struct {
775
776 NotificationEndpoints *[]ApplicationNotificationEndpoint `json:"notificationEndpoints,omitempty"`
777 }
778
779
780 type ApplicationPackageContact struct {
781
782 ContactName *string `json:"contactName,omitempty"`
783
784 Email *string `json:"email,omitempty"`
785
786 Phone *string `json:"phone,omitempty"`
787 }
788
789
790 type ApplicationPackageLockingPolicyDefinition struct {
791
792 AllowedActions *[]string `json:"allowedActions,omitempty"`
793
794 AllowedDataActions *[]string `json:"allowedDataActions,omitempty"`
795 }
796
797
798 type ApplicationPackageSupportUrls struct {
799
800 PublicAzure *string `json:"publicAzure,omitempty"`
801
802 GovernmentCloud *string `json:"governmentCloud,omitempty"`
803 }
804
805
806 type ApplicationPatchable struct {
807 autorest.Response `json:"-"`
808
809 *ApplicationProperties `json:"properties,omitempty"`
810
811 Plan *PlanPatchable `json:"plan,omitempty"`
812
813 Kind *string `json:"kind,omitempty"`
814
815 Identity *Identity `json:"identity,omitempty"`
816
817 ManagedBy *string `json:"managedBy,omitempty"`
818
819 Sku *Sku `json:"sku,omitempty"`
820
821 ID *string `json:"id,omitempty"`
822
823 Name *string `json:"name,omitempty"`
824
825 Type *string `json:"type,omitempty"`
826
827 Location *string `json:"location,omitempty"`
828
829 Tags map[string]*string `json:"tags"`
830 }
831
832
833 func (ap ApplicationPatchable) MarshalJSON() ([]byte, error) {
834 objectMap := make(map[string]interface{})
835 if ap.ApplicationProperties != nil {
836 objectMap["properties"] = ap.ApplicationProperties
837 }
838 if ap.Plan != nil {
839 objectMap["plan"] = ap.Plan
840 }
841 if ap.Kind != nil {
842 objectMap["kind"] = ap.Kind
843 }
844 if ap.Identity != nil {
845 objectMap["identity"] = ap.Identity
846 }
847 if ap.ManagedBy != nil {
848 objectMap["managedBy"] = ap.ManagedBy
849 }
850 if ap.Sku != nil {
851 objectMap["sku"] = ap.Sku
852 }
853 if ap.Location != nil {
854 objectMap["location"] = ap.Location
855 }
856 if ap.Tags != nil {
857 objectMap["tags"] = ap.Tags
858 }
859 return json.Marshal(objectMap)
860 }
861
862
863 func (ap *ApplicationPatchable) UnmarshalJSON(body []byte) error {
864 var m map[string]*json.RawMessage
865 err := json.Unmarshal(body, &m)
866 if err != nil {
867 return err
868 }
869 for k, v := range m {
870 switch k {
871 case "properties":
872 if v != nil {
873 var applicationProperties ApplicationProperties
874 err = json.Unmarshal(*v, &applicationProperties)
875 if err != nil {
876 return err
877 }
878 ap.ApplicationProperties = &applicationProperties
879 }
880 case "plan":
881 if v != nil {
882 var plan PlanPatchable
883 err = json.Unmarshal(*v, &plan)
884 if err != nil {
885 return err
886 }
887 ap.Plan = &plan
888 }
889 case "kind":
890 if v != nil {
891 var kind string
892 err = json.Unmarshal(*v, &kind)
893 if err != nil {
894 return err
895 }
896 ap.Kind = &kind
897 }
898 case "identity":
899 if v != nil {
900 var identity Identity
901 err = json.Unmarshal(*v, &identity)
902 if err != nil {
903 return err
904 }
905 ap.Identity = &identity
906 }
907 case "managedBy":
908 if v != nil {
909 var managedBy string
910 err = json.Unmarshal(*v, &managedBy)
911 if err != nil {
912 return err
913 }
914 ap.ManagedBy = &managedBy
915 }
916 case "sku":
917 if v != nil {
918 var sku Sku
919 err = json.Unmarshal(*v, &sku)
920 if err != nil {
921 return err
922 }
923 ap.Sku = &sku
924 }
925 case "id":
926 if v != nil {
927 var ID string
928 err = json.Unmarshal(*v, &ID)
929 if err != nil {
930 return err
931 }
932 ap.ID = &ID
933 }
934 case "name":
935 if v != nil {
936 var name string
937 err = json.Unmarshal(*v, &name)
938 if err != nil {
939 return err
940 }
941 ap.Name = &name
942 }
943 case "type":
944 if v != nil {
945 var typeVar string
946 err = json.Unmarshal(*v, &typeVar)
947 if err != nil {
948 return err
949 }
950 ap.Type = &typeVar
951 }
952 case "location":
953 if v != nil {
954 var location string
955 err = json.Unmarshal(*v, &location)
956 if err != nil {
957 return err
958 }
959 ap.Location = &location
960 }
961 case "tags":
962 if v != nil {
963 var tags map[string]*string
964 err = json.Unmarshal(*v, &tags)
965 if err != nil {
966 return err
967 }
968 ap.Tags = tags
969 }
970 }
971 }
972
973 return nil
974 }
975
976
977 type ApplicationPolicy struct {
978
979 Name *string `json:"name,omitempty"`
980
981 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`
982
983 Parameters *string `json:"parameters,omitempty"`
984 }
985
986
987 type ApplicationProperties struct {
988
989 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
990
991 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
992
993 Parameters interface{} `json:"parameters,omitempty"`
994
995 Outputs interface{} `json:"outputs,omitempty"`
996
997 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
998
999 BillingDetails *ApplicationBillingDetailsDefinition `json:"billingDetails,omitempty"`
1000
1001 JitAccessPolicy *ApplicationJitAccessPolicy `json:"jitAccessPolicy,omitempty"`
1002
1003 PublisherTenantID *string `json:"publisherTenantId,omitempty"`
1004
1005 Authorizations *[]ApplicationAuthorization `json:"authorizations,omitempty"`
1006
1007 ManagementMode ApplicationManagementMode `json:"managementMode,omitempty"`
1008
1009 CustomerSupport *ApplicationPackageContact `json:"customerSupport,omitempty"`
1010
1011 SupportUrls *ApplicationPackageSupportUrls `json:"supportUrls,omitempty"`
1012
1013 Artifacts *[]ApplicationArtifact `json:"artifacts,omitempty"`
1014
1015 CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
1016
1017 UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
1018 }
1019
1020
1021 func (ap ApplicationProperties) MarshalJSON() ([]byte, error) {
1022 objectMap := make(map[string]interface{})
1023 if ap.ManagedResourceGroupID != nil {
1024 objectMap["managedResourceGroupId"] = ap.ManagedResourceGroupID
1025 }
1026 if ap.ApplicationDefinitionID != nil {
1027 objectMap["applicationDefinitionId"] = ap.ApplicationDefinitionID
1028 }
1029 if ap.Parameters != nil {
1030 objectMap["parameters"] = ap.Parameters
1031 }
1032 if ap.JitAccessPolicy != nil {
1033 objectMap["jitAccessPolicy"] = ap.JitAccessPolicy
1034 }
1035 return json.Marshal(objectMap)
1036 }
1037
1038
1039 type ApplicationPropertiesPatchable struct {
1040
1041 ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
1042
1043 ApplicationDefinitionID *string `json:"applicationDefinitionId,omitempty"`
1044
1045 Parameters interface{} `json:"parameters,omitempty"`
1046
1047 Outputs interface{} `json:"outputs,omitempty"`
1048
1049 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1050 }
1051
1052
1053 func (app ApplicationPropertiesPatchable) MarshalJSON() ([]byte, error) {
1054 objectMap := make(map[string]interface{})
1055 if app.ManagedResourceGroupID != nil {
1056 objectMap["managedResourceGroupId"] = app.ManagedResourceGroupID
1057 }
1058 if app.ApplicationDefinitionID != nil {
1059 objectMap["applicationDefinitionId"] = app.ApplicationDefinitionID
1060 }
1061 if app.Parameters != nil {
1062 objectMap["parameters"] = app.Parameters
1063 }
1064 return json.Marshal(objectMap)
1065 }
1066
1067
1068
1069 type ApplicationsCreateOrUpdateByIDFuture struct {
1070 azure.FutureAPI
1071
1072
1073 Result func(ApplicationsClient) (Application, error)
1074 }
1075
1076
1077 func (future *ApplicationsCreateOrUpdateByIDFuture) UnmarshalJSON(body []byte) error {
1078 var azFuture azure.Future
1079 if err := json.Unmarshal(body, &azFuture); err != nil {
1080 return err
1081 }
1082 future.FutureAPI = &azFuture
1083 future.Result = future.result
1084 return nil
1085 }
1086
1087
1088 func (future *ApplicationsCreateOrUpdateByIDFuture) result(client ApplicationsClient) (a Application, err error) {
1089 var done bool
1090 done, err = future.DoneWithContext(context.Background(), client)
1091 if err != nil {
1092 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", future.Response(), "Polling failure")
1093 return
1094 }
1095 if !done {
1096 a.Response.Response = future.Response()
1097 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateByIDFuture")
1098 return
1099 }
1100 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1101 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1102 a, err = client.CreateOrUpdateByIDResponder(a.Response.Response)
1103 if err != nil {
1104 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateByIDFuture", "Result", a.Response.Response, "Failure responding to request")
1105 }
1106 }
1107 return
1108 }
1109
1110
1111
1112 type ApplicationsCreateOrUpdateFuture struct {
1113 azure.FutureAPI
1114
1115
1116 Result func(ApplicationsClient) (Application, error)
1117 }
1118
1119
1120 func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1121 var azFuture azure.Future
1122 if err := json.Unmarshal(body, &azFuture); err != nil {
1123 return err
1124 }
1125 future.FutureAPI = &azFuture
1126 future.Result = future.result
1127 return nil
1128 }
1129
1130
1131 func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (a Application, err error) {
1132 var done bool
1133 done, err = future.DoneWithContext(context.Background(), client)
1134 if err != nil {
1135 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1136 return
1137 }
1138 if !done {
1139 a.Response.Response = future.Response()
1140 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsCreateOrUpdateFuture")
1141 return
1142 }
1143 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1144 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
1145 a, err = client.CreateOrUpdateResponder(a.Response.Response)
1146 if err != nil {
1147 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request")
1148 }
1149 }
1150 return
1151 }
1152
1153
1154
1155 type ApplicationsDeleteByIDFuture struct {
1156 azure.FutureAPI
1157
1158
1159 Result func(ApplicationsClient) (autorest.Response, error)
1160 }
1161
1162
1163 func (future *ApplicationsDeleteByIDFuture) UnmarshalJSON(body []byte) error {
1164 var azFuture azure.Future
1165 if err := json.Unmarshal(body, &azFuture); err != nil {
1166 return err
1167 }
1168 future.FutureAPI = &azFuture
1169 future.Result = future.result
1170 return nil
1171 }
1172
1173
1174 func (future *ApplicationsDeleteByIDFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1175 var done bool
1176 done, err = future.DoneWithContext(context.Background(), client)
1177 if err != nil {
1178 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteByIDFuture", "Result", future.Response(), "Polling failure")
1179 return
1180 }
1181 if !done {
1182 ar.Response = future.Response()
1183 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteByIDFuture")
1184 return
1185 }
1186 ar.Response = future.Response()
1187 return
1188 }
1189
1190
1191
1192 type ApplicationsDeleteFuture struct {
1193 azure.FutureAPI
1194
1195
1196 Result func(ApplicationsClient) (autorest.Response, error)
1197 }
1198
1199
1200 func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error {
1201 var azFuture azure.Future
1202 if err := json.Unmarshal(body, &azFuture); err != nil {
1203 return err
1204 }
1205 future.FutureAPI = &azFuture
1206 future.Result = future.result
1207 return nil
1208 }
1209
1210
1211 func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1212 var done bool
1213 done, err = future.DoneWithContext(context.Background(), client)
1214 if err != nil {
1215 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure")
1216 return
1217 }
1218 if !done {
1219 ar.Response = future.Response()
1220 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsDeleteFuture")
1221 return
1222 }
1223 ar.Response = future.Response()
1224 return
1225 }
1226
1227
1228
1229 type ApplicationsRefreshPermissionsFuture struct {
1230 azure.FutureAPI
1231
1232
1233 Result func(ApplicationsClient) (autorest.Response, error)
1234 }
1235
1236
1237 func (future *ApplicationsRefreshPermissionsFuture) UnmarshalJSON(body []byte) error {
1238 var azFuture azure.Future
1239 if err := json.Unmarshal(body, &azFuture); err != nil {
1240 return err
1241 }
1242 future.FutureAPI = &azFuture
1243 future.Result = future.result
1244 return nil
1245 }
1246
1247
1248 func (future *ApplicationsRefreshPermissionsFuture) result(client ApplicationsClient) (ar autorest.Response, err error) {
1249 var done bool
1250 done, err = future.DoneWithContext(context.Background(), client)
1251 if err != nil {
1252 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsRefreshPermissionsFuture", "Result", future.Response(), "Polling failure")
1253 return
1254 }
1255 if !done {
1256 ar.Response = future.Response()
1257 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsRefreshPermissionsFuture")
1258 return
1259 }
1260 ar.Response = future.Response()
1261 return
1262 }
1263
1264
1265
1266 type ApplicationsUpdateAccessFuture struct {
1267 azure.FutureAPI
1268
1269
1270 Result func(ApplicationsClient) (UpdateAccessDefinition, error)
1271 }
1272
1273
1274 func (future *ApplicationsUpdateAccessFuture) UnmarshalJSON(body []byte) error {
1275 var azFuture azure.Future
1276 if err := json.Unmarshal(body, &azFuture); err != nil {
1277 return err
1278 }
1279 future.FutureAPI = &azFuture
1280 future.Result = future.result
1281 return nil
1282 }
1283
1284
1285 func (future *ApplicationsUpdateAccessFuture) result(client ApplicationsClient) (uad UpdateAccessDefinition, err error) {
1286 var done bool
1287 done, err = future.DoneWithContext(context.Background(), client)
1288 if err != nil {
1289 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", future.Response(), "Polling failure")
1290 return
1291 }
1292 if !done {
1293 uad.Response.Response = future.Response()
1294 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateAccessFuture")
1295 return
1296 }
1297 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1298 if uad.Response.Response, err = future.GetResult(sender); err == nil && uad.Response.Response.StatusCode != http.StatusNoContent {
1299 uad, err = client.UpdateAccessResponder(uad.Response.Response)
1300 if err != nil {
1301 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateAccessFuture", "Result", uad.Response.Response, "Failure responding to request")
1302 }
1303 }
1304 return
1305 }
1306
1307
1308
1309 type ApplicationsUpdateByIDFuture struct {
1310 azure.FutureAPI
1311
1312
1313 Result func(ApplicationsClient) (ApplicationPatchable, error)
1314 }
1315
1316
1317 func (future *ApplicationsUpdateByIDFuture) UnmarshalJSON(body []byte) error {
1318 var azFuture azure.Future
1319 if err := json.Unmarshal(body, &azFuture); err != nil {
1320 return err
1321 }
1322 future.FutureAPI = &azFuture
1323 future.Result = future.result
1324 return nil
1325 }
1326
1327
1328 func (future *ApplicationsUpdateByIDFuture) result(client ApplicationsClient) (ap ApplicationPatchable, err error) {
1329 var done bool
1330 done, err = future.DoneWithContext(context.Background(), client)
1331 if err != nil {
1332 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", future.Response(), "Polling failure")
1333 return
1334 }
1335 if !done {
1336 ap.Response.Response = future.Response()
1337 err = azure.NewAsyncOpIncompleteError("managedapplications.ApplicationsUpdateByIDFuture")
1338 return
1339 }
1340 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1341 if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent {
1342 ap, err = client.UpdateByIDResponder(ap.Response.Response)
1343 if err != nil {
1344 err = autorest.NewErrorWithError(err, "managedapplications.ApplicationsUpdateByIDFuture", "Result", ap.Response.Response, "Failure responding to request")
1345 }
1346 }
1347 return
1348 }
1349
1350
1351 type ErrorAdditionalInfo struct {
1352
1353 Type *string `json:"type,omitempty"`
1354
1355 Info interface{} `json:"info,omitempty"`
1356 }
1357
1358
1359 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
1360 objectMap := make(map[string]interface{})
1361 return json.Marshal(objectMap)
1362 }
1363
1364
1365 type ErrorDetail struct {
1366
1367 Code *string `json:"code,omitempty"`
1368
1369 Message *string `json:"message,omitempty"`
1370
1371 Target *string `json:"target,omitempty"`
1372
1373 Details *[]ErrorDetail `json:"details,omitempty"`
1374
1375 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
1376 }
1377
1378
1379 func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
1380 objectMap := make(map[string]interface{})
1381 return json.Marshal(objectMap)
1382 }
1383
1384
1385
1386 type ErrorResponse struct {
1387
1388 Error *ErrorDetail `json:"error,omitempty"`
1389 }
1390
1391
1392 type GenericResource struct {
1393
1394 ManagedBy *string `json:"managedBy,omitempty"`
1395
1396 Sku *Sku `json:"sku,omitempty"`
1397
1398 ID *string `json:"id,omitempty"`
1399
1400 Name *string `json:"name,omitempty"`
1401
1402 Type *string `json:"type,omitempty"`
1403
1404 Location *string `json:"location,omitempty"`
1405
1406 Tags map[string]*string `json:"tags"`
1407 }
1408
1409
1410 func (gr GenericResource) MarshalJSON() ([]byte, error) {
1411 objectMap := make(map[string]interface{})
1412 if gr.ManagedBy != nil {
1413 objectMap["managedBy"] = gr.ManagedBy
1414 }
1415 if gr.Sku != nil {
1416 objectMap["sku"] = gr.Sku
1417 }
1418 if gr.Location != nil {
1419 objectMap["location"] = gr.Location
1420 }
1421 if gr.Tags != nil {
1422 objectMap["tags"] = gr.Tags
1423 }
1424 return json.Marshal(objectMap)
1425 }
1426
1427
1428 type Identity struct {
1429
1430 PrincipalID *string `json:"principalId,omitempty"`
1431
1432 TenantID *string `json:"tenantId,omitempty"`
1433
1434 Type ResourceIdentityType `json:"type,omitempty"`
1435
1436 UserAssignedIdentities map[string]*UserAssignedResourceIdentity `json:"userAssignedIdentities"`
1437 }
1438
1439
1440 func (i Identity) MarshalJSON() ([]byte, error) {
1441 objectMap := make(map[string]interface{})
1442 if i.Type != "" {
1443 objectMap["type"] = i.Type
1444 }
1445 if i.UserAssignedIdentities != nil {
1446 objectMap["userAssignedIdentities"] = i.UserAssignedIdentities
1447 }
1448 return json.Marshal(objectMap)
1449 }
1450
1451
1452 type JitApproverDefinition struct {
1453
1454 ID *string `json:"id,omitempty"`
1455
1456 Type JitApproverType `json:"type,omitempty"`
1457
1458 DisplayName *string `json:"displayName,omitempty"`
1459 }
1460
1461
1462 type JitAuthorizationPolicies struct {
1463
1464 PrincipalID *string `json:"principalId,omitempty"`
1465
1466 RoleDefinitionID *string `json:"roleDefinitionId,omitempty"`
1467 }
1468
1469
1470 type JitRequestDefinition struct {
1471 autorest.Response `json:"-"`
1472
1473 *JitRequestProperties `json:"properties,omitempty"`
1474
1475 ID *string `json:"id,omitempty"`
1476
1477 Name *string `json:"name,omitempty"`
1478
1479 Type *string `json:"type,omitempty"`
1480
1481 Location *string `json:"location,omitempty"`
1482
1483 Tags map[string]*string `json:"tags"`
1484 }
1485
1486
1487 func (jrd JitRequestDefinition) MarshalJSON() ([]byte, error) {
1488 objectMap := make(map[string]interface{})
1489 if jrd.JitRequestProperties != nil {
1490 objectMap["properties"] = jrd.JitRequestProperties
1491 }
1492 if jrd.Location != nil {
1493 objectMap["location"] = jrd.Location
1494 }
1495 if jrd.Tags != nil {
1496 objectMap["tags"] = jrd.Tags
1497 }
1498 return json.Marshal(objectMap)
1499 }
1500
1501
1502 func (jrd *JitRequestDefinition) UnmarshalJSON(body []byte) error {
1503 var m map[string]*json.RawMessage
1504 err := json.Unmarshal(body, &m)
1505 if err != nil {
1506 return err
1507 }
1508 for k, v := range m {
1509 switch k {
1510 case "properties":
1511 if v != nil {
1512 var jitRequestProperties JitRequestProperties
1513 err = json.Unmarshal(*v, &jitRequestProperties)
1514 if err != nil {
1515 return err
1516 }
1517 jrd.JitRequestProperties = &jitRequestProperties
1518 }
1519 case "id":
1520 if v != nil {
1521 var ID string
1522 err = json.Unmarshal(*v, &ID)
1523 if err != nil {
1524 return err
1525 }
1526 jrd.ID = &ID
1527 }
1528 case "name":
1529 if v != nil {
1530 var name string
1531 err = json.Unmarshal(*v, &name)
1532 if err != nil {
1533 return err
1534 }
1535 jrd.Name = &name
1536 }
1537 case "type":
1538 if v != nil {
1539 var typeVar string
1540 err = json.Unmarshal(*v, &typeVar)
1541 if err != nil {
1542 return err
1543 }
1544 jrd.Type = &typeVar
1545 }
1546 case "location":
1547 if v != nil {
1548 var location string
1549 err = json.Unmarshal(*v, &location)
1550 if err != nil {
1551 return err
1552 }
1553 jrd.Location = &location
1554 }
1555 case "tags":
1556 if v != nil {
1557 var tags map[string]*string
1558 err = json.Unmarshal(*v, &tags)
1559 if err != nil {
1560 return err
1561 }
1562 jrd.Tags = tags
1563 }
1564 }
1565 }
1566
1567 return nil
1568 }
1569
1570
1571 type JitRequestDefinitionListResult struct {
1572 autorest.Response `json:"-"`
1573
1574 Value *[]JitRequestDefinition `json:"value,omitempty"`
1575
1576 NextLink *string `json:"nextLink,omitempty"`
1577 }
1578
1579
1580 type JitRequestMetadata struct {
1581
1582 OriginRequestID *string `json:"originRequestId,omitempty"`
1583
1584 RequestorID *string `json:"requestorId,omitempty"`
1585
1586 TenantDisplayName *string `json:"tenantDisplayName,omitempty"`
1587
1588 SubjectDisplayName *string `json:"subjectDisplayName,omitempty"`
1589 }
1590
1591
1592 type JitRequestPatchable struct {
1593
1594 Tags map[string]*string `json:"tags"`
1595 }
1596
1597
1598 func (jrp JitRequestPatchable) MarshalJSON() ([]byte, error) {
1599 objectMap := make(map[string]interface{})
1600 if jrp.Tags != nil {
1601 objectMap["tags"] = jrp.Tags
1602 }
1603 return json.Marshal(objectMap)
1604 }
1605
1606
1607 type JitRequestProperties struct {
1608
1609 ApplicationResourceID *string `json:"applicationResourceId,omitempty"`
1610
1611 PublisherTenantID *string `json:"publisherTenantId,omitempty"`
1612
1613 JitAuthorizationPolicies *[]JitAuthorizationPolicies `json:"jitAuthorizationPolicies,omitempty"`
1614
1615 JitSchedulingPolicy *JitSchedulingPolicy `json:"jitSchedulingPolicy,omitempty"`
1616
1617 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1618
1619 JitRequestState JitRequestState `json:"jitRequestState,omitempty"`
1620
1621 CreatedBy *ApplicationClientDetails `json:"createdBy,omitempty"`
1622
1623 UpdatedBy *ApplicationClientDetails `json:"updatedBy,omitempty"`
1624 }
1625
1626
1627 func (jrp JitRequestProperties) MarshalJSON() ([]byte, error) {
1628 objectMap := make(map[string]interface{})
1629 if jrp.ApplicationResourceID != nil {
1630 objectMap["applicationResourceId"] = jrp.ApplicationResourceID
1631 }
1632 if jrp.JitAuthorizationPolicies != nil {
1633 objectMap["jitAuthorizationPolicies"] = jrp.JitAuthorizationPolicies
1634 }
1635 if jrp.JitSchedulingPolicy != nil {
1636 objectMap["jitSchedulingPolicy"] = jrp.JitSchedulingPolicy
1637 }
1638 return json.Marshal(objectMap)
1639 }
1640
1641
1642
1643 type JitRequestsCreateOrUpdateFuture struct {
1644 azure.FutureAPI
1645
1646
1647 Result func(JitRequestsClient) (JitRequestDefinition, error)
1648 }
1649
1650
1651 func (future *JitRequestsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1652 var azFuture azure.Future
1653 if err := json.Unmarshal(body, &azFuture); err != nil {
1654 return err
1655 }
1656 future.FutureAPI = &azFuture
1657 future.Result = future.result
1658 return nil
1659 }
1660
1661
1662 func (future *JitRequestsCreateOrUpdateFuture) result(client JitRequestsClient) (jrd JitRequestDefinition, err error) {
1663 var done bool
1664 done, err = future.DoneWithContext(context.Background(), client)
1665 if err != nil {
1666 err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1667 return
1668 }
1669 if !done {
1670 jrd.Response.Response = future.Response()
1671 err = azure.NewAsyncOpIncompleteError("managedapplications.JitRequestsCreateOrUpdateFuture")
1672 return
1673 }
1674 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1675 if jrd.Response.Response, err = future.GetResult(sender); err == nil && jrd.Response.Response.StatusCode != http.StatusNoContent {
1676 jrd, err = client.CreateOrUpdateResponder(jrd.Response.Response)
1677 if err != nil {
1678 err = autorest.NewErrorWithError(err, "managedapplications.JitRequestsCreateOrUpdateFuture", "Result", jrd.Response.Response, "Failure responding to request")
1679 }
1680 }
1681 return
1682 }
1683
1684
1685 type JitSchedulingPolicy struct {
1686
1687 Type JitSchedulingType `json:"type,omitempty"`
1688 Duration *string `json:"duration,omitempty"`
1689
1690 StartTime *date.Time `json:"startTime,omitempty"`
1691 }
1692
1693
1694 type ListTokenRequest struct {
1695
1696 AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
1697
1698 UserAssignedIdentities *[]string `json:"userAssignedIdentities,omitempty"`
1699 }
1700
1701
1702 type ManagedIdentityToken struct {
1703
1704 AccessToken *string `json:"accessToken,omitempty"`
1705
1706 ExpiresIn *string `json:"expiresIn,omitempty"`
1707
1708 ExpiresOn *string `json:"expiresOn,omitempty"`
1709
1710 NotBefore *string `json:"notBefore,omitempty"`
1711
1712 AuthorizationAudience *string `json:"authorizationAudience,omitempty"`
1713
1714 ResourceID *string `json:"resourceId,omitempty"`
1715
1716 TokenType *string `json:"tokenType,omitempty"`
1717 }
1718
1719
1720 type ManagedIdentityTokenResult struct {
1721 autorest.Response `json:"-"`
1722
1723 Value *[]ManagedIdentityToken `json:"value,omitempty"`
1724 }
1725
1726
1727 type Operation struct {
1728
1729 Name *string `json:"name,omitempty"`
1730
1731 IsDataAction *bool `json:"isDataAction,omitempty"`
1732
1733 Display *OperationDisplay `json:"display,omitempty"`
1734 }
1735
1736
1737 type OperationDisplay struct {
1738
1739 Provider *string `json:"provider,omitempty"`
1740
1741 Resource *string `json:"resource,omitempty"`
1742
1743 Operation *string `json:"operation,omitempty"`
1744
1745 Description *string `json:"description,omitempty"`
1746 }
1747
1748
1749 func (o OperationDisplay) MarshalJSON() ([]byte, error) {
1750 objectMap := make(map[string]interface{})
1751 if o.Provider != nil {
1752 objectMap["provider"] = o.Provider
1753 }
1754 if o.Resource != nil {
1755 objectMap["resource"] = o.Resource
1756 }
1757 if o.Operation != nil {
1758 objectMap["operation"] = o.Operation
1759 }
1760 return json.Marshal(objectMap)
1761 }
1762
1763
1764
1765 type OperationListResult struct {
1766 autorest.Response `json:"-"`
1767
1768 Value *[]Operation `json:"value,omitempty"`
1769
1770 NextLink *string `json:"nextLink,omitempty"`
1771 }
1772
1773
1774 type OperationListResultIterator struct {
1775 i int
1776 page OperationListResultPage
1777 }
1778
1779
1780
1781 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1782 if tracing.IsEnabled() {
1783 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1784 defer func() {
1785 sc := -1
1786 if iter.Response().Response.Response != nil {
1787 sc = iter.Response().Response.Response.StatusCode
1788 }
1789 tracing.EndSpan(ctx, sc, err)
1790 }()
1791 }
1792 iter.i++
1793 if iter.i < len(iter.page.Values()) {
1794 return nil
1795 }
1796 err = iter.page.NextWithContext(ctx)
1797 if err != nil {
1798 iter.i--
1799 return err
1800 }
1801 iter.i = 0
1802 return nil
1803 }
1804
1805
1806
1807
1808 func (iter *OperationListResultIterator) Next() error {
1809 return iter.NextWithContext(context.Background())
1810 }
1811
1812
1813 func (iter OperationListResultIterator) NotDone() bool {
1814 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1815 }
1816
1817
1818 func (iter OperationListResultIterator) Response() OperationListResult {
1819 return iter.page.Response()
1820 }
1821
1822
1823
1824 func (iter OperationListResultIterator) Value() Operation {
1825 if !iter.page.NotDone() {
1826 return Operation{}
1827 }
1828 return iter.page.Values()[iter.i]
1829 }
1830
1831
1832 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1833 return OperationListResultIterator{page: page}
1834 }
1835
1836
1837 func (olr OperationListResult) IsEmpty() bool {
1838 return olr.Value == nil || len(*olr.Value) == 0
1839 }
1840
1841
1842 func (olr OperationListResult) hasNextLink() bool {
1843 return olr.NextLink != nil && len(*olr.NextLink) != 0
1844 }
1845
1846
1847
1848 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1849 if !olr.hasNextLink() {
1850 return nil, nil
1851 }
1852 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1853 autorest.AsJSON(),
1854 autorest.AsGet(),
1855 autorest.WithBaseURL(to.String(olr.NextLink)))
1856 }
1857
1858
1859 type OperationListResultPage struct {
1860 fn func(context.Context, OperationListResult) (OperationListResult, error)
1861 olr OperationListResult
1862 }
1863
1864
1865
1866 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1867 if tracing.IsEnabled() {
1868 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1869 defer func() {
1870 sc := -1
1871 if page.Response().Response.Response != nil {
1872 sc = page.Response().Response.Response.StatusCode
1873 }
1874 tracing.EndSpan(ctx, sc, err)
1875 }()
1876 }
1877 for {
1878 next, err := page.fn(ctx, page.olr)
1879 if err != nil {
1880 return err
1881 }
1882 page.olr = next
1883 if !next.hasNextLink() || !next.IsEmpty() {
1884 break
1885 }
1886 }
1887 return nil
1888 }
1889
1890
1891
1892
1893 func (page *OperationListResultPage) Next() error {
1894 return page.NextWithContext(context.Background())
1895 }
1896
1897
1898 func (page OperationListResultPage) NotDone() bool {
1899 return !page.olr.IsEmpty()
1900 }
1901
1902
1903 func (page OperationListResultPage) Response() OperationListResult {
1904 return page.olr
1905 }
1906
1907
1908 func (page OperationListResultPage) Values() []Operation {
1909 if page.olr.IsEmpty() {
1910 return nil
1911 }
1912 return *page.olr.Value
1913 }
1914
1915
1916 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1917 return OperationListResultPage{
1918 fn: getNextPage,
1919 olr: cur,
1920 }
1921 }
1922
1923
1924 type Plan struct {
1925
1926 Name *string `json:"name,omitempty"`
1927
1928 Publisher *string `json:"publisher,omitempty"`
1929
1930 Product *string `json:"product,omitempty"`
1931
1932 PromotionCode *string `json:"promotionCode,omitempty"`
1933
1934 Version *string `json:"version,omitempty"`
1935 }
1936
1937
1938 type PlanPatchable struct {
1939
1940 Name *string `json:"name,omitempty"`
1941
1942 Publisher *string `json:"publisher,omitempty"`
1943
1944 Product *string `json:"product,omitempty"`
1945
1946 PromotionCode *string `json:"promotionCode,omitempty"`
1947
1948 Version *string `json:"version,omitempty"`
1949 }
1950
1951
1952 type Resource struct {
1953
1954 ID *string `json:"id,omitempty"`
1955
1956 Name *string `json:"name,omitempty"`
1957
1958 Type *string `json:"type,omitempty"`
1959
1960 Location *string `json:"location,omitempty"`
1961
1962 Tags map[string]*string `json:"tags"`
1963 }
1964
1965
1966 func (r Resource) MarshalJSON() ([]byte, error) {
1967 objectMap := make(map[string]interface{})
1968 if r.Location != nil {
1969 objectMap["location"] = r.Location
1970 }
1971 if r.Tags != nil {
1972 objectMap["tags"] = r.Tags
1973 }
1974 return json.Marshal(objectMap)
1975 }
1976
1977
1978 type Sku struct {
1979
1980 Name *string `json:"name,omitempty"`
1981
1982 Tier *string `json:"tier,omitempty"`
1983
1984 Size *string `json:"size,omitempty"`
1985
1986 Family *string `json:"family,omitempty"`
1987
1988 Model *string `json:"model,omitempty"`
1989
1990 Capacity *int32 `json:"capacity,omitempty"`
1991 }
1992
1993
1994 type UpdateAccessDefinition struct {
1995 autorest.Response `json:"-"`
1996
1997 Approver *string `json:"approver,omitempty"`
1998
1999 Metadata *JitRequestMetadata `json:"metadata,omitempty"`
2000
2001 Status Status `json:"status,omitempty"`
2002
2003 SubStatus Substatus `json:"subStatus,omitempty"`
2004 }
2005
2006
2007
2008 type UserAssignedResourceIdentity struct {
2009
2010 PrincipalID *string `json:"principalId,omitempty"`
2011
2012 TenantID *string `json:"tenantId,omitempty"`
2013 }
2014
2015
2016 func (uari UserAssignedResourceIdentity) MarshalJSON() ([]byte, error) {
2017 objectMap := make(map[string]interface{})
2018 return json.Marshal(objectMap)
2019 }
2020
View as plain text