mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 15:11:07 +02:00
81 lines
2.3 KiB
Go
81 lines
2.3 KiB
Go
// Code generated by "enumer -type=RolePathPolicy -text -json -transform=kebab-case"; DO NOT EDIT.
|
|
|
|
package pki_backend
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
const _RolePathPolicyName = "RPPUnknownRPPSignVerbatimRPPRole"
|
|
|
|
var _RolePathPolicyIndex = [...]uint8{0, 10, 25, 32}
|
|
|
|
func (i RolePathPolicy) String() string {
|
|
if i < 0 || i >= RolePathPolicy(len(_RolePathPolicyIndex)-1) {
|
|
return fmt.Sprintf("RolePathPolicy(%d)", i)
|
|
}
|
|
return _RolePathPolicyName[_RolePathPolicyIndex[i]:_RolePathPolicyIndex[i+1]]
|
|
}
|
|
|
|
var _RolePathPolicyValues = []RolePathPolicy{0, 1, 2}
|
|
|
|
var _RolePathPolicyNameToValueMap = map[string]RolePathPolicy{
|
|
_RolePathPolicyName[0:10]: 0,
|
|
_RolePathPolicyName[10:25]: 1,
|
|
_RolePathPolicyName[25:32]: 2,
|
|
}
|
|
|
|
// RolePathPolicyString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func RolePathPolicyString(s string) (RolePathPolicy, error) {
|
|
if val, ok := _RolePathPolicyNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to RolePathPolicy values", s)
|
|
}
|
|
|
|
// RolePathPolicyValues returns all values of the enum
|
|
func RolePathPolicyValues() []RolePathPolicy {
|
|
return _RolePathPolicyValues
|
|
}
|
|
|
|
// IsARolePathPolicy returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i RolePathPolicy) IsARolePathPolicy() bool {
|
|
for _, v := range _RolePathPolicyValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface for RolePathPolicy
|
|
func (i RolePathPolicy) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(i.String())
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface for RolePathPolicy
|
|
func (i *RolePathPolicy) UnmarshalJSON(data []byte) error {
|
|
var s string
|
|
if err := json.Unmarshal(data, &s); err != nil {
|
|
return fmt.Errorf("RolePathPolicy should be a string, got %s", data)
|
|
}
|
|
|
|
var err error
|
|
*i, err = RolePathPolicyString(s)
|
|
return err
|
|
}
|
|
|
|
// MarshalText implements the encoding.TextMarshaler interface for RolePathPolicy
|
|
func (i RolePathPolicy) MarshalText() ([]byte, error) {
|
|
return []byte(i.String()), nil
|
|
}
|
|
|
|
// UnmarshalText implements the encoding.TextUnmarshaler interface for RolePathPolicy
|
|
func (i *RolePathPolicy) UnmarshalText(text []byte) error {
|
|
var err error
|
|
*i, err = RolePathPolicyString(string(text))
|
|
return err
|
|
}
|