Documentation ¶
Index ¶
- func InvokeDataSourceValidator(resourceName, identifier string) schema.SchemaValidateFunc
- func InvokeValidator(resourceName, identifier string) schema.SchemaValidateFunc
- func IsSecurityGroupAddress(s string) bool
- func IsSecurityGroupCIDR(s string) bool
- func SetValidatorDict(v ValidatorDict)
- func ValidBucketLifecycleTimestamp(v interface{}, k string) (ws []string, errors []error)
- func ValidateAllowedEnterpriseNameValue() schema.SchemaValidateFunc
- func ValidateAllowedIntValues(is []int) schema.SchemaValidateFunc
- func ValidateAllowedRangeInt(start, end int) schema.SchemaValidateFunc
- func ValidateAllowedStringValues(validValues []string) schema.SchemaValidateFunc
- func ValidateAuthProtocol(v interface{}, k string) (ws []string, errors []error)
- func ValidateCIDR(v interface{}, k string) (ws []string, errors []error)
- func ValidateDatacenterOption(v []interface{}, allowedValues []string) error
- func ValidateDayOfWeek(v interface{}, k string) (ws []string, errors []error)
- func ValidateDiffieHellmanGroup(v interface{}, k string) (ws []string, errors []error)
- func ValidateDomainName(v interface{}, k string) (ws []string, errors []error)
- func ValidateEncyptionProtocol(v interface{}, k string) (ws []string, errors []error)
- func ValidateHour(start, end int) func(v interface{}, k string) (ws []string, errors []error)
- func ValidateIP(v interface{}, k string) (ws []string, errors []error)
- func ValidateIPVersion(v interface{}, k string) (ws []string, errors []error)
- func ValidateISName(v interface{}, k string) (ws []string, errors []error)
- func ValidateInterval(v interface{}, k string) (ws []string, errors []error)
- func ValidateKeyLifeTime(v interface{}, k string) (ws []string, errors []error)
- func ValidateLBListenerConnectionLimit(v interface{}, k string) (ws []string, errors []error)
- func ValidateLBListenerPolicyPriority(v interface{}, k string) (ws []string, errors []error)
- func ValidateLBListenerPort(v interface{}, k string) (ws []string, errors []error)
- func ValidateLBTimeout(v interface{}, k string) (ws []string, errors []error)
- func ValidateMaxConn(v interface{}, k string) (ws []string, errors []error)
- func ValidateMaxRetries(v interface{}, k string) (ws []string, errors []error)
- func ValidateMinute(start, end int) func(v interface{}, k string) (ws []string, errors []error)
- func ValidateNotes(v interface{}, k string) (ws []string, errors []error)
- func ValidatePortRange(start, end int) func(v interface{}, k string) (ws []string, errors []error)
- func ValidatePublicBandwidth(v interface{}, k string) (ws []string, errors []error)
- func ValidateRegexps(regex string) schema.SchemaValidateFunc
- func ValidateRemoteIP(v interface{}, k string) (ws []string, errors []error)
- func ValidateRoutePath(v interface{}, k string) (ws []string, errors []error)
- func ValidateRoutePort(v interface{}, k string) (ws []string, errors []error)
- func ValidateScheduleType(v interface{}, k string) (ws []string, errors []error)
- func ValidateSecondaryIPCount(v interface{}, k string) (ws []string, errors []error)
- func ValidateSecurityRuleDirection(v interface{}, k string) (ws []string, errors []error)
- func ValidateSecurityRuleEtherType(v interface{}, k string) (ws []string, errors []error)
- func ValidateSecurityRuleProtocol(v interface{}, k string) (ws []string, errors []error)
- func ValidateSizePerZone(v interface{}, k string) (ws []string, errors []error)
- func ValidateStorageType(v interface{}, k string) (ws []string, errors []error)
- func ValidateStringLength(v interface{}, k string) (ws []string, errors []error)
- func ValidateTimeout(v interface{}, k string) (ws []string, errors []error)
- func ValidateURLPath(v interface{}, k string) (ws []string, errors []error)
- func ValidateVLANName(v interface{}, k string) (ws []string, errors []error)
- func ValidateWeight(v interface{}, k string) (ws []string, errors []error)
- func ValidateWorkerNum(v interface{}, k string) (ws []string, errors []error)
- func Validatekeylife(v interface{}, k string) (ws []string, errors []error)
- type FunctionIdentifier
- type ResourceValidator
- type ValidateSchema
- type ValidatorDict
- type ValueConstraintType
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvokeDataSourceValidator ¶
func InvokeDataSourceValidator(resourceName, identifier string) schema.SchemaValidateFunc
func InvokeValidator ¶
func InvokeValidator(resourceName, identifier string) schema.SchemaValidateFunc
This is the main validation function. This function will be used in all the provider code.
func IsSecurityGroupAddress ¶
func IsSecurityGroupCIDR ¶
func SetValidatorDict ¶
func SetValidatorDict(v ValidatorDict)
func ValidateAllowedEnterpriseNameValue ¶
func ValidateAllowedEnterpriseNameValue() schema.SchemaValidateFunc
func ValidateAllowedIntValues ¶
func ValidateAllowedIntValues(is []int) schema.SchemaValidateFunc
func ValidateAllowedRangeInt ¶
func ValidateAllowedRangeInt(start, end int) schema.SchemaValidateFunc
func ValidateAllowedStringValues ¶
func ValidateAllowedStringValues(validValues []string) schema.SchemaValidateFunc
func ValidateAuthProtocol ¶
func ValidateCIDR ¶
ValidateCIDR...
func ValidateDayOfWeek ¶
func ValidateDomainName ¶
func ValidateHour ¶
func ValidateIP ¶
ValidateIP...
func ValidateIPVersion ¶
ValidateIPVersion
func ValidateISName ¶
ValidateISName
func ValidateInterval ¶
func ValidateKeyLifeTime ¶
func ValidateLBListenerPort ¶
func ValidateLBTimeout ¶
func ValidateMaxConn ¶
func ValidateMaxRetries ¶
func ValidateMinute ¶
func ValidateNotes ¶
func ValidatePortRange ¶
func ValidatePublicBandwidth ¶
func ValidateRegexps ¶
func ValidateRegexps(regex string) schema.SchemaValidateFunc
func ValidateRemoteIP ¶
ValidateRemoteIP...
func ValidateRoutePath ¶
func ValidateRoutePort ¶
func ValidateScheduleType ¶
func ValidateSizePerZone ¶
func ValidateStorageType ¶
func ValidateStringLength ¶
func ValidateTimeout ¶
func ValidateURLPath ¶
func ValidateVLANName ¶
func ValidateWeight ¶
func ValidateWorkerNum ¶
func Validatekeylife ¶
Types ¶
type FunctionIdentifier ¶
type FunctionIdentifier int
ValidateFunc is honored only when the schema's Type is set to TypeInt, TypeFloat, TypeString, TypeBool, or TypeMap. It is ignored for all other types. enum to list all the validator functions supported by this tool.
const ( IntBetween FunctionIdentifier = iota IntAtLeast IntAtMost ValidateAllowedStringValue StringLenBetween ValidateIPorCIDR ValidateCIDRAddress ValidateAllowedIntValue ValidateRegexpLen ValidateRegexp ValidateNoZeroValues ValidateJSONString ValidateJSONParam ValidateBindedPackageName ValidateOverlappingAddress ValidateCloudData )
func (FunctionIdentifier) MarshalText ¶
func (f FunctionIdentifier) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
Without this function, when FunctionalIdentifier is marshaled, it prints 0,1,2.. instead of printing IntBetween, IntAtLeast, IntAtMost.. in JSON Output
func (FunctionIdentifier) String ¶
func (i FunctionIdentifier) String() string
Use stringer tool to generate this later.
type ResourceValidator ¶
type ResourceValidator struct { // This is the resource name - Found in provider.go of IBM Terraform provider. // Ex: ibm_compute_monitor, ibm_compute_bare_metal, ibm_compute_dedicated_host, ibm_cis_global_load_balancer etc., ResourceName string // Array of validator objects. Each object refers to one parameter in the resource provider. Schema []ValidateSchema }
type ValidateSchema ¶
type ValidateSchema struct { //This is the parameter name. //Ex: private_subnet in ibm_compute_bare_metal resource Identifier string // this is similar to schema.ValueType Type ValueType // The actual validation function that needs to be invoked. // Ex: IntBetween, ValidateAllowedIntValues, ValidateAllowedStringValues ValidateFunctionIdentifier FunctionIdentifier MinValue string MaxValue string AllowedValues string //Comma separated list of strings. Matches string Regexp string MinValueLength int MaxValueLength int // Is this nullable Nullable bool Optional bool Required bool Default interface{} ForceNew bool CloudDataType string CloudDataRange []string }
Schema is used to describe the validation schema.
func (ValidateSchema) GetValue ¶
func (vs ValidateSchema) GetValue(valueConstraint ValueConstraintType) interface{}
utility functions - Move to different package
func (ValidateSchema) Zero ¶
func (vs ValidateSchema) Zero() interface{}
Zero returns the zero value for a type.
type ValidatorDict ¶
type ValidatorDict struct { ResourceValidatorDictionary map[string]*ResourceValidator DataSourceValidatorDictionary map[string]*ResourceValidator }
type ValueConstraintType ¶
type ValueConstraintType int
Type of constraints required for validation
const ( MinValue ValueConstraintType = iota MaxValue MinValueLength MaxValueLength AllowedValues MatchesValue )
func (ValueConstraintType) MarshalText ¶
func (vct ValueConstraintType) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (ValueConstraintType) String ¶
func (i ValueConstraintType) String() string
Use Stringer tool to generate this later.
type ValueType ¶
type ValueType int
ValueType -- Copied from Terraform for now. You can refer to Terraform ValueType directly. ValueType is an enum of the type that can be represented by a schema.
func (ValueType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.