Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultTLSConfig() *tls.Config
- func ExtractMachineName(target string) (string, error)
- func IsValid[T Validatable](obj T) error
- func LoadBasicAuthData(env Environment, providedServer, providedUsername, providedPassword string) (server, username, password string, err error)
- func ReadJSONOrYAML(src io.Reader, dest proto.Message) error
- func ReadPolicy(src io.Reader) (*policyv1.Policy, error)
- func ReadPolicyFromFile(fsys fs.FS, path string) (*policyv1.Policy, error)
- func ReadSchema(src io.Reader, id string) (*schemav1.Schema, error)
- func ReadSchemaFromFile(fsys fs.FS, path string) (*schemav1.Schema, error)
- func ToStructPB(v any) (*structpb.Value, error)
- func UserAgent(impl string) string
- func Validate[T proto.Message](obj T) error
- func ValidatePolicy(p *policyv1.Policy) error
- type Environment
- type OSEnvironment
- type ReqOpt
- type Validatable
Constants ¶
View Source
const ( AuthorizationHeader = "authorization" PlaygroundInstanceHeader = "playground-instance" UsernameEnvVar = "CERBOS_USERNAME" PasswordEnvVar = "CERBOS_PASSWORD" ServerEnvVar = "CERBOS_SERVER" NetrcFile = ".netrc" NetrcEnvVar = "NETRC" NetrcUserKey = "login" NetrcPassKey = "password" )
Variables ¶
View Source
var (
ErrMultipleYAMLDocs = errors.New("more than one YAML document detected")
)
Functions ¶
func DefaultTLSConfig ¶
func ExtractMachineName ¶
ExtractMachineName picks out the machine name from a gRPC target. See https://github.com/grpc/grpc/blob/master/doc/naming.md
func IsValid ¶
func IsValid[T Validatable](obj T) error
func LoadBasicAuthData ¶
func LoadBasicAuthData(env Environment, providedServer, providedUsername, providedPassword string) (server, username, password string, err error)
LoadBasicAuthData loads basic auth credentials and the server address by considering the following options: - User provided values (config or flags) - Environment variables - netrc file.
func ReadPolicy ¶
ReadPolicy reads a policy from the given reader.
func ReadPolicyFromFile ¶
func ReadSchemaFromFile ¶
func ValidatePolicy ¶
Types ¶
type Environment ¶
type OSEnvironment ¶
type OSEnvironment struct{}
func (OSEnvironment) Getenv ¶
func (OSEnvironment) Getenv(k string) string
type Validatable ¶
Click to show internal directories.
Click to hide internal directories.