-
Notifications
You must be signed in to change notification settings - Fork 40
/
constants.go
689 lines (603 loc) · 21 KB
/
constants.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
package databases
import (
"encoding/json"
"fmt"
"strings"
)
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type AlwaysEncryptedEnclaveType string
const (
AlwaysEncryptedEnclaveTypeDefault AlwaysEncryptedEnclaveType = "Default"
AlwaysEncryptedEnclaveTypeVBS AlwaysEncryptedEnclaveType = "VBS"
)
func PossibleValuesForAlwaysEncryptedEnclaveType() []string {
return []string{
string(AlwaysEncryptedEnclaveTypeDefault),
string(AlwaysEncryptedEnclaveTypeVBS),
}
}
func (s *AlwaysEncryptedEnclaveType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseAlwaysEncryptedEnclaveType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseAlwaysEncryptedEnclaveType(input string) (*AlwaysEncryptedEnclaveType, error) {
vals := map[string]AlwaysEncryptedEnclaveType{
"default": AlwaysEncryptedEnclaveTypeDefault,
"vbs": AlwaysEncryptedEnclaveTypeVBS,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := AlwaysEncryptedEnclaveType(input)
return &out, nil
}
type AvailabilityZoneType string
const (
AvailabilityZoneTypeNoPreference AvailabilityZoneType = "NoPreference"
AvailabilityZoneTypeOne AvailabilityZoneType = "1"
AvailabilityZoneTypeThree AvailabilityZoneType = "3"
AvailabilityZoneTypeTwo AvailabilityZoneType = "2"
)
func PossibleValuesForAvailabilityZoneType() []string {
return []string{
string(AvailabilityZoneTypeNoPreference),
string(AvailabilityZoneTypeOne),
string(AvailabilityZoneTypeThree),
string(AvailabilityZoneTypeTwo),
}
}
func (s *AvailabilityZoneType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseAvailabilityZoneType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseAvailabilityZoneType(input string) (*AvailabilityZoneType, error) {
vals := map[string]AvailabilityZoneType{
"nopreference": AvailabilityZoneTypeNoPreference,
"1": AvailabilityZoneTypeOne,
"3": AvailabilityZoneTypeThree,
"2": AvailabilityZoneTypeTwo,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := AvailabilityZoneType(input)
return &out, nil
}
type BackupStorageRedundancy string
const (
BackupStorageRedundancyGeo BackupStorageRedundancy = "Geo"
BackupStorageRedundancyGeoZone BackupStorageRedundancy = "GeoZone"
BackupStorageRedundancyLocal BackupStorageRedundancy = "Local"
BackupStorageRedundancyZone BackupStorageRedundancy = "Zone"
)
func PossibleValuesForBackupStorageRedundancy() []string {
return []string{
string(BackupStorageRedundancyGeo),
string(BackupStorageRedundancyGeoZone),
string(BackupStorageRedundancyLocal),
string(BackupStorageRedundancyZone),
}
}
func (s *BackupStorageRedundancy) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseBackupStorageRedundancy(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseBackupStorageRedundancy(input string) (*BackupStorageRedundancy, error) {
vals := map[string]BackupStorageRedundancy{
"geo": BackupStorageRedundancyGeo,
"geozone": BackupStorageRedundancyGeoZone,
"local": BackupStorageRedundancyLocal,
"zone": BackupStorageRedundancyZone,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := BackupStorageRedundancy(input)
return &out, nil
}
type CatalogCollationType string
const (
CatalogCollationTypeDATABASEDEFAULT CatalogCollationType = "DATABASE_DEFAULT"
CatalogCollationTypeSQLLatinOneGeneralCPOneCIAS CatalogCollationType = "SQL_Latin1_General_CP1_CI_AS"
)
func PossibleValuesForCatalogCollationType() []string {
return []string{
string(CatalogCollationTypeDATABASEDEFAULT),
string(CatalogCollationTypeSQLLatinOneGeneralCPOneCIAS),
}
}
func (s *CatalogCollationType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseCatalogCollationType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseCatalogCollationType(input string) (*CatalogCollationType, error) {
vals := map[string]CatalogCollationType{
"database_default": CatalogCollationTypeDATABASEDEFAULT,
"sql_latin1_general_cp1_ci_as": CatalogCollationTypeSQLLatinOneGeneralCPOneCIAS,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := CatalogCollationType(input)
return &out, nil
}
type CreateMode string
const (
CreateModeCopy CreateMode = "Copy"
CreateModeDefault CreateMode = "Default"
CreateModeOnlineSecondary CreateMode = "OnlineSecondary"
CreateModePointInTimeRestore CreateMode = "PointInTimeRestore"
CreateModeRecovery CreateMode = "Recovery"
CreateModeRestore CreateMode = "Restore"
CreateModeRestoreExternalBackup CreateMode = "RestoreExternalBackup"
CreateModeRestoreExternalBackupSecondary CreateMode = "RestoreExternalBackupSecondary"
CreateModeRestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup"
CreateModeSecondary CreateMode = "Secondary"
)
func PossibleValuesForCreateMode() []string {
return []string{
string(CreateModeCopy),
string(CreateModeDefault),
string(CreateModeOnlineSecondary),
string(CreateModePointInTimeRestore),
string(CreateModeRecovery),
string(CreateModeRestore),
string(CreateModeRestoreExternalBackup),
string(CreateModeRestoreExternalBackupSecondary),
string(CreateModeRestoreLongTermRetentionBackup),
string(CreateModeSecondary),
}
}
func (s *CreateMode) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseCreateMode(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseCreateMode(input string) (*CreateMode, error) {
vals := map[string]CreateMode{
"copy": CreateModeCopy,
"default": CreateModeDefault,
"onlinesecondary": CreateModeOnlineSecondary,
"pointintimerestore": CreateModePointInTimeRestore,
"recovery": CreateModeRecovery,
"restore": CreateModeRestore,
"restoreexternalbackup": CreateModeRestoreExternalBackup,
"restoreexternalbackupsecondary": CreateModeRestoreExternalBackupSecondary,
"restorelongtermretentionbackup": CreateModeRestoreLongTermRetentionBackup,
"secondary": CreateModeSecondary,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := CreateMode(input)
return &out, nil
}
type DatabaseKeyType string
const (
DatabaseKeyTypeAzureKeyVault DatabaseKeyType = "AzureKeyVault"
)
func PossibleValuesForDatabaseKeyType() []string {
return []string{
string(DatabaseKeyTypeAzureKeyVault),
}
}
func (s *DatabaseKeyType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDatabaseKeyType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseDatabaseKeyType(input string) (*DatabaseKeyType, error) {
vals := map[string]DatabaseKeyType{
"azurekeyvault": DatabaseKeyTypeAzureKeyVault,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := DatabaseKeyType(input)
return &out, nil
}
type DatabaseLicenseType string
const (
DatabaseLicenseTypeBasePrice DatabaseLicenseType = "BasePrice"
DatabaseLicenseTypeLicenseIncluded DatabaseLicenseType = "LicenseIncluded"
)
func PossibleValuesForDatabaseLicenseType() []string {
return []string{
string(DatabaseLicenseTypeBasePrice),
string(DatabaseLicenseTypeLicenseIncluded),
}
}
func (s *DatabaseLicenseType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDatabaseLicenseType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseDatabaseLicenseType(input string) (*DatabaseLicenseType, error) {
vals := map[string]DatabaseLicenseType{
"baseprice": DatabaseLicenseTypeBasePrice,
"licenseincluded": DatabaseLicenseTypeLicenseIncluded,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := DatabaseLicenseType(input)
return &out, nil
}
type DatabaseReadScale string
const (
DatabaseReadScaleDisabled DatabaseReadScale = "Disabled"
DatabaseReadScaleEnabled DatabaseReadScale = "Enabled"
)
func PossibleValuesForDatabaseReadScale() []string {
return []string{
string(DatabaseReadScaleDisabled),
string(DatabaseReadScaleEnabled),
}
}
func (s *DatabaseReadScale) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDatabaseReadScale(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseDatabaseReadScale(input string) (*DatabaseReadScale, error) {
vals := map[string]DatabaseReadScale{
"disabled": DatabaseReadScaleDisabled,
"enabled": DatabaseReadScaleEnabled,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := DatabaseReadScale(input)
return &out, nil
}
type DatabaseStatus string
const (
DatabaseStatusAutoClosed DatabaseStatus = "AutoClosed"
DatabaseStatusCopying DatabaseStatus = "Copying"
DatabaseStatusCreating DatabaseStatus = "Creating"
DatabaseStatusDisabled DatabaseStatus = "Disabled"
DatabaseStatusEmergencyMode DatabaseStatus = "EmergencyMode"
DatabaseStatusInaccessible DatabaseStatus = "Inaccessible"
DatabaseStatusOffline DatabaseStatus = "Offline"
DatabaseStatusOfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers"
DatabaseStatusOfflineSecondary DatabaseStatus = "OfflineSecondary"
DatabaseStatusOnline DatabaseStatus = "Online"
DatabaseStatusOnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers"
DatabaseStatusPaused DatabaseStatus = "Paused"
DatabaseStatusPausing DatabaseStatus = "Pausing"
DatabaseStatusRecovering DatabaseStatus = "Recovering"
DatabaseStatusRecoveryPending DatabaseStatus = "RecoveryPending"
DatabaseStatusRestoring DatabaseStatus = "Restoring"
DatabaseStatusResuming DatabaseStatus = "Resuming"
DatabaseStatusScaling DatabaseStatus = "Scaling"
DatabaseStatusShutdown DatabaseStatus = "Shutdown"
DatabaseStatusStandby DatabaseStatus = "Standby"
DatabaseStatusStarting DatabaseStatus = "Starting"
DatabaseStatusStopped DatabaseStatus = "Stopped"
DatabaseStatusStopping DatabaseStatus = "Stopping"
DatabaseStatusSuspect DatabaseStatus = "Suspect"
)
func PossibleValuesForDatabaseStatus() []string {
return []string{
string(DatabaseStatusAutoClosed),
string(DatabaseStatusCopying),
string(DatabaseStatusCreating),
string(DatabaseStatusDisabled),
string(DatabaseStatusEmergencyMode),
string(DatabaseStatusInaccessible),
string(DatabaseStatusOffline),
string(DatabaseStatusOfflineChangingDwPerformanceTiers),
string(DatabaseStatusOfflineSecondary),
string(DatabaseStatusOnline),
string(DatabaseStatusOnlineChangingDwPerformanceTiers),
string(DatabaseStatusPaused),
string(DatabaseStatusPausing),
string(DatabaseStatusRecovering),
string(DatabaseStatusRecoveryPending),
string(DatabaseStatusRestoring),
string(DatabaseStatusResuming),
string(DatabaseStatusScaling),
string(DatabaseStatusShutdown),
string(DatabaseStatusStandby),
string(DatabaseStatusStarting),
string(DatabaseStatusStopped),
string(DatabaseStatusStopping),
string(DatabaseStatusSuspect),
}
}
func (s *DatabaseStatus) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDatabaseStatus(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseDatabaseStatus(input string) (*DatabaseStatus, error) {
vals := map[string]DatabaseStatus{
"autoclosed": DatabaseStatusAutoClosed,
"copying": DatabaseStatusCopying,
"creating": DatabaseStatusCreating,
"disabled": DatabaseStatusDisabled,
"emergencymode": DatabaseStatusEmergencyMode,
"inaccessible": DatabaseStatusInaccessible,
"offline": DatabaseStatusOffline,
"offlinechangingdwperformancetiers": DatabaseStatusOfflineChangingDwPerformanceTiers,
"offlinesecondary": DatabaseStatusOfflineSecondary,
"online": DatabaseStatusOnline,
"onlinechangingdwperformancetiers": DatabaseStatusOnlineChangingDwPerformanceTiers,
"paused": DatabaseStatusPaused,
"pausing": DatabaseStatusPausing,
"recovering": DatabaseStatusRecovering,
"recoverypending": DatabaseStatusRecoveryPending,
"restoring": DatabaseStatusRestoring,
"resuming": DatabaseStatusResuming,
"scaling": DatabaseStatusScaling,
"shutdown": DatabaseStatusShutdown,
"standby": DatabaseStatusStandby,
"starting": DatabaseStatusStarting,
"stopped": DatabaseStatusStopped,
"stopping": DatabaseStatusStopping,
"suspect": DatabaseStatusSuspect,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := DatabaseStatus(input)
return &out, nil
}
type FreeLimitExhaustionBehavior string
const (
FreeLimitExhaustionBehaviorAutoPause FreeLimitExhaustionBehavior = "AutoPause"
FreeLimitExhaustionBehaviorBillOverUsage FreeLimitExhaustionBehavior = "BillOverUsage"
)
func PossibleValuesForFreeLimitExhaustionBehavior() []string {
return []string{
string(FreeLimitExhaustionBehaviorAutoPause),
string(FreeLimitExhaustionBehaviorBillOverUsage),
}
}
func (s *FreeLimitExhaustionBehavior) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseFreeLimitExhaustionBehavior(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseFreeLimitExhaustionBehavior(input string) (*FreeLimitExhaustionBehavior, error) {
vals := map[string]FreeLimitExhaustionBehavior{
"autopause": FreeLimitExhaustionBehaviorAutoPause,
"billoverusage": FreeLimitExhaustionBehaviorBillOverUsage,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := FreeLimitExhaustionBehavior(input)
return &out, nil
}
type ReplicaType string
const (
ReplicaTypePrimary ReplicaType = "Primary"
ReplicaTypeReadableSecondary ReplicaType = "ReadableSecondary"
)
func PossibleValuesForReplicaType() []string {
return []string{
string(ReplicaTypePrimary),
string(ReplicaTypeReadableSecondary),
}
}
func (s *ReplicaType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseReplicaType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseReplicaType(input string) (*ReplicaType, error) {
vals := map[string]ReplicaType{
"primary": ReplicaTypePrimary,
"readablesecondary": ReplicaTypeReadableSecondary,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := ReplicaType(input)
return &out, nil
}
type SampleName string
const (
SampleNameAdventureWorksLT SampleName = "AdventureWorksLT"
SampleNameWideWorldImportersFull SampleName = "WideWorldImportersFull"
SampleNameWideWorldImportersStd SampleName = "WideWorldImportersStd"
)
func PossibleValuesForSampleName() []string {
return []string{
string(SampleNameAdventureWorksLT),
string(SampleNameWideWorldImportersFull),
string(SampleNameWideWorldImportersStd),
}
}
func (s *SampleName) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseSampleName(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseSampleName(input string) (*SampleName, error) {
vals := map[string]SampleName{
"adventureworkslt": SampleNameAdventureWorksLT,
"wideworldimportersfull": SampleNameWideWorldImportersFull,
"wideworldimportersstd": SampleNameWideWorldImportersStd,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := SampleName(input)
return &out, nil
}
type SecondaryType string
const (
SecondaryTypeGeo SecondaryType = "Geo"
SecondaryTypeNamed SecondaryType = "Named"
SecondaryTypeStandby SecondaryType = "Standby"
)
func PossibleValuesForSecondaryType() []string {
return []string{
string(SecondaryTypeGeo),
string(SecondaryTypeNamed),
string(SecondaryTypeStandby),
}
}
func (s *SecondaryType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseSecondaryType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseSecondaryType(input string) (*SecondaryType, error) {
vals := map[string]SecondaryType{
"geo": SecondaryTypeGeo,
"named": SecondaryTypeNamed,
"standby": SecondaryTypeStandby,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := SecondaryType(input)
return &out, nil
}
type StorageKeyType string
const (
StorageKeyTypeSharedAccessKey StorageKeyType = "SharedAccessKey"
StorageKeyTypeStorageAccessKey StorageKeyType = "StorageAccessKey"
)
func PossibleValuesForStorageKeyType() []string {
return []string{
string(StorageKeyTypeSharedAccessKey),
string(StorageKeyTypeStorageAccessKey),
}
}
func (s *StorageKeyType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseStorageKeyType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}
func parseStorageKeyType(input string) (*StorageKeyType, error) {
vals := map[string]StorageKeyType{
"sharedaccesskey": StorageKeyTypeSharedAccessKey,
"storageaccesskey": StorageKeyTypeStorageAccessKey,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := StorageKeyType(input)
return &out, nil
}