Documentation
¶
Overview ¶
Functions to normalize YAML input before processing into data structure.
Index ¶
- Variables
- func CheckIsString(yaml interface{}) error
- func CheckPrivilegesACL(profiles map[string][]interface{}) error
- func CheckSpuriousKeys(yaml *map[string]interface{}, knownKeys ...string) error
- func Dump(root interface{})
- func DuplicateGrantRules(yaml map[string]interface{}) (rules []map[string]interface{})
- func DuplicateRoleRules(yaml map[string]interface{}) (rules []map[string]interface{})
- func FindConfigFile(userValue string) string
- func FindDotEnvFile(configpath string) string
- func FindFile(userValue string, candidates []string) (configpath string)
- func NormalizeAlias(yaml *map[string]interface{}, key, alias string) (err error)
- func NormalizeBoolean(v interface{}) interface{}
- func NormalizeCommonLdapSearch(yaml interface{}) (search map[string]interface{}, err error)
- func NormalizeConfigRoot(yaml interface{}) (config map[string]interface{}, err error)
- func NormalizeGrantRule(yaml interface{}) (rule map[string]interface{}, err error)
- func NormalizeLdapSearch(yaml interface{}) (search map[string]interface{}, err error)
- func NormalizeList(yaml interface{}) (list []interface{})
- func NormalizeMembership(raw interface{}) (value map[string]interface{}, err error)
- func NormalizeMemberships(raw interface{}) (memberships []map[string]interface{}, err error)
- func NormalizePostgres(yaml interface{}) error
- func NormalizePrivileges(value interface{}) (out map[string][]interface{}, err error)
- func NormalizeRoleOptions(yaml interface{}) (value map[string]interface{}, err error)
- func NormalizeRoleRule(yaml interface{}) (rule map[string]interface{}, err error)
- func NormalizeRules(yaml interface{}) (syncMap []interface{}, err error)
- func NormalizeStringList(yaml interface{}) (list []string, err error)
- func NormalizeSyncItem(yaml interface{}) (item map[string]interface{}, err error)
- func ReadYaml(path string) (values interface{}, err error)
- func ResolvePrivilegeRefs(value map[string]interface{}) map[string][]interface{}
- func YamlTo[T any](raw interface{}) (T, error)
- type Config
- type KeyConflict
- type LdapConfig
- type PostgresConfig
- type QueryConfig
- type YamlToFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var BuiltinsProfiles = map[string]interface{}{ "__connect__": []interface{}{map[string]interface{}{ "type": "CONNECT", "on": "DATABASE", }}, "__temporary__": []interface{}{map[string]interface{}{ "type": "TEMPORARY", "on": "DATABASE", }}, "__create_on_schemas__": []interface{}{map[string]interface{}{ "type": "CREATE", "on": "SCHEMA", }}, "__usage_on_schemas__": []interface{}{map[string]interface{}{ "type": "USAGE", "on": "SCHEMA", }}, "__all_on_schemas__": []interface{}{ "__create_on_schemas__", "__usage_on_schemas__", }, }
BuiltinsProfiles holds yaml rewrite for BuiltinsProfiles privileges from v5 format to v6.
Functions ¶
func CheckIsString ¶
func CheckIsString(yaml interface{}) error
func CheckPrivilegesACL ¶
func CheckSpuriousKeys ¶
func DuplicateGrantRules ¶
func DuplicateRoleRules ¶
Normalize one rule with a list of names to a list of rules with a single name.
func FindConfigFile ¶
func FindDotEnvFile ¶
func NormalizeAlias ¶
func NormalizeBoolean ¶
func NormalizeBoolean(v interface{}) interface{}
func NormalizeConfigRoot ¶
func NormalizeGrantRule ¶
func NormalizeLdapSearch ¶
func NormalizeList ¶
func NormalizeList(yaml interface{}) (list []interface{})
func NormalizeMembership ¶
func NormalizeMemberships ¶
func NormalizePostgres ¶
func NormalizePostgres(yaml interface{}) error
func NormalizePrivileges ¶
func NormalizeRoleOptions ¶
func NormalizeRoleRule ¶
func NormalizeRules ¶
func NormalizeRules(yaml interface{}) (syncMap []interface{}, err error)
func NormalizeStringList ¶
func NormalizeSyncItem ¶
func ResolvePrivilegeRefs ¶
Types ¶
type Config ¶
type Config struct { Version int Ldap LdapConfig Postgres PostgresConfig Privileges privilege.RefMap Rules wanted.Rules `mapstructure:"rules"` }
Config holds the YAML configuration. Not the flags.
func (Config) ArePrivilegesManaged ¶
func (*Config) DecodeYaml ¶
Wrap mapstructure for config object
func (*Config) DropPrivileges ¶
func (c *Config) DropPrivileges()
type KeyConflict ¶
func (*KeyConflict) Error ¶
func (err *KeyConflict) Error() string
type LdapConfig ¶
type PostgresConfig ¶
type PostgresConfig struct { FallbackOwner string `mapstructure:"fallback_owner"` DatabasesQuery QueryConfig[string] `mapstructure:"databases_query"` ManagedRolesQuery QueryConfig[string] `mapstructure:"managed_roles_query"` RolesBlacklistQuery QueryConfig[string] `mapstructure:"roles_blacklist_query"` SchemasQuery QueryConfig[postgres.Schema] `mapstructure:"schemas_query"` PrivilegesMap privilege.RefMap `mapstructure:"omit"` }
PostgresConfig holds the configuration of an inspect.Config.
This structure let mapstructure decode each query individually. The actually Querier object is instanciated early. Use Build() method to produce the final inspect.Config object.
func (PostgresConfig) Build ¶
func (c PostgresConfig) Build() inspect.Config
type QueryConfig ¶
func NewSQLQuery ¶
func NewSQLQuery[T any](sql string, rowto pgx.RowToFunc[T]) QueryConfig[T]
func NewYAMLQuery ¶
func NewYAMLQuery[T any](rows ...T) QueryConfig[T]
func (*QueryConfig[T]) Instantiate ¶
func (qc *QueryConfig[T]) Instantiate(rowTo pgx.RowToFunc[T], yamlTo YamlToFunc[T]) error
type YamlToFunc ¶
Click to show internal directories.
Click to hide internal directories.