1 package datacollection
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/monitor/mgmt/2021-09-01-preview/datacollection"
21
22
23 type AzureMonitorMetricsDestination struct {
24
25
26 Name *string `json:"name,omitempty"`
27 }
28
29
30 type ColumnDefinition struct {
31
32 Name *string `json:"name,omitempty"`
33
34 Type KnownColumnDefinitionType `json:"type,omitempty"`
35 }
36
37
38 type ConfigurationAccessEndpointSpec struct {
39
40 Endpoint *string `json:"endpoint,omitempty"`
41 }
42
43
44 func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) {
45 objectMap := make(map[string]interface{})
46 return json.Marshal(objectMap)
47 }
48
49
50 type DataFlow struct {
51
52 Streams *[]KnownDataFlowStreams `json:"streams,omitempty"`
53
54 Destinations *[]string `json:"destinations,omitempty"`
55
56 TransformKql *string `json:"transformKql,omitempty"`
57
58 OutputStream *string `json:"outputStream,omitempty"`
59 }
60
61
62 type DataSourcesSpec struct {
63
64 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"`
65
66 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"`
67
68 Syslog *[]SyslogDataSource `json:"syslog,omitempty"`
69
70 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"`
71
72 LogFiles *[]LogFilesDataSource `json:"logFiles,omitempty"`
73
74 IisLogs *[]IisLogsDataSource `json:"iisLogs,omitempty"`
75 }
76
77
78 type DestinationsSpec struct {
79
80 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"`
81
82 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"`
83 }
84
85
86 type DestinationsSpecAzureMonitorMetrics struct {
87
88
89 Name *string `json:"name,omitempty"`
90 }
91
92
93 type Endpoint struct {
94
95 Description *string `json:"description,omitempty"`
96
97 ImmutableID *string `json:"immutableId,omitempty"`
98
99 ConfigurationAccess *EndpointConfigurationAccess `json:"configurationAccess,omitempty"`
100
101 LogsIngestion *EndpointLogsIngestion `json:"logsIngestion,omitempty"`
102
103 NetworkAcls *EndpointNetworkAcls `json:"networkAcls,omitempty"`
104
105 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"`
106 }
107
108
109 func (e Endpoint) MarshalJSON() ([]byte, error) {
110 objectMap := make(map[string]interface{})
111 if e.Description != nil {
112 objectMap["description"] = e.Description
113 }
114 if e.ImmutableID != nil {
115 objectMap["immutableId"] = e.ImmutableID
116 }
117 if e.ConfigurationAccess != nil {
118 objectMap["configurationAccess"] = e.ConfigurationAccess
119 }
120 if e.LogsIngestion != nil {
121 objectMap["logsIngestion"] = e.LogsIngestion
122 }
123 if e.NetworkAcls != nil {
124 objectMap["networkAcls"] = e.NetworkAcls
125 }
126 return json.Marshal(objectMap)
127 }
128
129
130 type EndpointConfigurationAccess struct {
131
132 Endpoint *string `json:"endpoint,omitempty"`
133 }
134
135
136 func (eA EndpointConfigurationAccess) MarshalJSON() ([]byte, error) {
137 objectMap := make(map[string]interface{})
138 return json.Marshal(objectMap)
139 }
140
141
142 type EndpointLogsIngestion struct {
143
144 Endpoint *string `json:"endpoint,omitempty"`
145 }
146
147
148 func (eI EndpointLogsIngestion) MarshalJSON() ([]byte, error) {
149 objectMap := make(map[string]interface{})
150 return json.Marshal(objectMap)
151 }
152
153
154 type EndpointNetworkAcls struct {
155
156 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"`
157 }
158
159
160 type EndpointResource struct {
161 autorest.Response `json:"-"`
162
163 *EndpointResourceProperties `json:"properties,omitempty"`
164
165 Location *string `json:"location,omitempty"`
166
167 Tags map[string]*string `json:"tags"`
168
169 Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"`
170
171 ID *string `json:"id,omitempty"`
172
173 Name *string `json:"name,omitempty"`
174
175 Type *string `json:"type,omitempty"`
176
177 Etag *string `json:"etag,omitempty"`
178
179 SystemData *EndpointResourceSystemData `json:"systemData,omitempty"`
180 }
181
182
183 func (er EndpointResource) MarshalJSON() ([]byte, error) {
184 objectMap := make(map[string]interface{})
185 if er.EndpointResourceProperties != nil {
186 objectMap["properties"] = er.EndpointResourceProperties
187 }
188 if er.Location != nil {
189 objectMap["location"] = er.Location
190 }
191 if er.Tags != nil {
192 objectMap["tags"] = er.Tags
193 }
194 if er.Kind != "" {
195 objectMap["kind"] = er.Kind
196 }
197 return json.Marshal(objectMap)
198 }
199
200
201 func (er *EndpointResource) UnmarshalJSON(body []byte) error {
202 var m map[string]*json.RawMessage
203 err := json.Unmarshal(body, &m)
204 if err != nil {
205 return err
206 }
207 for k, v := range m {
208 switch k {
209 case "properties":
210 if v != nil {
211 var endpointResourceProperties EndpointResourceProperties
212 err = json.Unmarshal(*v, &endpointResourceProperties)
213 if err != nil {
214 return err
215 }
216 er.EndpointResourceProperties = &endpointResourceProperties
217 }
218 case "location":
219 if v != nil {
220 var location string
221 err = json.Unmarshal(*v, &location)
222 if err != nil {
223 return err
224 }
225 er.Location = &location
226 }
227 case "tags":
228 if v != nil {
229 var tags map[string]*string
230 err = json.Unmarshal(*v, &tags)
231 if err != nil {
232 return err
233 }
234 er.Tags = tags
235 }
236 case "kind":
237 if v != nil {
238 var kind KnownDataCollectionEndpointResourceKind
239 err = json.Unmarshal(*v, &kind)
240 if err != nil {
241 return err
242 }
243 er.Kind = kind
244 }
245 case "id":
246 if v != nil {
247 var ID string
248 err = json.Unmarshal(*v, &ID)
249 if err != nil {
250 return err
251 }
252 er.ID = &ID
253 }
254 case "name":
255 if v != nil {
256 var name string
257 err = json.Unmarshal(*v, &name)
258 if err != nil {
259 return err
260 }
261 er.Name = &name
262 }
263 case "type":
264 if v != nil {
265 var typeVar string
266 err = json.Unmarshal(*v, &typeVar)
267 if err != nil {
268 return err
269 }
270 er.Type = &typeVar
271 }
272 case "etag":
273 if v != nil {
274 var etag string
275 err = json.Unmarshal(*v, &etag)
276 if err != nil {
277 return err
278 }
279 er.Etag = &etag
280 }
281 case "systemData":
282 if v != nil {
283 var systemData EndpointResourceSystemData
284 err = json.Unmarshal(*v, &systemData)
285 if err != nil {
286 return err
287 }
288 er.SystemData = &systemData
289 }
290 }
291 }
292
293 return nil
294 }
295
296
297 type EndpointResourceListResult struct {
298 autorest.Response `json:"-"`
299
300 Value *[]EndpointResource `json:"value,omitempty"`
301
302 NextLink *string `json:"nextLink,omitempty"`
303 }
304
305
306 type EndpointResourceListResultIterator struct {
307 i int
308 page EndpointResourceListResultPage
309 }
310
311
312
313 func (iter *EndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
314 if tracing.IsEnabled() {
315 ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultIterator.NextWithContext")
316 defer func() {
317 sc := -1
318 if iter.Response().Response.Response != nil {
319 sc = iter.Response().Response.Response.StatusCode
320 }
321 tracing.EndSpan(ctx, sc, err)
322 }()
323 }
324 iter.i++
325 if iter.i < len(iter.page.Values()) {
326 return nil
327 }
328 err = iter.page.NextWithContext(ctx)
329 if err != nil {
330 iter.i--
331 return err
332 }
333 iter.i = 0
334 return nil
335 }
336
337
338
339
340 func (iter *EndpointResourceListResultIterator) Next() error {
341 return iter.NextWithContext(context.Background())
342 }
343
344
345 func (iter EndpointResourceListResultIterator) NotDone() bool {
346 return iter.page.NotDone() && iter.i < len(iter.page.Values())
347 }
348
349
350 func (iter EndpointResourceListResultIterator) Response() EndpointResourceListResult {
351 return iter.page.Response()
352 }
353
354
355
356 func (iter EndpointResourceListResultIterator) Value() EndpointResource {
357 if !iter.page.NotDone() {
358 return EndpointResource{}
359 }
360 return iter.page.Values()[iter.i]
361 }
362
363
364 func NewEndpointResourceListResultIterator(page EndpointResourceListResultPage) EndpointResourceListResultIterator {
365 return EndpointResourceListResultIterator{page: page}
366 }
367
368
369 func (erlr EndpointResourceListResult) IsEmpty() bool {
370 return erlr.Value == nil || len(*erlr.Value) == 0
371 }
372
373
374 func (erlr EndpointResourceListResult) hasNextLink() bool {
375 return erlr.NextLink != nil && len(*erlr.NextLink) != 0
376 }
377
378
379
380 func (erlr EndpointResourceListResult) endpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
381 if !erlr.hasNextLink() {
382 return nil, nil
383 }
384 return autorest.Prepare((&http.Request{}).WithContext(ctx),
385 autorest.AsJSON(),
386 autorest.AsGet(),
387 autorest.WithBaseURL(to.String(erlr.NextLink)))
388 }
389
390
391 type EndpointResourceListResultPage struct {
392 fn func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error)
393 erlr EndpointResourceListResult
394 }
395
396
397
398 func (page *EndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
399 if tracing.IsEnabled() {
400 ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultPage.NextWithContext")
401 defer func() {
402 sc := -1
403 if page.Response().Response.Response != nil {
404 sc = page.Response().Response.Response.StatusCode
405 }
406 tracing.EndSpan(ctx, sc, err)
407 }()
408 }
409 for {
410 next, err := page.fn(ctx, page.erlr)
411 if err != nil {
412 return err
413 }
414 page.erlr = next
415 if !next.hasNextLink() || !next.IsEmpty() {
416 break
417 }
418 }
419 return nil
420 }
421
422
423
424
425 func (page *EndpointResourceListResultPage) Next() error {
426 return page.NextWithContext(context.Background())
427 }
428
429
430 func (page EndpointResourceListResultPage) NotDone() bool {
431 return !page.erlr.IsEmpty()
432 }
433
434
435 func (page EndpointResourceListResultPage) Response() EndpointResourceListResult {
436 return page.erlr
437 }
438
439
440 func (page EndpointResourceListResultPage) Values() []EndpointResource {
441 if page.erlr.IsEmpty() {
442 return nil
443 }
444 return *page.erlr.Value
445 }
446
447
448 func NewEndpointResourceListResultPage(cur EndpointResourceListResult, getNextPage func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error)) EndpointResourceListResultPage {
449 return EndpointResourceListResultPage{
450 fn: getNextPage,
451 erlr: cur,
452 }
453 }
454
455
456 type EndpointResourceProperties struct {
457
458 Description *string `json:"description,omitempty"`
459
460 ImmutableID *string `json:"immutableId,omitempty"`
461
462 ConfigurationAccess *EndpointConfigurationAccess `json:"configurationAccess,omitempty"`
463
464 LogsIngestion *EndpointLogsIngestion `json:"logsIngestion,omitempty"`
465
466 NetworkAcls *EndpointNetworkAcls `json:"networkAcls,omitempty"`
467
468 ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"`
469 }
470
471
472 func (er EndpointResourceProperties) MarshalJSON() ([]byte, error) {
473 objectMap := make(map[string]interface{})
474 if er.Description != nil {
475 objectMap["description"] = er.Description
476 }
477 if er.ImmutableID != nil {
478 objectMap["immutableId"] = er.ImmutableID
479 }
480 if er.ConfigurationAccess != nil {
481 objectMap["configurationAccess"] = er.ConfigurationAccess
482 }
483 if er.LogsIngestion != nil {
484 objectMap["logsIngestion"] = er.LogsIngestion
485 }
486 if er.NetworkAcls != nil {
487 objectMap["networkAcls"] = er.NetworkAcls
488 }
489 return json.Marshal(objectMap)
490 }
491
492
493 type EndpointResourceSystemData struct {
494
495 CreatedBy *string `json:"createdBy,omitempty"`
496
497 CreatedByType CreatedByType `json:"createdByType,omitempty"`
498
499 CreatedAt *date.Time `json:"createdAt,omitempty"`
500
501 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
502
503 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
504
505 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
506 }
507
508
509 type ErrorAdditionalInfo struct {
510
511 Type *string `json:"type,omitempty"`
512
513 Info interface{} `json:"info,omitempty"`
514 }
515
516
517 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
518 objectMap := make(map[string]interface{})
519 return json.Marshal(objectMap)
520 }
521
522
523 type ErrorDetail struct {
524
525 Code *string `json:"code,omitempty"`
526
527 Message *string `json:"message,omitempty"`
528
529 Target *string `json:"target,omitempty"`
530
531 Details *[]ErrorDetail `json:"details,omitempty"`
532
533 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
534 }
535
536
537 func (ed ErrorDetail) MarshalJSON() ([]byte, error) {
538 objectMap := make(map[string]interface{})
539 return json.Marshal(objectMap)
540 }
541
542
543
544 type ErrorResponseCommonV2 struct {
545
546 Error *ErrorDetail `json:"error,omitempty"`
547 }
548
549
550
551
552 type ExtensionDataSource struct {
553
554
555 Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"`
556
557 ExtensionName *string `json:"extensionName,omitempty"`
558
559 ExtensionSettings interface{} `json:"extensionSettings,omitempty"`
560
561 InputDataSources *[]string `json:"inputDataSources,omitempty"`
562
563
564 Name *string `json:"name,omitempty"`
565 }
566
567
568 type IisLogsDataSource struct {
569
570 Streams *[]string `json:"streams,omitempty"`
571
572 LogDirectories *[]string `json:"logDirectories,omitempty"`
573
574
575 Name *string `json:"name,omitempty"`
576 }
577
578
579 type LogAnalyticsDestination struct {
580
581 WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"`
582
583 WorkspaceID *string `json:"workspaceId,omitempty"`
584
585
586 Name *string `json:"name,omitempty"`
587 }
588
589
590 func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) {
591 objectMap := make(map[string]interface{})
592 if lad.WorkspaceResourceID != nil {
593 objectMap["workspaceResourceId"] = lad.WorkspaceResourceID
594 }
595 if lad.Name != nil {
596 objectMap["name"] = lad.Name
597 }
598 return json.Marshal(objectMap)
599 }
600
601
602 type LogFilesDataSource struct {
603
604
605 Streams *[]string `json:"streams,omitempty"`
606
607 FilePatterns *[]string `json:"filePatterns,omitempty"`
608
609 Format *string `json:"format,omitempty"`
610
611 Settings *LogFilesDataSourceSettings `json:"settings,omitempty"`
612
613
614 Name *string `json:"name,omitempty"`
615 }
616
617
618 type LogFilesDataSourceSettings struct {
619
620 Text *LogFileSettingsText `json:"text,omitempty"`
621 }
622
623
624 type LogFileSettings struct {
625
626 Text *LogFileSettingsText `json:"text,omitempty"`
627 }
628
629
630 type LogFileSettingsText struct {
631
632 RecordStartTimestampFormat KnownLogFileTextSettingsRecordStartTimestampFormat `json:"recordStartTimestampFormat,omitempty"`
633 }
634
635
636 type LogFileTextSettings struct {
637
638 RecordStartTimestampFormat KnownLogFileTextSettingsRecordStartTimestampFormat `json:"recordStartTimestampFormat,omitempty"`
639 }
640
641
642 type LogsIngestionEndpointSpec struct {
643
644 Endpoint *string `json:"endpoint,omitempty"`
645 }
646
647
648 func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) {
649 objectMap := make(map[string]interface{})
650 return json.Marshal(objectMap)
651 }
652
653
654 type Metadata struct {
655
656 ProvisionedBy *string `json:"provisionedBy,omitempty"`
657 }
658
659
660 func (mVar Metadata) MarshalJSON() ([]byte, error) {
661 objectMap := make(map[string]interface{})
662 return json.Marshal(objectMap)
663 }
664
665
666 type NetworkRuleSet struct {
667
668 PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"`
669 }
670
671
672
673
674 type PerfCounterDataSource struct {
675
676
677 Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"`
678
679 SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"`
680
681
682
683 CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"`
684
685
686 Name *string `json:"name,omitempty"`
687 }
688
689
690 type ResourceForUpdate struct {
691
692 Tags map[string]*string `json:"tags"`
693 }
694
695
696 func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) {
697 objectMap := make(map[string]interface{})
698 if rfu.Tags != nil {
699 objectMap["tags"] = rfu.Tags
700 }
701 return json.Marshal(objectMap)
702 }
703
704
705 type Rule struct {
706
707 Description *string `json:"description,omitempty"`
708
709 ImmutableID *string `json:"immutableId,omitempty"`
710
711 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
712
713 Metadata *RuleMetadata `json:"metadata,omitempty"`
714
715 StreamDeclarations map[string]*StreamDeclaration `json:"streamDeclarations"`
716
717
718 DataSources *RuleDataSources `json:"dataSources,omitempty"`
719
720 Destinations *RuleDestinations `json:"destinations,omitempty"`
721
722 DataFlows *[]DataFlow `json:"dataFlows,omitempty"`
723
724 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"`
725 }
726
727
728 func (r Rule) MarshalJSON() ([]byte, error) {
729 objectMap := make(map[string]interface{})
730 if r.Description != nil {
731 objectMap["description"] = r.Description
732 }
733 if r.DataCollectionEndpointID != nil {
734 objectMap["dataCollectionEndpointId"] = r.DataCollectionEndpointID
735 }
736 if r.StreamDeclarations != nil {
737 objectMap["streamDeclarations"] = r.StreamDeclarations
738 }
739 if r.DataSources != nil {
740 objectMap["dataSources"] = r.DataSources
741 }
742 if r.Destinations != nil {
743 objectMap["destinations"] = r.Destinations
744 }
745 if r.DataFlows != nil {
746 objectMap["dataFlows"] = r.DataFlows
747 }
748 return json.Marshal(objectMap)
749 }
750
751
752 type RuleAssociation struct {
753
754 Description *string `json:"description,omitempty"`
755
756 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"`
757
758 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
759
760 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"`
761
762 Metadata *RuleAssociationMetadata `json:"metadata,omitempty"`
763 }
764
765
766 func (ra RuleAssociation) MarshalJSON() ([]byte, error) {
767 objectMap := make(map[string]interface{})
768 if ra.Description != nil {
769 objectMap["description"] = ra.Description
770 }
771 if ra.DataCollectionRuleID != nil {
772 objectMap["dataCollectionRuleId"] = ra.DataCollectionRuleID
773 }
774 if ra.DataCollectionEndpointID != nil {
775 objectMap["dataCollectionEndpointId"] = ra.DataCollectionEndpointID
776 }
777 return json.Marshal(objectMap)
778 }
779
780
781 type RuleAssociationMetadata struct {
782
783 ProvisionedBy *string `json:"provisionedBy,omitempty"`
784 }
785
786
787 func (ra RuleAssociationMetadata) MarshalJSON() ([]byte, error) {
788 objectMap := make(map[string]interface{})
789 return json.Marshal(objectMap)
790 }
791
792
793 type RuleAssociationProxyOnlyResource struct {
794 autorest.Response `json:"-"`
795
796 *RuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"`
797
798 ID *string `json:"id,omitempty"`
799
800 Name *string `json:"name,omitempty"`
801
802 Type *string `json:"type,omitempty"`
803
804 Etag *string `json:"etag,omitempty"`
805
806 SystemData *RuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"`
807 }
808
809
810 func (rapor RuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) {
811 objectMap := make(map[string]interface{})
812 if rapor.RuleAssociationProxyOnlyResourceProperties != nil {
813 objectMap["properties"] = rapor.RuleAssociationProxyOnlyResourceProperties
814 }
815 return json.Marshal(objectMap)
816 }
817
818
819 func (rapor *RuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error {
820 var m map[string]*json.RawMessage
821 err := json.Unmarshal(body, &m)
822 if err != nil {
823 return err
824 }
825 for k, v := range m {
826 switch k {
827 case "properties":
828 if v != nil {
829 var ruleAssociationProxyOnlyResourceProperties RuleAssociationProxyOnlyResourceProperties
830 err = json.Unmarshal(*v, &ruleAssociationProxyOnlyResourceProperties)
831 if err != nil {
832 return err
833 }
834 rapor.RuleAssociationProxyOnlyResourceProperties = &ruleAssociationProxyOnlyResourceProperties
835 }
836 case "id":
837 if v != nil {
838 var ID string
839 err = json.Unmarshal(*v, &ID)
840 if err != nil {
841 return err
842 }
843 rapor.ID = &ID
844 }
845 case "name":
846 if v != nil {
847 var name string
848 err = json.Unmarshal(*v, &name)
849 if err != nil {
850 return err
851 }
852 rapor.Name = &name
853 }
854 case "type":
855 if v != nil {
856 var typeVar string
857 err = json.Unmarshal(*v, &typeVar)
858 if err != nil {
859 return err
860 }
861 rapor.Type = &typeVar
862 }
863 case "etag":
864 if v != nil {
865 var etag string
866 err = json.Unmarshal(*v, &etag)
867 if err != nil {
868 return err
869 }
870 rapor.Etag = &etag
871 }
872 case "systemData":
873 if v != nil {
874 var systemData RuleAssociationProxyOnlyResourceSystemData
875 err = json.Unmarshal(*v, &systemData)
876 if err != nil {
877 return err
878 }
879 rapor.SystemData = &systemData
880 }
881 }
882 }
883
884 return nil
885 }
886
887
888 type RuleAssociationProxyOnlyResourceListResult struct {
889 autorest.Response `json:"-"`
890
891 Value *[]RuleAssociationProxyOnlyResource `json:"value,omitempty"`
892
893 NextLink *string `json:"nextLink,omitempty"`
894 }
895
896
897
898 type RuleAssociationProxyOnlyResourceListResultIterator struct {
899 i int
900 page RuleAssociationProxyOnlyResourceListResultPage
901 }
902
903
904
905 func (iter *RuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
906 if tracing.IsEnabled() {
907 ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationProxyOnlyResourceListResultIterator.NextWithContext")
908 defer func() {
909 sc := -1
910 if iter.Response().Response.Response != nil {
911 sc = iter.Response().Response.Response.StatusCode
912 }
913 tracing.EndSpan(ctx, sc, err)
914 }()
915 }
916 iter.i++
917 if iter.i < len(iter.page.Values()) {
918 return nil
919 }
920 err = iter.page.NextWithContext(ctx)
921 if err != nil {
922 iter.i--
923 return err
924 }
925 iter.i = 0
926 return nil
927 }
928
929
930
931
932 func (iter *RuleAssociationProxyOnlyResourceListResultIterator) Next() error {
933 return iter.NextWithContext(context.Background())
934 }
935
936
937 func (iter RuleAssociationProxyOnlyResourceListResultIterator) NotDone() bool {
938 return iter.page.NotDone() && iter.i < len(iter.page.Values())
939 }
940
941
942 func (iter RuleAssociationProxyOnlyResourceListResultIterator) Response() RuleAssociationProxyOnlyResourceListResult {
943 return iter.page.Response()
944 }
945
946
947
948 func (iter RuleAssociationProxyOnlyResourceListResultIterator) Value() RuleAssociationProxyOnlyResource {
949 if !iter.page.NotDone() {
950 return RuleAssociationProxyOnlyResource{}
951 }
952 return iter.page.Values()[iter.i]
953 }
954
955
956 func NewRuleAssociationProxyOnlyResourceListResultIterator(page RuleAssociationProxyOnlyResourceListResultPage) RuleAssociationProxyOnlyResourceListResultIterator {
957 return RuleAssociationProxyOnlyResourceListResultIterator{page: page}
958 }
959
960
961 func (raporlr RuleAssociationProxyOnlyResourceListResult) IsEmpty() bool {
962 return raporlr.Value == nil || len(*raporlr.Value) == 0
963 }
964
965
966 func (raporlr RuleAssociationProxyOnlyResourceListResult) hasNextLink() bool {
967 return raporlr.NextLink != nil && len(*raporlr.NextLink) != 0
968 }
969
970
971
972 func (raporlr RuleAssociationProxyOnlyResourceListResult) ruleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
973 if !raporlr.hasNextLink() {
974 return nil, nil
975 }
976 return autorest.Prepare((&http.Request{}).WithContext(ctx),
977 autorest.AsJSON(),
978 autorest.AsGet(),
979 autorest.WithBaseURL(to.String(raporlr.NextLink)))
980 }
981
982
983
984 type RuleAssociationProxyOnlyResourceListResultPage struct {
985 fn func(context.Context, RuleAssociationProxyOnlyResourceListResult) (RuleAssociationProxyOnlyResourceListResult, error)
986 raporlr RuleAssociationProxyOnlyResourceListResult
987 }
988
989
990
991 func (page *RuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
992 if tracing.IsEnabled() {
993 ctx = tracing.StartSpan(ctx, fqdn+"/RuleAssociationProxyOnlyResourceListResultPage.NextWithContext")
994 defer func() {
995 sc := -1
996 if page.Response().Response.Response != nil {
997 sc = page.Response().Response.Response.StatusCode
998 }
999 tracing.EndSpan(ctx, sc, err)
1000 }()
1001 }
1002 for {
1003 next, err := page.fn(ctx, page.raporlr)
1004 if err != nil {
1005 return err
1006 }
1007 page.raporlr = next
1008 if !next.hasNextLink() || !next.IsEmpty() {
1009 break
1010 }
1011 }
1012 return nil
1013 }
1014
1015
1016
1017
1018 func (page *RuleAssociationProxyOnlyResourceListResultPage) Next() error {
1019 return page.NextWithContext(context.Background())
1020 }
1021
1022
1023 func (page RuleAssociationProxyOnlyResourceListResultPage) NotDone() bool {
1024 return !page.raporlr.IsEmpty()
1025 }
1026
1027
1028 func (page RuleAssociationProxyOnlyResourceListResultPage) Response() RuleAssociationProxyOnlyResourceListResult {
1029 return page.raporlr
1030 }
1031
1032
1033 func (page RuleAssociationProxyOnlyResourceListResultPage) Values() []RuleAssociationProxyOnlyResource {
1034 if page.raporlr.IsEmpty() {
1035 return nil
1036 }
1037 return *page.raporlr.Value
1038 }
1039
1040
1041 func NewRuleAssociationProxyOnlyResourceListResultPage(cur RuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, RuleAssociationProxyOnlyResourceListResult) (RuleAssociationProxyOnlyResourceListResult, error)) RuleAssociationProxyOnlyResourceListResultPage {
1042 return RuleAssociationProxyOnlyResourceListResultPage{
1043 fn: getNextPage,
1044 raporlr: cur,
1045 }
1046 }
1047
1048
1049 type RuleAssociationProxyOnlyResourceProperties struct {
1050
1051 Description *string `json:"description,omitempty"`
1052
1053 DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"`
1054
1055 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
1056
1057 ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"`
1058
1059 Metadata *RuleAssociationMetadata `json:"metadata,omitempty"`
1060 }
1061
1062
1063 func (rapor RuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) {
1064 objectMap := make(map[string]interface{})
1065 if rapor.Description != nil {
1066 objectMap["description"] = rapor.Description
1067 }
1068 if rapor.DataCollectionRuleID != nil {
1069 objectMap["dataCollectionRuleId"] = rapor.DataCollectionRuleID
1070 }
1071 if rapor.DataCollectionEndpointID != nil {
1072 objectMap["dataCollectionEndpointId"] = rapor.DataCollectionEndpointID
1073 }
1074 return json.Marshal(objectMap)
1075 }
1076
1077
1078
1079 type RuleAssociationProxyOnlyResourceSystemData struct {
1080
1081 CreatedBy *string `json:"createdBy,omitempty"`
1082
1083 CreatedByType CreatedByType `json:"createdByType,omitempty"`
1084
1085 CreatedAt *date.Time `json:"createdAt,omitempty"`
1086
1087 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
1088
1089 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
1090
1091 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
1092 }
1093
1094
1095
1096
1097 type RuleDataSources struct {
1098
1099 PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"`
1100
1101 WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"`
1102
1103 Syslog *[]SyslogDataSource `json:"syslog,omitempty"`
1104
1105 Extensions *[]ExtensionDataSource `json:"extensions,omitempty"`
1106
1107 LogFiles *[]LogFilesDataSource `json:"logFiles,omitempty"`
1108
1109 IisLogs *[]IisLogsDataSource `json:"iisLogs,omitempty"`
1110 }
1111
1112
1113 type RuleDestinations struct {
1114
1115 LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"`
1116
1117 AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"`
1118 }
1119
1120
1121 type RuleMetadata struct {
1122
1123 ProvisionedBy *string `json:"provisionedBy,omitempty"`
1124 }
1125
1126
1127 func (r RuleMetadata) MarshalJSON() ([]byte, error) {
1128 objectMap := make(map[string]interface{})
1129 return json.Marshal(objectMap)
1130 }
1131
1132
1133 type RuleResource struct {
1134 autorest.Response `json:"-"`
1135
1136 *RuleResourceProperties `json:"properties,omitempty"`
1137
1138 Location *string `json:"location,omitempty"`
1139
1140 Tags map[string]*string `json:"tags"`
1141
1142 Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"`
1143
1144 ID *string `json:"id,omitempty"`
1145
1146 Name *string `json:"name,omitempty"`
1147
1148 Type *string `json:"type,omitempty"`
1149
1150 Etag *string `json:"etag,omitempty"`
1151
1152 SystemData *RuleResourceSystemData `json:"systemData,omitempty"`
1153 }
1154
1155
1156 func (rr RuleResource) MarshalJSON() ([]byte, error) {
1157 objectMap := make(map[string]interface{})
1158 if rr.RuleResourceProperties != nil {
1159 objectMap["properties"] = rr.RuleResourceProperties
1160 }
1161 if rr.Location != nil {
1162 objectMap["location"] = rr.Location
1163 }
1164 if rr.Tags != nil {
1165 objectMap["tags"] = rr.Tags
1166 }
1167 if rr.Kind != "" {
1168 objectMap["kind"] = rr.Kind
1169 }
1170 return json.Marshal(objectMap)
1171 }
1172
1173
1174 func (rr *RuleResource) UnmarshalJSON(body []byte) error {
1175 var m map[string]*json.RawMessage
1176 err := json.Unmarshal(body, &m)
1177 if err != nil {
1178 return err
1179 }
1180 for k, v := range m {
1181 switch k {
1182 case "properties":
1183 if v != nil {
1184 var ruleResourceProperties RuleResourceProperties
1185 err = json.Unmarshal(*v, &ruleResourceProperties)
1186 if err != nil {
1187 return err
1188 }
1189 rr.RuleResourceProperties = &ruleResourceProperties
1190 }
1191 case "location":
1192 if v != nil {
1193 var location string
1194 err = json.Unmarshal(*v, &location)
1195 if err != nil {
1196 return err
1197 }
1198 rr.Location = &location
1199 }
1200 case "tags":
1201 if v != nil {
1202 var tags map[string]*string
1203 err = json.Unmarshal(*v, &tags)
1204 if err != nil {
1205 return err
1206 }
1207 rr.Tags = tags
1208 }
1209 case "kind":
1210 if v != nil {
1211 var kind KnownDataCollectionRuleResourceKind
1212 err = json.Unmarshal(*v, &kind)
1213 if err != nil {
1214 return err
1215 }
1216 rr.Kind = kind
1217 }
1218 case "id":
1219 if v != nil {
1220 var ID string
1221 err = json.Unmarshal(*v, &ID)
1222 if err != nil {
1223 return err
1224 }
1225 rr.ID = &ID
1226 }
1227 case "name":
1228 if v != nil {
1229 var name string
1230 err = json.Unmarshal(*v, &name)
1231 if err != nil {
1232 return err
1233 }
1234 rr.Name = &name
1235 }
1236 case "type":
1237 if v != nil {
1238 var typeVar string
1239 err = json.Unmarshal(*v, &typeVar)
1240 if err != nil {
1241 return err
1242 }
1243 rr.Type = &typeVar
1244 }
1245 case "etag":
1246 if v != nil {
1247 var etag string
1248 err = json.Unmarshal(*v, &etag)
1249 if err != nil {
1250 return err
1251 }
1252 rr.Etag = &etag
1253 }
1254 case "systemData":
1255 if v != nil {
1256 var systemData RuleResourceSystemData
1257 err = json.Unmarshal(*v, &systemData)
1258 if err != nil {
1259 return err
1260 }
1261 rr.SystemData = &systemData
1262 }
1263 }
1264 }
1265
1266 return nil
1267 }
1268
1269
1270 type RuleResourceListResult struct {
1271 autorest.Response `json:"-"`
1272
1273 Value *[]RuleResource `json:"value,omitempty"`
1274
1275 NextLink *string `json:"nextLink,omitempty"`
1276 }
1277
1278
1279 type RuleResourceListResultIterator struct {
1280 i int
1281 page RuleResourceListResultPage
1282 }
1283
1284
1285
1286 func (iter *RuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
1287 if tracing.IsEnabled() {
1288 ctx = tracing.StartSpan(ctx, fqdn+"/RuleResourceListResultIterator.NextWithContext")
1289 defer func() {
1290 sc := -1
1291 if iter.Response().Response.Response != nil {
1292 sc = iter.Response().Response.Response.StatusCode
1293 }
1294 tracing.EndSpan(ctx, sc, err)
1295 }()
1296 }
1297 iter.i++
1298 if iter.i < len(iter.page.Values()) {
1299 return nil
1300 }
1301 err = iter.page.NextWithContext(ctx)
1302 if err != nil {
1303 iter.i--
1304 return err
1305 }
1306 iter.i = 0
1307 return nil
1308 }
1309
1310
1311
1312
1313 func (iter *RuleResourceListResultIterator) Next() error {
1314 return iter.NextWithContext(context.Background())
1315 }
1316
1317
1318 func (iter RuleResourceListResultIterator) NotDone() bool {
1319 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1320 }
1321
1322
1323 func (iter RuleResourceListResultIterator) Response() RuleResourceListResult {
1324 return iter.page.Response()
1325 }
1326
1327
1328
1329 func (iter RuleResourceListResultIterator) Value() RuleResource {
1330 if !iter.page.NotDone() {
1331 return RuleResource{}
1332 }
1333 return iter.page.Values()[iter.i]
1334 }
1335
1336
1337 func NewRuleResourceListResultIterator(page RuleResourceListResultPage) RuleResourceListResultIterator {
1338 return RuleResourceListResultIterator{page: page}
1339 }
1340
1341
1342 func (rrlr RuleResourceListResult) IsEmpty() bool {
1343 return rrlr.Value == nil || len(*rrlr.Value) == 0
1344 }
1345
1346
1347 func (rrlr RuleResourceListResult) hasNextLink() bool {
1348 return rrlr.NextLink != nil && len(*rrlr.NextLink) != 0
1349 }
1350
1351
1352
1353 func (rrlr RuleResourceListResult) ruleResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
1354 if !rrlr.hasNextLink() {
1355 return nil, nil
1356 }
1357 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1358 autorest.AsJSON(),
1359 autorest.AsGet(),
1360 autorest.WithBaseURL(to.String(rrlr.NextLink)))
1361 }
1362
1363
1364 type RuleResourceListResultPage struct {
1365 fn func(context.Context, RuleResourceListResult) (RuleResourceListResult, error)
1366 rrlr RuleResourceListResult
1367 }
1368
1369
1370
1371 func (page *RuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
1372 if tracing.IsEnabled() {
1373 ctx = tracing.StartSpan(ctx, fqdn+"/RuleResourceListResultPage.NextWithContext")
1374 defer func() {
1375 sc := -1
1376 if page.Response().Response.Response != nil {
1377 sc = page.Response().Response.Response.StatusCode
1378 }
1379 tracing.EndSpan(ctx, sc, err)
1380 }()
1381 }
1382 for {
1383 next, err := page.fn(ctx, page.rrlr)
1384 if err != nil {
1385 return err
1386 }
1387 page.rrlr = next
1388 if !next.hasNextLink() || !next.IsEmpty() {
1389 break
1390 }
1391 }
1392 return nil
1393 }
1394
1395
1396
1397
1398 func (page *RuleResourceListResultPage) Next() error {
1399 return page.NextWithContext(context.Background())
1400 }
1401
1402
1403 func (page RuleResourceListResultPage) NotDone() bool {
1404 return !page.rrlr.IsEmpty()
1405 }
1406
1407
1408 func (page RuleResourceListResultPage) Response() RuleResourceListResult {
1409 return page.rrlr
1410 }
1411
1412
1413 func (page RuleResourceListResultPage) Values() []RuleResource {
1414 if page.rrlr.IsEmpty() {
1415 return nil
1416 }
1417 return *page.rrlr.Value
1418 }
1419
1420
1421 func NewRuleResourceListResultPage(cur RuleResourceListResult, getNextPage func(context.Context, RuleResourceListResult) (RuleResourceListResult, error)) RuleResourceListResultPage {
1422 return RuleResourceListResultPage{
1423 fn: getNextPage,
1424 rrlr: cur,
1425 }
1426 }
1427
1428
1429 type RuleResourceProperties struct {
1430
1431 Description *string `json:"description,omitempty"`
1432
1433 ImmutableID *string `json:"immutableId,omitempty"`
1434
1435 DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"`
1436
1437 Metadata *RuleMetadata `json:"metadata,omitempty"`
1438
1439 StreamDeclarations map[string]*StreamDeclaration `json:"streamDeclarations"`
1440
1441
1442 DataSources *RuleDataSources `json:"dataSources,omitempty"`
1443
1444 Destinations *RuleDestinations `json:"destinations,omitempty"`
1445
1446 DataFlows *[]DataFlow `json:"dataFlows,omitempty"`
1447
1448 ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"`
1449 }
1450
1451
1452 func (rr RuleResourceProperties) MarshalJSON() ([]byte, error) {
1453 objectMap := make(map[string]interface{})
1454 if rr.Description != nil {
1455 objectMap["description"] = rr.Description
1456 }
1457 if rr.DataCollectionEndpointID != nil {
1458 objectMap["dataCollectionEndpointId"] = rr.DataCollectionEndpointID
1459 }
1460 if rr.StreamDeclarations != nil {
1461 objectMap["streamDeclarations"] = rr.StreamDeclarations
1462 }
1463 if rr.DataSources != nil {
1464 objectMap["dataSources"] = rr.DataSources
1465 }
1466 if rr.Destinations != nil {
1467 objectMap["destinations"] = rr.Destinations
1468 }
1469 if rr.DataFlows != nil {
1470 objectMap["dataFlows"] = rr.DataFlows
1471 }
1472 return json.Marshal(objectMap)
1473 }
1474
1475
1476 type RuleResourceSystemData struct {
1477
1478 CreatedBy *string `json:"createdBy,omitempty"`
1479
1480 CreatedByType CreatedByType `json:"createdByType,omitempty"`
1481
1482 CreatedAt *date.Time `json:"createdAt,omitempty"`
1483
1484 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
1485
1486 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
1487
1488 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
1489 }
1490
1491
1492 type StreamDeclaration struct {
1493
1494 Columns *[]ColumnDefinition `json:"columns,omitempty"`
1495 }
1496
1497
1498
1499 type SyslogDataSource struct {
1500
1501
1502 Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"`
1503
1504 FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"`
1505
1506 LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"`
1507
1508
1509 Name *string `json:"name,omitempty"`
1510 }
1511
1512
1513 type SystemData struct {
1514
1515 CreatedBy *string `json:"createdBy,omitempty"`
1516
1517 CreatedByType CreatedByType `json:"createdByType,omitempty"`
1518
1519 CreatedAt *date.Time `json:"createdAt,omitempty"`
1520
1521 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
1522
1523 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
1524
1525 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
1526 }
1527
1528
1529
1530
1531 type WindowsEventLogDataSource struct {
1532
1533
1534 Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"`
1535
1536 XPathQueries *[]string `json:"xPathQueries,omitempty"`
1537
1538
1539 Name *string `json:"name,omitempty"`
1540 }
1541
View as plain text