forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
executable file
·557 lines (488 loc) · 21.7 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
package recoveryservices
// 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"
"errors"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// AuthType enumerates the values for auth type.
type AuthType string
const (
// AAD specifies the aad state for auth type.
AAD AuthType = "AAD"
// AccessControlService specifies the access control service state for auth type.
AccessControlService AuthType = "AccessControlService"
// ACS specifies the acs state for auth type.
ACS AuthType = "ACS"
// AzureActiveDirectory specifies the azure active directory state for auth type.
AzureActiveDirectory AuthType = "AzureActiveDirectory"
// Invalid specifies the invalid state for auth type.
Invalid AuthType = "Invalid"
)
// EnhancedSecurityState enumerates the values for enhanced security state.
type EnhancedSecurityState string
const (
// EnhancedSecurityStateDisabled specifies the enhanced security state disabled state for enhanced security state.
EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled"
// EnhancedSecurityStateEnabled specifies the enhanced security state enabled state for enhanced security state.
EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled"
// EnhancedSecurityStateInvalid specifies the enhanced security state invalid state for enhanced security state.
EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid"
)
// SkuName enumerates the values for sku name.
type SkuName string
const (
// RS0 specifies the rs0 state for sku name.
RS0 SkuName = "RS0"
// Standard specifies the standard state for sku name.
Standard SkuName = "Standard"
)
// StorageModelType enumerates the values for storage model type.
type StorageModelType string
const (
// StorageModelTypeGeoRedundant specifies the storage model type geo redundant state for storage model type.
StorageModelTypeGeoRedundant StorageModelType = "GeoRedundant"
// StorageModelTypeInvalid specifies the storage model type invalid state for storage model type.
StorageModelTypeInvalid StorageModelType = "Invalid"
// StorageModelTypeLocallyRedundant specifies the storage model type locally redundant state for storage model type.
StorageModelTypeLocallyRedundant StorageModelType = "LocallyRedundant"
)
// StorageType enumerates the values for storage type.
type StorageType string
const (
// StorageTypeGeoRedundant specifies the storage type geo redundant state for storage type.
StorageTypeGeoRedundant StorageType = "GeoRedundant"
// StorageTypeInvalid specifies the storage type invalid state for storage type.
StorageTypeInvalid StorageType = "Invalid"
// StorageTypeLocallyRedundant specifies the storage type locally redundant state for storage type.
StorageTypeLocallyRedundant StorageType = "LocallyRedundant"
)
// StorageTypeState enumerates the values for storage type state.
type StorageTypeState string
const (
// StorageTypeStateInvalid specifies the storage type state invalid state for storage type state.
StorageTypeStateInvalid StorageTypeState = "Invalid"
// StorageTypeStateLocked specifies the storage type state locked state for storage type state.
StorageTypeStateLocked StorageTypeState = "Locked"
// StorageTypeStateUnlocked specifies the storage type state unlocked state for storage type state.
StorageTypeStateUnlocked StorageTypeState = "Unlocked"
)
// TriggerType enumerates the values for trigger type.
type TriggerType string
const (
// ForcedUpgrade specifies the forced upgrade state for trigger type.
ForcedUpgrade TriggerType = "ForcedUpgrade"
// UserTriggered specifies the user triggered state for trigger type.
UserTriggered TriggerType = "UserTriggered"
)
// UsagesUnit enumerates the values for usages unit.
type UsagesUnit string
const (
// Bytes specifies the bytes state for usages unit.
Bytes UsagesUnit = "Bytes"
// BytesPerSecond specifies the bytes per second state for usages unit.
BytesPerSecond UsagesUnit = "BytesPerSecond"
// Count specifies the count state for usages unit.
Count UsagesUnit = "Count"
// CountPerSecond specifies the count per second state for usages unit.
CountPerSecond UsagesUnit = "CountPerSecond"
// Percent specifies the percent state for usages unit.
Percent UsagesUnit = "Percent"
// Seconds specifies the seconds state for usages unit.
Seconds UsagesUnit = "Seconds"
)
// VaultUpgradeState enumerates the values for vault upgrade state.
type VaultUpgradeState string
const (
// Failed specifies the failed state for vault upgrade state.
Failed VaultUpgradeState = "Failed"
// InProgress specifies the in progress state for vault upgrade state.
InProgress VaultUpgradeState = "InProgress"
// Unknown specifies the unknown state for vault upgrade state.
Unknown VaultUpgradeState = "Unknown"
// Upgraded specifies the upgraded state for vault upgrade state.
Upgraded VaultUpgradeState = "Upgraded"
)
// BackupStorageConfig is the backup storage config.
type BackupStorageConfig struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
*BackupStorageConfigProperties `json:"properties,omitempty"`
}
// BackupStorageConfigProperties is the backup storage config.
type BackupStorageConfigProperties struct {
StorageModelType StorageModelType `json:"storageModelType,omitempty"`
StorageType StorageType `json:"storageType,omitempty"`
StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"`
}
// BackupVaultConfig is backup vault config details.
type BackupVaultConfig struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
*BackupVaultConfigProperties `json:"properties,omitempty"`
}
// BackupVaultConfigProperties is backup vault config details.
type BackupVaultConfigProperties struct {
StorageType StorageType `json:"storageType,omitempty"`
StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"`
EnhancedSecurityState EnhancedSecurityState `json:"enhancedSecurityState,omitempty"`
}
// CertificateRequest is details of the certificate to be uploaded to the vault.
type CertificateRequest struct {
Properties *RawCertificateData `json:"properties,omitempty"`
}
// ClientDiscoveryDisplay is localized display information of an operation.
type ClientDiscoveryDisplay struct {
Provider *string `json:"Provider,omitempty"`
Resource *string `json:"Resource,omitempty"`
Operation *string `json:"Operation,omitempty"`
Description *string `json:"Description,omitempty"`
}
// ClientDiscoveryForLogSpecification is class to represent shoebox log specification in json client discovery.
type ClientDiscoveryForLogSpecification struct {
Name *string `json:"name,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
BlobDuration *string `json:"blobDuration,omitempty"`
}
// ClientDiscoveryForProperties is class to represent shoebox properties in json client discovery.
type ClientDiscoveryForProperties struct {
ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"`
}
// ClientDiscoveryForServiceSpecification is class to represent shoebox service specification in json client discovery.
type ClientDiscoveryForServiceSpecification struct {
LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"`
}
// ClientDiscoveryResponse is operations List response which contains list of available APIs.
type ClientDiscoveryResponse struct {
autorest.Response `json:"-"`
Value *[]ClientDiscoveryValueForSingleAPI `json:"Value,omitempty"`
NextLink *string `json:"NextLink,omitempty"`
}
// ClientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClientDiscoveryResponse) ClientDiscoveryResponsePreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClientDiscoveryValueForSingleAPI is available operation details.
type ClientDiscoveryValueForSingleAPI struct {
Name *string `json:"Name,omitempty"`
Display *ClientDiscoveryDisplay `json:"Display,omitempty"`
Origin *string `json:"Origin,omitempty"`
Properties *ClientDiscoveryForProperties `json:"Properties,omitempty"`
}
// JobsSummary is summary of the replication job data for this vault.
type JobsSummary struct {
FailedJobs *int32 `json:"failedJobs,omitempty"`
SuspendedJobs *int32 `json:"suspendedJobs,omitempty"`
InProgressJobs *int32 `json:"inProgressJobs,omitempty"`
}
// MonitoringSummary is summary of the replication monitoring data for this vault.
type MonitoringSummary struct {
UnHealthyVMCount *int32 `json:"unHealthyVmCount,omitempty"`
UnHealthyProviderCount *int32 `json:"unHealthyProviderCount,omitempty"`
EventsCount *int32 `json:"eventsCount,omitempty"`
DeprecatedProviderCount *int32 `json:"deprecatedProviderCount,omitempty"`
SupportedProviderCount *int32 `json:"supportedProviderCount,omitempty"`
UnsupportedProviderCount *int32 `json:"unsupportedProviderCount,omitempty"`
}
// NameInfo is the name of usage.
type NameInfo struct {
Value *string `json:"value,omitempty"`
LocalizedValue *string `json:"localizedValue,omitempty"`
}
// RawCertificateData is raw certificate data.
type RawCertificateData struct {
AuthType AuthType `json:"authType,omitempty"`
Certificate *[]byte `json:"certificate,omitempty"`
}
// ReplicationUsage is replication usages of a vault.
type ReplicationUsage struct {
MonitoringSummary *MonitoringSummary `json:"monitoringSummary,omitempty"`
JobsSummary *JobsSummary `json:"jobsSummary,omitempty"`
ProtectedItemCount *int32 `json:"protectedItemCount,omitempty"`
RecoveryPlanCount *int32 `json:"recoveryPlanCount,omitempty"`
RegisteredServersCount *int32 `json:"registeredServersCount,omitempty"`
RecoveryServicesProviderAuthType *int32 `json:"recoveryServicesProviderAuthType,omitempty"`
}
// ReplicationUsageList is replication usages for vault.
type ReplicationUsageList struct {
autorest.Response `json:"-"`
Value *[]ReplicationUsage `json:"value,omitempty"`
}
// Resource is ARM Resource.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
}
// ResourceCertificateAndAadDetails is certificate details representing the Vault credentials for AAD.
type ResourceCertificateAndAadDetails struct {
Certificate *[]byte `json:"certificate,omitempty"`
FriendlyName *string `json:"friendlyName,omitempty"`
Issuer *string `json:"issuer,omitempty"`
ResourceID *int64 `json:"resourceId,omitempty"`
Subject *string `json:"subject,omitempty"`
Thumbprint *string `json:"thumbprint,omitempty"`
ValidFrom *date.Time `json:"validFrom,omitempty"`
ValidTo *date.Time `json:"validTo,omitempty"`
AuthType AuthType `json:"authType,omitempty"`
AadAuthority *string `json:"aadAuthority,omitempty"`
AadTenantID *string `json:"aadTenantId,omitempty"`
ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty"`
ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty"`
AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"`
}
// MarshalJSON is the custom marshaler for ResourceCertificateAndAadDetails.
func (rcaad ResourceCertificateAndAadDetails) MarshalJSON() ([]byte, error) {
rcaad.AuthType = AzureActiveDirectory
type Alias ResourceCertificateAndAadDetails
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(rcaad),
})
}
// AsResourceCertificateAndAadDetails is the ResourceCertificateDetails implementation for ResourceCertificateAndAadDetails.
func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) {
return &rcaad, true
}
// AsResourceCertificateAndAcsDetails is the ResourceCertificateDetails implementation for ResourceCertificateAndAadDetails.
func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) {
return nil, false
}
// ResourceCertificateAndAcsDetails is certificate details representing the Vault credentials for ACS.
type ResourceCertificateAndAcsDetails struct {
Certificate *[]byte `json:"certificate,omitempty"`
FriendlyName *string `json:"friendlyName,omitempty"`
Issuer *string `json:"issuer,omitempty"`
ResourceID *int64 `json:"resourceId,omitempty"`
Subject *string `json:"subject,omitempty"`
Thumbprint *string `json:"thumbprint,omitempty"`
ValidFrom *date.Time `json:"validFrom,omitempty"`
ValidTo *date.Time `json:"validTo,omitempty"`
AuthType AuthType `json:"authType,omitempty"`
GlobalAcsNamespace *string `json:"globalAcsNamespace,omitempty"`
GlobalAcsHostName *string `json:"globalAcsHostName,omitempty"`
GlobalAcsRPRealm *string `json:"globalAcsRPRealm,omitempty"`
}
// MarshalJSON is the custom marshaler for ResourceCertificateAndAcsDetails.
func (rcaad ResourceCertificateAndAcsDetails) MarshalJSON() ([]byte, error) {
rcaad.AuthType = AccessControlService
type Alias ResourceCertificateAndAcsDetails
return json.Marshal(&struct {
Alias
}{
Alias: (Alias)(rcaad),
})
}
// AsResourceCertificateAndAadDetails is the ResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails.
func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) {
return nil, false
}
// AsResourceCertificateAndAcsDetails is the ResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails.
func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) {
return &rcaad, true
}
// ResourceCertificateDetails is certificate details representing the Vault credentials.
type ResourceCertificateDetails interface {
AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool)
AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool)
}
func unmarshalResourceCertificateDetails(body []byte) (ResourceCertificateDetails, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["authType"] {
case string(AzureActiveDirectory):
var rcaad ResourceCertificateAndAadDetails
err := json.Unmarshal(body, &rcaad)
return rcaad, err
case string(AccessControlService):
var rcaad ResourceCertificateAndAcsDetails
err := json.Unmarshal(body, &rcaad)
return rcaad, err
default:
return nil, errors.New("Unsupported type")
}
}
func unmarshalResourceCertificateDetailsArray(body []byte) ([]ResourceCertificateDetails, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
rcdArray := make([]ResourceCertificateDetails, len(rawMessages))
for index, rawMessage := range rawMessages {
rcd, err := unmarshalResourceCertificateDetails(*rawMessage)
if err != nil {
return nil, err
}
rcdArray[index] = rcd
}
return rcdArray, nil
}
// Sku is identifies the unique system identifier for each Azure resource.
type Sku struct {
Name SkuName `json:"name,omitempty"`
}
// TrackedResource is tracked resource with location.
type TrackedResource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// UpgradeDetails is details for upgrading vault.
type UpgradeDetails struct {
OperationID *string `json:"operationId,omitempty"`
StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"`
LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"`
EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"`
Status VaultUpgradeState `json:"status,omitempty"`
Message *string `json:"message,omitempty"`
TriggerType TriggerType `json:"triggerType,omitempty"`
UpgradedResourceID *string `json:"upgradedResourceId,omitempty"`
PreviousResourceID *string `json:"previousResourceId,omitempty"`
}
// Vault is resource information, as returned by the resource provider.
type Vault struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Properties *VaultProperties `json:"properties,omitempty"`
Sku *Sku `json:"sku,omitempty"`
}
// VaultCertificateResponse is certificate corresponding to a vault that can be used by clients to register themselves
// with the vault.
type VaultCertificateResponse struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ID *string `json:"id,omitempty"`
Properties ResourceCertificateDetails `json:"properties,omitempty"`
}
// UnmarshalJSON is the custom unmarshaler for VaultCertificateResponse struct.
func (vcr *VaultCertificateResponse) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
var v *json.RawMessage
v = m["name"]
if v != nil {
var name string
err = json.Unmarshal(*m["name"], &name)
if err != nil {
return err
}
vcr.Name = &name
}
v = m["type"]
if v != nil {
var typeVar string
err = json.Unmarshal(*m["type"], &typeVar)
if err != nil {
return err
}
vcr.Type = &typeVar
}
v = m["id"]
if v != nil {
var ID string
err = json.Unmarshal(*m["id"], &ID)
if err != nil {
return err
}
vcr.ID = &ID
}
v = m["properties"]
if v != nil {
properties, err := unmarshalResourceCertificateDetails(*m["properties"])
if err != nil {
return err
}
vcr.Properties = properties
}
return nil
}
// VaultExtendedInfo is vault extended information.
type VaultExtendedInfo struct {
IntegrityKey *string `json:"integrityKey,omitempty"`
EncryptionKey *string `json:"encryptionKey,omitempty"`
EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"`
Algorithm *string `json:"algorithm,omitempty"`
}
// VaultExtendedInfoResource is vault extended information.
type VaultExtendedInfoResource struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
ETag *string `json:"eTag,omitempty"`
*VaultExtendedInfo `json:"properties,omitempty"`
}
// VaultList is the response model for a list of Vaults.
type VaultList struct {
autorest.Response `json:"-"`
Value *[]Vault `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// VaultProperties is properties of the vault.
type VaultProperties struct {
ProvisioningState *string `json:"provisioningState,omitempty"`
UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"`
}
// VaultUsage is usages of a vault.
type VaultUsage struct {
Unit UsagesUnit `json:"unit,omitempty"`
QuotaPeriod *string `json:"quotaPeriod,omitempty"`
NextResetTime *date.Time `json:"nextResetTime,omitempty"`
CurrentValue *int64 `json:"currentValue,omitempty"`
Limit *int64 `json:"limit,omitempty"`
Name *NameInfo `json:"name,omitempty"`
}
// VaultUsageList is usage for vault.
type VaultUsageList struct {
autorest.Response `json:"-"`
Value *[]VaultUsage `json:"value,omitempty"`
}