-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.go
2540 lines (2296 loc) · 86.9 KB
/
types.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 gowbem
import (
"encoding/xml"
"errors"
"net/url"
"strconv"
"strings"
)
type CIM struct {
XMLName xml.Name `xml:"CIM"`
CimVersion string `xml:"CIMVERSION,attr"`
DtdVersion string `xml:"DTDVERSION,attr"`
Message *CimMessage `xml:"MESSAGE,omitempty"`
Declaration *CimDeclaration `xml:"DECLARATION,omitempty"`
hasFault func(cim *CIM) error
}
func (cim *CIM) Fault() error {
if nil == cim.hasFault {
return nil
}
return cim.hasFault(cim)
}
// <!-- Section: Declaration Elements -->
// <xs:element name="DECLARATION">
// <xs:annotation>
// <xs:documentation>A set of CIM schema element declarations, consisting of logical declaration groups.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice maxOccurs="unbounded">
// <xs:element ref="DECLGROUP"/>
// <xs:element ref="DECLGROUP.WITHNAME"/>
// <xs:element ref="DECLGROUP.WITHPATH"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimDeclaration struct {
XMLName xml.Name `xml:"DECLARATION"`
DeclGroups []CimAnyDeclGroup `xml:",any,omitempty"`
}
type CimAnyDeclGroup struct {
DeclGroup *CimDeclGroup `xml:"DECLGROUP,omitempty"`
DeclGroupWithName *CimDeclGroupWithName `xml:"DECLGROUP.WITHNAME,omitempty"`
DeclGroupWithPath *CimDeclGroupWithPath `xml:"DECLGROUP.WITHPATH,omitempty"`
}
func (self *CimAnyDeclGroup) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if nil != self.DeclGroup {
return e.Encode(self.DeclGroup)
}
if nil != self.DeclGroupWithName {
return e.Encode(self.DeclGroupWithName)
}
if nil != self.DeclGroupWithPath {
return e.Encode(self.DeclGroupWithPath)
}
return nil
}
func (self *CimAnyDeclGroup) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
if "DECLGROUP" == start.Name.Local {
self.DeclGroup = &CimDeclGroup{}
return d.DecodeElement(self.DeclGroup, &start)
}
if "DECLGROUP.WITHNAME" == start.Name.Local {
self.DeclGroupWithName = &CimDeclGroupWithName{}
return d.DecodeElement(self.DeclGroupWithName, &start)
}
if "DECLGROUP.WITHPATH" == start.Name.Local {
self.DeclGroupWithPath = &CimDeclGroupWithPath{}
return d.DecodeElement(self.DeclGroupWithPath, &start)
}
return nil
}
// <xs:element name="DECLGROUP">
// <xs:annotation>
// <xs:documentation>A logical group of CIM schema element declarations (classes, instances, and
// qualifier types/declarations) without any path information.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:choice minOccurs="0">
// <xs:element ref="LOCALNAMESPACEPATH"/>
// <xs:element ref="NAMESPACEPATH"/>
// </xs:choice>
// <xs:element ref="QUALIFIER.DECLARATION" minOccurs="0" maxOccurs="unbounded"/>
// <xs:element ref="VALUE.OBJECT" minOccurs="0" maxOccurs="unbounded"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimDeclGroup struct {
XMLName xml.Name `xml:"DECLGROUP"`
LocalNamespacePath *CimLocalNamespacePath `xml:"LOCALNAMESPACEPATH,omitempty"`
NamespacePath *CimNamespacePath `xml:"NAMESPACEPATH,omitempty"`
QualifierDeclarations []CimQualifierDeclaration `xml:"QUALIFIER.DECLARATION,omitempty"`
ValueObjects []CimValueObject `xml:"VALUE.OBJECT,omitempty"`
}
// <xs:element name="DECLGROUP.WITHNAME">
// <xs:annotation>
// <xs:documentation>A logical group of CIM schema element declarations (classes, instances, and
// qualifier types/declarations) with name (local path) information.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:choice minOccurs="0">
// <xs:element ref="LOCALNAMESPACEPATH"/>
// <xs:element ref="NAMESPACEPATH"/>
// </xs:choice>
// <xs:element ref="QUALIFIER.DECLARATION" minOccurs="0" maxOccurs="unbounded"/>
// <xs:element ref="VALUE.NAMEDOBJECT" minOccurs="0" maxOccurs="unbounded"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimDeclGroupWithName struct {
XMLName xml.Name `xml:"DECLGROUP.WITHNAME"`
LocalNamespacePath *CimLocalNamespacePath `xml:"LOCALNAMESPACEPATH,omitempty"`
NamespacePath *CimNamespacePath `xml:"NAMESPACEPATH,omitempty"`
QualifierDeclarations []CimQualifierDeclaration `xml:"QUALIFIER.DECLARATION,omitempty"`
ValueNamedObjects []CimValueNamedObject `xml:"VALUE.NAMEDOBJECT,omitempty"`
}
// <xs:element name="DECLGROUP.WITHPATH">
// <xs:annotation>
// <xs:documentation>A logical group of CIM schema element declarations (classes, instances, and
// qualifier types/declarations) with path information.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice minOccurs="0" maxOccurs="unbounded">
// <xs:element ref="VALUE.OBJECTWITHPATH"/>
// <xs:element ref="VALUE.OBJECTWITHLOCALPATH"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimDeclGroupWithPath struct {
XMLName xml.Name `xml:"DECLGROUP.WITHPATH"`
Values []CimAnyDeclGroup `xml:",any,omitempty"`
}
type CimAnyDeclGroupWithPath struct {
ValueObjectWithPaths *CimValueObjectWithPath `xml:"VALUE.OBJECTWITHPATH,omitempty"`
ValueObjectWithLocalPaths *CimValueObjectWithLocalPath `xml:"VALUE.OBJECTWITHLOCALPATH,omitempty"`
}
func (self *CimAnyDeclGroupWithPath) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if nil != self.ValueObjectWithPaths {
return e.Encode(self.ValueObjectWithPaths)
}
if nil != self.ValueObjectWithLocalPaths {
return e.Encode(self.ValueObjectWithLocalPaths)
}
return nil
}
func (self *CimAnyDeclGroupWithPath) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
if "VALUE.OBJECTWITHPATH" == start.Name.Local {
self.ValueObjectWithPaths = &CimValueObjectWithPath{}
return d.DecodeElement(self.ValueObjectWithPaths, &start)
}
if "VALUE.OBJECTWITHLOCALPATH" == start.Name.Local {
self.ValueObjectWithLocalPaths = &CimValueObjectWithLocalPath{}
return d.DecodeElement(self.ValueObjectWithLocalPaths, &start)
}
return nil
}
// <xs:element name="QUALIFIER.DECLARATION">
// <xs:annotation>
// <xs:documentation>Defines a single CIM qualifier type/declaration.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="SCOPE" minOccurs="0"/>
// <xs:choice minOccurs="0">
// <xs:element ref="VALUE"/>
// <xs:element ref="VALUE.ARRAY"/>
// </xs:choice>
// </xs:sequence>
// <xs:attribute ref="NAME" use="required"/>
// <xs:attribute ref="TYPE" use="required"/>
// <xs:attribute name="ISARRAY" type="xs:boolean" default="false"/>
// <xs:attribute ref="ARRAYSIZE"/>
// <xs:attributeGroup ref="QualifierFlavor"/>
// </xs:complexType>
// </xs:element>
type CimQualifierDeclaration struct {
CimQualifierFlavor
XMLName xml.Name `xml:"QUALIFIER.DECLARATION"`
Name string `xml:"NAME,attr"`
Type string `xml:"TYPE,attr"`
IsArray bool `xml:"ISARRAY,attr,omitempty"`
ArraySize int `xml:"ARRAYSIZE,attr,omitempty"`
Scope *CimScope `xml:"SCOPE,omitempty"`
Value *CimValue `xml:"VALUE,omitempty"`
ValueArray *CimValueArray `xml:"VALUE.ARRAY,omitempty"`
}
// <xs:element name="SCOPE">
// <xs:annotation>
// <xs:documentation>Defines the scope of a qualifier type/declaration.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:attribute name="CLASS" type="xs:boolean" default="false"/>
// <xs:attribute name="ASSOCIATION" type="xs:boolean" default="false"/>
// <xs:attribute name="REFERENCE" type="xs:boolean" default="false"/>
// <xs:attribute name="PROPERTY" type="xs:boolean" default="false"/>
// <xs:attribute name="METHOD" type="xs:boolean" default="false"/>
// <xs:attribute name="PARAMETER" type="xs:boolean" default="false"/>
// <xs:attribute name="INDICATION" type="xs:boolean" default="false"/>
// </xs:complexType>
// </xs:element>
type CimScope struct {
XMLName xml.Name `xml:"SCOPE"`
Class bool `xml:"CLASS,attr,omitempty"`
Association bool `xml:"ASSOCIATION,attr,omitempty"`
Reference bool `xml:"REFERENCE,attr,omitempty"`
Property bool `xml:"PROPERTY,attr,omitempty"`
Method bool `xml:"METHOD,attr,omitempty"`
Parameter bool `xml:"PARAMETER,attr,omitempty"`
Indication bool `xml:"INDICATION,attr,omitempty"`
}
// <!-- Section: Value Elements -->
// <xs:element name="VALUE">
// <xs:annotation>
// <xs:documentation>Defines a non-reference, non-NULL scalar value.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:simpleType>
// <xs:union memberTypes="StringValue_Type CharacterValue_Type RealValue_Type BooleanValue_Type IntegerValue_Type DateTimeValue_Type"/>
// </xs:simpleType>
// </xs:element>
type CimValue struct {
XMLName xml.Name `xml:"VALUE"`
Value string `xml:",chardata"`
}
func (self *CimValue) GetValue() interface{} {
return self.Value
}
func (self *CimValue) IsNil() bool {
return false
}
func (self *CimValue) ToString(buf *strings.Builder) {
buf.WriteString(self.Value)
}
func (self *CimValue) String() string {
return self.Value
}
// <xs:element name="VALUE.ARRAY">
// <xs:annotation>
// <xs:documentation>Defines an non-reference array value.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice minOccurs="0" maxOccurs="unbounded">
// <xs:element ref="VALUE"/>
// <xs:element ref="VALUE.NULL"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueArray struct {
XMLName xml.Name `xml:"VALUE.ARRAY"`
Values []CimValueOrNull `xml:",any,omitempty"`
}
func (self *CimValueArray) GetValue() interface{} {
if nil == self || nil == self.Values {
return nil
}
results := make([]interface{}, len(self.Values))
for idx, v := range self.Values {
results[idx] = v.GetValue()
}
return results
}
func (self *CimValueArray) IsNil() bool {
return nil == self || nil == self.Values
}
func (self *CimValueArray) ToString(buf *strings.Builder) {
if nil == self || nil == self.Values {
buf.WriteString(NULLSTRING)
} else if 0 == len(self.Values) {
buf.WriteString("[]")
} else {
buf.WriteString("[")
for idx, v := range self.Values {
if idx != 0 {
buf.WriteString(",")
}
v.ToString(buf)
}
buf.WriteString("]")
}
}
func (self *CimValueArray) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
const NULLSTRING = "null"
type CimValueOrNull struct {
Value *CimValue `xml:"VALUE,omitempty"`
Null *CimValueNull `xml:"VALUE.NULL,omitempty"`
}
func (self *CimValueOrNull) GetValue() interface{} {
if nil == self.Value {
return nil
}
return self.Value.GetValue()
}
func (self *CimValueOrNull) IsNil() bool {
return nil == self.Value
}
func (self *CimValueOrNull) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if nil != self.Value {
return e.Encode(self.Value)
}
if nil != self.Null {
return e.Encode(self.Null)
}
return nil
}
func (self *CimValueOrNull) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
if "VALUE" == start.Name.Local {
self.Value = &CimValue{}
return d.DecodeElement(self.Value, &start)
}
if "VALUE.NULL" == start.Name.Local {
self.Null = &CimValueNull{}
return d.DecodeElement(self.Null, &start)
}
return nil
}
func (self *CimValueOrNull) ToString(buf *strings.Builder) {
if nil == self.Value {
buf.WriteString(NULLSTRING)
} else {
self.Value.ToString(buf)
}
}
func (self *CimValueOrNull) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="VALUE.REFERENCE">
// <xs:annotation>
// <xs:documentation>Defines a non-NULL reference scalar value.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice>
// <xs:element ref="CLASSPATH"/>
// <xs:element ref="LOCALCLASSPATH"/>
// <xs:element ref="CLASSNAME"/>
// <xs:element ref="INSTANCEPATH"/>
// <xs:element ref="LOCALINSTANCEPATH"/>
// <xs:element ref="INSTANCENAME"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueReference struct {
XMLName xml.Name `xml:"VALUE.REFERENCE"`
ClassPath *CimClassPath `xml:"CLASSPATH,omitempty"`
LocalClassPath *CimLocalClassPath `xml:"LOCALCLASSPATH,omitempty"`
ClassName *CimClassName `xml:"CLASSNAME,omitempty"`
InstancePath *CimInstancePath `xml:"INSTANCEPATH,omitempty"`
LocalInstancePath *CimLocalInstancePath `xml:"LOCALINSTANCEPATH,omitempty"`
InstanceName *CimInstanceName `xml:"INSTANCENAME,omitempty"`
}
func (self *CimValueReference) GetValue() interface{} {
if nil != self.ClassPath {
return self.ClassPath
} else if nil != self.LocalClassPath {
return self.LocalClassPath
} else if nil != self.ClassName {
return self.ClassName.Name
} else if nil != self.InstancePath {
return self.InstancePath
} else if nil != self.LocalInstancePath {
return self.LocalInstancePath
} else if nil != self.InstanceName {
return self.InstanceName
} else {
return nil
}
}
func (self *CimValueReference) IsNil() bool {
return nil == self.ClassPath ||
nil == self.LocalClassPath ||
nil == self.ClassName ||
nil == self.InstancePath ||
nil == self.LocalInstancePath ||
nil == self.InstanceName
}
func (self *CimValueReference) ToString(buf *strings.Builder) {
if nil != self.ClassPath {
self.ClassPath.ToString(buf)
} else if nil != self.LocalClassPath {
self.LocalClassPath.ToString(buf)
} else if nil != self.ClassName {
buf.WriteString(self.ClassName.Name)
} else if nil != self.InstancePath {
self.InstancePath.ToString(buf)
} else if nil != self.LocalInstancePath {
self.LocalInstancePath.ToString(buf)
} else if nil != self.InstanceName {
self.InstanceName.ToString(buf)
} else {
buf.WriteString(NULLSTRING)
}
}
func (self *CimValueReference) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="VALUE.REFARRAY">
// <xs:annotation>
// <xs:documentation>Defines a reference array value.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice minOccurs="0" maxOccurs="unbounded">
// <xs:element ref="VALUE.REFERENCE"/>
// <xs:element ref="VALUE.NULL"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueRefArray struct {
XMLName xml.Name `xml:"VALUE.REFARRAY"`
Values []CimValueReferenceOrNull `xml:",any,omitempty"`
}
func (self *CimValueRefArray) GetValue() interface{} {
if nil == self || nil == self.Values {
return nil
}
results := make([]interface{}, len(self.Values))
for idx, v := range self.Values {
results[idx] = v.GetValue()
}
return results
}
func (self *CimValueRefArray) IsNil() bool {
return nil == self || nil == self.Values
}
func (self *CimValueRefArray) ToString(buf *strings.Builder) {
if nil == self || nil == self.Values {
buf.WriteString(NULLSTRING)
} else if 0 == len(self.Values) {
buf.WriteString("[]")
} else {
buf.WriteString("[")
for idx, v := range self.Values {
if idx != 0 {
buf.WriteString(",")
}
v.ToString(buf)
}
buf.WriteString("]")
}
}
func (self *CimValueRefArray) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
type CimValueReferenceOrNull struct {
Value *CimValueReference
Null *CimValueNull
}
func (self *CimValueReferenceOrNull) GetValue() interface{} {
if nil == self.Value {
return nil
}
return self.Value.GetValue()
}
func (self *CimValueReferenceOrNull) IsNil() bool {
return nil == self.Value
}
func (self *CimValueReferenceOrNull) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if nil != self.Value {
return e.Encode(self.Value)
}
if nil != self.Null {
return e.Encode(self.Null)
}
return nil
}
func (self *CimValueReferenceOrNull) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
if "VALUE.REFERENCE" == start.Name.Local {
self.Value = &CimValueReference{}
return d.DecodeElement(self.Value, &start)
}
if "VALUE.NULL" == start.Name.Local {
self.Null = &CimValueNull{}
return d.DecodeElement(self.Null, &start)
}
return nil
}
func (self *CimValueReferenceOrNull) ToString(buf *strings.Builder) {
if nil == self.Value {
buf.WriteString(NULLSTRING)
} else {
self.Value.ToString(buf)
}
}
func (self *CimValueReferenceOrNull) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="VALUE.OBJECT">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a CIM object (class or instance) definition.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice>
// <xs:element ref="CLASS"/>
// <xs:element ref="INSTANCE"/>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueObject struct {
XMLName xml.Name `xml:"VALUE.OBJECT"`
Instance *CimInstance `xml:"INSTANCE,omitempty"`
Class *CimClass `xml:"CLASS,omitempty"`
}
// <xs:element name="VALUE.NAMEDINSTANCE">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a named CIM instance definition.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="INSTANCENAME"/>
// <xs:element ref="INSTANCE"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimValueNamedInstance struct {
XMLName xml.Name `xml:"VALUE.NAMEDINSTANCE"`
InstanceName CimInstanceName `xml:"INSTANCENAME"`
Instance CimInstance `xml:"INSTANCE"`
}
func (self *CimValueNamedInstance) GetName() CIMInstanceName {
return &self.InstanceName
}
func (self *CimValueNamedInstance) GetInstance() CIMInstance {
return &self.Instance
}
func (self *CimValueNamedInstance) ToString(buf *strings.Builder) {
xml.NewEncoder(buf).Encode(self)
}
func (self *CimValueNamedInstance) String() string {
var sb strings.Builder
self.ToString(&sb)
return sb.String()
}
func ToCimInstanceName(name CIMInstanceName) CimInstanceName {
return *name.(*CimInstanceName)
}
func ToCimInstance(instance CIMInstance) CimInstance {
return *instance.(*CimInstance)
}
// <xs:element name="VALUE.NAMEDOBJECT">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a named CIM object (class or instance) definition.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice>
// <xs:element ref="CLASS"/>
// <xs:sequence>
// <xs:element ref="INSTANCENAME"/>
// <xs:element ref="INSTANCE"/>
// </xs:sequence>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueNamedObject struct {
XMLName xml.Name `xml:"VALUE.NAMEDOBJECT"`
Class *CimClass `xml:"CLASS,omitempty"`
InstanceName *CimInstanceName `xml:"INSTANCENAME,omitempty"`
Instance *CimInstance `xml:"INSTANCE,omitempty"`
}
// <xs:element name="VALUE.OBJECTWITHPATH">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a CIM object (class or instance) definition with additional
// information that defines the absolute path to that object.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice>
// <xs:sequence>
// <xs:element ref="CLASSPATH"/>
// <xs:element ref="CLASS"/>
// </xs:sequence>
// <xs:sequence>
// <xs:element ref="INSTANCEPATH"/>
// <xs:element ref="INSTANCE"/>
// </xs:sequence>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueObjectWithPath struct {
XMLName xml.Name `xml:"VALUE.OBJECTWITHPATH"`
ClassPath *CimClassPath `xml:"CLASSPATH,omitempty"`
Class *CimClass `xml:"CLASS,omitempty"`
InstancePath *CimInstancePath `xml:"INSTANCEPATH,omitempty"`
Instance *CimInstance `xml:"INSTANCE,omitempty"`
}
func (object CimValueObjectWithPath) GetName() CIMInstanceName {
return &object.InstancePath.InstanceName
}
func (object CimValueObjectWithPath) GetInstance() CIMInstance {
return object.Instance
}
// <xs:element name="VALUE.OBJECTWITHLOCALPATH">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a CIM object (class or instance) definition with additional
// information that defines the local path to that object.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:choice>
// <xs:sequence>
// <xs:element ref="LOCALCLASSPATH"/>
// <xs:element ref="CLASS"/>
// </xs:sequence>
// <xs:sequence>
// <xs:element ref="LOCALINSTANCEPATH"/>
// <xs:element ref="INSTANCE"/>
// </xs:sequence>
// </xs:choice>
// </xs:complexType>
// </xs:element>
type CimValueObjectWithLocalPath struct {
XMLName xml.Name `xml:"VALUE.OBJECTWITHLOCALPATH"`
ClassPath *CimLocalClassPath `xml:"LOCALCLASSPATH,omitempty"`
Class *CimClass `xml:"CLASS,omitempty"`
InstancePath *CimLocalInstancePath `xml:"LOCALINSTANCEPATH,omitempty"`
Instance *CimInstance `xml:"INSTANCE,omitempty"`
}
func (object CimValueObjectWithLocalPath) GetName() CIMInstanceName {
return &object.InstancePath.InstanceName
}
func (object CimValueObjectWithLocalPath) GetInstance() CIMInstance {
return object.Instance
}
// <xs:element name="VALUE.NULL">
// <xs:annotation>
// <xs:documentation>Defines the NULL value.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType/>
// </xs:element>
type CimValueNull struct {
XMLName xml.Name `xml:"VALUE.NULL"`
}
// <xs:element name="VALUE.INSTANCEWITHPATH">
// <xs:annotation>
// <xs:documentation>Defines a value that comprises a CIM instance definition with additional information that
// defines the absolute path to that object.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="INSTANCEPATH"/>
// <xs:element ref="INSTANCE"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimValueInstanceWithPath struct {
XMLName xml.Name `xml:"VALUE.INSTANCEWITHPATH"`
InstancePath CimInstancePath `xml:"INSTANCEPATH"`
Instance CimInstance `xml:"INSTANCE"`
}
// <!-- Section: Naming and Location Elements -->
// <xs:element name="NAMESPACEPATH">
// <xs:annotation>
// <xs:documentation>Defines an (absolute) namespace path.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="HOST"/>
// <xs:element ref="LOCALNAMESPACEPATH"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimNamespacePath struct {
XMLName xml.Name `xml:"NAMESPACEPATH"`
Host CimHost `xml:"HOST"`
LocalNamespacePath CimLocalNamespacePath `xml:"LOCALNAMESPACEPATH"`
}
func (self *CimNamespacePath) IsNil() bool {
return self.LocalNamespacePath.IsNil()
}
func (self *CimNamespacePath) ToString(buf *strings.Builder) {
buf.WriteString(self.Host.Value)
buf.WriteString("/")
self.LocalNamespacePath.ToString(buf)
}
func (self *CimNamespacePath) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="LOCALNAMESPACEPATH">
// <xs:annotation>
// <xs:documentation>Defines a local namespace path (one without a host component).
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="NAMESPACE" maxOccurs="unbounded"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimLocalNamespacePath struct {
XMLName xml.Name `xml:"LOCALNAMESPACEPATH"`
Namespaces []CimNamespace `xml:"NAMESPACE"`
}
func (self *CimLocalNamespacePath) IsNil() bool {
return 0 == len(self.Namespaces)
}
func (self *CimLocalNamespacePath) ToString(buf *strings.Builder) {
if 0 != len(self.Namespaces) {
for idx, nm := range self.Namespaces {
if idx > 0 {
buf.WriteString("/")
}
buf.WriteString(nm.Name)
}
}
}
func (self *CimLocalNamespacePath) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="HOST">
// <xs:annotation>
// <xs:documentation>Defines a host name and optionally a port number.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:simpleType>
// <xs:restriction base="xs:string"/>
// </xs:simpleType>
// </xs:element>
type CimHost struct {
XMLName xml.Name `xml:"HOST"`
Value string `xml:",chardata"`
}
// <xs:element name="NAMESPACE">
// <xs:annotation>
// <xs:documentation>Defines a single namespace within the namespace component of a namespace path.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:attribute ref="NAME" use="required"/>
// </xs:complexType>
// </xs:element>
type CimNamespace struct {
XMLName xml.Name `xml:"NAMESPACE"`
Name string `xml:"NAME,attr"`
}
// <xs:element name="CLASSPATH">
// <xs:annotation>
// <xs:documentation>Defines the absolute path to a CIM class.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="NAMESPACEPATH"/>
// <xs:element ref="CLASSNAME"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimClassPath struct {
XMLName xml.Name `xml:"CLASSPATH"`
NamespacePath CimNamespacePath `xml:"NAMESPACEPATH"`
ClassName CimClassName `xml:"CLASSNAME"`
}
func (self *CimClassPath) IsNil() bool {
return self.NamespacePath.IsNil()
}
func (self *CimClassPath) ToString(buf *strings.Builder) {
self.NamespacePath.ToString(buf)
buf.WriteRune(':')
buf.WriteString(self.ClassName.Name)
}
func (self *CimClassPath) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="LOCALCLASSPATH">
// <xs:annotation>
// <xs:documentation>Defines the local path to a CIM class.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="LOCALNAMESPACEPATH"/>
// <xs:element ref="CLASSNAME"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimLocalClassPath struct {
XMLName xml.Name `xml:"LOCALCLASSPATH"`
NamespacePath CimLocalNamespacePath `xml:"LOCALNAMESPACEPATH"`
ClassName CimClassName `xml:"CLASSNAME"`
}
func (self *CimLocalClassPath) IsNil() bool {
return self.NamespacePath.IsNil()
}
func (self *CimLocalClassPath) ToString(buf *strings.Builder) {
self.NamespacePath.ToString(buf)
buf.WriteRune(':')
buf.WriteString(self.ClassName.Name)
}
func (self *CimLocalClassPath) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="CLASSNAME">
// <xs:annotation>
// <xs:documentation>Defines the name of a CIM class.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:attribute name="NAME" type="CIMClassName_Type" use="required"/>
// </xs:complexType>
// </xs:element>
type CimClassName struct {
XMLName xml.Name `xml:"CLASSNAME"`
Name string `xml:"NAME,attr"`
}
func (self *CimClassName) String() string {
return self.Name
}
// <xs:element name="INSTANCEPATH">
// <xs:annotation>
// <xs:documentation>Defines the absolute path to a CIM instance.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="NAMESPACEPATH"/>
// <xs:element ref="INSTANCENAME"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimInstancePath struct {
XMLName xml.Name `xml:"INSTANCEPATH"`
NamespacePath CimNamespacePath `xml:"NAMESPACEPATH"`
InstanceName CimInstanceName `xml:"INSTANCENAME"`
}
func (self *CimInstancePath) IsNil() bool {
return self.NamespacePath.IsNil()
}
func (self *CimInstancePath) ToString(buf *strings.Builder) {
self.NamespacePath.ToString(buf)
if self.InstanceName.IsTyped() {
buf.WriteString("/(instance)")
} else {
buf.WriteRune(':')
}
self.InstanceName.ToString(buf)
}
func (self *CimInstancePath) String() string {
var buf strings.Builder
self.ToString(&buf)
return buf.String()
}
// <xs:element name="LOCALINSTANCEPATH">
// <xs:annotation>
// <xs:documentation>Defines the local path to a CIM instance.
// For details, see the corresponding element defined in DSP0201.</xs:documentation>
// </xs:annotation>
// <xs:complexType>
// <xs:sequence>
// <xs:element ref="LOCALNAMESPACEPATH"/>
// <xs:element ref="INSTANCENAME"/>
// </xs:sequence>
// </xs:complexType>
// </xs:element>
type CimLocalInstancePath struct {
XMLName xml.Name `xml:"LOCALINSTANCEPATH"`
LocalNamespacePath CimLocalNamespacePath `xml:"LOCALNAMESPACEPATH"`
InstanceName CimInstanceName `xml:"INSTANCENAME"`
}
func (self *CimLocalInstancePath) IsNil() bool {
return self.LocalNamespacePath.IsNil()