-
Notifications
You must be signed in to change notification settings - Fork 839
/
models.go
961 lines (879 loc) · 31.3 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
package operationalinsights
// 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 (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2015-11-01-preview/operationalinsights"
// DataSourceKind enumerates the values for data source kind.
type DataSourceKind string
const (
// AzureActivityLog ...
AzureActivityLog DataSourceKind = "AzureActivityLog"
// ChangeTrackingCustomRegistry ...
ChangeTrackingCustomRegistry DataSourceKind = "ChangeTrackingCustomRegistry"
// ChangeTrackingDefaultPath ...
ChangeTrackingDefaultPath DataSourceKind = "ChangeTrackingDefaultPath"
// ChangeTrackingDefaultRegistry ...
ChangeTrackingDefaultRegistry DataSourceKind = "ChangeTrackingDefaultRegistry"
// ChangeTrackingPath ...
ChangeTrackingPath DataSourceKind = "ChangeTrackingPath"
// CustomLog ...
CustomLog DataSourceKind = "CustomLog"
// CustomLogCollection ...
CustomLogCollection DataSourceKind = "CustomLogCollection"
// GenericDataSource ...
GenericDataSource DataSourceKind = "GenericDataSource"
// IISLogs ...
IISLogs DataSourceKind = "IISLogs"
// LinuxPerformanceCollection ...
LinuxPerformanceCollection DataSourceKind = "LinuxPerformanceCollection"
// LinuxPerformanceObject ...
LinuxPerformanceObject DataSourceKind = "LinuxPerformanceObject"
// LinuxSyslog ...
LinuxSyslog DataSourceKind = "LinuxSyslog"
// LinuxSyslogCollection ...
LinuxSyslogCollection DataSourceKind = "LinuxSyslogCollection"
// WindowsEvent ...
WindowsEvent DataSourceKind = "WindowsEvent"
// WindowsPerformanceCounter ...
WindowsPerformanceCounter DataSourceKind = "WindowsPerformanceCounter"
)
// PossibleDataSourceKindValues returns an array of possible values for the DataSourceKind const type.
func PossibleDataSourceKindValues() []DataSourceKind {
return []DataSourceKind{AzureActivityLog, ChangeTrackingCustomRegistry, ChangeTrackingDefaultPath, ChangeTrackingDefaultRegistry, ChangeTrackingPath, CustomLog, CustomLogCollection, GenericDataSource, IISLogs, LinuxPerformanceCollection, LinuxPerformanceObject, LinuxSyslog, LinuxSyslogCollection, WindowsEvent, WindowsPerformanceCounter}
}
// EntityStatus enumerates the values for entity status.
type EntityStatus string
const (
// Canceled ...
Canceled EntityStatus = "Canceled"
// Creating ...
Creating EntityStatus = "Creating"
// Deleting ...
Deleting EntityStatus = "Deleting"
// Failed ...
Failed EntityStatus = "Failed"
// ProvisioningAccount ...
ProvisioningAccount EntityStatus = "ProvisioningAccount"
// Succeeded ...
Succeeded EntityStatus = "Succeeded"
)
// PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type.
func PossibleEntityStatusValues() []EntityStatus {
return []EntityStatus{Canceled, Creating, Deleting, Failed, ProvisioningAccount, Succeeded}
}
// SkuNameEnum enumerates the values for sku name enum.
type SkuNameEnum string
const (
// Free ...
Free SkuNameEnum = "Free"
// PerGB2018 ...
PerGB2018 SkuNameEnum = "PerGB2018"
// PerNode ...
PerNode SkuNameEnum = "PerNode"
// Premium ...
Premium SkuNameEnum = "Premium"
// Standalone ...
Standalone SkuNameEnum = "Standalone"
// Standard ...
Standard SkuNameEnum = "Standard"
// Unlimited ...
Unlimited SkuNameEnum = "Unlimited"
)
// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type.
func PossibleSkuNameEnumValues() []SkuNameEnum {
return []SkuNameEnum{Free, PerGB2018, PerNode, Premium, Standalone, Standard, Unlimited}
}
// DataSource datasources under OMS Workspace.
type DataSource struct {
autorest.Response `json:"-"`
// Properties - The data source properties in raw json format, each kind of data source have it's own schema.
Properties interface{} `json:"properties,omitempty"`
// ETag - The ETag of the data source.
ETag *string `json:"eTag,omitempty"`
// Kind - Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'
Kind DataSourceKind `json:"kind,omitempty"`
// ID - Resource ID.
ID *string `json:"id,omitempty"`
// Name - Resource name.
Name *string `json:"name,omitempty"`
// Type - Resource type.
Type *string `json:"type,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for DataSource.
func (ds DataSource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ds.Properties != nil {
objectMap["properties"] = ds.Properties
}
if ds.ETag != nil {
objectMap["eTag"] = ds.ETag
}
if ds.Kind != "" {
objectMap["kind"] = ds.Kind
}
if ds.ID != nil {
objectMap["id"] = ds.ID
}
if ds.Name != nil {
objectMap["name"] = ds.Name
}
if ds.Type != nil {
objectMap["type"] = ds.Type
}
if ds.Tags != nil {
objectMap["tags"] = ds.Tags
}
return json.Marshal(objectMap)
}
// DataSourceFilter dataSource filter. Right now, only filter by kind is supported.
type DataSourceFilter struct {
// Kind - Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'
Kind DataSourceKind `json:"kind,omitempty"`
}
// DataSourceListResult the list data source by workspace operation response.
type DataSourceListResult struct {
autorest.Response `json:"-"`
// Value - A list of datasources.
Value *[]DataSource `json:"value,omitempty"`
// NextLink - The link (url) to the next page of datasources.
NextLink *string `json:"nextLink,omitempty"`
}
// DataSourceListResultIterator provides access to a complete listing of DataSource values.
type DataSourceListResultIterator struct {
i int
page DataSourceListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *DataSourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/DataSourceListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *DataSourceListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter DataSourceListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter DataSourceListResultIterator) Response() DataSourceListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter DataSourceListResultIterator) Value() DataSource {
if !iter.page.NotDone() {
return DataSource{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the DataSourceListResultIterator type.
func NewDataSourceListResultIterator(page DataSourceListResultPage) DataSourceListResultIterator {
return DataSourceListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (dslr DataSourceListResult) IsEmpty() bool {
return dslr.Value == nil || len(*dslr.Value) == 0
}
// dataSourceListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dslr DataSourceListResult) dataSourceListResultPreparer(ctx context.Context) (*http.Request, error) {
if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(dslr.NextLink)))
}
// DataSourceListResultPage contains a page of DataSource values.
type DataSourceListResultPage struct {
fn func(context.Context, DataSourceListResult) (DataSourceListResult, error)
dslr DataSourceListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *DataSourceListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/DataSourceListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.dslr)
if err != nil {
return err
}
page.dslr = next
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *DataSourceListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page DataSourceListResultPage) NotDone() bool {
return !page.dslr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page DataSourceListResultPage) Response() DataSourceListResult {
return page.dslr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page DataSourceListResultPage) Values() []DataSource {
if page.dslr.IsEmpty() {
return nil
}
return *page.dslr.Value
}
// Creates a new instance of the DataSourceListResultPage type.
func NewDataSourceListResultPage(getNextPage func(context.Context, DataSourceListResult) (DataSourceListResult, error)) DataSourceListResultPage {
return DataSourceListResultPage{fn: getNextPage}
}
// IntelligencePack intelligence Pack containing a string name and boolean indicating if it's enabled.
type IntelligencePack struct {
// Name - The name of the intelligence pack.
Name *string `json:"name,omitempty"`
// Enabled - The enabled boolean for the intelligence pack.
Enabled *bool `json:"enabled,omitempty"`
// DisplayName - The display name of the intelligence pack.
DisplayName *string `json:"displayName,omitempty"`
}
// LinkedService the top level Linked service resource container.
type LinkedService struct {
autorest.Response `json:"-"`
// LinkedServiceProperties - The properties of the linked service.
*LinkedServiceProperties `json:"properties,omitempty"`
// ID - Resource ID.
ID *string `json:"id,omitempty"`
// Name - Resource name.
Name *string `json:"name,omitempty"`
// Type - Resource type.
Type *string `json:"type,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for LinkedService.
func (ls LinkedService) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ls.LinkedServiceProperties != nil {
objectMap["properties"] = ls.LinkedServiceProperties
}
if ls.ID != nil {
objectMap["id"] = ls.ID
}
if ls.Name != nil {
objectMap["name"] = ls.Name
}
if ls.Type != nil {
objectMap["type"] = ls.Type
}
if ls.Tags != nil {
objectMap["tags"] = ls.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for LinkedService struct.
func (ls *LinkedService) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var linkedServiceProperties LinkedServiceProperties
err = json.Unmarshal(*v, &linkedServiceProperties)
if err != nil {
return err
}
ls.LinkedServiceProperties = &linkedServiceProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ls.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ls.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ls.Type = &typeVar
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
ls.Tags = tags
}
}
}
return nil
}
// LinkedServiceListResult the list linked service operation response.
type LinkedServiceListResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets a list of linked service instances.
Value *[]LinkedService `json:"value,omitempty"`
}
// LinkedServiceProperties linked service properties.
type LinkedServiceProperties struct {
// ResourceID - The resource id of the resource that will be linked to the workspace.
ResourceID *string `json:"resourceId,omitempty"`
}
// ListIntelligencePack ...
type ListIntelligencePack struct {
autorest.Response `json:"-"`
Value *[]IntelligencePack `json:"value,omitempty"`
}
// ManagementGroup a management group that is connected to a workspace
type ManagementGroup struct {
// ManagementGroupProperties - The properties of the management group.
*ManagementGroupProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ManagementGroup.
func (mg ManagementGroup) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if mg.ManagementGroupProperties != nil {
objectMap["properties"] = mg.ManagementGroupProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ManagementGroup struct.
func (mg *ManagementGroup) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var managementGroupProperties ManagementGroupProperties
err = json.Unmarshal(*v, &managementGroupProperties)
if err != nil {
return err
}
mg.ManagementGroupProperties = &managementGroupProperties
}
}
}
return nil
}
// ManagementGroupProperties management group properties.
type ManagementGroupProperties struct {
// ServerCount - The number of servers connected to the management group.
ServerCount *int32 `json:"serverCount,omitempty"`
// IsGateway - Gets or sets a value indicating whether the management group is a gateway.
IsGateway *bool `json:"isGateway,omitempty"`
// Name - The name of the management group.
Name *string `json:"name,omitempty"`
// ID - The unique ID of the management group.
ID *string `json:"id,omitempty"`
// Created - The datetime that the management group was created.
Created *date.Time `json:"created,omitempty"`
// DataReceived - The last datetime that the management group received data.
DataReceived *date.Time `json:"dataReceived,omitempty"`
// Version - The version of System Center that is managing the management group.
Version *string `json:"version,omitempty"`
// Sku - The SKU of System Center that is managing the management group.
Sku *string `json:"sku,omitempty"`
}
// MetricName the name of a metric.
type MetricName struct {
// Value - The system name of the metric.
Value *string `json:"value,omitempty"`
// LocalizedValue - The localized name of the metric.
LocalizedValue *string `json:"localizedValue,omitempty"`
}
// Operation supported operation of OperationalInsights resource provider.
type Operation struct {
// Name - Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
// Display - Display metadata associated with the operation.
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay display metadata associated with the operation.
type OperationDisplay struct {
// Provider - Service provider: Microsoft OperationsManagement.
Provider *string `json:"provider,omitempty"`
// Resource - Resource on which the operation is performed etc.
Resource *string `json:"resource,omitempty"`
// Operation - Type of operation: get, read, delete, etc.
Operation *string `json:"operation,omitempty"`
}
// OperationListResult result of the request to list solution operations.
type OperationListResult struct {
autorest.Response `json:"-"`
// Value - List of solution operations supported by the OperationsManagement resource provider.
Value *[]Operation `json:"value,omitempty"`
// NextLink - URL to get the next set of operation list results if there are any.
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListResultIterator provides access to a complete listing of Operation values.
type OperationListResultIterator struct {
i int
page OperationListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *OperationListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter OperationListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter OperationListResultIterator) Response() OperationListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter OperationListResultIterator) Value() Operation {
if !iter.page.NotDone() {
return Operation{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the OperationListResultIterator type.
func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
return OperationListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (olr OperationListResult) IsEmpty() bool {
return olr.Value == nil || len(*olr.Value) == 0
}
// operationListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(olr.NextLink)))
}
// OperationListResultPage contains a page of Operation values.
type OperationListResultPage struct {
fn func(context.Context, OperationListResult) (OperationListResult, error)
olr OperationListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.olr)
if err != nil {
return err
}
page.olr = next
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *OperationListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page OperationListResultPage) NotDone() bool {
return !page.olr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page OperationListResultPage) Response() OperationListResult {
return page.olr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page OperationListResultPage) Values() []Operation {
if page.olr.IsEmpty() {
return nil
}
return *page.olr.Value
}
// Creates a new instance of the OperationListResultPage type.
func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
return OperationListResultPage{fn: getNextPage}
}
// ProxyResource common properties of proxy resource.
type ProxyResource struct {
// ID - Resource ID.
ID *string `json:"id,omitempty"`
// Name - Resource name.
Name *string `json:"name,omitempty"`
// Type - Resource type.
Type *string `json:"type,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for ProxyResource.
func (pr ProxyResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if pr.ID != nil {
objectMap["id"] = pr.ID
}
if pr.Name != nil {
objectMap["name"] = pr.Name
}
if pr.Type != nil {
objectMap["type"] = pr.Type
}
if pr.Tags != nil {
objectMap["tags"] = pr.Tags
}
return json.Marshal(objectMap)
}
// Resource the resource definition.
type Resource struct {
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.ID != nil {
objectMap["id"] = r.ID
}
if r.Name != nil {
objectMap["name"] = r.Name
}
if r.Type != nil {
objectMap["type"] = r.Type
}
if r.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// SharedKeys the shared keys for a workspace.
type SharedKeys struct {
autorest.Response `json:"-"`
// PrimarySharedKey - The primary shared key of a workspace.
PrimarySharedKey *string `json:"primarySharedKey,omitempty"`
// SecondarySharedKey - The secondary shared key of a workspace.
SecondarySharedKey *string `json:"secondarySharedKey,omitempty"`
}
// Sku the SKU (tier) of a workspace.
type Sku struct {
// Name - The name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'Unlimited', 'PerNode', 'PerGB2018', 'Standalone'
Name SkuNameEnum `json:"name,omitempty"`
}
// UsageMetric a metric describing the usage of a resource.
type UsageMetric struct {
// Name - The name of the metric.
Name *MetricName `json:"name,omitempty"`
// Unit - The units used for the metric.
Unit *string `json:"unit,omitempty"`
// CurrentValue - The current value of the metric.
CurrentValue *float64 `json:"currentValue,omitempty"`
// Limit - The quota limit for the metric.
Limit *float64 `json:"limit,omitempty"`
// NextResetTime - The time that the metric's value will reset.
NextResetTime *date.Time `json:"nextResetTime,omitempty"`
// QuotaPeriod - The quota period that determines the length of time between value resets.
QuotaPeriod *string `json:"quotaPeriod,omitempty"`
}
// Workspace the top level Workspace resource container.
type Workspace struct {
autorest.Response `json:"-"`
// WorkspaceProperties - Workspace properties.
*WorkspaceProperties `json:"properties,omitempty"`
// ETag - The ETag of the workspace.
ETag *string `json:"eTag,omitempty"`
// ID - Resource Id
ID *string `json:"id,omitempty"`
// Name - Resource name
Name *string `json:"name,omitempty"`
// Type - Resource type
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Workspace.
func (w Workspace) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if w.WorkspaceProperties != nil {
objectMap["properties"] = w.WorkspaceProperties
}
if w.ETag != nil {
objectMap["eTag"] = w.ETag
}
if w.ID != nil {
objectMap["id"] = w.ID
}
if w.Name != nil {
objectMap["name"] = w.Name
}
if w.Type != nil {
objectMap["type"] = w.Type
}
if w.Location != nil {
objectMap["location"] = w.Location
}
if w.Tags != nil {
objectMap["tags"] = w.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Workspace struct.
func (w *Workspace) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var workspaceProperties WorkspaceProperties
err = json.Unmarshal(*v, &workspaceProperties)
if err != nil {
return err
}
w.WorkspaceProperties = &workspaceProperties
}
case "eTag":
if v != nil {
var eTag string
err = json.Unmarshal(*v, &eTag)
if err != nil {
return err
}
w.ETag = &eTag
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
w.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
w.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
w.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
w.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
w.Tags = tags
}
}
}
return nil
}
// WorkspaceListManagementGroupsResult the list workspace managmement groups operation response.
type WorkspaceListManagementGroupsResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets a list of management groups attached to the workspace.
Value *[]ManagementGroup `json:"value,omitempty"`
}
// WorkspaceListResult the list workspaces operation response.
type WorkspaceListResult struct {
autorest.Response `json:"-"`
// Value - A list of workspaces.
Value *[]Workspace `json:"value,omitempty"`
}
// WorkspaceListUsagesResult the list workspace usages operation response.
type WorkspaceListUsagesResult struct {
autorest.Response `json:"-"`
// Value - Gets or sets a list of usage metrics for a workspace.
Value *[]UsageMetric `json:"value,omitempty"`
}
// WorkspaceProperties workspace properties.
type WorkspaceProperties struct {
// ProvisioningState - The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount'
ProvisioningState EntityStatus `json:"provisioningState,omitempty"`
// Source - The source of the workspace. Source defines where the workspace was created. 'Azure' implies it was created in Azure. 'External' implies it was created via the Operational Insights Portal. This value is set on the service side and read-only on the client side.
Source *string `json:"source,omitempty"`
// CustomerID - The ID associated with the workspace. Setting this value at creation time allows the workspace being created to be linked to an existing workspace.
CustomerID *string `json:"customerId,omitempty"`
// PortalURL - The URL of the Operational Insights portal for this workspace. This value is set on the service side and read-only on the client side.
PortalURL *string `json:"portalUrl,omitempty"`
// Sku - The SKU of the workspace.
Sku *Sku `json:"sku,omitempty"`
// RetentionInDays - The workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus.
RetentionInDays *int32 `json:"retentionInDays,omitempty"`
}
// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type WorkspacesCreateOrUpdateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *WorkspacesCreateOrUpdateFuture) Result(client WorkspacesClient) (w Workspace, err error) {
var done bool
done, err = future.Done(client)
if err != nil {
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesCreateOrUpdateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent {
w, err = client.CreateOrUpdateResponder(w.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request")
}
}
return
}