Documentation ¶
Index ¶
- Variables
- func AddAnchor(key, anchorPrefix string) string
- func ContainsCondition(str string) bool
- func GetAnchorsResourcesFromMap(patternMap map[string]interface{}) (map[string]interface{}, map[string]interface{})
- func IsAddIfNotPresentAnchor(key string) bool
- func IsConditionAnchor(str string) bool
- func IsConditionalAnchorError(msg string) bool
- func IsEqualityAnchor(str string) bool
- func IsExistenceAnchor(str string) bool
- func IsGlobalAnchor(str string) bool
- func IsGlobalAnchorError(msg string) bool
- func IsNegationAnchor(str string) bool
- func IsNegationAnchorError(msg string) bool
- func IsNonAnchor(str string) bool
- func RemoveAnchor(key string) (string, string)
- func RemoveAnchorsFromPath(str string) string
- type AnchorError
- type AnchorKey
- type ConditionAnchorHandler
- type DefaultHandler
- type EqualityHandler
- type ExistenceHandler
- type GlobalAnchorHandler
- type IsAnchor
- type NegationHandler
- type ValidateAnchorError
- type ValidationHandler
- func CreateElementHandler(element string, pattern interface{}, path string) ValidationHandler
- func NewConditionAnchorHandler(anchor string, pattern interface{}, path string) ValidationHandler
- func NewDefaultHandler(element string, pattern interface{}, path string) ValidationHandler
- func NewEqualityHandler(anchor string, pattern interface{}, path string) ValidationHandler
- func NewExistenceHandler(anchor string, pattern interface{}, path string) ValidationHandler
- func NewGlobalAnchorHandler(anchor string, pattern interface{}, path string) ValidationHandler
- func NewNegationHandler(anchor string, pattern interface{}, path string) ValidationHandler
Constants ¶
This section is empty.
Variables ¶
var ConditionalAnchorErrMsg = "conditional anchor mismatch"
ConditionalAnchorErrMsg - the error message for conditional anchor error
var GlobalAnchorErrMsg = "global anchor mismatch"
GlobalAnchorErrMsg - the error message for global anchor error
var NegationAnchorErrMsg = "negation anchor matched in resource"
NegationAnchorErrMsg - the error message for negation anchor error
Functions ¶
func AddAnchor ¶ added in v1.6.0
AddAnchor adds an anchor with the supplied prefix. The suffix is assumed to be ")".
func ContainsCondition ¶ added in v1.6.0
ContainsCondition returns true, if str is either condition anchor or global condition anchor
func GetAnchorsResourcesFromMap ¶ added in v1.1.0
func GetAnchorsResourcesFromMap(patternMap map[string]interface{}) (map[string]interface{}, map[string]interface{})
GetAnchorsResourcesFromMap returns map of anchors
func IsAddIfNotPresentAnchor ¶ added in v1.6.0
IsAddIfNotPresentAnchor checks for addition anchor
func IsConditionAnchor ¶
IsConditionAnchor checks for condition anchor
func IsConditionalAnchorError ¶ added in v1.6.0
IsConditionalAnchorError checks if error message has conditional anchor error string
func IsEqualityAnchor ¶
IsEqualityAnchor checks for equality anchor
func IsExistenceAnchor ¶ added in v1.6.0
IsExistenceAnchor checks for existence anchor
func IsGlobalAnchor ¶ added in v1.6.0
IsGlobalAnchor checks for global condition anchor
func IsGlobalAnchorError ¶ added in v1.6.0
IsGlobalAnchorError checks if error message has global anchor error string
func IsNegationAnchor ¶
IsNegationAnchor checks for negation anchor
func IsNegationAnchorError ¶ added in v1.6.0
IsNegationAnchorError checks if error message has negation anchor error string
func IsNonAnchor ¶ added in v1.6.0
IsNonAnchor checks that key does not have any anchor
func RemoveAnchor ¶ added in v1.6.0
RemoveAnchor remove anchor from the given key. It returns the anchor-free tag value and the prefix of the anchor.
func RemoveAnchorsFromPath ¶ added in v1.6.0
RemoveAnchorsFromPath removes all anchor from path string
Types ¶
type AnchorError ¶ added in v1.6.0
type AnchorError int
AnchorError is the const specification of anchor errors
const ( // ConditionalAnchorErr refers to condition violation ConditionalAnchorErr AnchorError = iota // GlobalAnchorErr refers to global condition violation GlobalAnchorErr // NegationAnchorErr refers to negation violation NegationAnchorErr )
type AnchorKey ¶ added in v1.6.0
type AnchorKey struct { // AnchorError - used in validate to break execution of the recursion when if condition fails AnchorError ValidateAnchorError // contains filtered or unexported fields }
AnchorKey - contains map of anchors
func NewAnchorMap ¶ added in v1.6.0
func NewAnchorMap() *AnchorKey
NewAnchorMap -initialize anchorMap
func (*AnchorKey) CheckAnchorInResource ¶ added in v1.6.0
func (ac *AnchorKey) CheckAnchorInResource(pattern interface{}, resource interface{})
CheckAnchorInResource checks if condition anchor key has values
func (*AnchorKey) IsAnchorError ¶ added in v1.6.0
IsAnchorError - if any of the anchor key doesn't exists in the resource then it will return true if any of (key)=false then return IsAnchorError() as true if all the keys exists in the pattern exists in resource then return IsAnchorError() as false
type ConditionAnchorHandler ¶ added in v1.1.0
type ConditionAnchorHandler struct {
// contains filtered or unexported fields
}
ConditionAnchorHandler provides handler for condition anchor
type DefaultHandler ¶ added in v1.1.0
type DefaultHandler struct {
// contains filtered or unexported fields
}
DefaultHandler provides handler for non anchor element
type EqualityHandler ¶ added in v1.1.0
type EqualityHandler struct {
// contains filtered or unexported fields
}
EqualityHandler provides handler for non anchor element
type ExistenceHandler ¶ added in v1.2.0
type ExistenceHandler struct {
// contains filtered or unexported fields
}
ExistenceHandler provides handlers to process exitence anchor handler
type GlobalAnchorHandler ¶ added in v1.4.3
type GlobalAnchorHandler struct {
// contains filtered or unexported fields
}
GlobalAnchorHandler provides handler for global condition anchor
type NegationHandler ¶ added in v1.1.0
type NegationHandler struct {
// contains filtered or unexported fields
}
NegationHandler provides handler for check if the tag in anchor is not defined
type ValidateAnchorError ¶ added in v1.6.0
type ValidateAnchorError struct { Err AnchorError Message string }
ValidateAnchorError represents the error type of validation anchors
func NewConditionalAnchorError ¶ added in v1.6.0
func NewConditionalAnchorError(msg string) ValidateAnchorError
NewConditionalAnchorError returns a new instance of ConditionalAnchorError
func NewGlobalAnchorError ¶ added in v1.6.0
func NewGlobalAnchorError(msg string) ValidateAnchorError
NewGlobalAnchorError returns a new instance of GlobalAnchorError
func NewNegationAnchorError ¶ added in v1.6.0
func NewNegationAnchorError(msg string) ValidateAnchorError
NewNegationAnchorError returns a new instance of NegationAnchorError
func (ValidateAnchorError) Error ¶ added in v1.6.0
func (e ValidateAnchorError) Error() error
Error returns an error instance of the anchor error
func (ValidateAnchorError) IsConditionAnchorError ¶ added in v1.6.0
func (e ValidateAnchorError) IsConditionAnchorError() bool
IsConditionAnchorError checks if the error is a conditional anchor error
func (ValidateAnchorError) IsGlobalAnchorError ¶ added in v1.6.0
func (e ValidateAnchorError) IsGlobalAnchorError() bool
IsGlobalAnchorError checks if the error is a global anchor error
func (ValidateAnchorError) IsNegationAnchorError ¶ added in v1.6.0
func (e ValidateAnchorError) IsNegationAnchorError() bool
IsNegationAnchorError checks if the error is a negation anchor error
func (ValidateAnchorError) IsNil ¶ added in v1.6.0
func (e ValidateAnchorError) IsNil() bool
IsNil checks if the error isn't populated
type ValidationHandler ¶ added in v1.1.0
type ValidationHandler interface {
Handle(handler resourceElementHandler, resourceMap map[string]interface{}, originPattern interface{}, ac *AnchorKey) (string, error)
}
ValidationHandler for element processes
func CreateElementHandler ¶ added in v1.1.0
func CreateElementHandler(element string, pattern interface{}, path string) ValidationHandler
CreateElementHandler factory to process elements
func NewConditionAnchorHandler ¶ added in v1.1.0
func NewConditionAnchorHandler(anchor string, pattern interface{}, path string) ValidationHandler
NewConditionAnchorHandler returns an instance of condition acnhor handler
func NewDefaultHandler ¶ added in v1.1.0
func NewDefaultHandler(element string, pattern interface{}, path string) ValidationHandler
NewDefaultHandler returns handler for non anchor elements
func NewEqualityHandler ¶ added in v1.1.0
func NewEqualityHandler(anchor string, pattern interface{}, path string) ValidationHandler
NewEqualityHandler returens instance of equality handler
func NewExistenceHandler ¶ added in v1.2.0
func NewExistenceHandler(anchor string, pattern interface{}, path string) ValidationHandler
NewExistenceHandler returns existence handler
func NewGlobalAnchorHandler ¶ added in v1.4.3
func NewGlobalAnchorHandler(anchor string, pattern interface{}, path string) ValidationHandler
NewGlobalAnchorHandler returns an instance of condition acnhor handler
func NewNegationHandler ¶ added in v1.1.0
func NewNegationHandler(anchor string, pattern interface{}, path string) ValidationHandler
NewNegationHandler returns instance of negation handler