-
Notifications
You must be signed in to change notification settings - Fork 9
/
enums_enum.go
3170 lines (2748 loc) · 85 KB
/
enums_enum.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
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by go-enum DO NOT EDIT.
// Version: 0.6.0
// Revision: 919e61c0174b91303753ee3898569a01abb32c97
// Build Date: 2023-12-18T15:54:43Z
// Built By: goreleaser
package enums
import (
"database/sql/driver"
"errors"
"fmt"
)
const (
// ArtifactTypeImage is a ArtifactType of type Image.
ArtifactTypeImage ArtifactType = "Image"
// ArtifactTypeImageIndex is a ArtifactType of type ImageIndex.
ArtifactTypeImageIndex ArtifactType = "ImageIndex"
// ArtifactTypeChart is a ArtifactType of type Chart.
ArtifactTypeChart ArtifactType = "Chart"
// ArtifactTypeCnab is a ArtifactType of type Cnab.
ArtifactTypeCnab ArtifactType = "Cnab"
// ArtifactTypeWasm is a ArtifactType of type Wasm.
ArtifactTypeWasm ArtifactType = "Wasm"
// ArtifactTypeProvenance is a ArtifactType of type Provenance.
ArtifactTypeProvenance ArtifactType = "Provenance"
// ArtifactTypeCosign is a ArtifactType of type Cosign.
ArtifactTypeCosign ArtifactType = "Cosign"
// ArtifactTypeSif is a ArtifactType of type Sif.
ArtifactTypeSif ArtifactType = "Sif"
// ArtifactTypeUnknown is a ArtifactType of type Unknown.
ArtifactTypeUnknown ArtifactType = "Unknown"
)
var ErrInvalidArtifactType = errors.New("not a valid ArtifactType")
// String implements the Stringer interface.
func (x ArtifactType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x ArtifactType) IsValid() bool {
_, err := ParseArtifactType(string(x))
return err == nil
}
var _ArtifactTypeValue = map[string]ArtifactType{
"Image": ArtifactTypeImage,
"ImageIndex": ArtifactTypeImageIndex,
"Chart": ArtifactTypeChart,
"Cnab": ArtifactTypeCnab,
"Wasm": ArtifactTypeWasm,
"Provenance": ArtifactTypeProvenance,
"Cosign": ArtifactTypeCosign,
"Sif": ArtifactTypeSif,
"Unknown": ArtifactTypeUnknown,
}
// ParseArtifactType attempts to convert a string to a ArtifactType.
func ParseArtifactType(name string) (ArtifactType, error) {
if x, ok := _ArtifactTypeValue[name]; ok {
return x, nil
}
return ArtifactType(""), fmt.Errorf("%s is %w", name, ErrInvalidArtifactType)
}
// MustParseArtifactType converts a string to a ArtifactType, and panics if is not valid.
func MustParseArtifactType(name string) ArtifactType {
val, err := ParseArtifactType(name)
if err != nil {
panic(err)
}
return val
}
var errArtifactTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *ArtifactType) Scan(value interface{}) (err error) {
if value == nil {
*x = ArtifactType("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseArtifactType(v)
case []byte:
*x, err = ParseArtifactType(string(v))
case ArtifactType:
*x = v
case *ArtifactType:
if v == nil {
return errArtifactTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errArtifactTypeNilPtr
}
*x, err = ParseArtifactType(*v)
default:
return errors.New("invalid type for ArtifactType")
}
return
}
// Value implements the driver Valuer interface.
func (x ArtifactType) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// AuditActionCreate is a AuditAction of type Create.
AuditActionCreate AuditAction = "Create"
// AuditActionUpdate is a AuditAction of type Update.
AuditActionUpdate AuditAction = "Update"
// AuditActionDelete is a AuditAction of type Delete.
AuditActionDelete AuditAction = "Delete"
// AuditActionPull is a AuditAction of type Pull.
AuditActionPull AuditAction = "Pull"
// AuditActionPush is a AuditAction of type Push.
AuditActionPush AuditAction = "Push"
)
var ErrInvalidAuditAction = errors.New("not a valid AuditAction")
// String implements the Stringer interface.
func (x AuditAction) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x AuditAction) IsValid() bool {
_, err := ParseAuditAction(string(x))
return err == nil
}
var _AuditActionValue = map[string]AuditAction{
"Create": AuditActionCreate,
"Update": AuditActionUpdate,
"Delete": AuditActionDelete,
"Pull": AuditActionPull,
"Push": AuditActionPush,
}
// ParseAuditAction attempts to convert a string to a AuditAction.
func ParseAuditAction(name string) (AuditAction, error) {
if x, ok := _AuditActionValue[name]; ok {
return x, nil
}
return AuditAction(""), fmt.Errorf("%s is %w", name, ErrInvalidAuditAction)
}
// MustParseAuditAction converts a string to a AuditAction, and panics if is not valid.
func MustParseAuditAction(name string) AuditAction {
val, err := ParseAuditAction(name)
if err != nil {
panic(err)
}
return val
}
var errAuditActionNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *AuditAction) Scan(value interface{}) (err error) {
if value == nil {
*x = AuditAction("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseAuditAction(v)
case []byte:
*x, err = ParseAuditAction(string(v))
case AuditAction:
*x = v
case *AuditAction:
if v == nil {
return errAuditActionNilPtr
}
*x = *v
case *string:
if v == nil {
return errAuditActionNilPtr
}
*x, err = ParseAuditAction(*v)
default:
return errors.New("invalid type for AuditAction")
}
return
}
// Value implements the driver Valuer interface.
func (x AuditAction) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// AuditResourceTypeNamespace is a AuditResourceType of type Namespace.
AuditResourceTypeNamespace AuditResourceType = "Namespace"
// AuditResourceTypeNamespaceMember is a AuditResourceType of type NamespaceMember.
AuditResourceTypeNamespaceMember AuditResourceType = "NamespaceMember"
// AuditResourceTypeRepository is a AuditResourceType of type Repository.
AuditResourceTypeRepository AuditResourceType = "Repository"
// AuditResourceTypeTag is a AuditResourceType of type Tag.
AuditResourceTypeTag AuditResourceType = "Tag"
// AuditResourceTypeWebhook is a AuditResourceType of type Webhook.
AuditResourceTypeWebhook AuditResourceType = "Webhook"
// AuditResourceTypeBuilder is a AuditResourceType of type Builder.
AuditResourceTypeBuilder AuditResourceType = "Builder"
)
var ErrInvalidAuditResourceType = errors.New("not a valid AuditResourceType")
// String implements the Stringer interface.
func (x AuditResourceType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x AuditResourceType) IsValid() bool {
_, err := ParseAuditResourceType(string(x))
return err == nil
}
var _AuditResourceTypeValue = map[string]AuditResourceType{
"Namespace": AuditResourceTypeNamespace,
"NamespaceMember": AuditResourceTypeNamespaceMember,
"Repository": AuditResourceTypeRepository,
"Tag": AuditResourceTypeTag,
"Webhook": AuditResourceTypeWebhook,
"Builder": AuditResourceTypeBuilder,
}
// ParseAuditResourceType attempts to convert a string to a AuditResourceType.
func ParseAuditResourceType(name string) (AuditResourceType, error) {
if x, ok := _AuditResourceTypeValue[name]; ok {
return x, nil
}
return AuditResourceType(""), fmt.Errorf("%s is %w", name, ErrInvalidAuditResourceType)
}
// MustParseAuditResourceType converts a string to a AuditResourceType, and panics if is not valid.
func MustParseAuditResourceType(name string) AuditResourceType {
val, err := ParseAuditResourceType(name)
if err != nil {
panic(err)
}
return val
}
var errAuditResourceTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *AuditResourceType) Scan(value interface{}) (err error) {
if value == nil {
*x = AuditResourceType("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseAuditResourceType(v)
case []byte:
*x, err = ParseAuditResourceType(string(v))
case AuditResourceType:
*x = v
case *AuditResourceType:
if v == nil {
return errAuditResourceTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errAuditResourceTypeNilPtr
}
*x, err = ParseAuditResourceType(*v)
default:
return errors.New("invalid type for AuditResourceType")
}
return
}
// Value implements the driver Valuer interface.
func (x AuditResourceType) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// AuthRead is a Auth of type Read.
AuthRead Auth = "Read"
// AuthManage is a Auth of type Manage.
AuthManage Auth = "Manage"
// AuthAdmin is a Auth of type Admin.
AuthAdmin Auth = "Admin"
)
var ErrInvalidAuth = errors.New("not a valid Auth")
// String implements the Stringer interface.
func (x Auth) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x Auth) IsValid() bool {
_, err := ParseAuth(string(x))
return err == nil
}
var _AuthValue = map[string]Auth{
"Read": AuthRead,
"Manage": AuthManage,
"Admin": AuthAdmin,
}
// ParseAuth attempts to convert a string to a Auth.
func ParseAuth(name string) (Auth, error) {
if x, ok := _AuthValue[name]; ok {
return x, nil
}
return Auth(""), fmt.Errorf("%s is %w", name, ErrInvalidAuth)
}
// MustParseAuth converts a string to a Auth, and panics if is not valid.
func MustParseAuth(name string) Auth {
val, err := ParseAuth(name)
if err != nil {
panic(err)
}
return val
}
var errAuthNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *Auth) Scan(value interface{}) (err error) {
if value == nil {
*x = Auth("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseAuth(v)
case []byte:
*x, err = ParseAuth(string(v))
case Auth:
*x = v
case *Auth:
if v == nil {
return errAuthNilPtr
}
*x = *v
case *string:
if v == nil {
return errAuthNilPtr
}
*x, err = ParseAuth(*v)
default:
return errors.New("invalid type for Auth")
}
return
}
// Value implements the driver Valuer interface.
func (x Auth) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// BuildStatusSuccess is a BuildStatus of type Success.
BuildStatusSuccess BuildStatus = "Success"
// BuildStatusFailed is a BuildStatus of type Failed.
BuildStatusFailed BuildStatus = "Failed"
// BuildStatusPending is a BuildStatus of type Pending.
BuildStatusPending BuildStatus = "Pending"
// BuildStatusScheduling is a BuildStatus of type Scheduling.
BuildStatusScheduling BuildStatus = "Scheduling"
// BuildStatusBuilding is a BuildStatus of type Building.
BuildStatusBuilding BuildStatus = "Building"
// BuildStatusStopping is a BuildStatus of type Stopping.
BuildStatusStopping BuildStatus = "Stopping"
// BuildStatusStopped is a BuildStatus of type Stopped.
BuildStatusStopped BuildStatus = "Stopped"
)
var ErrInvalidBuildStatus = errors.New("not a valid BuildStatus")
// String implements the Stringer interface.
func (x BuildStatus) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x BuildStatus) IsValid() bool {
_, err := ParseBuildStatus(string(x))
return err == nil
}
var _BuildStatusValue = map[string]BuildStatus{
"Success": BuildStatusSuccess,
"Failed": BuildStatusFailed,
"Pending": BuildStatusPending,
"Scheduling": BuildStatusScheduling,
"Building": BuildStatusBuilding,
"Stopping": BuildStatusStopping,
"Stopped": BuildStatusStopped,
}
// ParseBuildStatus attempts to convert a string to a BuildStatus.
func ParseBuildStatus(name string) (BuildStatus, error) {
if x, ok := _BuildStatusValue[name]; ok {
return x, nil
}
return BuildStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidBuildStatus)
}
// MustParseBuildStatus converts a string to a BuildStatus, and panics if is not valid.
func MustParseBuildStatus(name string) BuildStatus {
val, err := ParseBuildStatus(name)
if err != nil {
panic(err)
}
return val
}
var errBuildStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *BuildStatus) Scan(value interface{}) (err error) {
if value == nil {
*x = BuildStatus("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseBuildStatus(v)
case []byte:
*x, err = ParseBuildStatus(string(v))
case BuildStatus:
*x = v
case *BuildStatus:
if v == nil {
return errBuildStatusNilPtr
}
*x = *v
case *string:
if v == nil {
return errBuildStatusNilPtr
}
*x, err = ParseBuildStatus(*v)
default:
return errors.New("invalid type for BuildStatus")
}
return
}
// Value implements the driver Valuer interface.
func (x BuildStatus) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// BuilderSourceDockerfile is a BuilderSource of type Dockerfile.
BuilderSourceDockerfile BuilderSource = "Dockerfile"
// BuilderSourceCodeRepository is a BuilderSource of type CodeRepository.
BuilderSourceCodeRepository BuilderSource = "CodeRepository"
// BuilderSourceSelfCodeRepository is a BuilderSource of type SelfCodeRepository.
BuilderSourceSelfCodeRepository BuilderSource = "SelfCodeRepository"
)
var ErrInvalidBuilderSource = errors.New("not a valid BuilderSource")
// String implements the Stringer interface.
func (x BuilderSource) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x BuilderSource) IsValid() bool {
_, err := ParseBuilderSource(string(x))
return err == nil
}
var _BuilderSourceValue = map[string]BuilderSource{
"Dockerfile": BuilderSourceDockerfile,
"CodeRepository": BuilderSourceCodeRepository,
"SelfCodeRepository": BuilderSourceSelfCodeRepository,
}
// ParseBuilderSource attempts to convert a string to a BuilderSource.
func ParseBuilderSource(name string) (BuilderSource, error) {
if x, ok := _BuilderSourceValue[name]; ok {
return x, nil
}
return BuilderSource(""), fmt.Errorf("%s is %w", name, ErrInvalidBuilderSource)
}
// MustParseBuilderSource converts a string to a BuilderSource, and panics if is not valid.
func MustParseBuilderSource(name string) BuilderSource {
val, err := ParseBuilderSource(name)
if err != nil {
panic(err)
}
return val
}
var errBuilderSourceNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *BuilderSource) Scan(value interface{}) (err error) {
if value == nil {
*x = BuilderSource("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseBuilderSource(v)
case []byte:
*x, err = ParseBuilderSource(string(v))
case BuilderSource:
*x = v
case *BuilderSource:
if v == nil {
return errBuilderSourceNilPtr
}
*x = *v
case *string:
if v == nil {
return errBuilderSourceNilPtr
}
*x, err = ParseBuilderSource(*v)
default:
return errors.New("invalid type for BuilderSource")
}
return
}
// Value implements the driver Valuer interface.
func (x BuilderSource) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// BuilderTypeDocker is a BuilderType of type docker.
BuilderTypeDocker BuilderType = "docker"
// BuilderTypeKubernetes is a BuilderType of type kubernetes.
BuilderTypeKubernetes BuilderType = "kubernetes"
)
var ErrInvalidBuilderType = errors.New("not a valid BuilderType")
// String implements the Stringer interface.
func (x BuilderType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x BuilderType) IsValid() bool {
_, err := ParseBuilderType(string(x))
return err == nil
}
var _BuilderTypeValue = map[string]BuilderType{
"docker": BuilderTypeDocker,
"kubernetes": BuilderTypeKubernetes,
}
// ParseBuilderType attempts to convert a string to a BuilderType.
func ParseBuilderType(name string) (BuilderType, error) {
if x, ok := _BuilderTypeValue[name]; ok {
return x, nil
}
return BuilderType(""), fmt.Errorf("%s is %w", name, ErrInvalidBuilderType)
}
// MustParseBuilderType converts a string to a BuilderType, and panics if is not valid.
func MustParseBuilderType(name string) BuilderType {
val, err := ParseBuilderType(name)
if err != nil {
panic(err)
}
return val
}
var errBuilderTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *BuilderType) Scan(value interface{}) (err error) {
if value == nil {
*x = BuilderType("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseBuilderType(v)
case []byte:
*x, err = ParseBuilderType(string(v))
case BuilderType:
*x = v
case *BuilderType:
if v == nil {
return errBuilderTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errBuilderTypeNilPtr
}
*x, err = ParseBuilderType(*v)
default:
return errors.New("invalid type for BuilderType")
}
return
}
// Value implements the driver Valuer interface.
func (x BuilderType) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// CacherTypeInmemory is a CacherType of type inmemory.
CacherTypeInmemory CacherType = "inmemory"
// CacherTypeRedis is a CacherType of type redis.
CacherTypeRedis CacherType = "redis"
// CacherTypeBadger is a CacherType of type badger.
CacherTypeBadger CacherType = "badger"
)
var ErrInvalidCacherType = errors.New("not a valid CacherType")
// String implements the Stringer interface.
func (x CacherType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x CacherType) IsValid() bool {
_, err := ParseCacherType(string(x))
return err == nil
}
var _CacherTypeValue = map[string]CacherType{
"inmemory": CacherTypeInmemory,
"redis": CacherTypeRedis,
"badger": CacherTypeBadger,
}
// ParseCacherType attempts to convert a string to a CacherType.
func ParseCacherType(name string) (CacherType, error) {
if x, ok := _CacherTypeValue[name]; ok {
return x, nil
}
return CacherType(""), fmt.Errorf("%s is %w", name, ErrInvalidCacherType)
}
// MustParseCacherType converts a string to a CacherType, and panics if is not valid.
func MustParseCacherType(name string) CacherType {
val, err := ParseCacherType(name)
if err != nil {
panic(err)
}
return val
}
var errCacherTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *CacherType) Scan(value interface{}) (err error) {
if value == nil {
*x = CacherType("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseCacherType(v)
case []byte:
*x, err = ParseCacherType(string(v))
case CacherType:
*x = v
case *CacherType:
if v == nil {
return errCacherTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errCacherTypeNilPtr
}
*x, err = ParseCacherType(*v)
default:
return errors.New("invalid type for CacherType")
}
return
}
// Value implements the driver Valuer interface.
func (x CacherType) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// DaemonVulnerability is a Daemon of type Vulnerability.
DaemonVulnerability Daemon = "Vulnerability"
// DaemonSbom is a Daemon of type Sbom.
DaemonSbom Daemon = "Sbom"
// DaemonGc is a Daemon of type Gc.
DaemonGc Daemon = "Gc"
// DaemonGcRepository is a Daemon of type GcRepository.
DaemonGcRepository Daemon = "GcRepository"
// DaemonGcArtifact is a Daemon of type GcArtifact.
DaemonGcArtifact Daemon = "GcArtifact"
// DaemonGcBlob is a Daemon of type GcBlob.
DaemonGcBlob Daemon = "GcBlob"
// DaemonGcTag is a Daemon of type GcTag.
DaemonGcTag Daemon = "GcTag"
// DaemonWebhook is a Daemon of type Webhook.
DaemonWebhook Daemon = "Webhook"
// DaemonBuilder is a Daemon of type Builder.
DaemonBuilder Daemon = "Builder"
// DaemonCodeRepository is a Daemon of type CodeRepository.
DaemonCodeRepository Daemon = "CodeRepository"
// DaemonTagPushed is a Daemon of type TagPushed.
DaemonTagPushed Daemon = "TagPushed"
// DaemonArtifactPushed is a Daemon of type ArtifactPushed.
DaemonArtifactPushed Daemon = "ArtifactPushed"
)
var ErrInvalidDaemon = errors.New("not a valid Daemon")
// String implements the Stringer interface.
func (x Daemon) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x Daemon) IsValid() bool {
_, err := ParseDaemon(string(x))
return err == nil
}
var _DaemonValue = map[string]Daemon{
"Vulnerability": DaemonVulnerability,
"Sbom": DaemonSbom,
"Gc": DaemonGc,
"GcRepository": DaemonGcRepository,
"GcArtifact": DaemonGcArtifact,
"GcBlob": DaemonGcBlob,
"GcTag": DaemonGcTag,
"Webhook": DaemonWebhook,
"Builder": DaemonBuilder,
"CodeRepository": DaemonCodeRepository,
"TagPushed": DaemonTagPushed,
"ArtifactPushed": DaemonArtifactPushed,
}
// ParseDaemon attempts to convert a string to a Daemon.
func ParseDaemon(name string) (Daemon, error) {
if x, ok := _DaemonValue[name]; ok {
return x, nil
}
return Daemon(""), fmt.Errorf("%s is %w", name, ErrInvalidDaemon)
}
// MustParseDaemon converts a string to a Daemon, and panics if is not valid.
func MustParseDaemon(name string) Daemon {
val, err := ParseDaemon(name)
if err != nil {
panic(err)
}
return val
}
var errDaemonNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *Daemon) Scan(value interface{}) (err error) {
if value == nil {
*x = Daemon("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseDaemon(v)
case []byte:
*x, err = ParseDaemon(string(v))
case Daemon:
*x = v
case *Daemon:
if v == nil {
return errDaemonNilPtr
}
*x = *v
case *string:
if v == nil {
return errDaemonNilPtr
}
*x, err = ParseDaemon(*v)
default:
return errors.New("invalid type for Daemon")
}
return
}
// Value implements the driver Valuer interface.
func (x Daemon) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// DaemonBuilderActionStart is a DaemonBuilderAction of type Start.
DaemonBuilderActionStart DaemonBuilderAction = "Start"
// DaemonBuilderActionRestart is a DaemonBuilderAction of type Restart.
DaemonBuilderActionRestart DaemonBuilderAction = "Restart"
// DaemonBuilderActionStop is a DaemonBuilderAction of type Stop.
DaemonBuilderActionStop DaemonBuilderAction = "Stop"
)
var ErrInvalidDaemonBuilderAction = errors.New("not a valid DaemonBuilderAction")
// String implements the Stringer interface.
func (x DaemonBuilderAction) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x DaemonBuilderAction) IsValid() bool {
_, err := ParseDaemonBuilderAction(string(x))
return err == nil
}
var _DaemonBuilderActionValue = map[string]DaemonBuilderAction{
"Start": DaemonBuilderActionStart,
"Restart": DaemonBuilderActionRestart,
"Stop": DaemonBuilderActionStop,
}
// ParseDaemonBuilderAction attempts to convert a string to a DaemonBuilderAction.
func ParseDaemonBuilderAction(name string) (DaemonBuilderAction, error) {
if x, ok := _DaemonBuilderActionValue[name]; ok {
return x, nil
}
return DaemonBuilderAction(""), fmt.Errorf("%s is %w", name, ErrInvalidDaemonBuilderAction)
}
// MustParseDaemonBuilderAction converts a string to a DaemonBuilderAction, and panics if is not valid.
func MustParseDaemonBuilderAction(name string) DaemonBuilderAction {
val, err := ParseDaemonBuilderAction(name)
if err != nil {
panic(err)
}
return val
}
var errDaemonBuilderActionNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *DaemonBuilderAction) Scan(value interface{}) (err error) {
if value == nil {
*x = DaemonBuilderAction("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency
switch v := value.(type) {
case string:
*x, err = ParseDaemonBuilderAction(v)
case []byte:
*x, err = ParseDaemonBuilderAction(string(v))
case DaemonBuilderAction:
*x = v
case *DaemonBuilderAction:
if v == nil {
return errDaemonBuilderActionNilPtr
}
*x = *v
case *string:
if v == nil {
return errDaemonBuilderActionNilPtr
}
*x, err = ParseDaemonBuilderAction(*v)
default:
return errors.New("invalid type for DaemonBuilderAction")
}
return
}
// Value implements the driver Valuer interface.
func (x DaemonBuilderAction) Value() (driver.Value, error) {
return x.String(), nil
}
const (
// DatabasePostgresql is a Database of type postgresql.
DatabasePostgresql Database = "postgresql"
// DatabaseMysql is a Database of type mysql.
DatabaseMysql Database = "mysql"
// DatabaseSqlite3 is a Database of type sqlite3.
DatabaseSqlite3 Database = "sqlite3"
)
var ErrInvalidDatabase = errors.New("not a valid Database")
// String implements the Stringer interface.
func (x Database) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x Database) IsValid() bool {
_, err := ParseDatabase(string(x))
return err == nil
}
var _DatabaseValue = map[string]Database{
"postgresql": DatabasePostgresql,
"mysql": DatabaseMysql,
"sqlite3": DatabaseSqlite3,
}
// ParseDatabase attempts to convert a string to a Database.
func ParseDatabase(name string) (Database, error) {
if x, ok := _DatabaseValue[name]; ok {
return x, nil
}
return Database(""), fmt.Errorf("%s is %w", name, ErrInvalidDatabase)
}
// MustParseDatabase converts a string to a Database, and panics if is not valid.
func MustParseDatabase(name string) Database {
val, err := ParseDatabase(name)
if err != nil {
panic(err)
}
return val
}
var errDatabaseNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *Database) Scan(value interface{}) (err error) {
if value == nil {
*x = Database("")
return
}
// A wider range of scannable types.
// driver.Value values at the top of the list for expediency