1 package servicemap
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/date"
14 "github.com/Azure/go-autorest/autorest/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/servicemap"
21
22
23 type Acceptor struct {
24 *AcceptorProperties `json:"properties,omitempty"`
25
26 ID *string `json:"id,omitempty"`
27
28 Type *string `json:"type,omitempty"`
29
30 Name *string `json:"name,omitempty"`
31
32 Kind KindBasicRelationship `json:"kind,omitempty"`
33 }
34
35
36 func (a Acceptor) MarshalJSON() ([]byte, error) {
37 a.Kind = KindRelacceptor
38 objectMap := make(map[string]interface{})
39 if a.AcceptorProperties != nil {
40 objectMap["properties"] = a.AcceptorProperties
41 }
42 if a.Kind != "" {
43 objectMap["kind"] = a.Kind
44 }
45 return json.Marshal(objectMap)
46 }
47
48
49 func (a Acceptor) AsConnection() (*Connection, bool) {
50 return nil, false
51 }
52
53
54 func (a Acceptor) AsAcceptor() (*Acceptor, bool) {
55 return &a, true
56 }
57
58
59 func (a Acceptor) AsRelationship() (*Relationship, bool) {
60 return nil, false
61 }
62
63
64 func (a Acceptor) AsBasicRelationship() (BasicRelationship, bool) {
65 return &a, true
66 }
67
68
69 func (a *Acceptor) UnmarshalJSON(body []byte) error {
70 var m map[string]*json.RawMessage
71 err := json.Unmarshal(body, &m)
72 if err != nil {
73 return err
74 }
75 for k, v := range m {
76 switch k {
77 case "properties":
78 if v != nil {
79 var acceptorProperties AcceptorProperties
80 err = json.Unmarshal(*v, &acceptorProperties)
81 if err != nil {
82 return err
83 }
84 a.AcceptorProperties = &acceptorProperties
85 }
86 case "kind":
87 if v != nil {
88 var kind KindBasicRelationship
89 err = json.Unmarshal(*v, &kind)
90 if err != nil {
91 return err
92 }
93 a.Kind = kind
94 }
95 case "id":
96 if v != nil {
97 var ID string
98 err = json.Unmarshal(*v, &ID)
99 if err != nil {
100 return err
101 }
102 a.ID = &ID
103 }
104 case "type":
105 if v != nil {
106 var typeVar string
107 err = json.Unmarshal(*v, &typeVar)
108 if err != nil {
109 return err
110 }
111 a.Type = &typeVar
112 }
113 case "name":
114 if v != nil {
115 var name string
116 err = json.Unmarshal(*v, &name)
117 if err != nil {
118 return err
119 }
120 a.Name = &name
121 }
122 }
123 }
124
125 return nil
126 }
127
128
129 type AcceptorProperties struct {
130
131 Source *PortReference `json:"source,omitempty"`
132
133 Destination *ProcessReference `json:"destination,omitempty"`
134
135 StartTime *date.Time `json:"startTime,omitempty"`
136
137 EndTime *date.Time `json:"endTime,omitempty"`
138 }
139
140
141 type AgentConfiguration struct {
142
143 AgentID *string `json:"agentId,omitempty"`
144
145 DependencyAgentID *string `json:"dependencyAgentId,omitempty"`
146
147 DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"`
148
149 DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"`
150
151 RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"`
152
153 ClockGranularity *int32 `json:"clockGranularity,omitempty"`
154 }
155
156
157 type AzureCloudServiceConfiguration struct {
158
159 Name *string `json:"name,omitempty"`
160
161 InstanceID *string `json:"instanceId,omitempty"`
162
163 Deployment *string `json:"deployment,omitempty"`
164
165 RoleName *string `json:"roleName,omitempty"`
166
167 RoleType AzureCloudServiceRoleType `json:"roleType,omitempty"`
168 }
169
170
171 type AzureHostingConfiguration struct {
172
173 VMID *string `json:"vmId,omitempty"`
174
175 Location *string `json:"location,omitempty"`
176
177 Name *string `json:"name,omitempty"`
178
179 Size *string `json:"size,omitempty"`
180
181 UpdateDomain *string `json:"updateDomain,omitempty"`
182
183 FaultDomain *string `json:"faultDomain,omitempty"`
184
185 SubscriptionID *string `json:"subscriptionId,omitempty"`
186
187 ResourceGroup *string `json:"resourceGroup,omitempty"`
188
189 ResourceID *string `json:"resourceId,omitempty"`
190
191 Image *ImageConfiguration `json:"image,omitempty"`
192
193 CloudService *AzureCloudServiceConfiguration `json:"cloudService,omitempty"`
194
195 VMScaleSet *AzureVMScaleSetConfiguration `json:"vmScaleSet,omitempty"`
196
197 ServiceFabricCluster *AzureServiceFabricClusterConfiguration `json:"serviceFabricCluster,omitempty"`
198
199 Provider Provider `json:"provider,omitempty"`
200
201 Kind KindBasicHostingConfiguration `json:"kind,omitempty"`
202 }
203
204
205 func (ahc AzureHostingConfiguration) MarshalJSON() ([]byte, error) {
206 ahc.Kind = KindProviderazure
207 objectMap := make(map[string]interface{})
208 if ahc.VMID != nil {
209 objectMap["vmId"] = ahc.VMID
210 }
211 if ahc.Location != nil {
212 objectMap["location"] = ahc.Location
213 }
214 if ahc.Name != nil {
215 objectMap["name"] = ahc.Name
216 }
217 if ahc.Size != nil {
218 objectMap["size"] = ahc.Size
219 }
220 if ahc.UpdateDomain != nil {
221 objectMap["updateDomain"] = ahc.UpdateDomain
222 }
223 if ahc.FaultDomain != nil {
224 objectMap["faultDomain"] = ahc.FaultDomain
225 }
226 if ahc.SubscriptionID != nil {
227 objectMap["subscriptionId"] = ahc.SubscriptionID
228 }
229 if ahc.ResourceGroup != nil {
230 objectMap["resourceGroup"] = ahc.ResourceGroup
231 }
232 if ahc.ResourceID != nil {
233 objectMap["resourceId"] = ahc.ResourceID
234 }
235 if ahc.Image != nil {
236 objectMap["image"] = ahc.Image
237 }
238 if ahc.CloudService != nil {
239 objectMap["cloudService"] = ahc.CloudService
240 }
241 if ahc.VMScaleSet != nil {
242 objectMap["vmScaleSet"] = ahc.VMScaleSet
243 }
244 if ahc.ServiceFabricCluster != nil {
245 objectMap["serviceFabricCluster"] = ahc.ServiceFabricCluster
246 }
247 if ahc.Provider != "" {
248 objectMap["provider"] = ahc.Provider
249 }
250 if ahc.Kind != "" {
251 objectMap["kind"] = ahc.Kind
252 }
253 return json.Marshal(objectMap)
254 }
255
256
257 func (ahc AzureHostingConfiguration) AsAzureHostingConfiguration() (*AzureHostingConfiguration, bool) {
258 return &ahc, true
259 }
260
261
262 func (ahc AzureHostingConfiguration) AsHostingConfiguration() (*HostingConfiguration, bool) {
263 return nil, false
264 }
265
266
267 func (ahc AzureHostingConfiguration) AsBasicHostingConfiguration() (BasicHostingConfiguration, bool) {
268 return &ahc, true
269 }
270
271
272 type AzureProcessHostingConfiguration struct {
273
274 CloudService *AzureCloudServiceConfiguration `json:"cloudService,omitempty"`
275
276 Provider Provider1 `json:"provider,omitempty"`
277
278 Kind KindBasicProcessHostingConfiguration `json:"kind,omitempty"`
279 }
280
281
282 func (aphc AzureProcessHostingConfiguration) MarshalJSON() ([]byte, error) {
283 aphc.Kind = KindBasicProcessHostingConfigurationKindProviderazure
284 objectMap := make(map[string]interface{})
285 if aphc.CloudService != nil {
286 objectMap["cloudService"] = aphc.CloudService
287 }
288 if aphc.Provider != "" {
289 objectMap["provider"] = aphc.Provider
290 }
291 if aphc.Kind != "" {
292 objectMap["kind"] = aphc.Kind
293 }
294 return json.Marshal(objectMap)
295 }
296
297
298 func (aphc AzureProcessHostingConfiguration) AsAzureProcessHostingConfiguration() (*AzureProcessHostingConfiguration, bool) {
299 return &aphc, true
300 }
301
302
303 func (aphc AzureProcessHostingConfiguration) AsProcessHostingConfiguration() (*ProcessHostingConfiguration, bool) {
304 return nil, false
305 }
306
307
308 func (aphc AzureProcessHostingConfiguration) AsBasicProcessHostingConfiguration() (BasicProcessHostingConfiguration, bool) {
309 return &aphc, true
310 }
311
312
313 type AzureServiceFabricClusterConfiguration struct {
314
315 Name *string `json:"name,omitempty"`
316
317 ClusterID *string `json:"clusterId,omitempty"`
318 }
319
320
321 type AzureVMScaleSetConfiguration struct {
322
323 Name *string `json:"name,omitempty"`
324
325 InstanceID *string `json:"instanceId,omitempty"`
326
327 Deployment *string `json:"deployment,omitempty"`
328
329 ResourceID *string `json:"resourceId,omitempty"`
330 }
331
332
333
334 type ClientGroup struct {
335 autorest.Response `json:"-"`
336
337 *ClientGroupProperties `json:"properties,omitempty"`
338
339 Etag *string `json:"etag,omitempty"`
340
341 ID *string `json:"id,omitempty"`
342
343 Type *string `json:"type,omitempty"`
344
345 Name *string `json:"name,omitempty"`
346
347 Kind KindBasicCoreResource `json:"kind,omitempty"`
348 }
349
350
351 func (cg ClientGroup) MarshalJSON() ([]byte, error) {
352 cg.Kind = KindClientGroup
353 objectMap := make(map[string]interface{})
354 if cg.ClientGroupProperties != nil {
355 objectMap["properties"] = cg.ClientGroupProperties
356 }
357 if cg.Etag != nil {
358 objectMap["etag"] = cg.Etag
359 }
360 if cg.Kind != "" {
361 objectMap["kind"] = cg.Kind
362 }
363 return json.Marshal(objectMap)
364 }
365
366
367 func (cg ClientGroup) AsMachine() (*Machine, bool) {
368 return nil, false
369 }
370
371
372 func (cg ClientGroup) AsProcess() (*Process, bool) {
373 return nil, false
374 }
375
376
377 func (cg ClientGroup) AsPort() (*Port, bool) {
378 return nil, false
379 }
380
381
382 func (cg ClientGroup) AsClientGroup() (*ClientGroup, bool) {
383 return &cg, true
384 }
385
386
387 func (cg ClientGroup) AsMachineGroup() (*MachineGroup, bool) {
388 return nil, false
389 }
390
391
392 func (cg ClientGroup) AsCoreResource() (*CoreResource, bool) {
393 return nil, false
394 }
395
396
397 func (cg ClientGroup) AsBasicCoreResource() (BasicCoreResource, bool) {
398 return &cg, true
399 }
400
401
402 func (cg *ClientGroup) UnmarshalJSON(body []byte) error {
403 var m map[string]*json.RawMessage
404 err := json.Unmarshal(body, &m)
405 if err != nil {
406 return err
407 }
408 for k, v := range m {
409 switch k {
410 case "properties":
411 if v != nil {
412 var clientGroupProperties ClientGroupProperties
413 err = json.Unmarshal(*v, &clientGroupProperties)
414 if err != nil {
415 return err
416 }
417 cg.ClientGroupProperties = &clientGroupProperties
418 }
419 case "etag":
420 if v != nil {
421 var etag string
422 err = json.Unmarshal(*v, &etag)
423 if err != nil {
424 return err
425 }
426 cg.Etag = &etag
427 }
428 case "kind":
429 if v != nil {
430 var kind KindBasicCoreResource
431 err = json.Unmarshal(*v, &kind)
432 if err != nil {
433 return err
434 }
435 cg.Kind = kind
436 }
437 case "id":
438 if v != nil {
439 var ID string
440 err = json.Unmarshal(*v, &ID)
441 if err != nil {
442 return err
443 }
444 cg.ID = &ID
445 }
446 case "type":
447 if v != nil {
448 var typeVar string
449 err = json.Unmarshal(*v, &typeVar)
450 if err != nil {
451 return err
452 }
453 cg.Type = &typeVar
454 }
455 case "name":
456 if v != nil {
457 var name string
458 err = json.Unmarshal(*v, &name)
459 if err != nil {
460 return err
461 }
462 cg.Name = &name
463 }
464 }
465 }
466
467 return nil
468 }
469
470
471 type ClientGroupMember struct {
472
473 *ClientGroupMemberProperties `json:"properties,omitempty"`
474
475 ID *string `json:"id,omitempty"`
476
477 Type *string `json:"type,omitempty"`
478
479 Name *string `json:"name,omitempty"`
480 }
481
482
483 func (cgm ClientGroupMember) MarshalJSON() ([]byte, error) {
484 objectMap := make(map[string]interface{})
485 if cgm.ClientGroupMemberProperties != nil {
486 objectMap["properties"] = cgm.ClientGroupMemberProperties
487 }
488 return json.Marshal(objectMap)
489 }
490
491
492 func (cgm *ClientGroupMember) UnmarshalJSON(body []byte) error {
493 var m map[string]*json.RawMessage
494 err := json.Unmarshal(body, &m)
495 if err != nil {
496 return err
497 }
498 for k, v := range m {
499 switch k {
500 case "properties":
501 if v != nil {
502 var clientGroupMemberProperties ClientGroupMemberProperties
503 err = json.Unmarshal(*v, &clientGroupMemberProperties)
504 if err != nil {
505 return err
506 }
507 cgm.ClientGroupMemberProperties = &clientGroupMemberProperties
508 }
509 case "id":
510 if v != nil {
511 var ID string
512 err = json.Unmarshal(*v, &ID)
513 if err != nil {
514 return err
515 }
516 cgm.ID = &ID
517 }
518 case "type":
519 if v != nil {
520 var typeVar string
521 err = json.Unmarshal(*v, &typeVar)
522 if err != nil {
523 return err
524 }
525 cgm.Type = &typeVar
526 }
527 case "name":
528 if v != nil {
529 var name string
530 err = json.Unmarshal(*v, &name)
531 if err != nil {
532 return err
533 }
534 cgm.Name = &name
535 }
536 }
537 }
538
539 return nil
540 }
541
542
543 type ClientGroupMemberProperties struct {
544
545 IPAddress *string `json:"ipAddress,omitempty"`
546
547 Port *PortReference `json:"port,omitempty"`
548
549 Processes *[]ProcessReference `json:"processes,omitempty"`
550 }
551
552
553 type ClientGroupMembersCollection struct {
554 autorest.Response `json:"-"`
555
556 Value *[]ClientGroupMember `json:"value,omitempty"`
557
558 NextLink *string `json:"nextLink,omitempty"`
559 }
560
561
562 type ClientGroupMembersCollectionIterator struct {
563 i int
564 page ClientGroupMembersCollectionPage
565 }
566
567
568
569 func (iter *ClientGroupMembersCollectionIterator) NextWithContext(ctx context.Context) (err error) {
570 if tracing.IsEnabled() {
571 ctx = tracing.StartSpan(ctx, fqdn+"/ClientGroupMembersCollectionIterator.NextWithContext")
572 defer func() {
573 sc := -1
574 if iter.Response().Response.Response != nil {
575 sc = iter.Response().Response.Response.StatusCode
576 }
577 tracing.EndSpan(ctx, sc, err)
578 }()
579 }
580 iter.i++
581 if iter.i < len(iter.page.Values()) {
582 return nil
583 }
584 err = iter.page.NextWithContext(ctx)
585 if err != nil {
586 iter.i--
587 return err
588 }
589 iter.i = 0
590 return nil
591 }
592
593
594
595
596 func (iter *ClientGroupMembersCollectionIterator) Next() error {
597 return iter.NextWithContext(context.Background())
598 }
599
600
601 func (iter ClientGroupMembersCollectionIterator) NotDone() bool {
602 return iter.page.NotDone() && iter.i < len(iter.page.Values())
603 }
604
605
606 func (iter ClientGroupMembersCollectionIterator) Response() ClientGroupMembersCollection {
607 return iter.page.Response()
608 }
609
610
611
612 func (iter ClientGroupMembersCollectionIterator) Value() ClientGroupMember {
613 if !iter.page.NotDone() {
614 return ClientGroupMember{}
615 }
616 return iter.page.Values()[iter.i]
617 }
618
619
620 func NewClientGroupMembersCollectionIterator(page ClientGroupMembersCollectionPage) ClientGroupMembersCollectionIterator {
621 return ClientGroupMembersCollectionIterator{page: page}
622 }
623
624
625 func (cgmc ClientGroupMembersCollection) IsEmpty() bool {
626 return cgmc.Value == nil || len(*cgmc.Value) == 0
627 }
628
629
630 func (cgmc ClientGroupMembersCollection) hasNextLink() bool {
631 return cgmc.NextLink != nil && len(*cgmc.NextLink) != 0
632 }
633
634
635
636 func (cgmc ClientGroupMembersCollection) clientGroupMembersCollectionPreparer(ctx context.Context) (*http.Request, error) {
637 if !cgmc.hasNextLink() {
638 return nil, nil
639 }
640 return autorest.Prepare((&http.Request{}).WithContext(ctx),
641 autorest.AsJSON(),
642 autorest.AsGet(),
643 autorest.WithBaseURL(to.String(cgmc.NextLink)))
644 }
645
646
647 type ClientGroupMembersCollectionPage struct {
648 fn func(context.Context, ClientGroupMembersCollection) (ClientGroupMembersCollection, error)
649 cgmc ClientGroupMembersCollection
650 }
651
652
653
654 func (page *ClientGroupMembersCollectionPage) NextWithContext(ctx context.Context) (err error) {
655 if tracing.IsEnabled() {
656 ctx = tracing.StartSpan(ctx, fqdn+"/ClientGroupMembersCollectionPage.NextWithContext")
657 defer func() {
658 sc := -1
659 if page.Response().Response.Response != nil {
660 sc = page.Response().Response.Response.StatusCode
661 }
662 tracing.EndSpan(ctx, sc, err)
663 }()
664 }
665 for {
666 next, err := page.fn(ctx, page.cgmc)
667 if err != nil {
668 return err
669 }
670 page.cgmc = next
671 if !next.hasNextLink() || !next.IsEmpty() {
672 break
673 }
674 }
675 return nil
676 }
677
678
679
680
681 func (page *ClientGroupMembersCollectionPage) Next() error {
682 return page.NextWithContext(context.Background())
683 }
684
685
686 func (page ClientGroupMembersCollectionPage) NotDone() bool {
687 return !page.cgmc.IsEmpty()
688 }
689
690
691 func (page ClientGroupMembersCollectionPage) Response() ClientGroupMembersCollection {
692 return page.cgmc
693 }
694
695
696 func (page ClientGroupMembersCollectionPage) Values() []ClientGroupMember {
697 if page.cgmc.IsEmpty() {
698 return nil
699 }
700 return *page.cgmc.Value
701 }
702
703
704 func NewClientGroupMembersCollectionPage(cur ClientGroupMembersCollection, getNextPage func(context.Context, ClientGroupMembersCollection) (ClientGroupMembersCollection, error)) ClientGroupMembersCollectionPage {
705 return ClientGroupMembersCollectionPage{
706 fn: getNextPage,
707 cgmc: cur,
708 }
709 }
710
711
712 type ClientGroupMembersCount struct {
713 autorest.Response `json:"-"`
714
715 StartTime *date.Time `json:"startTime,omitempty"`
716
717 EndTime *date.Time `json:"endTime,omitempty"`
718
719 GroupID *string `json:"groupId,omitempty"`
720
721 Count *int32 `json:"count,omitempty"`
722
723 Accuracy Accuracy `json:"accuracy,omitempty"`
724 }
725
726
727 type ClientGroupProperties struct {
728
729 ClientsOf BasicResourceReference `json:"clientsOf,omitempty"`
730 }
731
732
733 func (cg *ClientGroupProperties) UnmarshalJSON(body []byte) error {
734 var m map[string]*json.RawMessage
735 err := json.Unmarshal(body, &m)
736 if err != nil {
737 return err
738 }
739 for k, v := range m {
740 switch k {
741 case "clientsOf":
742 if v != nil {
743 clientsOf, err := unmarshalBasicResourceReference(*v)
744 if err != nil {
745 return err
746 }
747 cg.ClientsOf = clientsOf
748 }
749 }
750 }
751
752 return nil
753 }
754
755
756 type ClientGroupReference struct {
757
758 ID *string `json:"id,omitempty"`
759
760 Type *string `json:"type,omitempty"`
761
762 Name *string `json:"name,omitempty"`
763
764 Kind Kind `json:"kind,omitempty"`
765 }
766
767
768 func (cgr ClientGroupReference) MarshalJSON() ([]byte, error) {
769 cgr.Kind = KindRefclientgroup
770 objectMap := make(map[string]interface{})
771 if cgr.ID != nil {
772 objectMap["id"] = cgr.ID
773 }
774 if cgr.Kind != "" {
775 objectMap["kind"] = cgr.Kind
776 }
777 return json.Marshal(objectMap)
778 }
779
780
781 func (cgr ClientGroupReference) AsMachineReference() (*MachineReference, bool) {
782 return nil, false
783 }
784
785
786 func (cgr ClientGroupReference) AsProcessReference() (*ProcessReference, bool) {
787 return nil, false
788 }
789
790
791 func (cgr ClientGroupReference) AsPortReference() (*PortReference, bool) {
792 return nil, false
793 }
794
795
796 func (cgr ClientGroupReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
797 return nil, false
798 }
799
800
801 func (cgr ClientGroupReference) AsClientGroupReference() (*ClientGroupReference, bool) {
802 return &cgr, true
803 }
804
805
806 func (cgr ClientGroupReference) AsResourceReference() (*ResourceReference, bool) {
807 return nil, false
808 }
809
810
811 func (cgr ClientGroupReference) AsBasicResourceReference() (BasicResourceReference, bool) {
812 return &cgr, true
813 }
814
815
816 type Connection struct {
817 *ConnectionProperties `json:"properties,omitempty"`
818
819 Kind KindBasicRelationship `json:"kind,omitempty"`
820
821 ID *string `json:"id,omitempty"`
822
823 Type *string `json:"type,omitempty"`
824
825 Name *string `json:"name,omitempty"`
826 }
827
828
829 func (c Connection) MarshalJSON() ([]byte, error) {
830 c.Kind = KindRelconnection
831 objectMap := make(map[string]interface{})
832 if c.ConnectionProperties != nil {
833 objectMap["properties"] = c.ConnectionProperties
834 }
835 if c.Kind != "" {
836 objectMap["kind"] = c.Kind
837 }
838 return json.Marshal(objectMap)
839 }
840
841
842 func (c Connection) AsConnection() (*Connection, bool) {
843 return &c, true
844 }
845
846
847 func (c Connection) AsAcceptor() (*Acceptor, bool) {
848 return nil, false
849 }
850
851
852 func (c Connection) AsRelationship() (*Relationship, bool) {
853 return nil, false
854 }
855
856
857 func (c Connection) AsBasicRelationship() (BasicRelationship, bool) {
858 return &c, true
859 }
860
861
862 func (c *Connection) UnmarshalJSON(body []byte) error {
863 var m map[string]*json.RawMessage
864 err := json.Unmarshal(body, &m)
865 if err != nil {
866 return err
867 }
868 for k, v := range m {
869 switch k {
870 case "properties":
871 if v != nil {
872 var connectionProperties ConnectionProperties
873 err = json.Unmarshal(*v, &connectionProperties)
874 if err != nil {
875 return err
876 }
877 c.ConnectionProperties = &connectionProperties
878 }
879 case "kind":
880 if v != nil {
881 var kind KindBasicRelationship
882 err = json.Unmarshal(*v, &kind)
883 if err != nil {
884 return err
885 }
886 c.Kind = kind
887 }
888 case "id":
889 if v != nil {
890 var ID string
891 err = json.Unmarshal(*v, &ID)
892 if err != nil {
893 return err
894 }
895 c.ID = &ID
896 }
897 case "type":
898 if v != nil {
899 var typeVar string
900 err = json.Unmarshal(*v, &typeVar)
901 if err != nil {
902 return err
903 }
904 c.Type = &typeVar
905 }
906 case "name":
907 if v != nil {
908 var name string
909 err = json.Unmarshal(*v, &name)
910 if err != nil {
911 return err
912 }
913 c.Name = &name
914 }
915 }
916 }
917
918 return nil
919 }
920
921
922 type ConnectionCollection struct {
923 autorest.Response `json:"-"`
924
925 Value *[]Connection `json:"value,omitempty"`
926
927 NextLink *string `json:"nextLink,omitempty"`
928 }
929
930
931 type ConnectionCollectionIterator struct {
932 i int
933 page ConnectionCollectionPage
934 }
935
936
937
938 func (iter *ConnectionCollectionIterator) NextWithContext(ctx context.Context) (err error) {
939 if tracing.IsEnabled() {
940 ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionCollectionIterator.NextWithContext")
941 defer func() {
942 sc := -1
943 if iter.Response().Response.Response != nil {
944 sc = iter.Response().Response.Response.StatusCode
945 }
946 tracing.EndSpan(ctx, sc, err)
947 }()
948 }
949 iter.i++
950 if iter.i < len(iter.page.Values()) {
951 return nil
952 }
953 err = iter.page.NextWithContext(ctx)
954 if err != nil {
955 iter.i--
956 return err
957 }
958 iter.i = 0
959 return nil
960 }
961
962
963
964
965 func (iter *ConnectionCollectionIterator) Next() error {
966 return iter.NextWithContext(context.Background())
967 }
968
969
970 func (iter ConnectionCollectionIterator) NotDone() bool {
971 return iter.page.NotDone() && iter.i < len(iter.page.Values())
972 }
973
974
975 func (iter ConnectionCollectionIterator) Response() ConnectionCollection {
976 return iter.page.Response()
977 }
978
979
980
981 func (iter ConnectionCollectionIterator) Value() Connection {
982 if !iter.page.NotDone() {
983 return Connection{}
984 }
985 return iter.page.Values()[iter.i]
986 }
987
988
989 func NewConnectionCollectionIterator(page ConnectionCollectionPage) ConnectionCollectionIterator {
990 return ConnectionCollectionIterator{page: page}
991 }
992
993
994 func (cc ConnectionCollection) IsEmpty() bool {
995 return cc.Value == nil || len(*cc.Value) == 0
996 }
997
998
999 func (cc ConnectionCollection) hasNextLink() bool {
1000 return cc.NextLink != nil && len(*cc.NextLink) != 0
1001 }
1002
1003
1004
1005 func (cc ConnectionCollection) connectionCollectionPreparer(ctx context.Context) (*http.Request, error) {
1006 if !cc.hasNextLink() {
1007 return nil, nil
1008 }
1009 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1010 autorest.AsJSON(),
1011 autorest.AsGet(),
1012 autorest.WithBaseURL(to.String(cc.NextLink)))
1013 }
1014
1015
1016 type ConnectionCollectionPage struct {
1017 fn func(context.Context, ConnectionCollection) (ConnectionCollection, error)
1018 cc ConnectionCollection
1019 }
1020
1021
1022
1023 func (page *ConnectionCollectionPage) NextWithContext(ctx context.Context) (err error) {
1024 if tracing.IsEnabled() {
1025 ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionCollectionPage.NextWithContext")
1026 defer func() {
1027 sc := -1
1028 if page.Response().Response.Response != nil {
1029 sc = page.Response().Response.Response.StatusCode
1030 }
1031 tracing.EndSpan(ctx, sc, err)
1032 }()
1033 }
1034 for {
1035 next, err := page.fn(ctx, page.cc)
1036 if err != nil {
1037 return err
1038 }
1039 page.cc = next
1040 if !next.hasNextLink() || !next.IsEmpty() {
1041 break
1042 }
1043 }
1044 return nil
1045 }
1046
1047
1048
1049
1050 func (page *ConnectionCollectionPage) Next() error {
1051 return page.NextWithContext(context.Background())
1052 }
1053
1054
1055 func (page ConnectionCollectionPage) NotDone() bool {
1056 return !page.cc.IsEmpty()
1057 }
1058
1059
1060 func (page ConnectionCollectionPage) Response() ConnectionCollection {
1061 return page.cc
1062 }
1063
1064
1065 func (page ConnectionCollectionPage) Values() []Connection {
1066 if page.cc.IsEmpty() {
1067 return nil
1068 }
1069 return *page.cc.Value
1070 }
1071
1072
1073 func NewConnectionCollectionPage(cur ConnectionCollection, getNextPage func(context.Context, ConnectionCollection) (ConnectionCollection, error)) ConnectionCollectionPage {
1074 return ConnectionCollectionPage{
1075 fn: getNextPage,
1076 cc: cur,
1077 }
1078 }
1079
1080
1081 type ConnectionProperties struct {
1082
1083 ServerPort *PortReference `json:"serverPort,omitempty"`
1084
1085 FailureState ConnectionFailureState `json:"failureState,omitempty"`
1086
1087 Source BasicResourceReference `json:"source,omitempty"`
1088
1089 Destination BasicResourceReference `json:"destination,omitempty"`
1090
1091 StartTime *date.Time `json:"startTime,omitempty"`
1092
1093 EndTime *date.Time `json:"endTime,omitempty"`
1094 }
1095
1096
1097 func (cp *ConnectionProperties) UnmarshalJSON(body []byte) error {
1098 var m map[string]*json.RawMessage
1099 err := json.Unmarshal(body, &m)
1100 if err != nil {
1101 return err
1102 }
1103 for k, v := range m {
1104 switch k {
1105 case "serverPort":
1106 if v != nil {
1107 var serverPort PortReference
1108 err = json.Unmarshal(*v, &serverPort)
1109 if err != nil {
1110 return err
1111 }
1112 cp.ServerPort = &serverPort
1113 }
1114 case "failureState":
1115 if v != nil {
1116 var failureState ConnectionFailureState
1117 err = json.Unmarshal(*v, &failureState)
1118 if err != nil {
1119 return err
1120 }
1121 cp.FailureState = failureState
1122 }
1123 case "source":
1124 if v != nil {
1125 source, err := unmarshalBasicResourceReference(*v)
1126 if err != nil {
1127 return err
1128 }
1129 cp.Source = source
1130 }
1131 case "destination":
1132 if v != nil {
1133 destination, err := unmarshalBasicResourceReference(*v)
1134 if err != nil {
1135 return err
1136 }
1137 cp.Destination = destination
1138 }
1139 case "startTime":
1140 if v != nil {
1141 var startTime date.Time
1142 err = json.Unmarshal(*v, &startTime)
1143 if err != nil {
1144 return err
1145 }
1146 cp.StartTime = &startTime
1147 }
1148 case "endTime":
1149 if v != nil {
1150 var endTime date.Time
1151 err = json.Unmarshal(*v, &endTime)
1152 if err != nil {
1153 return err
1154 }
1155 cp.EndTime = &endTime
1156 }
1157 }
1158 }
1159
1160 return nil
1161 }
1162
1163
1164 type BasicCoreResource interface {
1165 AsMachine() (*Machine, bool)
1166 AsProcess() (*Process, bool)
1167 AsPort() (*Port, bool)
1168 AsClientGroup() (*ClientGroup, bool)
1169 AsMachineGroup() (*MachineGroup, bool)
1170 AsCoreResource() (*CoreResource, bool)
1171 }
1172
1173
1174 type CoreResource struct {
1175
1176 Etag *string `json:"etag,omitempty"`
1177
1178 Kind KindBasicCoreResource `json:"kind,omitempty"`
1179
1180 ID *string `json:"id,omitempty"`
1181
1182 Type *string `json:"type,omitempty"`
1183
1184 Name *string `json:"name,omitempty"`
1185 }
1186
1187 func unmarshalBasicCoreResource(body []byte) (BasicCoreResource, error) {
1188 var m map[string]interface{}
1189 err := json.Unmarshal(body, &m)
1190 if err != nil {
1191 return nil, err
1192 }
1193
1194 switch m["kind"] {
1195 case string(KindMachine):
1196 var mVar Machine
1197 err := json.Unmarshal(body, &mVar)
1198 return mVar, err
1199 case string(KindProcess):
1200 var p Process
1201 err := json.Unmarshal(body, &p)
1202 return p, err
1203 case string(KindPort):
1204 var p Port
1205 err := json.Unmarshal(body, &p)
1206 return p, err
1207 case string(KindClientGroup):
1208 var cg ClientGroup
1209 err := json.Unmarshal(body, &cg)
1210 return cg, err
1211 case string(KindMachineGroup):
1212 var mg MachineGroup
1213 err := json.Unmarshal(body, &mg)
1214 return mg, err
1215 default:
1216 var cr CoreResource
1217 err := json.Unmarshal(body, &cr)
1218 return cr, err
1219 }
1220 }
1221 func unmarshalBasicCoreResourceArray(body []byte) ([]BasicCoreResource, error) {
1222 var rawMessages []*json.RawMessage
1223 err := json.Unmarshal(body, &rawMessages)
1224 if err != nil {
1225 return nil, err
1226 }
1227
1228 crArray := make([]BasicCoreResource, len(rawMessages))
1229
1230 for index, rawMessage := range rawMessages {
1231 cr, err := unmarshalBasicCoreResource(*rawMessage)
1232 if err != nil {
1233 return nil, err
1234 }
1235 crArray[index] = cr
1236 }
1237 return crArray, nil
1238 }
1239
1240
1241 func (cr CoreResource) MarshalJSON() ([]byte, error) {
1242 cr.Kind = KindCoreResource
1243 objectMap := make(map[string]interface{})
1244 if cr.Etag != nil {
1245 objectMap["etag"] = cr.Etag
1246 }
1247 if cr.Kind != "" {
1248 objectMap["kind"] = cr.Kind
1249 }
1250 return json.Marshal(objectMap)
1251 }
1252
1253
1254 func (cr CoreResource) AsMachine() (*Machine, bool) {
1255 return nil, false
1256 }
1257
1258
1259 func (cr CoreResource) AsProcess() (*Process, bool) {
1260 return nil, false
1261 }
1262
1263
1264 func (cr CoreResource) AsPort() (*Port, bool) {
1265 return nil, false
1266 }
1267
1268
1269 func (cr CoreResource) AsClientGroup() (*ClientGroup, bool) {
1270 return nil, false
1271 }
1272
1273
1274 func (cr CoreResource) AsMachineGroup() (*MachineGroup, bool) {
1275 return nil, false
1276 }
1277
1278
1279 func (cr CoreResource) AsCoreResource() (*CoreResource, bool) {
1280 return &cr, true
1281 }
1282
1283
1284 func (cr CoreResource) AsBasicCoreResource() (BasicCoreResource, bool) {
1285 return &cr, true
1286 }
1287
1288
1289 type Error struct {
1290
1291 Code *string `json:"code,omitempty"`
1292
1293 Message *string `json:"message,omitempty"`
1294 }
1295
1296
1297 type ErrorResponse struct {
1298
1299 Error *Error `json:"error,omitempty"`
1300 }
1301
1302
1303 type BasicHostingConfiguration interface {
1304 AsAzureHostingConfiguration() (*AzureHostingConfiguration, bool)
1305 AsHostingConfiguration() (*HostingConfiguration, bool)
1306 }
1307
1308
1309 type HostingConfiguration struct {
1310
1311 Provider Provider `json:"provider,omitempty"`
1312
1313 Kind KindBasicHostingConfiguration `json:"kind,omitempty"`
1314 }
1315
1316 func unmarshalBasicHostingConfiguration(body []byte) (BasicHostingConfiguration, error) {
1317 var m map[string]interface{}
1318 err := json.Unmarshal(body, &m)
1319 if err != nil {
1320 return nil, err
1321 }
1322
1323 switch m["kind"] {
1324 case string(KindProviderazure):
1325 var ahc AzureHostingConfiguration
1326 err := json.Unmarshal(body, &ahc)
1327 return ahc, err
1328 default:
1329 var hc HostingConfiguration
1330 err := json.Unmarshal(body, &hc)
1331 return hc, err
1332 }
1333 }
1334 func unmarshalBasicHostingConfigurationArray(body []byte) ([]BasicHostingConfiguration, error) {
1335 var rawMessages []*json.RawMessage
1336 err := json.Unmarshal(body, &rawMessages)
1337 if err != nil {
1338 return nil, err
1339 }
1340
1341 hcArray := make([]BasicHostingConfiguration, len(rawMessages))
1342
1343 for index, rawMessage := range rawMessages {
1344 hc, err := unmarshalBasicHostingConfiguration(*rawMessage)
1345 if err != nil {
1346 return nil, err
1347 }
1348 hcArray[index] = hc
1349 }
1350 return hcArray, nil
1351 }
1352
1353
1354 func (hc HostingConfiguration) MarshalJSON() ([]byte, error) {
1355 hc.Kind = KindHostingConfiguration
1356 objectMap := make(map[string]interface{})
1357 if hc.Provider != "" {
1358 objectMap["provider"] = hc.Provider
1359 }
1360 if hc.Kind != "" {
1361 objectMap["kind"] = hc.Kind
1362 }
1363 return json.Marshal(objectMap)
1364 }
1365
1366
1367 func (hc HostingConfiguration) AsAzureHostingConfiguration() (*AzureHostingConfiguration, bool) {
1368 return nil, false
1369 }
1370
1371
1372 func (hc HostingConfiguration) AsHostingConfiguration() (*HostingConfiguration, bool) {
1373 return &hc, true
1374 }
1375
1376
1377 func (hc HostingConfiguration) AsBasicHostingConfiguration() (BasicHostingConfiguration, bool) {
1378 return &hc, true
1379 }
1380
1381
1382 type HypervisorConfiguration struct {
1383
1384 HypervisorType HypervisorType `json:"hypervisorType,omitempty"`
1385
1386 NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
1387 }
1388
1389
1390 type ImageConfiguration struct {
1391
1392 Publisher *string `json:"publisher,omitempty"`
1393
1394 Offering *string `json:"offering,omitempty"`
1395
1396 Sku *string `json:"sku,omitempty"`
1397
1398 Version *string `json:"version,omitempty"`
1399 }
1400
1401
1402 type Ipv4NetworkInterface struct {
1403
1404 IPAddress *string `json:"ipAddress,omitempty"`
1405
1406 SubnetMask *string `json:"subnetMask,omitempty"`
1407 }
1408
1409
1410 type Ipv6NetworkInterface struct {
1411
1412 IPAddress *string `json:"ipAddress,omitempty"`
1413 }
1414
1415
1416 type Liveness struct {
1417 autorest.Response `json:"-"`
1418
1419 StartTime *date.Time `json:"startTime,omitempty"`
1420
1421 EndTime *date.Time `json:"endTime,omitempty"`
1422
1423 Live *bool `json:"live,omitempty"`
1424 }
1425
1426
1427
1428
1429
1430
1431
1432 type Machine struct {
1433 autorest.Response `json:"-"`
1434
1435 *MachineProperties `json:"properties,omitempty"`
1436
1437 Etag *string `json:"etag,omitempty"`
1438
1439 Kind KindBasicCoreResource `json:"kind,omitempty"`
1440
1441 ID *string `json:"id,omitempty"`
1442
1443 Type *string `json:"type,omitempty"`
1444
1445 Name *string `json:"name,omitempty"`
1446 }
1447
1448
1449 func (mVar Machine) MarshalJSON() ([]byte, error) {
1450 mVar.Kind = KindMachine
1451 objectMap := make(map[string]interface{})
1452 if mVar.MachineProperties != nil {
1453 objectMap["properties"] = mVar.MachineProperties
1454 }
1455 if mVar.Etag != nil {
1456 objectMap["etag"] = mVar.Etag
1457 }
1458 if mVar.Kind != "" {
1459 objectMap["kind"] = mVar.Kind
1460 }
1461 return json.Marshal(objectMap)
1462 }
1463
1464
1465 func (mVar Machine) AsMachine() (*Machine, bool) {
1466 return &mVar, true
1467 }
1468
1469
1470 func (mVar Machine) AsProcess() (*Process, bool) {
1471 return nil, false
1472 }
1473
1474
1475 func (mVar Machine) AsPort() (*Port, bool) {
1476 return nil, false
1477 }
1478
1479
1480 func (mVar Machine) AsClientGroup() (*ClientGroup, bool) {
1481 return nil, false
1482 }
1483
1484
1485 func (mVar Machine) AsMachineGroup() (*MachineGroup, bool) {
1486 return nil, false
1487 }
1488
1489
1490 func (mVar Machine) AsCoreResource() (*CoreResource, bool) {
1491 return nil, false
1492 }
1493
1494
1495 func (mVar Machine) AsBasicCoreResource() (BasicCoreResource, bool) {
1496 return &mVar, true
1497 }
1498
1499
1500 func (mVar *Machine) UnmarshalJSON(body []byte) error {
1501 var m map[string]*json.RawMessage
1502 err := json.Unmarshal(body, &m)
1503 if err != nil {
1504 return err
1505 }
1506 for k, v := range m {
1507 switch k {
1508 case "properties":
1509 if v != nil {
1510 var machineProperties MachineProperties
1511 err = json.Unmarshal(*v, &machineProperties)
1512 if err != nil {
1513 return err
1514 }
1515 mVar.MachineProperties = &machineProperties
1516 }
1517 case "etag":
1518 if v != nil {
1519 var etag string
1520 err = json.Unmarshal(*v, &etag)
1521 if err != nil {
1522 return err
1523 }
1524 mVar.Etag = &etag
1525 }
1526 case "kind":
1527 if v != nil {
1528 var kind KindBasicCoreResource
1529 err = json.Unmarshal(*v, &kind)
1530 if err != nil {
1531 return err
1532 }
1533 mVar.Kind = kind
1534 }
1535 case "id":
1536 if v != nil {
1537 var ID string
1538 err = json.Unmarshal(*v, &ID)
1539 if err != nil {
1540 return err
1541 }
1542 mVar.ID = &ID
1543 }
1544 case "type":
1545 if v != nil {
1546 var typeVar string
1547 err = json.Unmarshal(*v, &typeVar)
1548 if err != nil {
1549 return err
1550 }
1551 mVar.Type = &typeVar
1552 }
1553 case "name":
1554 if v != nil {
1555 var name string
1556 err = json.Unmarshal(*v, &name)
1557 if err != nil {
1558 return err
1559 }
1560 mVar.Name = &name
1561 }
1562 }
1563 }
1564
1565 return nil
1566 }
1567
1568
1569 type MachineCollection struct {
1570 autorest.Response `json:"-"`
1571
1572 Value *[]Machine `json:"value,omitempty"`
1573
1574 NextLink *string `json:"nextLink,omitempty"`
1575 }
1576
1577
1578 type MachineCollectionIterator struct {
1579 i int
1580 page MachineCollectionPage
1581 }
1582
1583
1584
1585 func (iter *MachineCollectionIterator) NextWithContext(ctx context.Context) (err error) {
1586 if tracing.IsEnabled() {
1587 ctx = tracing.StartSpan(ctx, fqdn+"/MachineCollectionIterator.NextWithContext")
1588 defer func() {
1589 sc := -1
1590 if iter.Response().Response.Response != nil {
1591 sc = iter.Response().Response.Response.StatusCode
1592 }
1593 tracing.EndSpan(ctx, sc, err)
1594 }()
1595 }
1596 iter.i++
1597 if iter.i < len(iter.page.Values()) {
1598 return nil
1599 }
1600 err = iter.page.NextWithContext(ctx)
1601 if err != nil {
1602 iter.i--
1603 return err
1604 }
1605 iter.i = 0
1606 return nil
1607 }
1608
1609
1610
1611
1612 func (iter *MachineCollectionIterator) Next() error {
1613 return iter.NextWithContext(context.Background())
1614 }
1615
1616
1617 func (iter MachineCollectionIterator) NotDone() bool {
1618 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1619 }
1620
1621
1622 func (iter MachineCollectionIterator) Response() MachineCollection {
1623 return iter.page.Response()
1624 }
1625
1626
1627
1628 func (iter MachineCollectionIterator) Value() Machine {
1629 if !iter.page.NotDone() {
1630 return Machine{}
1631 }
1632 return iter.page.Values()[iter.i]
1633 }
1634
1635
1636 func NewMachineCollectionIterator(page MachineCollectionPage) MachineCollectionIterator {
1637 return MachineCollectionIterator{page: page}
1638 }
1639
1640
1641 func (mc MachineCollection) IsEmpty() bool {
1642 return mc.Value == nil || len(*mc.Value) == 0
1643 }
1644
1645
1646 func (mc MachineCollection) hasNextLink() bool {
1647 return mc.NextLink != nil && len(*mc.NextLink) != 0
1648 }
1649
1650
1651
1652 func (mc MachineCollection) machineCollectionPreparer(ctx context.Context) (*http.Request, error) {
1653 if !mc.hasNextLink() {
1654 return nil, nil
1655 }
1656 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1657 autorest.AsJSON(),
1658 autorest.AsGet(),
1659 autorest.WithBaseURL(to.String(mc.NextLink)))
1660 }
1661
1662
1663 type MachineCollectionPage struct {
1664 fn func(context.Context, MachineCollection) (MachineCollection, error)
1665 mc MachineCollection
1666 }
1667
1668
1669
1670 func (page *MachineCollectionPage) NextWithContext(ctx context.Context) (err error) {
1671 if tracing.IsEnabled() {
1672 ctx = tracing.StartSpan(ctx, fqdn+"/MachineCollectionPage.NextWithContext")
1673 defer func() {
1674 sc := -1
1675 if page.Response().Response.Response != nil {
1676 sc = page.Response().Response.Response.StatusCode
1677 }
1678 tracing.EndSpan(ctx, sc, err)
1679 }()
1680 }
1681 for {
1682 next, err := page.fn(ctx, page.mc)
1683 if err != nil {
1684 return err
1685 }
1686 page.mc = next
1687 if !next.hasNextLink() || !next.IsEmpty() {
1688 break
1689 }
1690 }
1691 return nil
1692 }
1693
1694
1695
1696
1697 func (page *MachineCollectionPage) Next() error {
1698 return page.NextWithContext(context.Background())
1699 }
1700
1701
1702 func (page MachineCollectionPage) NotDone() bool {
1703 return !page.mc.IsEmpty()
1704 }
1705
1706
1707 func (page MachineCollectionPage) Response() MachineCollection {
1708 return page.mc
1709 }
1710
1711
1712 func (page MachineCollectionPage) Values() []Machine {
1713 if page.mc.IsEmpty() {
1714 return nil
1715 }
1716 return *page.mc.Value
1717 }
1718
1719
1720 func NewMachineCollectionPage(cur MachineCollection, getNextPage func(context.Context, MachineCollection) (MachineCollection, error)) MachineCollectionPage {
1721 return MachineCollectionPage{
1722 fn: getNextPage,
1723 mc: cur,
1724 }
1725 }
1726
1727
1728 type MachineCountsByOperatingSystem struct {
1729
1730 Windows *int32 `json:"windows,omitempty"`
1731
1732 Linux *int32 `json:"linux,omitempty"`
1733 }
1734
1735
1736 type MachineGroup struct {
1737 autorest.Response `json:"-"`
1738
1739 *MachineGroupProperties `json:"properties,omitempty"`
1740
1741 Etag *string `json:"etag,omitempty"`
1742
1743 Kind KindBasicCoreResource `json:"kind,omitempty"`
1744
1745 ID *string `json:"id,omitempty"`
1746
1747 Type *string `json:"type,omitempty"`
1748
1749 Name *string `json:"name,omitempty"`
1750 }
1751
1752
1753 func (mg MachineGroup) MarshalJSON() ([]byte, error) {
1754 mg.Kind = KindMachineGroup
1755 objectMap := make(map[string]interface{})
1756 if mg.MachineGroupProperties != nil {
1757 objectMap["properties"] = mg.MachineGroupProperties
1758 }
1759 if mg.Etag != nil {
1760 objectMap["etag"] = mg.Etag
1761 }
1762 if mg.Kind != "" {
1763 objectMap["kind"] = mg.Kind
1764 }
1765 return json.Marshal(objectMap)
1766 }
1767
1768
1769 func (mg MachineGroup) AsMachine() (*Machine, bool) {
1770 return nil, false
1771 }
1772
1773
1774 func (mg MachineGroup) AsProcess() (*Process, bool) {
1775 return nil, false
1776 }
1777
1778
1779 func (mg MachineGroup) AsPort() (*Port, bool) {
1780 return nil, false
1781 }
1782
1783
1784 func (mg MachineGroup) AsClientGroup() (*ClientGroup, bool) {
1785 return nil, false
1786 }
1787
1788
1789 func (mg MachineGroup) AsMachineGroup() (*MachineGroup, bool) {
1790 return &mg, true
1791 }
1792
1793
1794 func (mg MachineGroup) AsCoreResource() (*CoreResource, bool) {
1795 return nil, false
1796 }
1797
1798
1799 func (mg MachineGroup) AsBasicCoreResource() (BasicCoreResource, bool) {
1800 return &mg, true
1801 }
1802
1803
1804 func (mg *MachineGroup) UnmarshalJSON(body []byte) error {
1805 var m map[string]*json.RawMessage
1806 err := json.Unmarshal(body, &m)
1807 if err != nil {
1808 return err
1809 }
1810 for k, v := range m {
1811 switch k {
1812 case "properties":
1813 if v != nil {
1814 var machineGroupProperties MachineGroupProperties
1815 err = json.Unmarshal(*v, &machineGroupProperties)
1816 if err != nil {
1817 return err
1818 }
1819 mg.MachineGroupProperties = &machineGroupProperties
1820 }
1821 case "etag":
1822 if v != nil {
1823 var etag string
1824 err = json.Unmarshal(*v, &etag)
1825 if err != nil {
1826 return err
1827 }
1828 mg.Etag = &etag
1829 }
1830 case "kind":
1831 if v != nil {
1832 var kind KindBasicCoreResource
1833 err = json.Unmarshal(*v, &kind)
1834 if err != nil {
1835 return err
1836 }
1837 mg.Kind = kind
1838 }
1839 case "id":
1840 if v != nil {
1841 var ID string
1842 err = json.Unmarshal(*v, &ID)
1843 if err != nil {
1844 return err
1845 }
1846 mg.ID = &ID
1847 }
1848 case "type":
1849 if v != nil {
1850 var typeVar string
1851 err = json.Unmarshal(*v, &typeVar)
1852 if err != nil {
1853 return err
1854 }
1855 mg.Type = &typeVar
1856 }
1857 case "name":
1858 if v != nil {
1859 var name string
1860 err = json.Unmarshal(*v, &name)
1861 if err != nil {
1862 return err
1863 }
1864 mg.Name = &name
1865 }
1866 }
1867 }
1868
1869 return nil
1870 }
1871
1872
1873 type MachineGroupCollection struct {
1874 autorest.Response `json:"-"`
1875
1876 Value *[]MachineGroup `json:"value,omitempty"`
1877
1878 NextLink *string `json:"nextLink,omitempty"`
1879 }
1880
1881
1882 type MachineGroupCollectionIterator struct {
1883 i int
1884 page MachineGroupCollectionPage
1885 }
1886
1887
1888
1889 func (iter *MachineGroupCollectionIterator) NextWithContext(ctx context.Context) (err error) {
1890 if tracing.IsEnabled() {
1891 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupCollectionIterator.NextWithContext")
1892 defer func() {
1893 sc := -1
1894 if iter.Response().Response.Response != nil {
1895 sc = iter.Response().Response.Response.StatusCode
1896 }
1897 tracing.EndSpan(ctx, sc, err)
1898 }()
1899 }
1900 iter.i++
1901 if iter.i < len(iter.page.Values()) {
1902 return nil
1903 }
1904 err = iter.page.NextWithContext(ctx)
1905 if err != nil {
1906 iter.i--
1907 return err
1908 }
1909 iter.i = 0
1910 return nil
1911 }
1912
1913
1914
1915
1916 func (iter *MachineGroupCollectionIterator) Next() error {
1917 return iter.NextWithContext(context.Background())
1918 }
1919
1920
1921 func (iter MachineGroupCollectionIterator) NotDone() bool {
1922 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1923 }
1924
1925
1926 func (iter MachineGroupCollectionIterator) Response() MachineGroupCollection {
1927 return iter.page.Response()
1928 }
1929
1930
1931
1932 func (iter MachineGroupCollectionIterator) Value() MachineGroup {
1933 if !iter.page.NotDone() {
1934 return MachineGroup{}
1935 }
1936 return iter.page.Values()[iter.i]
1937 }
1938
1939
1940 func NewMachineGroupCollectionIterator(page MachineGroupCollectionPage) MachineGroupCollectionIterator {
1941 return MachineGroupCollectionIterator{page: page}
1942 }
1943
1944
1945 func (mgc MachineGroupCollection) IsEmpty() bool {
1946 return mgc.Value == nil || len(*mgc.Value) == 0
1947 }
1948
1949
1950 func (mgc MachineGroupCollection) hasNextLink() bool {
1951 return mgc.NextLink != nil && len(*mgc.NextLink) != 0
1952 }
1953
1954
1955
1956 func (mgc MachineGroupCollection) machineGroupCollectionPreparer(ctx context.Context) (*http.Request, error) {
1957 if !mgc.hasNextLink() {
1958 return nil, nil
1959 }
1960 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1961 autorest.AsJSON(),
1962 autorest.AsGet(),
1963 autorest.WithBaseURL(to.String(mgc.NextLink)))
1964 }
1965
1966
1967 type MachineGroupCollectionPage struct {
1968 fn func(context.Context, MachineGroupCollection) (MachineGroupCollection, error)
1969 mgc MachineGroupCollection
1970 }
1971
1972
1973
1974 func (page *MachineGroupCollectionPage) NextWithContext(ctx context.Context) (err error) {
1975 if tracing.IsEnabled() {
1976 ctx = tracing.StartSpan(ctx, fqdn+"/MachineGroupCollectionPage.NextWithContext")
1977 defer func() {
1978 sc := -1
1979 if page.Response().Response.Response != nil {
1980 sc = page.Response().Response.Response.StatusCode
1981 }
1982 tracing.EndSpan(ctx, sc, err)
1983 }()
1984 }
1985 for {
1986 next, err := page.fn(ctx, page.mgc)
1987 if err != nil {
1988 return err
1989 }
1990 page.mgc = next
1991 if !next.hasNextLink() || !next.IsEmpty() {
1992 break
1993 }
1994 }
1995 return nil
1996 }
1997
1998
1999
2000
2001 func (page *MachineGroupCollectionPage) Next() error {
2002 return page.NextWithContext(context.Background())
2003 }
2004
2005
2006 func (page MachineGroupCollectionPage) NotDone() bool {
2007 return !page.mgc.IsEmpty()
2008 }
2009
2010
2011 func (page MachineGroupCollectionPage) Response() MachineGroupCollection {
2012 return page.mgc
2013 }
2014
2015
2016 func (page MachineGroupCollectionPage) Values() []MachineGroup {
2017 if page.mgc.IsEmpty() {
2018 return nil
2019 }
2020 return *page.mgc.Value
2021 }
2022
2023
2024 func NewMachineGroupCollectionPage(cur MachineGroupCollection, getNextPage func(context.Context, MachineGroupCollection) (MachineGroupCollection, error)) MachineGroupCollectionPage {
2025 return MachineGroupCollectionPage{
2026 fn: getNextPage,
2027 mgc: cur,
2028 }
2029 }
2030
2031
2032
2033 type MachineGroupMapRequest struct {
2034
2035 MachineGroupID *string `json:"machineGroupId,omitempty"`
2036
2037 FilterProcesses *bool `json:"filterProcesses,omitempty"`
2038
2039 StartTime *date.Time `json:"startTime,omitempty"`
2040
2041 EndTime *date.Time `json:"endTime,omitempty"`
2042
2043 Kind KindBasicMapRequest `json:"kind,omitempty"`
2044 }
2045
2046
2047 func (mgmr MachineGroupMapRequest) MarshalJSON() ([]byte, error) {
2048 mgmr.Kind = KindMapmachineGroupDependency
2049 objectMap := make(map[string]interface{})
2050 if mgmr.MachineGroupID != nil {
2051 objectMap["machineGroupId"] = mgmr.MachineGroupID
2052 }
2053 if mgmr.FilterProcesses != nil {
2054 objectMap["filterProcesses"] = mgmr.FilterProcesses
2055 }
2056 if mgmr.StartTime != nil {
2057 objectMap["startTime"] = mgmr.StartTime
2058 }
2059 if mgmr.EndTime != nil {
2060 objectMap["endTime"] = mgmr.EndTime
2061 }
2062 if mgmr.Kind != "" {
2063 objectMap["kind"] = mgmr.Kind
2064 }
2065 return json.Marshal(objectMap)
2066 }
2067
2068
2069 func (mgmr MachineGroupMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
2070 return nil, false
2071 }
2072
2073
2074 func (mgmr MachineGroupMapRequest) AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool) {
2075 return nil, false
2076 }
2077
2078
2079 func (mgmr MachineGroupMapRequest) AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool) {
2080 return &mgmr, true
2081 }
2082
2083
2084 func (mgmr MachineGroupMapRequest) AsMachineListMapRequest() (*MachineListMapRequest, bool) {
2085 return nil, false
2086 }
2087
2088
2089 func (mgmr MachineGroupMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
2090 return &mgmr, true
2091 }
2092
2093
2094 func (mgmr MachineGroupMapRequest) AsMapRequest() (*MapRequest, bool) {
2095 return nil, false
2096 }
2097
2098
2099 func (mgmr MachineGroupMapRequest) AsBasicMapRequest() (BasicMapRequest, bool) {
2100 return &mgmr, true
2101 }
2102
2103
2104 type MachineGroupProperties struct {
2105
2106 GroupType MachineGroupType `json:"groupType,omitempty"`
2107
2108 DisplayName *string `json:"displayName,omitempty"`
2109
2110 Count *int32 `json:"count,omitempty"`
2111
2112 Machines *[]MachineReferenceWithHints `json:"machines,omitempty"`
2113 }
2114
2115
2116
2117 type MachineListMapRequest struct {
2118
2119 MachineIds *[]string `json:"machineIds,omitempty"`
2120
2121 FilterProcesses *bool `json:"filterProcesses,omitempty"`
2122
2123 StartTime *date.Time `json:"startTime,omitempty"`
2124
2125 EndTime *date.Time `json:"endTime,omitempty"`
2126
2127 Kind KindBasicMapRequest `json:"kind,omitempty"`
2128 }
2129
2130
2131 func (mlmr MachineListMapRequest) MarshalJSON() ([]byte, error) {
2132 mlmr.Kind = KindMapmachineListDependency
2133 objectMap := make(map[string]interface{})
2134 if mlmr.MachineIds != nil {
2135 objectMap["machineIds"] = mlmr.MachineIds
2136 }
2137 if mlmr.FilterProcesses != nil {
2138 objectMap["filterProcesses"] = mlmr.FilterProcesses
2139 }
2140 if mlmr.StartTime != nil {
2141 objectMap["startTime"] = mlmr.StartTime
2142 }
2143 if mlmr.EndTime != nil {
2144 objectMap["endTime"] = mlmr.EndTime
2145 }
2146 if mlmr.Kind != "" {
2147 objectMap["kind"] = mlmr.Kind
2148 }
2149 return json.Marshal(objectMap)
2150 }
2151
2152
2153 func (mlmr MachineListMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
2154 return nil, false
2155 }
2156
2157
2158 func (mlmr MachineListMapRequest) AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool) {
2159 return nil, false
2160 }
2161
2162
2163 func (mlmr MachineListMapRequest) AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool) {
2164 return &mlmr, true
2165 }
2166
2167
2168 func (mlmr MachineListMapRequest) AsMachineListMapRequest() (*MachineListMapRequest, bool) {
2169 return &mlmr, true
2170 }
2171
2172
2173 func (mlmr MachineListMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
2174 return nil, false
2175 }
2176
2177
2178 func (mlmr MachineListMapRequest) AsMapRequest() (*MapRequest, bool) {
2179 return nil, false
2180 }
2181
2182
2183 func (mlmr MachineListMapRequest) AsBasicMapRequest() (BasicMapRequest, bool) {
2184 return &mlmr, true
2185 }
2186
2187
2188 type MachineProperties struct {
2189
2190 Timestamp *date.Time `json:"timestamp,omitempty"`
2191
2192 MonitoringState MonitoringState `json:"monitoringState,omitempty"`
2193
2194 VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"`
2195
2196 DisplayName *string `json:"displayName,omitempty"`
2197
2198 ComputerName *string `json:"computerName,omitempty"`
2199
2200 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2201
2202 BootTime *date.Time `json:"bootTime,omitempty"`
2203
2204 Timezone *Timezone `json:"timezone,omitempty"`
2205
2206 Agent *AgentConfiguration `json:"agent,omitempty"`
2207
2208 Resources *MachineResourcesConfiguration `json:"resources,omitempty"`
2209
2210 Networking *NetworkConfiguration `json:"networking,omitempty"`
2211
2212 OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"`
2213
2214 VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"`
2215
2216 Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"`
2217
2218 Hosting BasicHostingConfiguration `json:"hosting,omitempty"`
2219 }
2220
2221
2222 func (mVar *MachineProperties) UnmarshalJSON(body []byte) error {
2223 var m map[string]*json.RawMessage
2224 err := json.Unmarshal(body, &m)
2225 if err != nil {
2226 return err
2227 }
2228 for k, v := range m {
2229 switch k {
2230 case "timestamp":
2231 if v != nil {
2232 var timestamp date.Time
2233 err = json.Unmarshal(*v, ×tamp)
2234 if err != nil {
2235 return err
2236 }
2237 mVar.Timestamp = ×tamp
2238 }
2239 case "monitoringState":
2240 if v != nil {
2241 var monitoringState MonitoringState
2242 err = json.Unmarshal(*v, &monitoringState)
2243 if err != nil {
2244 return err
2245 }
2246 mVar.MonitoringState = monitoringState
2247 }
2248 case "virtualizationState":
2249 if v != nil {
2250 var virtualizationState VirtualizationState
2251 err = json.Unmarshal(*v, &virtualizationState)
2252 if err != nil {
2253 return err
2254 }
2255 mVar.VirtualizationState = virtualizationState
2256 }
2257 case "displayName":
2258 if v != nil {
2259 var displayName string
2260 err = json.Unmarshal(*v, &displayName)
2261 if err != nil {
2262 return err
2263 }
2264 mVar.DisplayName = &displayName
2265 }
2266 case "computerName":
2267 if v != nil {
2268 var computerName string
2269 err = json.Unmarshal(*v, &computerName)
2270 if err != nil {
2271 return err
2272 }
2273 mVar.ComputerName = &computerName
2274 }
2275 case "fullyQualifiedDomainName":
2276 if v != nil {
2277 var fullyQualifiedDomainName string
2278 err = json.Unmarshal(*v, &fullyQualifiedDomainName)
2279 if err != nil {
2280 return err
2281 }
2282 mVar.FullyQualifiedDomainName = &fullyQualifiedDomainName
2283 }
2284 case "bootTime":
2285 if v != nil {
2286 var bootTime date.Time
2287 err = json.Unmarshal(*v, &bootTime)
2288 if err != nil {
2289 return err
2290 }
2291 mVar.BootTime = &bootTime
2292 }
2293 case "timezone":
2294 if v != nil {
2295 var timezone Timezone
2296 err = json.Unmarshal(*v, &timezone)
2297 if err != nil {
2298 return err
2299 }
2300 mVar.Timezone = &timezone
2301 }
2302 case "agent":
2303 if v != nil {
2304 var agent AgentConfiguration
2305 err = json.Unmarshal(*v, &agent)
2306 if err != nil {
2307 return err
2308 }
2309 mVar.Agent = &agent
2310 }
2311 case "resources":
2312 if v != nil {
2313 var resources MachineResourcesConfiguration
2314 err = json.Unmarshal(*v, &resources)
2315 if err != nil {
2316 return err
2317 }
2318 mVar.Resources = &resources
2319 }
2320 case "networking":
2321 if v != nil {
2322 var networking NetworkConfiguration
2323 err = json.Unmarshal(*v, &networking)
2324 if err != nil {
2325 return err
2326 }
2327 mVar.Networking = &networking
2328 }
2329 case "operatingSystem":
2330 if v != nil {
2331 var operatingSystem OperatingSystemConfiguration
2332 err = json.Unmarshal(*v, &operatingSystem)
2333 if err != nil {
2334 return err
2335 }
2336 mVar.OperatingSystem = &operatingSystem
2337 }
2338 case "virtualMachine":
2339 if v != nil {
2340 var virtualMachine VirtualMachineConfiguration
2341 err = json.Unmarshal(*v, &virtualMachine)
2342 if err != nil {
2343 return err
2344 }
2345 mVar.VirtualMachine = &virtualMachine
2346 }
2347 case "hypervisor":
2348 if v != nil {
2349 var hypervisor HypervisorConfiguration
2350 err = json.Unmarshal(*v, &hypervisor)
2351 if err != nil {
2352 return err
2353 }
2354 mVar.Hypervisor = &hypervisor
2355 }
2356 case "hosting":
2357 if v != nil {
2358 hosting, err := unmarshalBasicHostingConfiguration(*v)
2359 if err != nil {
2360 return err
2361 }
2362 mVar.Hosting = hosting
2363 }
2364 }
2365 }
2366
2367 return nil
2368 }
2369
2370
2371 type MachineReference struct {
2372
2373 ID *string `json:"id,omitempty"`
2374
2375 Type *string `json:"type,omitempty"`
2376
2377 Name *string `json:"name,omitempty"`
2378
2379 Kind Kind `json:"kind,omitempty"`
2380 }
2381
2382
2383 func (mr MachineReference) MarshalJSON() ([]byte, error) {
2384 mr.Kind = KindRefmachine
2385 objectMap := make(map[string]interface{})
2386 if mr.ID != nil {
2387 objectMap["id"] = mr.ID
2388 }
2389 if mr.Kind != "" {
2390 objectMap["kind"] = mr.Kind
2391 }
2392 return json.Marshal(objectMap)
2393 }
2394
2395
2396 func (mr MachineReference) AsMachineReference() (*MachineReference, bool) {
2397 return &mr, true
2398 }
2399
2400
2401 func (mr MachineReference) AsProcessReference() (*ProcessReference, bool) {
2402 return nil, false
2403 }
2404
2405
2406 func (mr MachineReference) AsPortReference() (*PortReference, bool) {
2407 return nil, false
2408 }
2409
2410
2411 func (mr MachineReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
2412 return nil, false
2413 }
2414
2415
2416 func (mr MachineReference) AsClientGroupReference() (*ClientGroupReference, bool) {
2417 return nil, false
2418 }
2419
2420
2421 func (mr MachineReference) AsResourceReference() (*ResourceReference, bool) {
2422 return nil, false
2423 }
2424
2425
2426 func (mr MachineReference) AsBasicResourceReference() (BasicResourceReference, bool) {
2427 return &mr, true
2428 }
2429
2430
2431 type MachineReferenceWithHints struct {
2432
2433 *MachineReferenceWithHintsProperties `json:"properties,omitempty"`
2434
2435 ID *string `json:"id,omitempty"`
2436
2437 Type *string `json:"type,omitempty"`
2438
2439 Name *string `json:"name,omitempty"`
2440
2441 Kind Kind `json:"kind,omitempty"`
2442 }
2443
2444
2445 func (mrwh MachineReferenceWithHints) MarshalJSON() ([]byte, error) {
2446 mrwh.Kind = KindRefmachinewithhints
2447 objectMap := make(map[string]interface{})
2448 if mrwh.MachineReferenceWithHintsProperties != nil {
2449 objectMap["properties"] = mrwh.MachineReferenceWithHintsProperties
2450 }
2451 if mrwh.ID != nil {
2452 objectMap["id"] = mrwh.ID
2453 }
2454 if mrwh.Kind != "" {
2455 objectMap["kind"] = mrwh.Kind
2456 }
2457 return json.Marshal(objectMap)
2458 }
2459
2460
2461 func (mrwh MachineReferenceWithHints) AsMachineReference() (*MachineReference, bool) {
2462 return nil, false
2463 }
2464
2465
2466 func (mrwh MachineReferenceWithHints) AsProcessReference() (*ProcessReference, bool) {
2467 return nil, false
2468 }
2469
2470
2471 func (mrwh MachineReferenceWithHints) AsPortReference() (*PortReference, bool) {
2472 return nil, false
2473 }
2474
2475
2476 func (mrwh MachineReferenceWithHints) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
2477 return &mrwh, true
2478 }
2479
2480
2481 func (mrwh MachineReferenceWithHints) AsClientGroupReference() (*ClientGroupReference, bool) {
2482 return nil, false
2483 }
2484
2485
2486 func (mrwh MachineReferenceWithHints) AsResourceReference() (*ResourceReference, bool) {
2487 return nil, false
2488 }
2489
2490
2491 func (mrwh MachineReferenceWithHints) AsBasicResourceReference() (BasicResourceReference, bool) {
2492 return &mrwh, true
2493 }
2494
2495
2496 func (mrwh *MachineReferenceWithHints) UnmarshalJSON(body []byte) error {
2497 var m map[string]*json.RawMessage
2498 err := json.Unmarshal(body, &m)
2499 if err != nil {
2500 return err
2501 }
2502 for k, v := range m {
2503 switch k {
2504 case "properties":
2505 if v != nil {
2506 var machineReferenceWithHintsProperties MachineReferenceWithHintsProperties
2507 err = json.Unmarshal(*v, &machineReferenceWithHintsProperties)
2508 if err != nil {
2509 return err
2510 }
2511 mrwh.MachineReferenceWithHintsProperties = &machineReferenceWithHintsProperties
2512 }
2513 case "id":
2514 if v != nil {
2515 var ID string
2516 err = json.Unmarshal(*v, &ID)
2517 if err != nil {
2518 return err
2519 }
2520 mrwh.ID = &ID
2521 }
2522 case "type":
2523 if v != nil {
2524 var typeVar string
2525 err = json.Unmarshal(*v, &typeVar)
2526 if err != nil {
2527 return err
2528 }
2529 mrwh.Type = &typeVar
2530 }
2531 case "name":
2532 if v != nil {
2533 var name string
2534 err = json.Unmarshal(*v, &name)
2535 if err != nil {
2536 return err
2537 }
2538 mrwh.Name = &name
2539 }
2540 case "kind":
2541 if v != nil {
2542 var kind Kind
2543 err = json.Unmarshal(*v, &kind)
2544 if err != nil {
2545 return err
2546 }
2547 mrwh.Kind = kind
2548 }
2549 }
2550 }
2551
2552 return nil
2553 }
2554
2555
2556 type MachineReferenceWithHintsProperties struct {
2557
2558 DisplayNameHint *string `json:"displayNameHint,omitempty"`
2559
2560 OsFamilyHint OperatingSystemFamily `json:"osFamilyHint,omitempty"`
2561 }
2562
2563
2564 func (mrwh MachineReferenceWithHintsProperties) MarshalJSON() ([]byte, error) {
2565 objectMap := make(map[string]interface{})
2566 return json.Marshal(objectMap)
2567 }
2568
2569
2570 type MachineResourcesConfiguration struct {
2571
2572 PhysicalMemory *int32 `json:"physicalMemory,omitempty"`
2573
2574 Cpus *int32 `json:"cpus,omitempty"`
2575
2576 CPUSpeed *int32 `json:"cpuSpeed,omitempty"`
2577
2578 CPUSpeedAccuracy Accuracy `json:"cpuSpeedAccuracy,omitempty"`
2579 }
2580
2581
2582 type MachinesSummary struct {
2583 autorest.Response `json:"-"`
2584 *MachinesSummaryProperties `json:"properties,omitempty"`
2585
2586 ID *string `json:"id,omitempty"`
2587
2588 Type *string `json:"type,omitempty"`
2589
2590 Name *string `json:"name,omitempty"`
2591 }
2592
2593
2594 func (ms MachinesSummary) MarshalJSON() ([]byte, error) {
2595 objectMap := make(map[string]interface{})
2596 if ms.MachinesSummaryProperties != nil {
2597 objectMap["properties"] = ms.MachinesSummaryProperties
2598 }
2599 return json.Marshal(objectMap)
2600 }
2601
2602
2603 func (ms *MachinesSummary) UnmarshalJSON(body []byte) error {
2604 var m map[string]*json.RawMessage
2605 err := json.Unmarshal(body, &m)
2606 if err != nil {
2607 return err
2608 }
2609 for k, v := range m {
2610 switch k {
2611 case "properties":
2612 if v != nil {
2613 var machinesSummaryProperties MachinesSummaryProperties
2614 err = json.Unmarshal(*v, &machinesSummaryProperties)
2615 if err != nil {
2616 return err
2617 }
2618 ms.MachinesSummaryProperties = &machinesSummaryProperties
2619 }
2620 case "id":
2621 if v != nil {
2622 var ID string
2623 err = json.Unmarshal(*v, &ID)
2624 if err != nil {
2625 return err
2626 }
2627 ms.ID = &ID
2628 }
2629 case "type":
2630 if v != nil {
2631 var typeVar string
2632 err = json.Unmarshal(*v, &typeVar)
2633 if err != nil {
2634 return err
2635 }
2636 ms.Type = &typeVar
2637 }
2638 case "name":
2639 if v != nil {
2640 var name string
2641 err = json.Unmarshal(*v, &name)
2642 if err != nil {
2643 return err
2644 }
2645 ms.Name = &name
2646 }
2647 }
2648 }
2649
2650 return nil
2651 }
2652
2653
2654 type MachinesSummaryProperties struct {
2655
2656 Total *int32 `json:"total,omitempty"`
2657
2658 Live *int32 `json:"live,omitempty"`
2659
2660 Os *MachineCountsByOperatingSystem `json:"os,omitempty"`
2661
2662 StartTime *date.Time `json:"startTime,omitempty"`
2663
2664 EndTime *date.Time `json:"endTime,omitempty"`
2665 }
2666
2667
2668 type Map struct {
2669 Nodes *MapNodes `json:"nodes,omitempty"`
2670 Edges *MapEdges `json:"edges,omitempty"`
2671 }
2672
2673
2674 type MapEdges struct {
2675
2676 Connections *[]Connection `json:"connections,omitempty"`
2677
2678 Acceptors *[]Acceptor `json:"acceptors,omitempty"`
2679 }
2680
2681
2682 type MapNodes struct {
2683
2684 Machines *[]Machine `json:"machines,omitempty"`
2685
2686 Processes *[]Process `json:"processes,omitempty"`
2687
2688 Ports *[]Port `json:"ports,omitempty"`
2689
2690 ClientGroups *[]ClientGroup `json:"clientGroups,omitempty"`
2691 }
2692
2693
2694 type BasicMapRequest interface {
2695 AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool)
2696 AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool)
2697 AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool)
2698 AsMachineListMapRequest() (*MachineListMapRequest, bool)
2699 AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool)
2700 AsMapRequest() (*MapRequest, bool)
2701 }
2702
2703
2704 type MapRequest struct {
2705
2706 StartTime *date.Time `json:"startTime,omitempty"`
2707
2708 EndTime *date.Time `json:"endTime,omitempty"`
2709
2710 Kind KindBasicMapRequest `json:"kind,omitempty"`
2711 }
2712
2713 func unmarshalBasicMapRequest(body []byte) (BasicMapRequest, error) {
2714 var m map[string]interface{}
2715 err := json.Unmarshal(body, &m)
2716 if err != nil {
2717 return nil, err
2718 }
2719
2720 switch m["kind"] {
2721 case string(KindMapsingleMachineDependency):
2722 var smdmr SingleMachineDependencyMapRequest
2723 err := json.Unmarshal(body, &smdmr)
2724 return smdmr, err
2725 case string(KindMultipleMachinesMapRequest):
2726 var mmmr MultipleMachinesMapRequest
2727 err := json.Unmarshal(body, &mmmr)
2728 return mmmr, err
2729 case string(KindMapmachineListDependency):
2730 var mlmr MachineListMapRequest
2731 err := json.Unmarshal(body, &mlmr)
2732 return mlmr, err
2733 case string(KindMapmachineGroupDependency):
2734 var mgmr MachineGroupMapRequest
2735 err := json.Unmarshal(body, &mgmr)
2736 return mgmr, err
2737 default:
2738 var mr MapRequest
2739 err := json.Unmarshal(body, &mr)
2740 return mr, err
2741 }
2742 }
2743 func unmarshalBasicMapRequestArray(body []byte) ([]BasicMapRequest, error) {
2744 var rawMessages []*json.RawMessage
2745 err := json.Unmarshal(body, &rawMessages)
2746 if err != nil {
2747 return nil, err
2748 }
2749
2750 mrArray := make([]BasicMapRequest, len(rawMessages))
2751
2752 for index, rawMessage := range rawMessages {
2753 mr, err := unmarshalBasicMapRequest(*rawMessage)
2754 if err != nil {
2755 return nil, err
2756 }
2757 mrArray[index] = mr
2758 }
2759 return mrArray, nil
2760 }
2761
2762
2763 func (mr MapRequest) MarshalJSON() ([]byte, error) {
2764 mr.Kind = KindMapRequest
2765 objectMap := make(map[string]interface{})
2766 if mr.StartTime != nil {
2767 objectMap["startTime"] = mr.StartTime
2768 }
2769 if mr.EndTime != nil {
2770 objectMap["endTime"] = mr.EndTime
2771 }
2772 if mr.Kind != "" {
2773 objectMap["kind"] = mr.Kind
2774 }
2775 return json.Marshal(objectMap)
2776 }
2777
2778
2779 func (mr MapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
2780 return nil, false
2781 }
2782
2783
2784 func (mr MapRequest) AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool) {
2785 return nil, false
2786 }
2787
2788
2789 func (mr MapRequest) AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool) {
2790 return nil, false
2791 }
2792
2793
2794 func (mr MapRequest) AsMachineListMapRequest() (*MachineListMapRequest, bool) {
2795 return nil, false
2796 }
2797
2798
2799 func (mr MapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
2800 return nil, false
2801 }
2802
2803
2804 func (mr MapRequest) AsMapRequest() (*MapRequest, bool) {
2805 return &mr, true
2806 }
2807
2808
2809 func (mr MapRequest) AsBasicMapRequest() (BasicMapRequest, bool) {
2810 return &mr, true
2811 }
2812
2813
2814 type MapResponse struct {
2815 autorest.Response `json:"-"`
2816
2817 StartTime *date.Time `json:"startTime,omitempty"`
2818
2819 EndTime *date.Time `json:"endTime,omitempty"`
2820
2821 Map *Map `json:"map,omitempty"`
2822 }
2823
2824
2825 type BasicMultipleMachinesMapRequest interface {
2826 AsMachineListMapRequest() (*MachineListMapRequest, bool)
2827 AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool)
2828 AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool)
2829 }
2830
2831
2832 type MultipleMachinesMapRequest struct {
2833
2834 FilterProcesses *bool `json:"filterProcesses,omitempty"`
2835
2836 StartTime *date.Time `json:"startTime,omitempty"`
2837
2838 EndTime *date.Time `json:"endTime,omitempty"`
2839
2840 Kind KindBasicMapRequest `json:"kind,omitempty"`
2841 }
2842
2843 func unmarshalBasicMultipleMachinesMapRequest(body []byte) (BasicMultipleMachinesMapRequest, error) {
2844 var m map[string]interface{}
2845 err := json.Unmarshal(body, &m)
2846 if err != nil {
2847 return nil, err
2848 }
2849
2850 switch m["kind"] {
2851 case string(KindMapmachineListDependency):
2852 var mlmr MachineListMapRequest
2853 err := json.Unmarshal(body, &mlmr)
2854 return mlmr, err
2855 case string(KindMapmachineGroupDependency):
2856 var mgmr MachineGroupMapRequest
2857 err := json.Unmarshal(body, &mgmr)
2858 return mgmr, err
2859 default:
2860 var mmmr MultipleMachinesMapRequest
2861 err := json.Unmarshal(body, &mmmr)
2862 return mmmr, err
2863 }
2864 }
2865 func unmarshalBasicMultipleMachinesMapRequestArray(body []byte) ([]BasicMultipleMachinesMapRequest, error) {
2866 var rawMessages []*json.RawMessage
2867 err := json.Unmarshal(body, &rawMessages)
2868 if err != nil {
2869 return nil, err
2870 }
2871
2872 mmmrArray := make([]BasicMultipleMachinesMapRequest, len(rawMessages))
2873
2874 for index, rawMessage := range rawMessages {
2875 mmmr, err := unmarshalBasicMultipleMachinesMapRequest(*rawMessage)
2876 if err != nil {
2877 return nil, err
2878 }
2879 mmmrArray[index] = mmmr
2880 }
2881 return mmmrArray, nil
2882 }
2883
2884
2885 func (mmmr MultipleMachinesMapRequest) MarshalJSON() ([]byte, error) {
2886 mmmr.Kind = KindMultipleMachinesMapRequest
2887 objectMap := make(map[string]interface{})
2888 if mmmr.FilterProcesses != nil {
2889 objectMap["filterProcesses"] = mmmr.FilterProcesses
2890 }
2891 if mmmr.StartTime != nil {
2892 objectMap["startTime"] = mmmr.StartTime
2893 }
2894 if mmmr.EndTime != nil {
2895 objectMap["endTime"] = mmmr.EndTime
2896 }
2897 if mmmr.Kind != "" {
2898 objectMap["kind"] = mmmr.Kind
2899 }
2900 return json.Marshal(objectMap)
2901 }
2902
2903
2904 func (mmmr MultipleMachinesMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
2905 return nil, false
2906 }
2907
2908
2909 func (mmmr MultipleMachinesMapRequest) AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool) {
2910 return &mmmr, true
2911 }
2912
2913
2914 func (mmmr MultipleMachinesMapRequest) AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool) {
2915 return &mmmr, true
2916 }
2917
2918
2919 func (mmmr MultipleMachinesMapRequest) AsMachineListMapRequest() (*MachineListMapRequest, bool) {
2920 return nil, false
2921 }
2922
2923
2924 func (mmmr MultipleMachinesMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
2925 return nil, false
2926 }
2927
2928
2929 func (mmmr MultipleMachinesMapRequest) AsMapRequest() (*MapRequest, bool) {
2930 return nil, false
2931 }
2932
2933
2934 func (mmmr MultipleMachinesMapRequest) AsBasicMapRequest() (BasicMapRequest, bool) {
2935 return &mmmr, true
2936 }
2937
2938
2939 type NetworkConfiguration struct {
2940
2941 Ipv4Interfaces *[]Ipv4NetworkInterface `json:"ipv4Interfaces,omitempty"`
2942
2943 Ipv6Interfaces *[]Ipv6NetworkInterface `json:"ipv6Interfaces,omitempty"`
2944
2945 DefaultIpv4Gateways *[]string `json:"defaultIpv4Gateways,omitempty"`
2946
2947 MacAddresses *[]string `json:"macAddresses,omitempty"`
2948
2949 DNSNames *[]string `json:"dnsNames,omitempty"`
2950 }
2951
2952
2953 type OperatingSystemConfiguration struct {
2954
2955 Family OperatingSystemFamily `json:"family,omitempty"`
2956
2957 FullName *string `json:"fullName,omitempty"`
2958
2959 Bitness Bitness `json:"bitness,omitempty"`
2960 }
2961
2962
2963
2964
2965
2966 type Port struct {
2967 autorest.Response `json:"-"`
2968
2969 *PortProperties `json:"properties,omitempty"`
2970
2971 Etag *string `json:"etag,omitempty"`
2972
2973 Kind KindBasicCoreResource `json:"kind,omitempty"`
2974
2975 ID *string `json:"id,omitempty"`
2976
2977 Type *string `json:"type,omitempty"`
2978
2979 Name *string `json:"name,omitempty"`
2980 }
2981
2982
2983 func (p Port) MarshalJSON() ([]byte, error) {
2984 p.Kind = KindPort
2985 objectMap := make(map[string]interface{})
2986 if p.PortProperties != nil {
2987 objectMap["properties"] = p.PortProperties
2988 }
2989 if p.Etag != nil {
2990 objectMap["etag"] = p.Etag
2991 }
2992 if p.Kind != "" {
2993 objectMap["kind"] = p.Kind
2994 }
2995 return json.Marshal(objectMap)
2996 }
2997
2998
2999 func (p Port) AsMachine() (*Machine, bool) {
3000 return nil, false
3001 }
3002
3003
3004 func (p Port) AsProcess() (*Process, bool) {
3005 return nil, false
3006 }
3007
3008
3009 func (p Port) AsPort() (*Port, bool) {
3010 return &p, true
3011 }
3012
3013
3014 func (p Port) AsClientGroup() (*ClientGroup, bool) {
3015 return nil, false
3016 }
3017
3018
3019 func (p Port) AsMachineGroup() (*MachineGroup, bool) {
3020 return nil, false
3021 }
3022
3023
3024 func (p Port) AsCoreResource() (*CoreResource, bool) {
3025 return nil, false
3026 }
3027
3028
3029 func (p Port) AsBasicCoreResource() (BasicCoreResource, bool) {
3030 return &p, true
3031 }
3032
3033
3034 func (p *Port) UnmarshalJSON(body []byte) error {
3035 var m map[string]*json.RawMessage
3036 err := json.Unmarshal(body, &m)
3037 if err != nil {
3038 return err
3039 }
3040 for k, v := range m {
3041 switch k {
3042 case "properties":
3043 if v != nil {
3044 var portProperties PortProperties
3045 err = json.Unmarshal(*v, &portProperties)
3046 if err != nil {
3047 return err
3048 }
3049 p.PortProperties = &portProperties
3050 }
3051 case "etag":
3052 if v != nil {
3053 var etag string
3054 err = json.Unmarshal(*v, &etag)
3055 if err != nil {
3056 return err
3057 }
3058 p.Etag = &etag
3059 }
3060 case "kind":
3061 if v != nil {
3062 var kind KindBasicCoreResource
3063 err = json.Unmarshal(*v, &kind)
3064 if err != nil {
3065 return err
3066 }
3067 p.Kind = kind
3068 }
3069 case "id":
3070 if v != nil {
3071 var ID string
3072 err = json.Unmarshal(*v, &ID)
3073 if err != nil {
3074 return err
3075 }
3076 p.ID = &ID
3077 }
3078 case "type":
3079 if v != nil {
3080 var typeVar string
3081 err = json.Unmarshal(*v, &typeVar)
3082 if err != nil {
3083 return err
3084 }
3085 p.Type = &typeVar
3086 }
3087 case "name":
3088 if v != nil {
3089 var name string
3090 err = json.Unmarshal(*v, &name)
3091 if err != nil {
3092 return err
3093 }
3094 p.Name = &name
3095 }
3096 }
3097 }
3098
3099 return nil
3100 }
3101
3102
3103 type PortCollection struct {
3104 autorest.Response `json:"-"`
3105
3106 Value *[]Port `json:"value,omitempty"`
3107
3108 NextLink *string `json:"nextLink,omitempty"`
3109 }
3110
3111
3112 type PortCollectionIterator struct {
3113 i int
3114 page PortCollectionPage
3115 }
3116
3117
3118
3119 func (iter *PortCollectionIterator) NextWithContext(ctx context.Context) (err error) {
3120 if tracing.IsEnabled() {
3121 ctx = tracing.StartSpan(ctx, fqdn+"/PortCollectionIterator.NextWithContext")
3122 defer func() {
3123 sc := -1
3124 if iter.Response().Response.Response != nil {
3125 sc = iter.Response().Response.Response.StatusCode
3126 }
3127 tracing.EndSpan(ctx, sc, err)
3128 }()
3129 }
3130 iter.i++
3131 if iter.i < len(iter.page.Values()) {
3132 return nil
3133 }
3134 err = iter.page.NextWithContext(ctx)
3135 if err != nil {
3136 iter.i--
3137 return err
3138 }
3139 iter.i = 0
3140 return nil
3141 }
3142
3143
3144
3145
3146 func (iter *PortCollectionIterator) Next() error {
3147 return iter.NextWithContext(context.Background())
3148 }
3149
3150
3151 func (iter PortCollectionIterator) NotDone() bool {
3152 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3153 }
3154
3155
3156 func (iter PortCollectionIterator) Response() PortCollection {
3157 return iter.page.Response()
3158 }
3159
3160
3161
3162 func (iter PortCollectionIterator) Value() Port {
3163 if !iter.page.NotDone() {
3164 return Port{}
3165 }
3166 return iter.page.Values()[iter.i]
3167 }
3168
3169
3170 func NewPortCollectionIterator(page PortCollectionPage) PortCollectionIterator {
3171 return PortCollectionIterator{page: page}
3172 }
3173
3174
3175 func (pc PortCollection) IsEmpty() bool {
3176 return pc.Value == nil || len(*pc.Value) == 0
3177 }
3178
3179
3180 func (pc PortCollection) hasNextLink() bool {
3181 return pc.NextLink != nil && len(*pc.NextLink) != 0
3182 }
3183
3184
3185
3186 func (pc PortCollection) portCollectionPreparer(ctx context.Context) (*http.Request, error) {
3187 if !pc.hasNextLink() {
3188 return nil, nil
3189 }
3190 return autorest.Prepare((&http.Request{}).WithContext(ctx),
3191 autorest.AsJSON(),
3192 autorest.AsGet(),
3193 autorest.WithBaseURL(to.String(pc.NextLink)))
3194 }
3195
3196
3197 type PortCollectionPage struct {
3198 fn func(context.Context, PortCollection) (PortCollection, error)
3199 pc PortCollection
3200 }
3201
3202
3203
3204 func (page *PortCollectionPage) NextWithContext(ctx context.Context) (err error) {
3205 if tracing.IsEnabled() {
3206 ctx = tracing.StartSpan(ctx, fqdn+"/PortCollectionPage.NextWithContext")
3207 defer func() {
3208 sc := -1
3209 if page.Response().Response.Response != nil {
3210 sc = page.Response().Response.Response.StatusCode
3211 }
3212 tracing.EndSpan(ctx, sc, err)
3213 }()
3214 }
3215 for {
3216 next, err := page.fn(ctx, page.pc)
3217 if err != nil {
3218 return err
3219 }
3220 page.pc = next
3221 if !next.hasNextLink() || !next.IsEmpty() {
3222 break
3223 }
3224 }
3225 return nil
3226 }
3227
3228
3229
3230
3231 func (page *PortCollectionPage) Next() error {
3232 return page.NextWithContext(context.Background())
3233 }
3234
3235
3236 func (page PortCollectionPage) NotDone() bool {
3237 return !page.pc.IsEmpty()
3238 }
3239
3240
3241 func (page PortCollectionPage) Response() PortCollection {
3242 return page.pc
3243 }
3244
3245
3246 func (page PortCollectionPage) Values() []Port {
3247 if page.pc.IsEmpty() {
3248 return nil
3249 }
3250 return *page.pc.Value
3251 }
3252
3253
3254 func NewPortCollectionPage(cur PortCollection, getNextPage func(context.Context, PortCollection) (PortCollection, error)) PortCollectionPage {
3255 return PortCollectionPage{
3256 fn: getNextPage,
3257 pc: cur,
3258 }
3259 }
3260
3261
3262 type PortProperties struct {
3263
3264 MonitoringState MonitoringState `json:"monitoringState,omitempty"`
3265
3266 Machine BasicResourceReference `json:"machine,omitempty"`
3267
3268 DisplayName *string `json:"displayName,omitempty"`
3269
3270 IPAddress *string `json:"ipAddress,omitempty"`
3271
3272 PortNumber *int32 `json:"portNumber,omitempty"`
3273 }
3274
3275
3276 func (p *PortProperties) UnmarshalJSON(body []byte) error {
3277 var m map[string]*json.RawMessage
3278 err := json.Unmarshal(body, &m)
3279 if err != nil {
3280 return err
3281 }
3282 for k, v := range m {
3283 switch k {
3284 case "monitoringState":
3285 if v != nil {
3286 var monitoringState MonitoringState
3287 err = json.Unmarshal(*v, &monitoringState)
3288 if err != nil {
3289 return err
3290 }
3291 p.MonitoringState = monitoringState
3292 }
3293 case "machine":
3294 if v != nil {
3295 machine, err := unmarshalBasicResourceReference(*v)
3296 if err != nil {
3297 return err
3298 }
3299 p.Machine = machine
3300 }
3301 case "displayName":
3302 if v != nil {
3303 var displayName string
3304 err = json.Unmarshal(*v, &displayName)
3305 if err != nil {
3306 return err
3307 }
3308 p.DisplayName = &displayName
3309 }
3310 case "ipAddress":
3311 if v != nil {
3312 var IPAddress string
3313 err = json.Unmarshal(*v, &IPAddress)
3314 if err != nil {
3315 return err
3316 }
3317 p.IPAddress = &IPAddress
3318 }
3319 case "portNumber":
3320 if v != nil {
3321 var portNumber int32
3322 err = json.Unmarshal(*v, &portNumber)
3323 if err != nil {
3324 return err
3325 }
3326 p.PortNumber = &portNumber
3327 }
3328 }
3329 }
3330
3331 return nil
3332 }
3333
3334
3335 type PortReference struct {
3336
3337 *PortReferenceProperties `json:"properties,omitempty"`
3338
3339 ID *string `json:"id,omitempty"`
3340
3341 Type *string `json:"type,omitempty"`
3342
3343 Name *string `json:"name,omitempty"`
3344
3345 Kind Kind `json:"kind,omitempty"`
3346 }
3347
3348
3349 func (pr PortReference) MarshalJSON() ([]byte, error) {
3350 pr.Kind = KindRefport
3351 objectMap := make(map[string]interface{})
3352 if pr.PortReferenceProperties != nil {
3353 objectMap["properties"] = pr.PortReferenceProperties
3354 }
3355 if pr.ID != nil {
3356 objectMap["id"] = pr.ID
3357 }
3358 if pr.Kind != "" {
3359 objectMap["kind"] = pr.Kind
3360 }
3361 return json.Marshal(objectMap)
3362 }
3363
3364
3365 func (pr PortReference) AsMachineReference() (*MachineReference, bool) {
3366 return nil, false
3367 }
3368
3369
3370 func (pr PortReference) AsProcessReference() (*ProcessReference, bool) {
3371 return nil, false
3372 }
3373
3374
3375 func (pr PortReference) AsPortReference() (*PortReference, bool) {
3376 return &pr, true
3377 }
3378
3379
3380 func (pr PortReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
3381 return nil, false
3382 }
3383
3384
3385 func (pr PortReference) AsClientGroupReference() (*ClientGroupReference, bool) {
3386 return nil, false
3387 }
3388
3389
3390 func (pr PortReference) AsResourceReference() (*ResourceReference, bool) {
3391 return nil, false
3392 }
3393
3394
3395 func (pr PortReference) AsBasicResourceReference() (BasicResourceReference, bool) {
3396 return &pr, true
3397 }
3398
3399
3400 func (pr *PortReference) UnmarshalJSON(body []byte) error {
3401 var m map[string]*json.RawMessage
3402 err := json.Unmarshal(body, &m)
3403 if err != nil {
3404 return err
3405 }
3406 for k, v := range m {
3407 switch k {
3408 case "properties":
3409 if v != nil {
3410 var portReferenceProperties PortReferenceProperties
3411 err = json.Unmarshal(*v, &portReferenceProperties)
3412 if err != nil {
3413 return err
3414 }
3415 pr.PortReferenceProperties = &portReferenceProperties
3416 }
3417 case "id":
3418 if v != nil {
3419 var ID string
3420 err = json.Unmarshal(*v, &ID)
3421 if err != nil {
3422 return err
3423 }
3424 pr.ID = &ID
3425 }
3426 case "type":
3427 if v != nil {
3428 var typeVar string
3429 err = json.Unmarshal(*v, &typeVar)
3430 if err != nil {
3431 return err
3432 }
3433 pr.Type = &typeVar
3434 }
3435 case "name":
3436 if v != nil {
3437 var name string
3438 err = json.Unmarshal(*v, &name)
3439 if err != nil {
3440 return err
3441 }
3442 pr.Name = &name
3443 }
3444 case "kind":
3445 if v != nil {
3446 var kind Kind
3447 err = json.Unmarshal(*v, &kind)
3448 if err != nil {
3449 return err
3450 }
3451 pr.Kind = kind
3452 }
3453 }
3454 }
3455
3456 return nil
3457 }
3458
3459
3460 type PortReferenceProperties struct {
3461
3462 Machine *MachineReference `json:"machine,omitempty"`
3463
3464 IPAddress *string `json:"ipAddress,omitempty"`
3465
3466 PortNumber *int32 `json:"portNumber,omitempty"`
3467 }
3468
3469
3470 func (pr PortReferenceProperties) MarshalJSON() ([]byte, error) {
3471 objectMap := make(map[string]interface{})
3472 if pr.PortNumber != nil {
3473 objectMap["portNumber"] = pr.PortNumber
3474 }
3475 return json.Marshal(objectMap)
3476 }
3477
3478
3479
3480
3481
3482
3483
3484 type Process struct {
3485 autorest.Response `json:"-"`
3486
3487 *ProcessProperties `json:"properties,omitempty"`
3488
3489 Etag *string `json:"etag,omitempty"`
3490
3491 Kind KindBasicCoreResource `json:"kind,omitempty"`
3492
3493 ID *string `json:"id,omitempty"`
3494
3495 Type *string `json:"type,omitempty"`
3496
3497 Name *string `json:"name,omitempty"`
3498 }
3499
3500
3501 func (p Process) MarshalJSON() ([]byte, error) {
3502 p.Kind = KindProcess
3503 objectMap := make(map[string]interface{})
3504 if p.ProcessProperties != nil {
3505 objectMap["properties"] = p.ProcessProperties
3506 }
3507 if p.Etag != nil {
3508 objectMap["etag"] = p.Etag
3509 }
3510 if p.Kind != "" {
3511 objectMap["kind"] = p.Kind
3512 }
3513 return json.Marshal(objectMap)
3514 }
3515
3516
3517 func (p Process) AsMachine() (*Machine, bool) {
3518 return nil, false
3519 }
3520
3521
3522 func (p Process) AsProcess() (*Process, bool) {
3523 return &p, true
3524 }
3525
3526
3527 func (p Process) AsPort() (*Port, bool) {
3528 return nil, false
3529 }
3530
3531
3532 func (p Process) AsClientGroup() (*ClientGroup, bool) {
3533 return nil, false
3534 }
3535
3536
3537 func (p Process) AsMachineGroup() (*MachineGroup, bool) {
3538 return nil, false
3539 }
3540
3541
3542 func (p Process) AsCoreResource() (*CoreResource, bool) {
3543 return nil, false
3544 }
3545
3546
3547 func (p Process) AsBasicCoreResource() (BasicCoreResource, bool) {
3548 return &p, true
3549 }
3550
3551
3552 func (p *Process) UnmarshalJSON(body []byte) error {
3553 var m map[string]*json.RawMessage
3554 err := json.Unmarshal(body, &m)
3555 if err != nil {
3556 return err
3557 }
3558 for k, v := range m {
3559 switch k {
3560 case "properties":
3561 if v != nil {
3562 var processProperties ProcessProperties
3563 err = json.Unmarshal(*v, &processProperties)
3564 if err != nil {
3565 return err
3566 }
3567 p.ProcessProperties = &processProperties
3568 }
3569 case "etag":
3570 if v != nil {
3571 var etag string
3572 err = json.Unmarshal(*v, &etag)
3573 if err != nil {
3574 return err
3575 }
3576 p.Etag = &etag
3577 }
3578 case "kind":
3579 if v != nil {
3580 var kind KindBasicCoreResource
3581 err = json.Unmarshal(*v, &kind)
3582 if err != nil {
3583 return err
3584 }
3585 p.Kind = kind
3586 }
3587 case "id":
3588 if v != nil {
3589 var ID string
3590 err = json.Unmarshal(*v, &ID)
3591 if err != nil {
3592 return err
3593 }
3594 p.ID = &ID
3595 }
3596 case "type":
3597 if v != nil {
3598 var typeVar string
3599 err = json.Unmarshal(*v, &typeVar)
3600 if err != nil {
3601 return err
3602 }
3603 p.Type = &typeVar
3604 }
3605 case "name":
3606 if v != nil {
3607 var name string
3608 err = json.Unmarshal(*v, &name)
3609 if err != nil {
3610 return err
3611 }
3612 p.Name = &name
3613 }
3614 }
3615 }
3616
3617 return nil
3618 }
3619
3620
3621 type ProcessCollection struct {
3622 autorest.Response `json:"-"`
3623
3624 Value *[]Process `json:"value,omitempty"`
3625
3626 NextLink *string `json:"nextLink,omitempty"`
3627 }
3628
3629
3630 type ProcessCollectionIterator struct {
3631 i int
3632 page ProcessCollectionPage
3633 }
3634
3635
3636
3637 func (iter *ProcessCollectionIterator) NextWithContext(ctx context.Context) (err error) {
3638 if tracing.IsEnabled() {
3639 ctx = tracing.StartSpan(ctx, fqdn+"/ProcessCollectionIterator.NextWithContext")
3640 defer func() {
3641 sc := -1
3642 if iter.Response().Response.Response != nil {
3643 sc = iter.Response().Response.Response.StatusCode
3644 }
3645 tracing.EndSpan(ctx, sc, err)
3646 }()
3647 }
3648 iter.i++
3649 if iter.i < len(iter.page.Values()) {
3650 return nil
3651 }
3652 err = iter.page.NextWithContext(ctx)
3653 if err != nil {
3654 iter.i--
3655 return err
3656 }
3657 iter.i = 0
3658 return nil
3659 }
3660
3661
3662
3663
3664 func (iter *ProcessCollectionIterator) Next() error {
3665 return iter.NextWithContext(context.Background())
3666 }
3667
3668
3669 func (iter ProcessCollectionIterator) NotDone() bool {
3670 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3671 }
3672
3673
3674 func (iter ProcessCollectionIterator) Response() ProcessCollection {
3675 return iter.page.Response()
3676 }
3677
3678
3679
3680 func (iter ProcessCollectionIterator) Value() Process {
3681 if !iter.page.NotDone() {
3682 return Process{}
3683 }
3684 return iter.page.Values()[iter.i]
3685 }
3686
3687
3688 func NewProcessCollectionIterator(page ProcessCollectionPage) ProcessCollectionIterator {
3689 return ProcessCollectionIterator{page: page}
3690 }
3691
3692
3693 func (pc ProcessCollection) IsEmpty() bool {
3694 return pc.Value == nil || len(*pc.Value) == 0
3695 }
3696
3697
3698 func (pc ProcessCollection) hasNextLink() bool {
3699 return pc.NextLink != nil && len(*pc.NextLink) != 0
3700 }
3701
3702
3703
3704 func (pc ProcessCollection) processCollectionPreparer(ctx context.Context) (*http.Request, error) {
3705 if !pc.hasNextLink() {
3706 return nil, nil
3707 }
3708 return autorest.Prepare((&http.Request{}).WithContext(ctx),
3709 autorest.AsJSON(),
3710 autorest.AsGet(),
3711 autorest.WithBaseURL(to.String(pc.NextLink)))
3712 }
3713
3714
3715 type ProcessCollectionPage struct {
3716 fn func(context.Context, ProcessCollection) (ProcessCollection, error)
3717 pc ProcessCollection
3718 }
3719
3720
3721
3722 func (page *ProcessCollectionPage) NextWithContext(ctx context.Context) (err error) {
3723 if tracing.IsEnabled() {
3724 ctx = tracing.StartSpan(ctx, fqdn+"/ProcessCollectionPage.NextWithContext")
3725 defer func() {
3726 sc := -1
3727 if page.Response().Response.Response != nil {
3728 sc = page.Response().Response.Response.StatusCode
3729 }
3730 tracing.EndSpan(ctx, sc, err)
3731 }()
3732 }
3733 for {
3734 next, err := page.fn(ctx, page.pc)
3735 if err != nil {
3736 return err
3737 }
3738 page.pc = next
3739 if !next.hasNextLink() || !next.IsEmpty() {
3740 break
3741 }
3742 }
3743 return nil
3744 }
3745
3746
3747
3748
3749 func (page *ProcessCollectionPage) Next() error {
3750 return page.NextWithContext(context.Background())
3751 }
3752
3753
3754 func (page ProcessCollectionPage) NotDone() bool {
3755 return !page.pc.IsEmpty()
3756 }
3757
3758
3759 func (page ProcessCollectionPage) Response() ProcessCollection {
3760 return page.pc
3761 }
3762
3763
3764 func (page ProcessCollectionPage) Values() []Process {
3765 if page.pc.IsEmpty() {
3766 return nil
3767 }
3768 return *page.pc.Value
3769 }
3770
3771
3772 func NewProcessCollectionPage(cur ProcessCollection, getNextPage func(context.Context, ProcessCollection) (ProcessCollection, error)) ProcessCollectionPage {
3773 return ProcessCollectionPage{
3774 fn: getNextPage,
3775 pc: cur,
3776 }
3777 }
3778
3779
3780 type ProcessDetails struct {
3781
3782 PersistentKey *string `json:"persistentKey,omitempty"`
3783
3784 PoolID *int32 `json:"poolId,omitempty"`
3785
3786 FirstPid *int32 `json:"firstPid,omitempty"`
3787
3788 Description *string `json:"description,omitempty"`
3789
3790 CompanyName *string `json:"companyName,omitempty"`
3791
3792 InternalName *string `json:"internalName,omitempty"`
3793
3794 ProductName *string `json:"productName,omitempty"`
3795
3796 ProductVersion *string `json:"productVersion,omitempty"`
3797
3798 FileVersion *string `json:"fileVersion,omitempty"`
3799
3800 CommandLine *string `json:"commandLine,omitempty"`
3801
3802 ExecutablePath *string `json:"executablePath,omitempty"`
3803
3804 WorkingDirectory *string `json:"workingDirectory,omitempty"`
3805
3806 Services *[]ProcessHostedService `json:"services,omitempty"`
3807
3808 ZoneName *string `json:"zoneName,omitempty"`
3809 }
3810
3811
3812 type ProcessHostedService struct {
3813
3814 Name *string `json:"name,omitempty"`
3815
3816 DisplayName *string `json:"displayName,omitempty"`
3817 }
3818
3819
3820 type BasicProcessHostingConfiguration interface {
3821 AsAzureProcessHostingConfiguration() (*AzureProcessHostingConfiguration, bool)
3822 AsProcessHostingConfiguration() (*ProcessHostingConfiguration, bool)
3823 }
3824
3825
3826 type ProcessHostingConfiguration struct {
3827
3828 Provider Provider1 `json:"provider,omitempty"`
3829
3830 Kind KindBasicProcessHostingConfiguration `json:"kind,omitempty"`
3831 }
3832
3833 func unmarshalBasicProcessHostingConfiguration(body []byte) (BasicProcessHostingConfiguration, error) {
3834 var m map[string]interface{}
3835 err := json.Unmarshal(body, &m)
3836 if err != nil {
3837 return nil, err
3838 }
3839
3840 switch m["kind"] {
3841 case string(KindBasicProcessHostingConfigurationKindProviderazure):
3842 var aphc AzureProcessHostingConfiguration
3843 err := json.Unmarshal(body, &aphc)
3844 return aphc, err
3845 default:
3846 var phc ProcessHostingConfiguration
3847 err := json.Unmarshal(body, &phc)
3848 return phc, err
3849 }
3850 }
3851 func unmarshalBasicProcessHostingConfigurationArray(body []byte) ([]BasicProcessHostingConfiguration, error) {
3852 var rawMessages []*json.RawMessage
3853 err := json.Unmarshal(body, &rawMessages)
3854 if err != nil {
3855 return nil, err
3856 }
3857
3858 phcArray := make([]BasicProcessHostingConfiguration, len(rawMessages))
3859
3860 for index, rawMessage := range rawMessages {
3861 phc, err := unmarshalBasicProcessHostingConfiguration(*rawMessage)
3862 if err != nil {
3863 return nil, err
3864 }
3865 phcArray[index] = phc
3866 }
3867 return phcArray, nil
3868 }
3869
3870
3871 func (phc ProcessHostingConfiguration) MarshalJSON() ([]byte, error) {
3872 phc.Kind = KindBasicProcessHostingConfigurationKindProcessHostingConfiguration
3873 objectMap := make(map[string]interface{})
3874 if phc.Provider != "" {
3875 objectMap["provider"] = phc.Provider
3876 }
3877 if phc.Kind != "" {
3878 objectMap["kind"] = phc.Kind
3879 }
3880 return json.Marshal(objectMap)
3881 }
3882
3883
3884 func (phc ProcessHostingConfiguration) AsAzureProcessHostingConfiguration() (*AzureProcessHostingConfiguration, bool) {
3885 return nil, false
3886 }
3887
3888
3889 func (phc ProcessHostingConfiguration) AsProcessHostingConfiguration() (*ProcessHostingConfiguration, bool) {
3890 return &phc, true
3891 }
3892
3893
3894 func (phc ProcessHostingConfiguration) AsBasicProcessHostingConfiguration() (BasicProcessHostingConfiguration, bool) {
3895 return &phc, true
3896 }
3897
3898
3899 type ProcessProperties struct {
3900
3901 Timestamp *date.Time `json:"timestamp,omitempty"`
3902
3903 MonitoringState MonitoringState `json:"monitoringState,omitempty"`
3904
3905 Machine BasicResourceReference `json:"machine,omitempty"`
3906
3907 ExecutableName *string `json:"executableName,omitempty"`
3908
3909 DisplayName *string `json:"displayName,omitempty"`
3910
3911 StartTime *date.Time `json:"startTime,omitempty"`
3912
3913 Role ProcessRole `json:"role,omitempty"`
3914
3915 Group *string `json:"group,omitempty"`
3916
3917 Details *ProcessDetails `json:"details,omitempty"`
3918
3919 User *ProcessUser `json:"user,omitempty"`
3920
3921 ClientOf BasicResourceReference `json:"clientOf,omitempty"`
3922
3923 AcceptorOf BasicResourceReference `json:"acceptorOf,omitempty"`
3924
3925 Hosting BasicProcessHostingConfiguration `json:"hosting,omitempty"`
3926 }
3927
3928
3929 func (p *ProcessProperties) UnmarshalJSON(body []byte) error {
3930 var m map[string]*json.RawMessage
3931 err := json.Unmarshal(body, &m)
3932 if err != nil {
3933 return err
3934 }
3935 for k, v := range m {
3936 switch k {
3937 case "timestamp":
3938 if v != nil {
3939 var timestamp date.Time
3940 err = json.Unmarshal(*v, ×tamp)
3941 if err != nil {
3942 return err
3943 }
3944 p.Timestamp = ×tamp
3945 }
3946 case "monitoringState":
3947 if v != nil {
3948 var monitoringState MonitoringState
3949 err = json.Unmarshal(*v, &monitoringState)
3950 if err != nil {
3951 return err
3952 }
3953 p.MonitoringState = monitoringState
3954 }
3955 case "machine":
3956 if v != nil {
3957 machine, err := unmarshalBasicResourceReference(*v)
3958 if err != nil {
3959 return err
3960 }
3961 p.Machine = machine
3962 }
3963 case "executableName":
3964 if v != nil {
3965 var executableName string
3966 err = json.Unmarshal(*v, &executableName)
3967 if err != nil {
3968 return err
3969 }
3970 p.ExecutableName = &executableName
3971 }
3972 case "displayName":
3973 if v != nil {
3974 var displayName string
3975 err = json.Unmarshal(*v, &displayName)
3976 if err != nil {
3977 return err
3978 }
3979 p.DisplayName = &displayName
3980 }
3981 case "startTime":
3982 if v != nil {
3983 var startTime date.Time
3984 err = json.Unmarshal(*v, &startTime)
3985 if err != nil {
3986 return err
3987 }
3988 p.StartTime = &startTime
3989 }
3990 case "role":
3991 if v != nil {
3992 var role ProcessRole
3993 err = json.Unmarshal(*v, &role)
3994 if err != nil {
3995 return err
3996 }
3997 p.Role = role
3998 }
3999 case "group":
4000 if v != nil {
4001 var group string
4002 err = json.Unmarshal(*v, &group)
4003 if err != nil {
4004 return err
4005 }
4006 p.Group = &group
4007 }
4008 case "details":
4009 if v != nil {
4010 var details ProcessDetails
4011 err = json.Unmarshal(*v, &details)
4012 if err != nil {
4013 return err
4014 }
4015 p.Details = &details
4016 }
4017 case "user":
4018 if v != nil {
4019 var userVar ProcessUser
4020 err = json.Unmarshal(*v, &userVar)
4021 if err != nil {
4022 return err
4023 }
4024 p.User = &userVar
4025 }
4026 case "clientOf":
4027 if v != nil {
4028 clientOf, err := unmarshalBasicResourceReference(*v)
4029 if err != nil {
4030 return err
4031 }
4032 p.ClientOf = clientOf
4033 }
4034 case "acceptorOf":
4035 if v != nil {
4036 acceptorOf, err := unmarshalBasicResourceReference(*v)
4037 if err != nil {
4038 return err
4039 }
4040 p.AcceptorOf = acceptorOf
4041 }
4042 case "hosting":
4043 if v != nil {
4044 hosting, err := unmarshalBasicProcessHostingConfiguration(*v)
4045 if err != nil {
4046 return err
4047 }
4048 p.Hosting = hosting
4049 }
4050 }
4051 }
4052
4053 return nil
4054 }
4055
4056
4057 type ProcessReference struct {
4058
4059 *ProcessReferenceProperties `json:"properties,omitempty"`
4060
4061 ID *string `json:"id,omitempty"`
4062
4063 Type *string `json:"type,omitempty"`
4064
4065 Name *string `json:"name,omitempty"`
4066
4067 Kind Kind `json:"kind,omitempty"`
4068 }
4069
4070
4071 func (pr ProcessReference) MarshalJSON() ([]byte, error) {
4072 pr.Kind = KindRefprocess
4073 objectMap := make(map[string]interface{})
4074 if pr.ProcessReferenceProperties != nil {
4075 objectMap["properties"] = pr.ProcessReferenceProperties
4076 }
4077 if pr.ID != nil {
4078 objectMap["id"] = pr.ID
4079 }
4080 if pr.Kind != "" {
4081 objectMap["kind"] = pr.Kind
4082 }
4083 return json.Marshal(objectMap)
4084 }
4085
4086
4087 func (pr ProcessReference) AsMachineReference() (*MachineReference, bool) {
4088 return nil, false
4089 }
4090
4091
4092 func (pr ProcessReference) AsProcessReference() (*ProcessReference, bool) {
4093 return &pr, true
4094 }
4095
4096
4097 func (pr ProcessReference) AsPortReference() (*PortReference, bool) {
4098 return nil, false
4099 }
4100
4101
4102 func (pr ProcessReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
4103 return nil, false
4104 }
4105
4106
4107 func (pr ProcessReference) AsClientGroupReference() (*ClientGroupReference, bool) {
4108 return nil, false
4109 }
4110
4111
4112 func (pr ProcessReference) AsResourceReference() (*ResourceReference, bool) {
4113 return nil, false
4114 }
4115
4116
4117 func (pr ProcessReference) AsBasicResourceReference() (BasicResourceReference, bool) {
4118 return &pr, true
4119 }
4120
4121
4122 func (pr *ProcessReference) UnmarshalJSON(body []byte) error {
4123 var m map[string]*json.RawMessage
4124 err := json.Unmarshal(body, &m)
4125 if err != nil {
4126 return err
4127 }
4128 for k, v := range m {
4129 switch k {
4130 case "properties":
4131 if v != nil {
4132 var processReferenceProperties ProcessReferenceProperties
4133 err = json.Unmarshal(*v, &processReferenceProperties)
4134 if err != nil {
4135 return err
4136 }
4137 pr.ProcessReferenceProperties = &processReferenceProperties
4138 }
4139 case "id":
4140 if v != nil {
4141 var ID string
4142 err = json.Unmarshal(*v, &ID)
4143 if err != nil {
4144 return err
4145 }
4146 pr.ID = &ID
4147 }
4148 case "type":
4149 if v != nil {
4150 var typeVar string
4151 err = json.Unmarshal(*v, &typeVar)
4152 if err != nil {
4153 return err
4154 }
4155 pr.Type = &typeVar
4156 }
4157 case "name":
4158 if v != nil {
4159 var name string
4160 err = json.Unmarshal(*v, &name)
4161 if err != nil {
4162 return err
4163 }
4164 pr.Name = &name
4165 }
4166 case "kind":
4167 if v != nil {
4168 var kind Kind
4169 err = json.Unmarshal(*v, &kind)
4170 if err != nil {
4171 return err
4172 }
4173 pr.Kind = kind
4174 }
4175 }
4176 }
4177
4178 return nil
4179 }
4180
4181
4182 type ProcessReferenceProperties struct {
4183
4184 Machine *MachineReference `json:"machine,omitempty"`
4185 }
4186
4187
4188 func (pr ProcessReferenceProperties) MarshalJSON() ([]byte, error) {
4189 objectMap := make(map[string]interface{})
4190 return json.Marshal(objectMap)
4191 }
4192
4193
4194 type ProcessUser struct {
4195
4196 UserName *string `json:"userName,omitempty"`
4197
4198 UserDomain *string `json:"userDomain,omitempty"`
4199 }
4200
4201
4202 type BasicRelationship interface {
4203 AsConnection() (*Connection, bool)
4204 AsAcceptor() (*Acceptor, bool)
4205 AsRelationship() (*Relationship, bool)
4206 }
4207
4208
4209 type Relationship struct {
4210
4211 Kind KindBasicRelationship `json:"kind,omitempty"`
4212
4213 ID *string `json:"id,omitempty"`
4214
4215 Type *string `json:"type,omitempty"`
4216
4217 Name *string `json:"name,omitempty"`
4218 }
4219
4220 func unmarshalBasicRelationship(body []byte) (BasicRelationship, error) {
4221 var m map[string]interface{}
4222 err := json.Unmarshal(body, &m)
4223 if err != nil {
4224 return nil, err
4225 }
4226
4227 switch m["kind"] {
4228 case string(KindRelconnection):
4229 var c Connection
4230 err := json.Unmarshal(body, &c)
4231 return c, err
4232 case string(KindRelacceptor):
4233 var a Acceptor
4234 err := json.Unmarshal(body, &a)
4235 return a, err
4236 default:
4237 var r Relationship
4238 err := json.Unmarshal(body, &r)
4239 return r, err
4240 }
4241 }
4242 func unmarshalBasicRelationshipArray(body []byte) ([]BasicRelationship, error) {
4243 var rawMessages []*json.RawMessage
4244 err := json.Unmarshal(body, &rawMessages)
4245 if err != nil {
4246 return nil, err
4247 }
4248
4249 rArray := make([]BasicRelationship, len(rawMessages))
4250
4251 for index, rawMessage := range rawMessages {
4252 r, err := unmarshalBasicRelationship(*rawMessage)
4253 if err != nil {
4254 return nil, err
4255 }
4256 rArray[index] = r
4257 }
4258 return rArray, nil
4259 }
4260
4261
4262 func (r Relationship) MarshalJSON() ([]byte, error) {
4263 r.Kind = KindRelationship
4264 objectMap := make(map[string]interface{})
4265 if r.Kind != "" {
4266 objectMap["kind"] = r.Kind
4267 }
4268 return json.Marshal(objectMap)
4269 }
4270
4271
4272 func (r Relationship) AsConnection() (*Connection, bool) {
4273 return nil, false
4274 }
4275
4276
4277 func (r Relationship) AsAcceptor() (*Acceptor, bool) {
4278 return nil, false
4279 }
4280
4281
4282 func (r Relationship) AsRelationship() (*Relationship, bool) {
4283 return &r, true
4284 }
4285
4286
4287 func (r Relationship) AsBasicRelationship() (BasicRelationship, bool) {
4288 return &r, true
4289 }
4290
4291
4292 type RelationshipProperties struct {
4293
4294 Source BasicResourceReference `json:"source,omitempty"`
4295
4296 Destination BasicResourceReference `json:"destination,omitempty"`
4297
4298 StartTime *date.Time `json:"startTime,omitempty"`
4299
4300 EndTime *date.Time `json:"endTime,omitempty"`
4301 }
4302
4303
4304 func (rp *RelationshipProperties) UnmarshalJSON(body []byte) error {
4305 var m map[string]*json.RawMessage
4306 err := json.Unmarshal(body, &m)
4307 if err != nil {
4308 return err
4309 }
4310 for k, v := range m {
4311 switch k {
4312 case "source":
4313 if v != nil {
4314 source, err := unmarshalBasicResourceReference(*v)
4315 if err != nil {
4316 return err
4317 }
4318 rp.Source = source
4319 }
4320 case "destination":
4321 if v != nil {
4322 destination, err := unmarshalBasicResourceReference(*v)
4323 if err != nil {
4324 return err
4325 }
4326 rp.Destination = destination
4327 }
4328 case "startTime":
4329 if v != nil {
4330 var startTime date.Time
4331 err = json.Unmarshal(*v, &startTime)
4332 if err != nil {
4333 return err
4334 }
4335 rp.StartTime = &startTime
4336 }
4337 case "endTime":
4338 if v != nil {
4339 var endTime date.Time
4340 err = json.Unmarshal(*v, &endTime)
4341 if err != nil {
4342 return err
4343 }
4344 rp.EndTime = &endTime
4345 }
4346 }
4347 }
4348
4349 return nil
4350 }
4351
4352
4353 type Resource struct {
4354
4355 ID *string `json:"id,omitempty"`
4356
4357 Type *string `json:"type,omitempty"`
4358
4359 Name *string `json:"name,omitempty"`
4360 }
4361
4362
4363 func (r Resource) MarshalJSON() ([]byte, error) {
4364 objectMap := make(map[string]interface{})
4365 return json.Marshal(objectMap)
4366 }
4367
4368
4369 type BasicResourceReference interface {
4370 AsMachineReference() (*MachineReference, bool)
4371 AsProcessReference() (*ProcessReference, bool)
4372 AsPortReference() (*PortReference, bool)
4373 AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool)
4374 AsClientGroupReference() (*ClientGroupReference, bool)
4375 AsResourceReference() (*ResourceReference, bool)
4376 }
4377
4378
4379 type ResourceReference struct {
4380
4381 ID *string `json:"id,omitempty"`
4382
4383 Type *string `json:"type,omitempty"`
4384
4385 Name *string `json:"name,omitempty"`
4386
4387 Kind Kind `json:"kind,omitempty"`
4388 }
4389
4390 func unmarshalBasicResourceReference(body []byte) (BasicResourceReference, error) {
4391 var m map[string]interface{}
4392 err := json.Unmarshal(body, &m)
4393 if err != nil {
4394 return nil, err
4395 }
4396
4397 switch m["kind"] {
4398 case string(KindRefmachine):
4399 var mr MachineReference
4400 err := json.Unmarshal(body, &mr)
4401 return mr, err
4402 case string(KindRefprocess):
4403 var pr ProcessReference
4404 err := json.Unmarshal(body, &pr)
4405 return pr, err
4406 case string(KindRefport):
4407 var pr PortReference
4408 err := json.Unmarshal(body, &pr)
4409 return pr, err
4410 case string(KindRefmachinewithhints):
4411 var mrwh MachineReferenceWithHints
4412 err := json.Unmarshal(body, &mrwh)
4413 return mrwh, err
4414 case string(KindRefclientgroup):
4415 var cgr ClientGroupReference
4416 err := json.Unmarshal(body, &cgr)
4417 return cgr, err
4418 default:
4419 var rr ResourceReference
4420 err := json.Unmarshal(body, &rr)
4421 return rr, err
4422 }
4423 }
4424 func unmarshalBasicResourceReferenceArray(body []byte) ([]BasicResourceReference, error) {
4425 var rawMessages []*json.RawMessage
4426 err := json.Unmarshal(body, &rawMessages)
4427 if err != nil {
4428 return nil, err
4429 }
4430
4431 rrArray := make([]BasicResourceReference, len(rawMessages))
4432
4433 for index, rawMessage := range rawMessages {
4434 rr, err := unmarshalBasicResourceReference(*rawMessage)
4435 if err != nil {
4436 return nil, err
4437 }
4438 rrArray[index] = rr
4439 }
4440 return rrArray, nil
4441 }
4442
4443
4444 func (rr ResourceReference) MarshalJSON() ([]byte, error) {
4445 rr.Kind = KindResourceReference
4446 objectMap := make(map[string]interface{})
4447 if rr.ID != nil {
4448 objectMap["id"] = rr.ID
4449 }
4450 if rr.Kind != "" {
4451 objectMap["kind"] = rr.Kind
4452 }
4453 return json.Marshal(objectMap)
4454 }
4455
4456
4457 func (rr ResourceReference) AsMachineReference() (*MachineReference, bool) {
4458 return nil, false
4459 }
4460
4461
4462 func (rr ResourceReference) AsProcessReference() (*ProcessReference, bool) {
4463 return nil, false
4464 }
4465
4466
4467 func (rr ResourceReference) AsPortReference() (*PortReference, bool) {
4468 return nil, false
4469 }
4470
4471
4472 func (rr ResourceReference) AsMachineReferenceWithHints() (*MachineReferenceWithHints, bool) {
4473 return nil, false
4474 }
4475
4476
4477 func (rr ResourceReference) AsClientGroupReference() (*ClientGroupReference, bool) {
4478 return nil, false
4479 }
4480
4481
4482 func (rr ResourceReference) AsResourceReference() (*ResourceReference, bool) {
4483 return &rr, true
4484 }
4485
4486
4487 func (rr ResourceReference) AsBasicResourceReference() (BasicResourceReference, bool) {
4488 return &rr, true
4489 }
4490
4491
4492
4493 type SingleMachineDependencyMapRequest struct {
4494
4495 MachineID *string `json:"machineId,omitempty"`
4496
4497 StartTime *date.Time `json:"startTime,omitempty"`
4498
4499 EndTime *date.Time `json:"endTime,omitempty"`
4500
4501 Kind KindBasicMapRequest `json:"kind,omitempty"`
4502 }
4503
4504
4505 func (smdmr SingleMachineDependencyMapRequest) MarshalJSON() ([]byte, error) {
4506 smdmr.Kind = KindMapsingleMachineDependency
4507 objectMap := make(map[string]interface{})
4508 if smdmr.MachineID != nil {
4509 objectMap["machineId"] = smdmr.MachineID
4510 }
4511 if smdmr.StartTime != nil {
4512 objectMap["startTime"] = smdmr.StartTime
4513 }
4514 if smdmr.EndTime != nil {
4515 objectMap["endTime"] = smdmr.EndTime
4516 }
4517 if smdmr.Kind != "" {
4518 objectMap["kind"] = smdmr.Kind
4519 }
4520 return json.Marshal(objectMap)
4521 }
4522
4523
4524 func (smdmr SingleMachineDependencyMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
4525 return &smdmr, true
4526 }
4527
4528
4529 func (smdmr SingleMachineDependencyMapRequest) AsMultipleMachinesMapRequest() (*MultipleMachinesMapRequest, bool) {
4530 return nil, false
4531 }
4532
4533
4534 func (smdmr SingleMachineDependencyMapRequest) AsBasicMultipleMachinesMapRequest() (BasicMultipleMachinesMapRequest, bool) {
4535 return nil, false
4536 }
4537
4538
4539 func (smdmr SingleMachineDependencyMapRequest) AsMachineListMapRequest() (*MachineListMapRequest, bool) {
4540 return nil, false
4541 }
4542
4543
4544 func (smdmr SingleMachineDependencyMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
4545 return nil, false
4546 }
4547
4548
4549 func (smdmr SingleMachineDependencyMapRequest) AsMapRequest() (*MapRequest, bool) {
4550 return nil, false
4551 }
4552
4553
4554 func (smdmr SingleMachineDependencyMapRequest) AsBasicMapRequest() (BasicMapRequest, bool) {
4555 return &smdmr, true
4556 }
4557
4558
4559 type Summary struct {
4560
4561 ID *string `json:"id,omitempty"`
4562
4563 Type *string `json:"type,omitempty"`
4564
4565 Name *string `json:"name,omitempty"`
4566 }
4567
4568
4569 func (s Summary) MarshalJSON() ([]byte, error) {
4570 objectMap := make(map[string]interface{})
4571 return json.Marshal(objectMap)
4572 }
4573
4574
4575 type SummaryProperties struct {
4576
4577 StartTime *date.Time `json:"startTime,omitempty"`
4578
4579 EndTime *date.Time `json:"endTime,omitempty"`
4580 }
4581
4582
4583 type Timezone struct {
4584
4585 FullName *string `json:"fullName,omitempty"`
4586 }
4587
4588
4589 type VirtualMachineConfiguration struct {
4590
4591 VirtualMachineType VirtualMachineType `json:"virtualMachineType,omitempty"`
4592
4593 NativeMachineID *string `json:"nativeMachineId,omitempty"`
4594
4595 VirtualMachineName *string `json:"virtualMachineName,omitempty"`
4596
4597 NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
4598 }
4599
View as plain text