Repository navigation
Expand file tree
/
Copy pathrules_enum.go
More file actions
151 lines (126 loc) · 4.12 KB
/
Copy pathrules_enum.go
File metadata and controls
151 lines (126 loc) · 4.12 KB
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
// Code generated by go-enum DO NOT EDIT.
// Version: v0.9.2
// Built By: go install
package caddy_oidc
import (
"errors"
"fmt"
)
const (
// ActionAllow is a Action of type Allow.
ActionAllow Action = iota
// ActionDeny is a Action of type Deny.
ActionDeny
)
var ErrInvalidAction = errors.New("not a valid Action")
const _ActionName = "allowdeny"
var _ActionMap = map[Action]string{
ActionAllow: _ActionName[0:5],
ActionDeny: _ActionName[5:9],
}
// String implements the Stringer interface.
func (x Action) String() string {
if str, ok := _ActionMap[x]; ok {
return str
}
return fmt.Sprintf("Action(%d)", x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x Action) IsValid() bool {
_, ok := _ActionMap[x]
return ok
}
var _ActionValue = map[string]Action{
_ActionName[0:5]: ActionAllow,
_ActionName[5:9]: ActionDeny,
}
// ParseAction attempts to convert a string to a Action.
func ParseAction(name string) (Action, error) {
if x, ok := _ActionValue[name]; ok {
return x, nil
}
return Action(0), fmt.Errorf("%s is %w", name, ErrInvalidAction)
}
// MarshalText implements the text marshaller method.
func (x Action) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
// UnmarshalText implements the text unmarshaller method.
func (x *Action) UnmarshalText(text []byte) error {
name := string(text)
tmp, err := ParseAction(name)
if err != nil {
return err
}
*x = tmp
return nil
}
// AppendText appends the textual representation of itself to the end of b
// (allocating a larger slice if necessary) and returns the updated slice.
//
// Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (x *Action) AppendText(b []byte) ([]byte, error) {
return append(b, x.String()...), nil
}
const (
// EvaluationResultImplicitDeny is a EvaluationResult of type Implicit Deny.
EvaluationResultImplicitDeny EvaluationResult = iota
// EvaluationResultExplicitDeny is a EvaluationResult of type Explicit Deny.
EvaluationResultExplicitDeny
// EvaluationResultAllow is a EvaluationResult of type Allow.
EvaluationResultAllow
)
var ErrInvalidEvaluationResult = errors.New("not a valid EvaluationResult")
const _EvaluationResultName = "implicit denyexplicit denyallow"
var _EvaluationResultMap = map[EvaluationResult]string{
EvaluationResultImplicitDeny: _EvaluationResultName[0:13],
EvaluationResultExplicitDeny: _EvaluationResultName[13:26],
EvaluationResultAllow: _EvaluationResultName[26:31],
}
// String implements the Stringer interface.
func (x EvaluationResult) String() string {
if str, ok := _EvaluationResultMap[x]; ok {
return str
}
return fmt.Sprintf("EvaluationResult(%d)", x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x EvaluationResult) IsValid() bool {
_, ok := _EvaluationResultMap[x]
return ok
}
var _EvaluationResultValue = map[string]EvaluationResult{
_EvaluationResultName[0:13]: EvaluationResultImplicitDeny,
_EvaluationResultName[13:26]: EvaluationResultExplicitDeny,
_EvaluationResultName[26:31]: EvaluationResultAllow,
}
// ParseEvaluationResult attempts to convert a string to a EvaluationResult.
func ParseEvaluationResult(name string) (EvaluationResult, error) {
if x, ok := _EvaluationResultValue[name]; ok {
return x, nil
}
return EvaluationResult(0), fmt.Errorf("%s is %w", name, ErrInvalidEvaluationResult)
}
// MarshalText implements the text marshaller method.
func (x EvaluationResult) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
// UnmarshalText implements the text unmarshaller method.
func (x *EvaluationResult) UnmarshalText(text []byte) error {
name := string(text)
tmp, err := ParseEvaluationResult(name)
if err != nil {
return err
}
*x = tmp
return nil
}
// AppendText appends the textual representation of itself to the end of b
// (allocating a larger slice if necessary) and returns the updated slice.
//
// Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (x *EvaluationResult) AppendText(b []byte) ([]byte, error) {
return append(b, x.String()...), nil
}