shared

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixInterface

func FixInterface(input map[interface{}]interface{}) map[string]interface{}

FixInterface converts a map[interface{}]interface{} into a map[string]interface{}

func GetFields

func GetFields(fg FieldGroup) []string

GetFields will return the list of YAML fields in a given field group

func ValidateGitHubOAuth

func ValidateGitHubOAuth(clientID, clientSecret string) bool

ValidateGitHubOAuth checks that the Bitbucker OAuth credentials are correct

Types

type FieldGroup

type FieldGroup interface {
	Validate() []ValidationError
	Fields() []string
}

FieldGroup is an interface that implements the Validate() function

type ValidationError

type ValidationError struct {
	Tags    []string
	Policy  string
	Message string
}

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 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(input string, field string, fgName string) (bool, ValidationError)

ValidateHostIsReachable will check if a get request returns a 200 status code

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 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)$

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL