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