forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
executable file
·581 lines (539 loc) · 16.4 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
package maintenance
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance"
// ImpactType enumerates the values for impact type.
type ImpactType string
const (
// Freeze ...
Freeze ImpactType = "Freeze"
// None ...
None ImpactType = "None"
// Redeploy ...
Redeploy ImpactType = "Redeploy"
// Restart ...
Restart ImpactType = "Restart"
)
// PossibleImpactTypeValues returns an array of possible values for the ImpactType const type.
func PossibleImpactTypeValues() []ImpactType {
return []ImpactType{Freeze, None, Redeploy, Restart}
}
// Scope enumerates the values for scope.
type Scope string
const (
// ScopeAll ...
ScopeAll Scope = "All"
// ScopeHost ...
ScopeHost Scope = "Host"
// ScopeInResource ...
ScopeInResource Scope = "InResource"
// ScopeResource ...
ScopeResource Scope = "Resource"
)
// PossibleScopeValues returns an array of possible values for the Scope const type.
func PossibleScopeValues() []Scope {
return []Scope{ScopeAll, ScopeHost, ScopeInResource, ScopeResource}
}
// UpdateStatus enumerates the values for update status.
type UpdateStatus string
const (
// Completed ...
Completed UpdateStatus = "Completed"
// InProgress ...
InProgress UpdateStatus = "InProgress"
// Pending ...
Pending UpdateStatus = "Pending"
// RetryLater ...
RetryLater UpdateStatus = "RetryLater"
// RetryNow ...
RetryNow UpdateStatus = "RetryNow"
)
// PossibleUpdateStatusValues returns an array of possible values for the UpdateStatus const type.
func PossibleUpdateStatusValues() []UpdateStatus {
return []UpdateStatus{Completed, InProgress, Pending, RetryLater, RetryNow}
}
// ApplyUpdate apply Update request
type ApplyUpdate struct {
autorest.Response `json:"-"`
// ApplyUpdateProperties - Properties of the apply update
*ApplyUpdateProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Fully qualified identifier of the resource
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Name of the resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type of the resource
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplyUpdate.
func (au ApplyUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if au.ApplyUpdateProperties != nil {
objectMap["properties"] = au.ApplyUpdateProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ApplyUpdate struct.
func (au *ApplyUpdate) 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 applyUpdateProperties ApplyUpdateProperties
err = json.Unmarshal(*v, &applyUpdateProperties)
if err != nil {
return err
}
au.ApplyUpdateProperties = &applyUpdateProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
au.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
au.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
au.Type = &typeVar
}
}
}
return nil
}
// ApplyUpdateProperties properties for apply update
type ApplyUpdateProperties struct {
// Status - The status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'
Status UpdateStatus `json:"status,omitempty"`
// ResourceID - The resourceId
ResourceID *string `json:"resourceId,omitempty"`
// LastUpdateTime - Last Update time
LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"`
}
// Configuration maintenance configuration record type
type Configuration struct {
autorest.Response `json:"-"`
// Location - Gets or sets location of the resource
Location *string `json:"location,omitempty"`
// Tags - Gets or sets tags of the resource
Tags map[string]*string `json:"tags"`
// ConfigurationProperties - Gets or sets properties of the resource
*ConfigurationProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Fully qualified identifier of the resource
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Name of the resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type of the resource
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Configuration.
func (c Configuration) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if c.Location != nil {
objectMap["location"] = c.Location
}
if c.Tags != nil {
objectMap["tags"] = c.Tags
}
if c.ConfigurationProperties != nil {
objectMap["properties"] = c.ConfigurationProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Configuration struct.
func (c *Configuration) 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 "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
c.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
c.Tags = tags
}
case "properties":
if v != nil {
var configurationProperties ConfigurationProperties
err = json.Unmarshal(*v, &configurationProperties)
if err != nil {
return err
}
c.ConfigurationProperties = &configurationProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
c.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
c.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
c.Type = &typeVar
}
}
}
return nil
}
// ConfigurationAssignment configuration Assignment
type ConfigurationAssignment struct {
autorest.Response `json:"-"`
// Location - Location of the resource
Location *string `json:"location,omitempty"`
// ConfigurationAssignmentProperties - Properties of the configuration assignment
*ConfigurationAssignmentProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Fully qualified identifier of the resource
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Name of the resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type of the resource
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for ConfigurationAssignment.
func (ca ConfigurationAssignment) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ca.Location != nil {
objectMap["location"] = ca.Location
}
if ca.ConfigurationAssignmentProperties != nil {
objectMap["properties"] = ca.ConfigurationAssignmentProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ConfigurationAssignment struct.
func (ca *ConfigurationAssignment) 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 "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
ca.Location = &location
}
case "properties":
if v != nil {
var configurationAssignmentProperties ConfigurationAssignmentProperties
err = json.Unmarshal(*v, &configurationAssignmentProperties)
if err != nil {
return err
}
ca.ConfigurationAssignmentProperties = &configurationAssignmentProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
ca.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
ca.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
ca.Type = &typeVar
}
}
}
return nil
}
// ConfigurationAssignmentProperties properties for configuration assignment
type ConfigurationAssignmentProperties struct {
// MaintenanceConfigurationID - The maintenance configuration Id
MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"`
// ResourceID - The unique resourceId
ResourceID *string `json:"resourceId,omitempty"`
}
// ConfigurationProperties properties for maintenance configuration
type ConfigurationProperties struct {
// Namespace - Gets or sets namespace of the resource
Namespace *string `json:"namespace,omitempty"`
// ExtensionProperties - Gets or sets extensionProperties of the maintenanceConfiguration
ExtensionProperties map[string]*string `json:"extensionProperties"`
// MaintenanceScope - Gets or sets maintenanceScope of the configuration. Possible values include: 'ScopeAll', 'ScopeHost', 'ScopeResource', 'ScopeInResource'
MaintenanceScope Scope `json:"maintenanceScope,omitempty"`
}
// MarshalJSON is the custom marshaler for ConfigurationProperties.
func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if cp.Namespace != nil {
objectMap["namespace"] = cp.Namespace
}
if cp.ExtensionProperties != nil {
objectMap["extensionProperties"] = cp.ExtensionProperties
}
if cp.MaintenanceScope != "" {
objectMap["maintenanceScope"] = cp.MaintenanceScope
}
return json.Marshal(objectMap)
}
// Error an error response received from the Azure Maintenance service.
type Error struct {
// Error - Details of the error
Error *ErrorDetails `json:"error,omitempty"`
}
// ErrorDetails an error response details received from the Azure Maintenance service.
type ErrorDetails struct {
// Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
Code *string `json:"code,omitempty"`
// Message - Human-readable representation of the error.
Message *string `json:"message,omitempty"`
}
// ListConfigurationAssignmentsResult response for ConfigurationAssignments list
type ListConfigurationAssignmentsResult struct {
autorest.Response `json:"-"`
// Value - The list of configuration Assignments
Value *[]ConfigurationAssignment `json:"value,omitempty"`
}
// ListMaintenanceConfigurationsResult response for MaintenanceConfigurations list
type ListMaintenanceConfigurationsResult struct {
autorest.Response `json:"-"`
// Value - The list of maintenance Configurations
Value *[]Configuration `json:"value,omitempty"`
}
// ListUpdatesResult response for Updates list
type ListUpdatesResult struct {
autorest.Response `json:"-"`
// Value - The pending updates
Value *[]Update `json:"value,omitempty"`
}
// Operation represents an operation returned by the GetOperations request
type Operation struct {
// Name - Name of the operation
Name *string `json:"name,omitempty"`
// Display - Display name of the operation
Display *OperationInfo `json:"display,omitempty"`
// Origin - Origin of the operation
Origin *string `json:"origin,omitempty"`
// Properties - Properties of the operation
Properties interface{} `json:"properties,omitempty"`
}
// OperationInfo information about an operation
type OperationInfo struct {
// Provider - Name of the provider
Provider *string `json:"provider,omitempty"`
// Resource - Name of the resource type
Resource *string `json:"resource,omitempty"`
// Operation - Name of the operation
Operation *string `json:"operation,omitempty"`
// Description - Description of the operation
Description *string `json:"description,omitempty"`
}
// OperationsListResult result of the List Operations operation
type OperationsListResult struct {
autorest.Response `json:"-"`
// Value - A collection of operations
Value *[]Operation `json:"value,omitempty"`
}
// Resource definition of a Resource
type Resource struct {
// ID - READ-ONLY; Fully qualified identifier of the resource
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Name of the resource
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Type of the resource
Type *string `json:"type,omitempty"`
}
// Update maintenance update on a resource
type Update struct {
// MaintenanceScope - The impact area. Possible values include: 'ScopeAll', 'ScopeHost', 'ScopeResource', 'ScopeInResource'
MaintenanceScope Scope `json:"maintenanceScope,omitempty"`
// ImpactType - The impact type. Possible values include: 'None', 'Freeze', 'Restart', 'Redeploy'
ImpactType ImpactType `json:"impactType,omitempty"`
// Status - The status. Possible values include: 'Pending', 'InProgress', 'Completed', 'RetryNow', 'RetryLater'
Status UpdateStatus `json:"status,omitempty"`
// ImpactDurationInSec - Duration of impact in seconds
ImpactDurationInSec *int32 `json:"impactDurationInSec,omitempty"`
// NotBefore - Time when Azure will start force updates if not self-updated by customer before this time
NotBefore *date.Time `json:"notBefore,omitempty"`
// UpdateProperties - Properties of the apply update
*UpdateProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for Update.
func (u Update) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if u.MaintenanceScope != "" {
objectMap["maintenanceScope"] = u.MaintenanceScope
}
if u.ImpactType != "" {
objectMap["impactType"] = u.ImpactType
}
if u.Status != "" {
objectMap["status"] = u.Status
}
if u.ImpactDurationInSec != nil {
objectMap["impactDurationInSec"] = u.ImpactDurationInSec
}
if u.NotBefore != nil {
objectMap["notBefore"] = u.NotBefore
}
if u.UpdateProperties != nil {
objectMap["properties"] = u.UpdateProperties
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Update struct.
func (u *Update) 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 "maintenanceScope":
if v != nil {
var maintenanceScope Scope
err = json.Unmarshal(*v, &maintenanceScope)
if err != nil {
return err
}
u.MaintenanceScope = maintenanceScope
}
case "impactType":
if v != nil {
var impactType ImpactType
err = json.Unmarshal(*v, &impactType)
if err != nil {
return err
}
u.ImpactType = impactType
}
case "status":
if v != nil {
var status UpdateStatus
err = json.Unmarshal(*v, &status)
if err != nil {
return err
}
u.Status = status
}
case "impactDurationInSec":
if v != nil {
var impactDurationInSec int32
err = json.Unmarshal(*v, &impactDurationInSec)
if err != nil {
return err
}
u.ImpactDurationInSec = &impactDurationInSec
}
case "notBefore":
if v != nil {
var notBefore date.Time
err = json.Unmarshal(*v, ¬Before)
if err != nil {
return err
}
u.NotBefore = ¬Before
}
case "properties":
if v != nil {
var updateProperties UpdateProperties
err = json.Unmarshal(*v, &updateProperties)
if err != nil {
return err
}
u.UpdateProperties = &updateProperties
}
}
}
return nil
}
// UpdateProperties properties for update
type UpdateProperties struct {
// ResourceID - The resourceId
ResourceID *string `json:"resourceId,omitempty"`
}