forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.go
1950 lines (1683 loc) · 62 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package servicemap
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"errors"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// Accuracy enumerates the values for accuracy.
type Accuracy string
const (
// Actual specifies the actual state for accuracy.
Actual Accuracy = "actual"
// Estimated specifies the estimated state for accuracy.
Estimated Accuracy = "estimated"
)
// Bitness enumerates the values for bitness.
type Bitness string
const (
// SixFourbit specifies the six fourbit state for bitness.
SixFourbit Bitness = "64bit"
// ThreeTwobit specifies the three twobit state for bitness.
ThreeTwobit Bitness = "32bit"
)
// ConnectionFailureState enumerates the values for connection failure state.
type ConnectionFailureState string
const (
// Failed specifies the failed state for connection failure state.
Failed ConnectionFailureState = "failed"
// Mixed specifies the mixed state for connection failure state.
Mixed ConnectionFailureState = "mixed"
// Ok specifies the ok state for connection failure state.
Ok ConnectionFailureState = "ok"
)
// HypervisorType enumerates the values for hypervisor type.
type HypervisorType string
const (
// Hyperv specifies the hyperv state for hypervisor type.
Hyperv HypervisorType = "hyperv"
// Unknown specifies the unknown state for hypervisor type.
Unknown HypervisorType = "unknown"
)
// Kind enumerates the values for kind.
type Kind string
const (
// KindRefmachine specifies the kind refmachine state for kind.
KindRefmachine Kind = "ref:machine"
// KindRefmachinewithhints specifies the kind refmachinewithhints state for kind.
KindRefmachinewithhints Kind = "ref:machinewithhints"
// KindRefport specifies the kind refport state for kind.
KindRefport Kind = "ref:port"
// KindRefprocess specifies the kind refprocess state for kind.
KindRefprocess Kind = "ref:process"
)
// KindCoreResource enumerates the values for kind core resource.
type KindCoreResource string
const (
// KindClientGroup specifies the kind client group state for kind core resource.
KindClientGroup KindCoreResource = "clientGroup"
// KindMachine specifies the kind machine state for kind core resource.
KindMachine KindCoreResource = "machine"
// KindMachineGroup specifies the kind machine group state for kind core resource.
KindMachineGroup KindCoreResource = "machineGroup"
// KindPort specifies the kind port state for kind core resource.
KindPort KindCoreResource = "port"
// KindProcess specifies the kind process state for kind core resource.
KindProcess KindCoreResource = "process"
)
// KindMapRequest enumerates the values for kind map request.
type KindMapRequest string
const (
// KindMapmachineGroupDependency specifies the kind mapmachine group dependency state for kind map request.
KindMapmachineGroupDependency KindMapRequest = "map:machine-group-dependency"
// KindMapsingleMachineDependency specifies the kind mapsingle machine dependency state for kind map request.
KindMapsingleMachineDependency KindMapRequest = "map:single-machine-dependency"
)
// KindRelationship enumerates the values for kind relationship.
type KindRelationship string
const (
// KindRelacceptor specifies the kind relacceptor state for kind relationship.
KindRelacceptor KindRelationship = "rel:acceptor"
// KindRelconnection specifies the kind relconnection state for kind relationship.
KindRelconnection KindRelationship = "rel:connection"
)
// MachineRebootStatus enumerates the values for machine reboot status.
type MachineRebootStatus string
const (
// MachineRebootStatusNotRebooted specifies the machine reboot status not rebooted state for machine reboot status.
MachineRebootStatusNotRebooted MachineRebootStatus = "notRebooted"
// MachineRebootStatusRebooted specifies the machine reboot status rebooted state for machine reboot status.
MachineRebootStatusRebooted MachineRebootStatus = "rebooted"
// MachineRebootStatusUnknown specifies the machine reboot status unknown state for machine reboot status.
MachineRebootStatusUnknown MachineRebootStatus = "unknown"
)
// MonitoringState enumerates the values for monitoring state.
type MonitoringState string
const (
// Discovered specifies the discovered state for monitoring state.
Discovered MonitoringState = "discovered"
// Monitored specifies the monitored state for monitoring state.
Monitored MonitoringState = "monitored"
)
// OperatingSystemFamily enumerates the values for operating system family.
type OperatingSystemFamily string
const (
// OperatingSystemFamilyAix specifies the operating system family aix state for operating system family.
OperatingSystemFamilyAix OperatingSystemFamily = "aix"
// OperatingSystemFamilyLinux specifies the operating system family linux state for operating system family.
OperatingSystemFamilyLinux OperatingSystemFamily = "linux"
// OperatingSystemFamilySolaris specifies the operating system family solaris state for operating system family.
OperatingSystemFamilySolaris OperatingSystemFamily = "solaris"
// OperatingSystemFamilyUnknown specifies the operating system family unknown state for operating system family.
OperatingSystemFamilyUnknown OperatingSystemFamily = "unknown"
// OperatingSystemFamilyWindows specifies the operating system family windows state for operating system family.
OperatingSystemFamilyWindows OperatingSystemFamily = "windows"
)
// ProcessRole enumerates the values for process role.
type ProcessRole string
const (
// AppServer specifies the app server state for process role.
AppServer ProcessRole = "appServer"
// DatabaseServer specifies the database server state for process role.
DatabaseServer ProcessRole = "databaseServer"
// LdapServer specifies the ldap server state for process role.
LdapServer ProcessRole = "ldapServer"
// SmbServer specifies the smb server state for process role.
SmbServer ProcessRole = "smbServer"
// WebServer specifies the web server state for process role.
WebServer ProcessRole = "webServer"
)
// VirtualizationState enumerates the values for virtualization state.
type VirtualizationState string
const (
// VirtualizationStateHypervisor specifies the virtualization state hypervisor state for virtualization state.
VirtualizationStateHypervisor VirtualizationState = "hypervisor"
// VirtualizationStatePhysical specifies the virtualization state physical state for virtualization state.
VirtualizationStatePhysical VirtualizationState = "physical"
// VirtualizationStateUnknown specifies the virtualization state unknown state for virtualization state.
VirtualizationStateUnknown VirtualizationState = "unknown"
// VirtualizationStateVirtual specifies the virtualization state virtual state for virtualization state.
VirtualizationStateVirtual VirtualizationState = "virtual"
)
// VirtualMachineType enumerates the values for virtual machine type.
type VirtualMachineType string
const (
// VirtualMachineTypeHyperv specifies the virtual machine type hyperv state for virtual machine type.
VirtualMachineTypeHyperv VirtualMachineType = "hyperv"
// VirtualMachineTypeLdom specifies the virtual machine type ldom state for virtual machine type.
VirtualMachineTypeLdom VirtualMachineType = "ldom"
// VirtualMachineTypeLpar specifies the virtual machine type lpar state for virtual machine type.
VirtualMachineTypeLpar VirtualMachineType = "lpar"
// VirtualMachineTypeUnknown specifies the virtual machine type unknown state for virtual machine type.
VirtualMachineTypeUnknown VirtualMachineType = "unknown"
// VirtualMachineTypeVirtualPc specifies the virtual machine type virtual pc state for virtual machine type.
VirtualMachineTypeVirtualPc VirtualMachineType = "virtualPc"
// VirtualMachineTypeVmware specifies the virtual machine type vmware state for virtual machine type.
VirtualMachineTypeVmware VirtualMachineType = "vmware"
// VirtualMachineTypeXen specifies the virtual machine type xen state for virtual machine type.
VirtualMachineTypeXen VirtualMachineType = "xen"
)
// Acceptor is a process accepting on a port.
type Acceptor struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind KindRelationship `json:"kind,omitempty"`
*AcceptorProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Acceptor.
func (a Acceptor) MarshalJSON() ([]byte, error) {
a.Kind = KindRelacceptor
type Alias Acceptor
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(a),
})
}
// AsConnection is the Relationship implementation for Acceptor.
func (a Acceptor) AsConnection() (*Connection, bool) {
return nil, false
}
// AsAcceptor is the Relationship implementation for Acceptor.
func (a Acceptor) AsAcceptor() (*Acceptor, bool) {
return &a, true
}
// AsCoreResource is the Relationship implementation for Acceptor.
func (a Acceptor) AsCoreResource() (*CoreResource, bool) {
return nil, false
}
// AsMachine is the Relationship implementation for Acceptor.
func (a Acceptor) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the Relationship implementation for Acceptor.
func (a Acceptor) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the Relationship implementation for Acceptor.
func (a Acceptor) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the Relationship implementation for Acceptor.
func (a Acceptor) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsClientGroupMember is the Relationship implementation for Acceptor.
func (a Acceptor) AsClientGroupMember() (*ClientGroupMember, bool) {
return nil, false
}
// AsMachineGroup is the Relationship implementation for Acceptor.
func (a Acceptor) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// AsSummary is the Relationship implementation for Acceptor.
func (a Acceptor) AsSummary() (*Summary, bool) {
return nil, false
}
// AsMachinesSummary is the Relationship implementation for Acceptor.
func (a Acceptor) AsMachinesSummary() (*MachinesSummary, bool) {
return nil, false
}
// AsRelationship is the Relationship implementation for Acceptor.
func (a Acceptor) AsRelationship() (*Relationship, bool) {
return nil, false
}
// AcceptorProperties is properties for an acceptor relationship.
type AcceptorProperties struct {
Source *PortReference `json:"source,omitempty"`
Destination *ProcessReference `json:"destination,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
}
// AgentConfiguration is describes the configuration of the Dependency Agent installed on a machine.
type AgentConfiguration struct {
AgentID *string `json:"agentId,omitempty"`
DependencyAgentID *string `json:"dependencyAgentId,omitempty"`
DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"`
DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"`
RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"`
ClockGranularity *int32 `json:"clockGranularity,omitempty"`
}
// ClientGroup is represents a collection of clients of a resource. A client group can represent the clients of a port,
// process, or a machine.
type ClientGroup struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*ClientGroupProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ClientGroup.
func (cg ClientGroup) MarshalJSON() ([]byte, error) {
cg.Kind = KindClientGroup
type Alias ClientGroup
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(cg),
})
}
// AsMachine is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsClientGroup() (*ClientGroup, bool) {
return &cg, true
}
// AsMachineGroup is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// AsCoreResource is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsCoreResource() (*CoreResource, bool) {
return nil, false
}
// AsClientGroupMember is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsClientGroupMember() (*ClientGroupMember, bool) {
return nil, false
}
// AsSummary is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsSummary() (*Summary, bool) {
return nil, false
}
// AsMachinesSummary is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsMachinesSummary() (*MachinesSummary, bool) {
return nil, false
}
// AsRelationship is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsRelationship() (*Relationship, bool) {
return nil, false
}
// AsConnection is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsConnection() (*Connection, bool) {
return nil, false
}
// AsAcceptor is the CoreResource implementation for ClientGroup.
func (cg ClientGroup) AsAcceptor() (*Acceptor, bool) {
return nil, false
}
// ClientGroupMember is represents a member of a client group
type ClientGroupMember struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
*ClientGroupMemberProperties `json:"properties,omitempty"`
}
// ClientGroupMemberProperties is resource properties.
type ClientGroupMemberProperties struct {
IPAddress *string `json:"ipAddress,omitempty"`
Port *PortReference `json:"port,omitempty"`
Processes *[]ProcessReference `json:"processes,omitempty"`
}
// ClientGroupMembersCollection is collection of ClientGroupMember resources.
type ClientGroupMembersCollection struct {
autorest.Response `json:"-"`
Value *[]ClientGroupMember `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClientGroupMembersCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClientGroupMembersCollection) ClientGroupMembersCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClientGroupMembersCount is specifies the number of members in a client group.
type ClientGroupMembersCount struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
GroupID *string `json:"groupId,omitempty"`
Count *int32 `json:"count,omitempty"`
Accuracy Accuracy `json:"accuracy,omitempty"`
}
// ClientGroupProperties is resource properties.
type ClientGroupProperties struct {
ClientsOf ResourceReference `json:"clientsOf,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ClientGroupProperties struct.
func (cg *ClientGroupProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["clientsOf"]
if v != nil {
clientsOf, err := unmarshalResourceReference(*m["clientsOf"])
if err != nil {
return err
}
cg.ClientsOf = clientsOf
}
return nil
}
// Connection is a network connection.
type Connection struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Kind KindRelationship `json:"kind,omitempty"`
*ConnectionProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Connection.
func (c Connection) MarshalJSON() ([]byte, error) {
c.Kind = KindRelconnection
type Alias Connection
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(c),
})
}
// AsConnection is the Relationship implementation for Connection.
func (c Connection) AsConnection() (*Connection, bool) {
return &c, true
}
// AsAcceptor is the Relationship implementation for Connection.
func (c Connection) AsAcceptor() (*Acceptor, bool) {
return nil, false
}
// AsCoreResource is the Relationship implementation for Connection.
func (c Connection) AsCoreResource() (*CoreResource, bool) {
return nil, false
}
// AsMachine is the Relationship implementation for Connection.
func (c Connection) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the Relationship implementation for Connection.
func (c Connection) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the Relationship implementation for Connection.
func (c Connection) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the Relationship implementation for Connection.
func (c Connection) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsClientGroupMember is the Relationship implementation for Connection.
func (c Connection) AsClientGroupMember() (*ClientGroupMember, bool) {
return nil, false
}
// AsMachineGroup is the Relationship implementation for Connection.
func (c Connection) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// AsSummary is the Relationship implementation for Connection.
func (c Connection) AsSummary() (*Summary, bool) {
return nil, false
}
// AsMachinesSummary is the Relationship implementation for Connection.
func (c Connection) AsMachinesSummary() (*MachinesSummary, bool) {
return nil, false
}
// AsRelationship is the Relationship implementation for Connection.
func (c Connection) AsRelationship() (*Relationship, bool) {
return nil, false
}
// ConnectionCollection is collection of Connection resources.
type ConnectionCollection struct {
autorest.Response `json:"-"`
Value *[]Connection `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ConnectionCollection) ConnectionCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ConnectionProperties is properties for a connection resource.
type ConnectionProperties struct {
Source ResourceReference `json:"source,omitempty"`
Destination ResourceReference `json:"destination,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
ServerPort *PortReference `json:"serverPort,omitempty"`
FailureState ConnectionFailureState `json:"failureState,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for ConnectionProperties struct.
func (cp *ConnectionProperties) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["serverPort"]
if v != nil {
var serverPort PortReference
err = json.Unmarshal(*m["serverPort"], &serverPort)
if err != nil {
return err
}
cp.ServerPort = &serverPort
}
v = m["failureState"]
if v != nil {
var failureState ConnectionFailureState
err = json.Unmarshal(*m["failureState"], &failureState)
if err != nil {
return err
}
cp.FailureState = failureState
}
v = m["source"]
if v != nil {
source, err := unmarshalResourceReference(*m["source"])
if err != nil {
return err
}
cp.Source = source
}
v = m["destination"]
if v != nil {
destination, err := unmarshalResourceReference(*m["destination"])
if err != nil {
return err
}
cp.Destination = destination
}
v = m["startTime"]
if v != nil {
var startTime date.Time
err = json.Unmarshal(*m["startTime"], &startTime)
if err != nil {
return err
}
cp.StartTime = &startTime
}
v = m["endTime"]
if v != nil {
var endTime date.Time
err = json.Unmarshal(*m["endTime"], &endTime)
if err != nil {
return err
}
cp.EndTime = &endTime
}
return nil
}
// CoreResource is marker resource for the core Service Map resources
type CoreResource interface {
AsMachine() (*Machine, bool)
AsProcess() (*Process, bool)
AsPort() (*Port, bool)
AsClientGroup() (*ClientGroup, bool)
AsMachineGroup() (*MachineGroup, bool)
}
func unmarshalCoreResource(body []byte) (CoreResource, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["kind"] {
case string(KindMachine):
var m Machine
err := json.Unmarshal(body, &m)
return m, err
case string(KindProcess):
var p Process
err := json.Unmarshal(body, &p)
return p, err
case string(KindPort):
var p Port
err := json.Unmarshal(body, &p)
return p, err
case string(KindClientGroup):
var cg ClientGroup
err := json.Unmarshal(body, &cg)
return cg, err
case string(KindMachineGroup):
var mg MachineGroup
err := json.Unmarshal(body, &mg)
return mg, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalCoreResourceArray(body []byte) ([]CoreResource, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
crArray := make([]CoreResource, len(rawMessages))
for index, rawMessage := range rawMessages {
cr, err := unmarshalCoreResource(*rawMessage)
if err != nil {
return nil, err
}
crArray[index] = cr
}
return crArray, nil
}
// Error is error details.
type Error struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// ErrorResponse is an error response from the API.
type ErrorResponse struct {
Error *Error `json:"error,omitempty"`
}
// HypervisorConfiguration is describes the hypervisor configuration of a machine.
type HypervisorConfiguration struct {
HypervisorType HypervisorType `json:"hypervisorType,omitempty"`
NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
}
// Ipv4NetworkInterface is describes an IPv4 network interface.
type Ipv4NetworkInterface struct {
IPAddress *string `json:"ipAddress,omitempty"`
SubnetMask *string `json:"subnetMask,omitempty"`
}
// Ipv6NetworkInterface is describes an IPv6 network interface.
type Ipv6NetworkInterface struct {
IPAddress *string `json:"ipAddress,omitempty"`
}
// Liveness is specifies the contents of a check liveness response.
type Liveness struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Live *bool `json:"live,omitempty"`
}
// Machine is a machine resource represents a discovered computer system. It can be *monitored*, i.e., a Dependency
// Agent is running on it, or *discovered*, i.e., its existence was inferred by observing the data stream from
// monitored machines. As machines change, prior versions of the machine resource are preserved and available for
// access. A machine is live during an interval of time, if either its Dependency Agent has reported data during
// (parts) of that interval, or a Dependency agent running on other machines has reported activity associated with the
// machine.
type Machine struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*MachineProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Machine.
func (m Machine) MarshalJSON() ([]byte, error) {
m.Kind = KindMachine
type Alias Machine
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(m),
})
}
// AsMachine is the CoreResource implementation for Machine.
func (m Machine) AsMachine() (*Machine, bool) {
return &m, true
}
// AsProcess is the CoreResource implementation for Machine.
func (m Machine) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for Machine.
func (m Machine) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for Machine.
func (m Machine) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for Machine.
func (m Machine) AsMachineGroup() (*MachineGroup, bool) {
return nil, false
}
// AsCoreResource is the CoreResource implementation for Machine.
func (m Machine) AsCoreResource() (*CoreResource, bool) {
return nil, false
}
// AsClientGroupMember is the CoreResource implementation for Machine.
func (m Machine) AsClientGroupMember() (*ClientGroupMember, bool) {
return nil, false
}
// AsSummary is the CoreResource implementation for Machine.
func (m Machine) AsSummary() (*Summary, bool) {
return nil, false
}
// AsMachinesSummary is the CoreResource implementation for Machine.
func (m Machine) AsMachinesSummary() (*MachinesSummary, bool) {
return nil, false
}
// AsRelationship is the CoreResource implementation for Machine.
func (m Machine) AsRelationship() (*Relationship, bool) {
return nil, false
}
// AsConnection is the CoreResource implementation for Machine.
func (m Machine) AsConnection() (*Connection, bool) {
return nil, false
}
// AsAcceptor is the CoreResource implementation for Machine.
func (m Machine) AsAcceptor() (*Acceptor, bool) {
return nil, false
}
// MachineCollection is collection of Machine resources.
type MachineCollection struct {
autorest.Response `json:"-"`
Value *[]Machine `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// MachineCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client MachineCollection) MachineCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MachineCountsByOperatingSystem is machines by operating system.
type MachineCountsByOperatingSystem struct {
Windows *int32 `json:"windows,omitempty"`
Linux *int32 `json:"linux,omitempty"`
}
// MachineGroup is a user-defined logical grouping of machines.
type MachineGroup struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
Kind KindCoreResource `json:"kind,omitempty"`
*MachineGroupProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineGroup.
func (mg MachineGroup) MarshalJSON() ([]byte, error) {
mg.Kind = KindMachineGroup
type Alias MachineGroup
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mg),
})
}
// AsMachine is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsMachine() (*Machine, bool) {
return nil, false
}
// AsProcess is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsProcess() (*Process, bool) {
return nil, false
}
// AsPort is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsPort() (*Port, bool) {
return nil, false
}
// AsClientGroup is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsClientGroup() (*ClientGroup, bool) {
return nil, false
}
// AsMachineGroup is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsMachineGroup() (*MachineGroup, bool) {
return &mg, true
}
// AsCoreResource is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsCoreResource() (*CoreResource, bool) {
return nil, false
}
// AsClientGroupMember is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsClientGroupMember() (*ClientGroupMember, bool) {
return nil, false
}
// AsSummary is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsSummary() (*Summary, bool) {
return nil, false
}
// AsMachinesSummary is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsMachinesSummary() (*MachinesSummary, bool) {
return nil, false
}
// AsRelationship is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsRelationship() (*Relationship, bool) {
return nil, false
}
// AsConnection is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsConnection() (*Connection, bool) {
return nil, false
}
// AsAcceptor is the CoreResource implementation for MachineGroup.
func (mg MachineGroup) AsAcceptor() (*Acceptor, bool) {
return nil, false
}
// MachineGroupCollection is collection of Machine Group resources.
type MachineGroupCollection struct {
autorest.Response `json:"-"`
Value *[]MachineGroup `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// MachineGroupCollectionPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client MachineGroupCollection) MachineGroupCollectionPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// MachineGroupMapRequest is specifies the computation of a machine group dependency map. A machine group dependency
// map includes all direct dependencies of a group of machines.
type MachineGroupMapRequest struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Kind KindMapRequest `json:"kind,omitempty"`
MachineGroupID *string `json:"machineGroupId,omitempty"`
FilterProcesses *bool `json:"filterProcesses,omitempty"`
}
// MarshalJSON is the custom marshaler for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) MarshalJSON() ([]byte, error) {
mgmr.Kind = KindMapmachineGroupDependency
type Alias MachineGroupMapRequest
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(mgmr),
})
}
// AsSingleMachineDependencyMapRequest is the MapRequest implementation for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) AsSingleMachineDependencyMapRequest() (*SingleMachineDependencyMapRequest, bool) {
return nil, false
}
// AsMachineGroupMapRequest is the MapRequest implementation for MachineGroupMapRequest.
func (mgmr MachineGroupMapRequest) AsMachineGroupMapRequest() (*MachineGroupMapRequest, bool) {
return &mgmr, true
}
// MachineGroupProperties is resource properties.
type MachineGroupProperties struct {
DisplayName *string `json:"displayName,omitempty"`
Machines *[]MachineReferenceWithHints `json:"machines,omitempty"`
}
// MachineProperties is resource properties.
type MachineProperties struct {
Timestamp *date.Time `json:"timestamp,omitempty"`
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
ComputerName *string `json:"computerName,omitempty"`
FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
BootTime *date.Time `json:"bootTime,omitempty"`
Timezone *Timezone `json:"timezone,omitempty"`
Agent *AgentConfiguration `json:"agent,omitempty"`
Resources *MachineResourcesConfiguration `json:"resources,omitempty"`
Networking *NetworkConfiguration `json:"networking,omitempty"`
OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"`
VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"`
Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"`