Documentation ¶
Index ¶
- func CreateArchive(directory string, buf io.Writer) error
- func FixInterface(input map[interface{}]interface{}) map[string]interface{}
- func FixNumbers(m map[string]interface{}) map[string]interface{}
- func GetFields(fg FieldGroup) []string
- func GetTlsConfig(opts Options) (*tls.Config, error)
- func HasOIDCProvider(fullConfig map[string]interface{}) bool
- func InterfaceArrayToStringArray(input []interface{}) []string
- func LoadCerts(dir string) map[string][]byte
- func RemoveNullValues(m map[string]interface{}) map[string]interface{}
- func ValidateBitbucketOAuth(clientID, clientSecret string) bool
- func ValidateDatabaseConnection(opts Options, rawURI, caCert string, threadlocals, autorollback bool, ...) error
- func ValidateElasticSearchCredentials(url, accessKey, accessSecret string) bool
- func ValidateGitHubOAuth(opts Options, clientID, clientSecret, githubEndpoint string) bool
- func ValidateGitLabOAuth(clientID, clientSecret, gitlabEndpoint string) bool
- func ValidateGoogleOAuth(clientID, clientSecret string) bool
- type DistributedStorageArgs
- type FieldGroup
- type IntOrString
- type Options
- type ValidationError
- func ValidateAtLeastOneOfBool(inputs []bool, fields []string, fgName string) (bool, ValidationError)
- func ValidateAtLeastOneOfString(inputs []string, fields []string, fgName string) (bool, ValidationError)
- func ValidateCertPairWithHostname(cert, key []byte, hostname string, fgName string) (bool, ValidationError)
- func ValidateCertsPresent(opts Options, requiredCertNames []string, fgName string) (bool, ValidationError)
- func ValidateEmailServer(opts Options, mailServer string, mailPort int, useTLS bool, useAuth bool, ...) (bool, ValidationError)
- func ValidateFileExists(input string, field string, fgName string) (bool, ValidationError)
- func ValidateHostIsReachable(opts Options, input string, field string, fgName string) (bool, ValidationError)
- func ValidateIsHostname(input string, field string, fgName string) (bool, ValidationError)
- func ValidateIsOneOfString(input string, options []string, field string, fgName string) (bool, ValidationError)
- func ValidateIsURL(input string, field string, fgName string) (bool, ValidationError)
- func ValidateLDAPServer(opts Options, ...) (bool, ValidationError)
- func ValidateOIDCServer(opts Options, oidcServer, clientID, clientSecret, serviceName string, ...) (bool, ValidationError)
- func ValidateRedisConnection(options *redis.Options, field, fgName string) (bool, ValidationError)
- func ValidateRequiredObject(input interface{}, field, fgName string) (bool, ValidationError)
- func ValidateRequiredString(input, field, fgName string) (bool, ValidationError)
- func ValidateStorage(opts Options, storageName string, storageType string, ...) (bool, []ValidationError)
- func ValidateTimePattern(input string, field string, fgName string) (bool, ValidationError)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateArchive ¶
CreateArchive will create a tar file from a directory.
func FixInterface ¶
func FixInterface(input map[interface{}]interface{}) map[string]interface{}
FixInterface converts a map[interface{}]interface{} into a map[string]interface{}
func FixNumbers ¶
FixNumbers will convert all json.Number values to integer values
func GetFields ¶
func GetFields(fg FieldGroup) []string
GetFields will return the list of YAML fields in a given field group
func GetTlsConfig ¶
GetTlsConfig will build a tls config struct given a set of CA certs
func HasOIDCProvider ¶
HasOIDCProvider will find if an OIDC provider is included in a config.yaml
func InterfaceArrayToStringArray ¶
func InterfaceArrayToStringArray(input []interface{}) []string
InterfaceArrayToStringArray converts a []interface{} to []string
func RemoveNullValues ¶
RemoveNullValues will remove empty values from a config.yaml. This will prevent a panic when it is unmarshalled.
func ValidateBitbucketOAuth ¶
ValidateBitbucketOAuth checks that the Bitbucker OAuth credentials are correct
func ValidateDatabaseConnection ¶
func ValidateDatabaseConnection(opts Options, rawURI, caCert string, threadlocals, autorollback bool, sslmode, sslrootcert, fgName string) error
ValidateDatabaseConnection checks that the Bitbucker OAuth credentials are correct
func ValidateElasticSearchCredentials ¶
ValidateElasticSearchCredentials will validate credentials
func ValidateGitHubOAuth ¶
ValidateGitHubOAuth checks that the Bitbucker OAuth credentials are correct
func ValidateGitLabOAuth ¶
ValidateGitLabOAuth checks that the Bitbucker OAuth credentials are correct
func ValidateGoogleOAuth ¶
ValidateGoogleOAuth checks that the Bitbucker OAuth credentials are correct
Types ¶
type DistributedStorageArgs ¶
type DistributedStorageArgs struct { // Args for RHOCSStorage, RadosGWStorage, IBMCloudStorage Hostname string `default:"" validate:"" json:"hostname,omitempty" yaml:"hostname,omitempty"` Port int `default:"" validate:"" json:"port,omitempty" yaml:"port,omitempty"` IsSecure bool `default:"" validate:"" json:"is_secure" yaml:"is_secure"` StoragePath string `default:"" validate:"" json:"storage_path,omitempty" yaml:"storage_path,omitempty"` AccessKey string `default:"" validate:"" json:"access_key,omitempty" yaml:"access_key,omitempty"` SecretKey string `default:"" validate:"" json:"secret_key,omitempty" yaml:"secret_key,omitempty"` BucketName string `default:"" validate:"" json:"bucket_name,omitempty" yaml:"bucket_name,omitempty"` // Args for S3Storage S3Bucket string `default:"" validate:"" json:"s3_bucket,omitempty" yaml:"s3_bucket,omitempty"` S3AccessKey string `default:"" validate:"" json:"s3_access_key,omitempty" yaml:"s3_access_key,omitempty"` S3SecretKey string `default:"" validate:"" json:"s3_secret_key,omitempty" yaml:"s3_secret_key,omitempty"` Host string `default:"" validate:"" json:"host,omitempty" yaml:"host,omitempty"` // Args for AzureStorage AzureContainer string `default:"" validate:"" json:"azure_container,omitempty" yaml:"azure_container,omitempty"` AzureAccountName string `default:"" validate:"" json:"azure_account_name,omitempty" yaml:"azure_account_name,omitempty"` AzureAccountKey string `default:"" validate:"" json:"azure_account_key,omitempty" yaml:"azure_account_key,omitempty"` SASToken string `default:"" validate:"" json:"sas_token,omitempty" yaml:"sas_token,omitempty"` EndpointURL string `default:"" validate:"" json:"endpoint_url,omitempty" yaml:"endpoint_url,omitempty"` // Args for Cloudfront CloudfrontDistributionDomain string `default:"" validate:"" json:"cloudfront_distribution_domain,omitempty" yaml:"cloudfront_distribution_domain,omitempty"` CloudfrontKeyID string `default:"" validate:"" json:"cloudfront_key_id,omitempty" yaml:"cloudfront_key_id,omitempty"` // Args for SwiftStorage SwiftAuthVersion int `default:"" validate:"" json:"auth_version,omitempty" yaml:"auth_version,omitempty"` SwiftAuthURL string `default:"" validate:"" json:"auth_url,omitempty" yaml:"auth_url,omitempty"` SwiftContainer string `default:"" validate:"" json:"swift_container,omitempty" yaml:"swift_container,omitempty"` SwiftUser string `default:"" validate:"" json:"swift_user,omitempty" yaml:"swift_user,omitempty"` SwiftPassword string `default:"" validate:"" json:"swift_password,omitempty" yaml:"swift_password,omitempty"` SwiftCaCertPath string `default:"" validate:"" json:"ca_cert_path,omitempty" yaml:"ca_cert_path,omitempty"` SwiftTempURLKey string `default:"" validate:"" json:"temp_url_key,omitempty" yaml:"temp_url_key,omitempty"` SwiftOsOptions map[string]interface{} `default:"" validate:"" json:"os_options,omitempty" yaml:"os_options,omitempty"` // Args for CloudFlare CloudflareDomain string `default:"" validate:"" json:"cloudflare_domain,omitempty" yaml:"cloudflare_domain,omitempty"` // Args for MultiCDNStorage DefaultProvider string `default:"" validate:"" json:"default_provider,omitempty" yaml:"default_provider,omitempty"` Providers map[string]interface{} `default:"" validate:"" json:"providers,omitempty" yaml:"providers,omitempty"` StorageConfig map[string]interface{} `default:"" validate:"" json:"storage_config,omitempty" yaml:"storage_config,omitempty"` // Args for STSS3Storage STSUserAccessKey string `default:"" validate:"" json:"sts_user_access_key,omitempty" yaml:"sts_user_access_key,omitempty"` STSUserSecretKey string `default:"" validate:"" json:"sts_user_secret_key,omitempty" yaml:"sts_user_secret_key,omitempty"` STSRoleArn string `default:"" validate:"" json:"sts_role_arn,omitempty" yaml:"sts_role_arn,omitempty"` }
DistributedStorageArgs
type FieldGroup ¶
type FieldGroup interface { Validate(opts Options) []ValidationError Fields() []string }
FieldGroup is an interface that implements the Validate() function
type IntOrString ¶
type IntOrString int
IntOrString is an int that may be unmarshaled from either a JSON number literal, or a JSON string.
func (*IntOrString) UnmarshalJSON ¶
func (i *IntOrString) UnmarshalJSON(d []byte) error
UnmarshalJSON will unmarshal an array of bytes into this type
type Options ¶
type Options struct { Mode string // One of Online, Offline, Testing Certificates map[string][]byte }
Options is a struct that tells the validator how to validate
type ValidationError ¶
ValidationError is a struct that holds information about a failed field group policy
func ValidateAtLeastOneOfBool ¶
func ValidateAtLeastOneOfBool(inputs []bool, fields []string, fgName string) (bool, ValidationError)
ValidateAtLeastOneOfBool validates that at least one of the given options is true
func ValidateAtLeastOneOfString ¶
func ValidateAtLeastOneOfString(inputs []string, fields []string, fgName string) (bool, ValidationError)
ValidateAtLeastOneOfString validates that at least one of the given options is true
func ValidateCertPairWithHostname ¶
func ValidateCertPairWithHostname(cert, key []byte, hostname string, fgName string) (bool, ValidationError)
ValidateCertPairWithHostname will validate that a public private key pair are valid and have the correct hostname
func ValidateCertsPresent ¶
func ValidateCertsPresent(opts Options, requiredCertNames []string, fgName string) (bool, ValidationError)
ValidateCertsPresent validates that all required certificates are present in the options struct
func ValidateEmailServer ¶
func ValidateEmailServer(opts Options, mailServer string, mailPort int, useTLS bool, useAuth bool, username string, password string, fgName string) (bool, ValidationError)
ValidateEmailServer validates that the provided smtp server is valid
func ValidateFileExists ¶
func ValidateFileExists(input string, field string, fgName string) (bool, ValidationError)
ValidateFileExists will check if a path exists on the current machine
func ValidateHostIsReachable ¶
func ValidateHostIsReachable(opts Options, input string, field string, fgName string) (bool, ValidationError)
ValidateHostIsReachable will check if a get request returns a 200 status code
func ValidateIsHostname ¶
func ValidateIsHostname(input string, field string, fgName string) (bool, ValidationError)
ValidateIsHostname tests a string to determine if it is a well-structured hostname or not.
func ValidateIsOneOfString ¶
func ValidateIsOneOfString(input string, options []string, field string, fgName string) (bool, ValidationError)
ValidateIsOneOfString validates that a string is one of a given option
func ValidateIsURL ¶
func ValidateIsURL(input string, field string, fgName string) (bool, ValidationError)
ValidateIsURL tests a string to determine if it is a well-structured url or not.
func ValidateLDAPServer ¶
func ValidateLDAPServer(opts Options, ldapUri, ldapAdminDn, ldapAdminPasswd, ldapUidAttr, ldapEmailAttr, ldapUserFilter string, ldapBaseDn []interface{}, fgName string) (bool, ValidationError)
ValidateLDAPServer validates that the provided ldap server is valid
func ValidateOIDCServer ¶
func ValidateOIDCServer(opts Options, oidcServer, clientID, clientSecret, serviceName string, loginScopes []interface{}, fgName string) (bool, ValidationError)
ValidateOIDCServer validates that the provided oidc server is valid
func ValidateRedisConnection ¶
func ValidateRedisConnection(options *redis.Options, field, fgName string) (bool, ValidationError)
ValidateRedisConnection validates that a Redis connection can successfully be established
func ValidateRequiredObject ¶
func ValidateRequiredObject(input interface{}, field, fgName string) (bool, ValidationError)
ValidateRequiredObject validates that a object input is not nil
func ValidateRequiredString ¶
func ValidateRequiredString(input, field, fgName string) (bool, ValidationError)
ValidateRequiredString validates that a string input is not empty
func ValidateStorage ¶
func ValidateStorage(opts Options, storageName string, storageType string, args *DistributedStorageArgs, fgName string) (bool, []ValidationError)
ValidateStorage will validate a S3 storage connection.
func ValidateTimePattern ¶
func ValidateTimePattern(input string, field string, fgName string) (bool, ValidationError)
ValidateTimePattern validates that a string has the pattern ^[0-9]+(w|m|d|h|s)$
func (ValidationError) String ¶
func (ve ValidationError) String() string