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