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 ValidateGitHubOAuth(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 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 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 ¶ added in v0.1.3
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 ¶ added in v0.1.3
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 ¶ added in v0.1.3
GetTlsConfig will build a tls config struct given a set of CA certs
func HasOIDCProvider ¶ added in v0.1.3
HasOIDCProvider will find if an OIDC provider is included in a config.yaml
func InterfaceArrayToStringArray ¶ added in v0.1.3
func InterfaceArrayToStringArray(input []interface{}) []string
InterfaceArrayToStringArray converts a []interface{} to []string
func RemoveNullValues ¶ added in v0.1.3
RemoveNullValues will remove empty values from a config.yaml. This will prevent a panic when it is unmarshalled.
func ValidateGitHubOAuth ¶
ValidateGitHubOAuth checks that the Bitbucker OAuth credentials are correct
Types ¶
type DistributedStorageArgs ¶ added in v0.1.3
type DistributedStorageArgs struct { // Args for RHOCSStorage, RadosGWStorage 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"` // 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"` }
DistributedStorageArgs
type FieldGroup ¶
type FieldGroup interface { Validate(opts Options) []ValidationError Fields() []string }
FieldGroup is an interface that implements the Validate() function
type IntOrString ¶ added in v0.1.3
type IntOrString int
IntOrString is an int that may be unmarshaled from either a JSON number literal, or a JSON string.
func (*IntOrString) UnmarshalJSON ¶ added in v0.1.3
func (i *IntOrString) UnmarshalJSON(d []byte) error
UnmarshalJSON will unmarshal an array of bytes into this type
type Options ¶ added in v0.1.3
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 ¶ added in v0.1.3
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 ¶ added in v0.1.3
func ValidateCertsPresent(opts Options, requiredCertNames []string, fgName string) (bool, ValidationError)
ValidateCertsPresent validates that all required certificates are present in the options struct
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 ¶ added in v0.1.3
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 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 ¶ added in v0.1.3
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 ¶ added in v0.1.3
func (ve ValidationError) String() string