-
Notifications
You must be signed in to change notification settings - Fork 798
/
zz_generated_models.go
580 lines (490 loc) · 18.8 KB
/
zz_generated_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
//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package armresourcegraph
import (
"encoding/json"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
"time"
)
// ClientResourcesHistoryOptions contains the optional parameters for the Client.ResourcesHistory method.
type ClientResourcesHistoryOptions struct {
// placeholder for future optional parameters
}
// ClientResourcesOptions contains the optional parameters for the Client.Resources method.
type ClientResourcesOptions struct {
// placeholder for future optional parameters
}
// Column - Query result column descriptor.
type Column struct {
// REQUIRED; Column name.
Name *string `json:"name,omitempty"`
// REQUIRED; Column data type.
Type *ColumnDataType `json:"type,omitempty"`
}
// DateTimeInterval - An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. [start,
// end).
type DateTimeInterval struct {
// REQUIRED; A datetime indicating the exclusive/open end of the time interval, i.e. [start,end). Specifying an end that occurs
// chronologically before start will result in an error.
End *time.Time `json:"end,omitempty"`
// REQUIRED; A datetime indicating the inclusive/closed start of the time interval, i.e. [start, end). Specifying a start
// that occurs chronologically after end will result in an error.
Start *time.Time `json:"start,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type DateTimeInterval.
func (d DateTimeInterval) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populateTimeRFC3339(objectMap, "end", d.End)
populateTimeRFC3339(objectMap, "start", d.Start)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DateTimeInterval.
func (d *DateTimeInterval) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "end":
err = unpopulateTimeRFC3339(val, &d.End)
delete(rawMsg, key)
case "start":
err = unpopulateTimeRFC3339(val, &d.Start)
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// Error details.
type Error struct {
// REQUIRED; Error code identifying the specific error.
Code *string `json:"code,omitempty"`
// REQUIRED; A human readable error message.
Message *string `json:"message,omitempty"`
// Error details
Details []*ErrorDetails `json:"details,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type Error.
func (e Error) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "code", e.Code)
populate(objectMap, "details", e.Details)
populate(objectMap, "message", e.Message)
return json.Marshal(objectMap)
}
// ErrorDetails - Error details.
type ErrorDetails struct {
// REQUIRED; Error code identifying the specific error.
Code *string `json:"code,omitempty"`
// REQUIRED; A human readable error message.
Message *string `json:"message,omitempty"`
// OPTIONAL; Contains additional key/value pairs not defined in the schema.
AdditionalProperties map[string]map[string]interface{}
}
// MarshalJSON implements the json.Marshaller interface for type ErrorDetails.
func (e ErrorDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "code", e.Code)
populate(objectMap, "message", e.Message)
if e.AdditionalProperties != nil {
for key, val := range e.AdditionalProperties {
objectMap[key] = val
}
}
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails.
func (e *ErrorDetails) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "code":
err = unpopulate(val, &e.Code)
delete(rawMsg, key)
case "message":
err = unpopulate(val, &e.Message)
delete(rawMsg, key)
default:
if e.AdditionalProperties == nil {
e.AdditionalProperties = map[string]map[string]interface{}{}
}
if val != nil {
var aux map[string]interface{}
err = json.Unmarshal(val, &aux)
e.AdditionalProperties[key] = aux
}
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// ErrorResponse - An error response from the API.
type ErrorResponse struct {
// REQUIRED; Error information.
Error *Error `json:"error,omitempty"`
}
// FacetClassification provides polymorphic access to related types.
// Call the interface's GetFacet() method to access the common type.
// Use a type switch to determine the concrete type. The possible types are:
// - *Facet, *FacetError, *FacetResult
type FacetClassification interface {
// GetFacet returns the Facet content of the underlying type.
GetFacet() *Facet
}
// Facet - A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError.
type Facet struct {
// REQUIRED; Facet expression, same as in the corresponding facet request.
Expression *string `json:"expression,omitempty"`
// REQUIRED; Result type
ResultType *string `json:"resultType,omitempty"`
}
// GetFacet implements the FacetClassification interface for type Facet.
func (f *Facet) GetFacet() *Facet { return f }
// FacetError - A facet whose execution resulted in an error.
type FacetError struct {
// REQUIRED; An array containing detected facet errors with details.
Errors []*ErrorDetails `json:"errors,omitempty"`
// REQUIRED; Facet expression, same as in the corresponding facet request.
Expression *string `json:"expression,omitempty"`
// REQUIRED; Result type
ResultType *string `json:"resultType,omitempty"`
}
// GetFacet implements the FacetClassification interface for type FacetError.
func (f *FacetError) GetFacet() *Facet {
return &Facet{
Expression: f.Expression,
ResultType: f.ResultType,
}
}
// MarshalJSON implements the json.Marshaller interface for type FacetError.
func (f FacetError) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "errors", f.Errors)
populate(objectMap, "expression", f.Expression)
objectMap["resultType"] = "FacetError"
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type FacetError.
func (f *FacetError) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "errors":
err = unpopulate(val, &f.Errors)
delete(rawMsg, key)
case "expression":
err = unpopulate(val, &f.Expression)
delete(rawMsg, key)
case "resultType":
err = unpopulate(val, &f.ResultType)
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// FacetRequest - A request to compute additional statistics (facets) over the query results.
type FacetRequest struct {
// REQUIRED; The column or list of columns to summarize by
Expression *string `json:"expression,omitempty"`
// The options for facet evaluation
Options *FacetRequestOptions `json:"options,omitempty"`
}
// FacetRequestOptions - The options for facet evaluation
type FacetRequestOptions struct {
// Specifies the filter condition for the 'where' clause which will be run on main query's result, just before the actual
// faceting.
Filter *string `json:"filter,omitempty"`
// The column name or query expression to sort on. Defaults to count if not present.
SortBy *string `json:"sortBy,omitempty"`
// The sorting order by the selected column (count by default).
SortOrder *FacetSortOrder `json:"sortOrder,omitempty"`
// The maximum number of facet rows that should be returned.
Top *int32 `json:"$top,omitempty"`
}
// FacetResult - Successfully executed facet containing additional statistics on the response of a query.
type FacetResult struct {
// REQUIRED; Number of records returned in the facet response.
Count *int32 `json:"count,omitempty"`
// REQUIRED; A JObject array or Table containing the desired facets. Only present if the facet is valid.
Data map[string]interface{} `json:"data,omitempty"`
// REQUIRED; Facet expression, same as in the corresponding facet request.
Expression *string `json:"expression,omitempty"`
// REQUIRED; Result type
ResultType *string `json:"resultType,omitempty"`
// REQUIRED; Number of total records in the facet results.
TotalRecords *int64 `json:"totalRecords,omitempty"`
}
// GetFacet implements the FacetClassification interface for type FacetResult.
func (f *FacetResult) GetFacet() *Facet {
return &Facet{
Expression: f.Expression,
ResultType: f.ResultType,
}
}
// MarshalJSON implements the json.Marshaller interface for type FacetResult.
func (f FacetResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "count", f.Count)
populate(objectMap, "data", f.Data)
populate(objectMap, "expression", f.Expression)
objectMap["resultType"] = "FacetResult"
populate(objectMap, "totalRecords", f.TotalRecords)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type FacetResult.
func (f *FacetResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "count":
err = unpopulate(val, &f.Count)
delete(rawMsg, key)
case "data":
err = unpopulate(val, &f.Data)
delete(rawMsg, key)
case "expression":
err = unpopulate(val, &f.Expression)
delete(rawMsg, key)
case "resultType":
err = unpopulate(val, &f.ResultType)
delete(rawMsg, key)
case "totalRecords":
err = unpopulate(val, &f.TotalRecords)
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// Operation - Resource Graph REST API operation definition.
type Operation struct {
// Display metadata associated with the operation.
Display *OperationDisplay `json:"display,omitempty"`
// Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
// The origin of operations.
Origin *string `json:"origin,omitempty"`
}
// OperationDisplay - Display metadata associated with the operation.
type OperationDisplay struct {
// Description for the operation.
Description *string `json:"description,omitempty"`
// Type of operation: get, read, delete, etc.
Operation *string `json:"operation,omitempty"`
// Service provider: Microsoft Resource Graph.
Provider *string `json:"provider,omitempty"`
// Resource on which the operation is performed etc.
Resource *string `json:"resource,omitempty"`
}
// OperationListResult - Result of the request to list Resource Graph operations. It contains a list of operations and a URL
// link to get the next set of results.
type OperationListResult struct {
// List of Resource Graph operations supported by the Resource Graph resource provider.
Value []*Operation `json:"value,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.
type OperationsClientListOptions struct {
// placeholder for future optional parameters
}
// QueryRequest - Describes a query to be executed.
type QueryRequest struct {
// REQUIRED; The resources query.
Query *string `json:"query,omitempty"`
// An array of facet requests to be computed against the query result.
Facets []*FacetRequest `json:"facets,omitempty"`
// Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ]
ManagementGroups []*string `json:"managementGroups,omitempty"`
// The query evaluation options
Options *QueryRequestOptions `json:"options,omitempty"`
// Azure subscriptions against which to execute the query.
Subscriptions []*string `json:"subscriptions,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type QueryRequest.
func (q QueryRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "facets", q.Facets)
populate(objectMap, "managementGroups", q.ManagementGroups)
populate(objectMap, "options", q.Options)
populate(objectMap, "query", q.Query)
populate(objectMap, "subscriptions", q.Subscriptions)
return json.Marshal(objectMap)
}
// QueryRequestOptions - The options for query evaluation
type QueryRequestOptions struct {
// Only applicable for tenant and management group level queries to decide whether to allow partial scopes for result in case
// the number of subscriptions exceed allowed limits.
AllowPartialScopes *bool `json:"allowPartialScopes,omitempty"`
// Defines what level of authorization resources should be returned based on the which subscriptions and management groups
// are passed as scopes.
AuthorizationScopeFilter *AuthorizationScopeFilter `json:"authorizationScopeFilter,omitempty"`
// Defines in which format query result returned.
ResultFormat *ResultFormat `json:"resultFormat,omitempty"`
// The number of rows to skip from the beginning of the results. Overrides the next page offset when $skipToken property is
// present.
Skip *int32 `json:"$skip,omitempty"`
// Continuation token for pagination, capturing the next page size and offset, as well as the context of the query.
SkipToken *string `json:"$skipToken,omitempty"`
// The maximum number of rows that the query should return. Overrides the page size when $skipToken property is present.
Top *int32 `json:"$top,omitempty"`
}
// QueryResponse - Query result.
type QueryResponse struct {
// REQUIRED; Number of records returned in the current response. In the case of paging, this is the number of records in the
// current page.
Count *int64 `json:"count,omitempty"`
// REQUIRED; Query output in JObject array or Table format.
Data map[string]interface{} `json:"data,omitempty"`
// REQUIRED; Indicates whether the query results are truncated.
ResultTruncated *ResultTruncated `json:"resultTruncated,omitempty"`
// REQUIRED; Number of total records matching the query.
TotalRecords *int64 `json:"totalRecords,omitempty"`
// Query facets.
Facets []FacetClassification `json:"facets,omitempty"`
// When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current
// request) to retrieve the next page of data.
SkipToken *string `json:"$skipToken,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type QueryResponse.
func (q QueryResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "count", q.Count)
populate(objectMap, "data", q.Data)
populate(objectMap, "facets", q.Facets)
populate(objectMap, "resultTruncated", q.ResultTruncated)
populate(objectMap, "$skipToken", q.SkipToken)
populate(objectMap, "totalRecords", q.TotalRecords)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryResponse.
func (q *QueryResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return err
}
for key, val := range rawMsg {
var err error
switch key {
case "count":
err = unpopulate(val, &q.Count)
delete(rawMsg, key)
case "data":
err = unpopulate(val, &q.Data)
delete(rawMsg, key)
case "facets":
q.Facets, err = unmarshalFacetClassificationArray(val)
delete(rawMsg, key)
case "resultTruncated":
err = unpopulate(val, &q.ResultTruncated)
delete(rawMsg, key)
case "$skipToken":
err = unpopulate(val, &q.SkipToken)
delete(rawMsg, key)
case "totalRecords":
err = unpopulate(val, &q.TotalRecords)
delete(rawMsg, key)
}
if err != nil {
return err
}
}
return nil
}
// ResourcesHistoryRequest - Describes a history request to be executed.
type ResourcesHistoryRequest struct {
// Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ]
ManagementGroups []*string `json:"managementGroups,omitempty"`
// The history request evaluation options
Options *ResourcesHistoryRequestOptions `json:"options,omitempty"`
// The resources query.
Query *string `json:"query,omitempty"`
// Azure subscriptions against which to execute the query.
Subscriptions []*string `json:"subscriptions,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type ResourcesHistoryRequest.
func (r ResourcesHistoryRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "managementGroups", r.ManagementGroups)
populate(objectMap, "options", r.Options)
populate(objectMap, "query", r.Query)
populate(objectMap, "subscriptions", r.Subscriptions)
return json.Marshal(objectMap)
}
// ResourcesHistoryRequestOptions - The options for history request evaluation
type ResourcesHistoryRequestOptions struct {
// The time interval used to fetch history.
Interval *DateTimeInterval `json:"interval,omitempty"`
// Defines in which format query result returned.
ResultFormat *ResultFormat `json:"resultFormat,omitempty"`
// The number of rows to skip from the beginning of the results. Overrides the next page offset when $skipToken property is
// present.
Skip *int32 `json:"$skip,omitempty"`
// Continuation token for pagination, capturing the next page size and offset, as well as the context of the query.
SkipToken *string `json:"$skipToken,omitempty"`
// The maximum number of rows that the query should return. Overrides the page size when $skipToken property is present.
Top *int32 `json:"$top,omitempty"`
}
// Table - Query output in tabular format.
type Table struct {
// REQUIRED; Query result column descriptors.
Columns []*Column `json:"columns,omitempty"`
// REQUIRED; Query result rows.
Rows [][]map[string]interface{} `json:"rows,omitempty"`
}
// MarshalJSON implements the json.Marshaller interface for type Table.
func (t Table) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
populate(objectMap, "columns", t.Columns)
populate(objectMap, "rows", t.Rows)
return json.Marshal(objectMap)
}
func populate(m map[string]interface{}, k string, v interface{}) {
if v == nil {
return
} else if azcore.IsNullValue(v) {
m[k] = nil
} else if !reflect.ValueOf(v).IsNil() {
m[k] = v
}
}
func unpopulate(data json.RawMessage, v interface{}) error {
if data == nil {
return nil
}
return json.Unmarshal(data, v)
}