-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapi_key_enum.go
49 lines (41 loc) · 1.28 KB
/
api_key_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
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package malak
import (
"errors"
"fmt"
)
const (
// RevocationTypeImmediate is a RevocationType of type immediate.
RevocationTypeImmediate RevocationType = "immediate"
// RevocationTypeDay is a RevocationType of type day.
RevocationTypeDay RevocationType = "day"
// RevocationTypeWeek is a RevocationType of type week.
RevocationTypeWeek RevocationType = "week"
)
var ErrInvalidRevocationType = errors.New("not a valid RevocationType")
// String implements the Stringer interface.
func (x RevocationType) 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 RevocationType) IsValid() bool {
_, err := ParseRevocationType(string(x))
return err == nil
}
var _RevocationTypeValue = map[string]RevocationType{
"immediate": RevocationTypeImmediate,
"day": RevocationTypeDay,
"week": RevocationTypeWeek,
}
// ParseRevocationType attempts to convert a string to a RevocationType.
func ParseRevocationType(name string) (RevocationType, error) {
if x, ok := _RevocationTypeValue[name]; ok {
return x, nil
}
return RevocationType(""), fmt.Errorf("%s is %w", name, ErrInvalidRevocationType)
}