1 package portal
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/to"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal"
20
21
22 type AzureEntityResource struct {
23
24 Etag *string `json:"etag,omitempty"`
25
26 ID *string `json:"id,omitempty"`
27
28 Name *string `json:"name,omitempty"`
29
30 Type *string `json:"type,omitempty"`
31 }
32
33
34 func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
35 objectMap := make(map[string]interface{})
36 return json.Marshal(objectMap)
37 }
38
39
40 type Configuration struct {
41 autorest.Response `json:"-"`
42
43 *ConfigurationProperties `json:"properties,omitempty"`
44
45 ID *string `json:"id,omitempty"`
46
47 Name *string `json:"name,omitempty"`
48
49 Type *string `json:"type,omitempty"`
50 }
51
52
53 func (c Configuration) MarshalJSON() ([]byte, error) {
54 objectMap := make(map[string]interface{})
55 if c.ConfigurationProperties != nil {
56 objectMap["properties"] = c.ConfigurationProperties
57 }
58 return json.Marshal(objectMap)
59 }
60
61
62 func (c *Configuration) UnmarshalJSON(body []byte) error {
63 var m map[string]*json.RawMessage
64 err := json.Unmarshal(body, &m)
65 if err != nil {
66 return err
67 }
68 for k, v := range m {
69 switch k {
70 case "properties":
71 if v != nil {
72 var configurationProperties ConfigurationProperties
73 err = json.Unmarshal(*v, &configurationProperties)
74 if err != nil {
75 return err
76 }
77 c.ConfigurationProperties = &configurationProperties
78 }
79 case "id":
80 if v != nil {
81 var ID string
82 err = json.Unmarshal(*v, &ID)
83 if err != nil {
84 return err
85 }
86 c.ID = &ID
87 }
88 case "name":
89 if v != nil {
90 var name string
91 err = json.Unmarshal(*v, &name)
92 if err != nil {
93 return err
94 }
95 c.Name = &name
96 }
97 case "type":
98 if v != nil {
99 var typeVar string
100 err = json.Unmarshal(*v, &typeVar)
101 if err != nil {
102 return err
103 }
104 c.Type = &typeVar
105 }
106 }
107 }
108
109 return nil
110 }
111
112
113 type ConfigurationList struct {
114 autorest.Response `json:"-"`
115
116 Value *[]Configuration `json:"value,omitempty"`
117
118 NextLink *string `json:"nextLink,omitempty"`
119 }
120
121
122 type ConfigurationProperties struct {
123
124 EnforcePrivateMarkdownStorage *bool `json:"enforcePrivateMarkdownStorage,omitempty"`
125 }
126
127
128 type Dashboard struct {
129 autorest.Response `json:"-"`
130
131 *DashboardProperties `json:"properties,omitempty"`
132
133 ID *string `json:"id,omitempty"`
134
135 Name *string `json:"name,omitempty"`
136
137 Type *string `json:"type,omitempty"`
138
139 Location *string `json:"location,omitempty"`
140
141 Tags map[string]*string `json:"tags"`
142 }
143
144
145 func (d Dashboard) MarshalJSON() ([]byte, error) {
146 objectMap := make(map[string]interface{})
147 if d.DashboardProperties != nil {
148 objectMap["properties"] = d.DashboardProperties
149 }
150 if d.Location != nil {
151 objectMap["location"] = d.Location
152 }
153 if d.Tags != nil {
154 objectMap["tags"] = d.Tags
155 }
156 return json.Marshal(objectMap)
157 }
158
159
160 func (d *Dashboard) UnmarshalJSON(body []byte) error {
161 var m map[string]*json.RawMessage
162 err := json.Unmarshal(body, &m)
163 if err != nil {
164 return err
165 }
166 for k, v := range m {
167 switch k {
168 case "properties":
169 if v != nil {
170 var dashboardProperties DashboardProperties
171 err = json.Unmarshal(*v, &dashboardProperties)
172 if err != nil {
173 return err
174 }
175 d.DashboardProperties = &dashboardProperties
176 }
177 case "id":
178 if v != nil {
179 var ID string
180 err = json.Unmarshal(*v, &ID)
181 if err != nil {
182 return err
183 }
184 d.ID = &ID
185 }
186 case "name":
187 if v != nil {
188 var name string
189 err = json.Unmarshal(*v, &name)
190 if err != nil {
191 return err
192 }
193 d.Name = &name
194 }
195 case "type":
196 if v != nil {
197 var typeVar string
198 err = json.Unmarshal(*v, &typeVar)
199 if err != nil {
200 return err
201 }
202 d.Type = &typeVar
203 }
204 case "location":
205 if v != nil {
206 var location string
207 err = json.Unmarshal(*v, &location)
208 if err != nil {
209 return err
210 }
211 d.Location = &location
212 }
213 case "tags":
214 if v != nil {
215 var tags map[string]*string
216 err = json.Unmarshal(*v, &tags)
217 if err != nil {
218 return err
219 }
220 d.Tags = tags
221 }
222 }
223 }
224
225 return nil
226 }
227
228
229 type DashboardLens struct {
230
231 Order *int32 `json:"order,omitempty"`
232
233 Parts map[string]*DashboardParts `json:"parts"`
234
235 Metadata map[string]interface{} `json:"metadata"`
236 }
237
238
239 func (dl DashboardLens) MarshalJSON() ([]byte, error) {
240 objectMap := make(map[string]interface{})
241 if dl.Order != nil {
242 objectMap["order"] = dl.Order
243 }
244 if dl.Parts != nil {
245 objectMap["parts"] = dl.Parts
246 }
247 if dl.Metadata != nil {
248 objectMap["metadata"] = dl.Metadata
249 }
250 return json.Marshal(objectMap)
251 }
252
253
254 type DashboardListResult struct {
255 autorest.Response `json:"-"`
256
257 Value *[]Dashboard `json:"value,omitempty"`
258
259 NextLink *string `json:"nextLink,omitempty"`
260 }
261
262
263 type DashboardListResultIterator struct {
264 i int
265 page DashboardListResultPage
266 }
267
268
269
270 func (iter *DashboardListResultIterator) NextWithContext(ctx context.Context) (err error) {
271 if tracing.IsEnabled() {
272 ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultIterator.NextWithContext")
273 defer func() {
274 sc := -1
275 if iter.Response().Response.Response != nil {
276 sc = iter.Response().Response.Response.StatusCode
277 }
278 tracing.EndSpan(ctx, sc, err)
279 }()
280 }
281 iter.i++
282 if iter.i < len(iter.page.Values()) {
283 return nil
284 }
285 err = iter.page.NextWithContext(ctx)
286 if err != nil {
287 iter.i--
288 return err
289 }
290 iter.i = 0
291 return nil
292 }
293
294
295
296
297 func (iter *DashboardListResultIterator) Next() error {
298 return iter.NextWithContext(context.Background())
299 }
300
301
302 func (iter DashboardListResultIterator) NotDone() bool {
303 return iter.page.NotDone() && iter.i < len(iter.page.Values())
304 }
305
306
307 func (iter DashboardListResultIterator) Response() DashboardListResult {
308 return iter.page.Response()
309 }
310
311
312
313 func (iter DashboardListResultIterator) Value() Dashboard {
314 if !iter.page.NotDone() {
315 return Dashboard{}
316 }
317 return iter.page.Values()[iter.i]
318 }
319
320
321 func NewDashboardListResultIterator(page DashboardListResultPage) DashboardListResultIterator {
322 return DashboardListResultIterator{page: page}
323 }
324
325
326 func (dlr DashboardListResult) IsEmpty() bool {
327 return dlr.Value == nil || len(*dlr.Value) == 0
328 }
329
330
331 func (dlr DashboardListResult) hasNextLink() bool {
332 return dlr.NextLink != nil && len(*dlr.NextLink) != 0
333 }
334
335
336
337 func (dlr DashboardListResult) dashboardListResultPreparer(ctx context.Context) (*http.Request, error) {
338 if !dlr.hasNextLink() {
339 return nil, nil
340 }
341 return autorest.Prepare((&http.Request{}).WithContext(ctx),
342 autorest.AsJSON(),
343 autorest.AsGet(),
344 autorest.WithBaseURL(to.String(dlr.NextLink)))
345 }
346
347
348 type DashboardListResultPage struct {
349 fn func(context.Context, DashboardListResult) (DashboardListResult, error)
350 dlr DashboardListResult
351 }
352
353
354
355 func (page *DashboardListResultPage) NextWithContext(ctx context.Context) (err error) {
356 if tracing.IsEnabled() {
357 ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultPage.NextWithContext")
358 defer func() {
359 sc := -1
360 if page.Response().Response.Response != nil {
361 sc = page.Response().Response.Response.StatusCode
362 }
363 tracing.EndSpan(ctx, sc, err)
364 }()
365 }
366 for {
367 next, err := page.fn(ctx, page.dlr)
368 if err != nil {
369 return err
370 }
371 page.dlr = next
372 if !next.hasNextLink() || !next.IsEmpty() {
373 break
374 }
375 }
376 return nil
377 }
378
379
380
381
382 func (page *DashboardListResultPage) Next() error {
383 return page.NextWithContext(context.Background())
384 }
385
386
387 func (page DashboardListResultPage) NotDone() bool {
388 return !page.dlr.IsEmpty()
389 }
390
391
392 func (page DashboardListResultPage) Response() DashboardListResult {
393 return page.dlr
394 }
395
396
397 func (page DashboardListResultPage) Values() []Dashboard {
398 if page.dlr.IsEmpty() {
399 return nil
400 }
401 return *page.dlr.Value
402 }
403
404
405 func NewDashboardListResultPage(cur DashboardListResult, getNextPage func(context.Context, DashboardListResult) (DashboardListResult, error)) DashboardListResultPage {
406 return DashboardListResultPage{
407 fn: getNextPage,
408 dlr: cur,
409 }
410 }
411
412
413 type DashboardParts struct {
414
415 Position *DashboardPartsPosition `json:"position,omitempty"`
416
417 Metadata map[string]interface{} `json:"metadata"`
418 }
419
420
421 func (dp DashboardParts) MarshalJSON() ([]byte, error) {
422 objectMap := make(map[string]interface{})
423 if dp.Position != nil {
424 objectMap["position"] = dp.Position
425 }
426 if dp.Metadata != nil {
427 objectMap["metadata"] = dp.Metadata
428 }
429 return json.Marshal(objectMap)
430 }
431
432
433 type DashboardPartsPosition struct {
434
435 X *int32 `json:"x,omitempty"`
436
437 Y *int32 `json:"y,omitempty"`
438
439 RowSpan *int32 `json:"rowSpan,omitempty"`
440
441 ColSpan *int32 `json:"colSpan,omitempty"`
442
443 Metadata map[string]interface{} `json:"metadata"`
444 }
445
446
447 func (dp DashboardPartsPosition) MarshalJSON() ([]byte, error) {
448 objectMap := make(map[string]interface{})
449 if dp.X != nil {
450 objectMap["x"] = dp.X
451 }
452 if dp.Y != nil {
453 objectMap["y"] = dp.Y
454 }
455 if dp.RowSpan != nil {
456 objectMap["rowSpan"] = dp.RowSpan
457 }
458 if dp.ColSpan != nil {
459 objectMap["colSpan"] = dp.ColSpan
460 }
461 if dp.Metadata != nil {
462 objectMap["metadata"] = dp.Metadata
463 }
464 return json.Marshal(objectMap)
465 }
466
467
468 type DashboardProperties struct {
469
470 Lenses map[string]*DashboardLens `json:"lenses"`
471
472 Metadata map[string]interface{} `json:"metadata"`
473 }
474
475
476 func (dp DashboardProperties) MarshalJSON() ([]byte, error) {
477 objectMap := make(map[string]interface{})
478 if dp.Lenses != nil {
479 objectMap["lenses"] = dp.Lenses
480 }
481 if dp.Metadata != nil {
482 objectMap["metadata"] = dp.Metadata
483 }
484 return json.Marshal(objectMap)
485 }
486
487
488 type ErrorDefinition struct {
489
490 Code *int32 `json:"code,omitempty"`
491
492 Message *string `json:"message,omitempty"`
493
494 Details *[]ErrorDefinition `json:"details,omitempty"`
495 }
496
497
498 func (ed ErrorDefinition) MarshalJSON() ([]byte, error) {
499 objectMap := make(map[string]interface{})
500 return json.Marshal(objectMap)
501 }
502
503
504 type ErrorResponse struct {
505
506 Error *ErrorDefinition `json:"error,omitempty"`
507 }
508
509
510 type PatchableDashboard struct {
511
512 *DashboardProperties `json:"properties,omitempty"`
513
514 Tags map[string]*string `json:"tags"`
515 }
516
517
518 func (pd PatchableDashboard) MarshalJSON() ([]byte, error) {
519 objectMap := make(map[string]interface{})
520 if pd.DashboardProperties != nil {
521 objectMap["properties"] = pd.DashboardProperties
522 }
523 if pd.Tags != nil {
524 objectMap["tags"] = pd.Tags
525 }
526 return json.Marshal(objectMap)
527 }
528
529
530 func (pd *PatchableDashboard) UnmarshalJSON(body []byte) error {
531 var m map[string]*json.RawMessage
532 err := json.Unmarshal(body, &m)
533 if err != nil {
534 return err
535 }
536 for k, v := range m {
537 switch k {
538 case "properties":
539 if v != nil {
540 var dashboardProperties DashboardProperties
541 err = json.Unmarshal(*v, &dashboardProperties)
542 if err != nil {
543 return err
544 }
545 pd.DashboardProperties = &dashboardProperties
546 }
547 case "tags":
548 if v != nil {
549 var tags map[string]*string
550 err = json.Unmarshal(*v, &tags)
551 if err != nil {
552 return err
553 }
554 pd.Tags = tags
555 }
556 }
557 }
558
559 return nil
560 }
561
562
563
564 type ProxyResource struct {
565
566 ID *string `json:"id,omitempty"`
567
568 Name *string `json:"name,omitempty"`
569
570 Type *string `json:"type,omitempty"`
571 }
572
573
574 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
575 objectMap := make(map[string]interface{})
576 return json.Marshal(objectMap)
577 }
578
579
580 type Resource struct {
581
582 ID *string `json:"id,omitempty"`
583
584 Name *string `json:"name,omitempty"`
585
586 Type *string `json:"type,omitempty"`
587 }
588
589
590 func (r Resource) MarshalJSON() ([]byte, error) {
591 objectMap := make(map[string]interface{})
592 return json.Marshal(objectMap)
593 }
594
595
596 type ResourceProviderOperation struct {
597
598 Name *string `json:"name,omitempty"`
599
600 IsDataAction *string `json:"isDataAction,omitempty"`
601
602 Display *ResourceProviderOperationDisplay `json:"display,omitempty"`
603 }
604
605
606 type ResourceProviderOperationDisplay struct {
607
608 Provider *string `json:"provider,omitempty"`
609
610 Resource *string `json:"resource,omitempty"`
611
612 Operation *string `json:"operation,omitempty"`
613
614 Description *string `json:"description,omitempty"`
615 }
616
617
618 type ResourceProviderOperationList struct {
619 autorest.Response `json:"-"`
620
621 Value *[]ResourceProviderOperation `json:"value,omitempty"`
622
623 NextLink *string `json:"nextLink,omitempty"`
624 }
625
626
627
628 type ResourceProviderOperationListIterator struct {
629 i int
630 page ResourceProviderOperationListPage
631 }
632
633
634
635 func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) {
636 if tracing.IsEnabled() {
637 ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext")
638 defer func() {
639 sc := -1
640 if iter.Response().Response.Response != nil {
641 sc = iter.Response().Response.Response.StatusCode
642 }
643 tracing.EndSpan(ctx, sc, err)
644 }()
645 }
646 iter.i++
647 if iter.i < len(iter.page.Values()) {
648 return nil
649 }
650 err = iter.page.NextWithContext(ctx)
651 if err != nil {
652 iter.i--
653 return err
654 }
655 iter.i = 0
656 return nil
657 }
658
659
660
661
662 func (iter *ResourceProviderOperationListIterator) Next() error {
663 return iter.NextWithContext(context.Background())
664 }
665
666
667 func (iter ResourceProviderOperationListIterator) NotDone() bool {
668 return iter.page.NotDone() && iter.i < len(iter.page.Values())
669 }
670
671
672 func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList {
673 return iter.page.Response()
674 }
675
676
677
678 func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation {
679 if !iter.page.NotDone() {
680 return ResourceProviderOperation{}
681 }
682 return iter.page.Values()[iter.i]
683 }
684
685
686 func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator {
687 return ResourceProviderOperationListIterator{page: page}
688 }
689
690
691 func (rpol ResourceProviderOperationList) IsEmpty() bool {
692 return rpol.Value == nil || len(*rpol.Value) == 0
693 }
694
695
696 func (rpol ResourceProviderOperationList) hasNextLink() bool {
697 return rpol.NextLink != nil && len(*rpol.NextLink) != 0
698 }
699
700
701
702 func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) {
703 if !rpol.hasNextLink() {
704 return nil, nil
705 }
706 return autorest.Prepare((&http.Request{}).WithContext(ctx),
707 autorest.AsJSON(),
708 autorest.AsGet(),
709 autorest.WithBaseURL(to.String(rpol.NextLink)))
710 }
711
712
713 type ResourceProviderOperationListPage struct {
714 fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)
715 rpol ResourceProviderOperationList
716 }
717
718
719
720 func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) {
721 if tracing.IsEnabled() {
722 ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext")
723 defer func() {
724 sc := -1
725 if page.Response().Response.Response != nil {
726 sc = page.Response().Response.Response.StatusCode
727 }
728 tracing.EndSpan(ctx, sc, err)
729 }()
730 }
731 for {
732 next, err := page.fn(ctx, page.rpol)
733 if err != nil {
734 return err
735 }
736 page.rpol = next
737 if !next.hasNextLink() || !next.IsEmpty() {
738 break
739 }
740 }
741 return nil
742 }
743
744
745
746
747 func (page *ResourceProviderOperationListPage) Next() error {
748 return page.NextWithContext(context.Background())
749 }
750
751
752 func (page ResourceProviderOperationListPage) NotDone() bool {
753 return !page.rpol.IsEmpty()
754 }
755
756
757 func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList {
758 return page.rpol
759 }
760
761
762 func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation {
763 if page.rpol.IsEmpty() {
764 return nil
765 }
766 return *page.rpol.Value
767 }
768
769
770 func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage {
771 return ResourceProviderOperationListPage{
772 fn: getNextPage,
773 rpol: cur,
774 }
775 }
776
777
778 type TrackedResource struct {
779
780 Tags map[string]*string `json:"tags"`
781
782 Location *string `json:"location,omitempty"`
783
784 ID *string `json:"id,omitempty"`
785
786 Name *string `json:"name,omitempty"`
787
788 Type *string `json:"type,omitempty"`
789 }
790
791
792 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
793 objectMap := make(map[string]interface{})
794 if tr.Tags != nil {
795 objectMap["tags"] = tr.Tags
796 }
797 if tr.Location != nil {
798 objectMap["location"] = tr.Location
799 }
800 return json.Marshal(objectMap)
801 }
802
View as plain text