Documentation ¶
Index ¶
- Constants
- func GetNext(next interface{}) string
- func HashInt(v interface{}) int
- func InvokeDataSourceValidator(resourceName, identifier string) schema.SchemaValidateFunc
- func InvokeValidator(resourceName, identifier string) schema.SchemaValidateFunc
- func Provider() *schema.Provider
- type ClientSession
- type Config
- type FunctionIdentifier
- type Map
- type ResourceValidator
- type Session
- type UserConfig
- type ValidateSchema
- type ValidatorDict
- type ValueConstraintType
- type ValueType
Constants ¶
const ( //ResourceControllerURL ... ResourceControllerURL = "resource_controller_url" //ResourceName ... ResourceName = "resource_name" //ResourceCRN ... ResourceCRN = "resource_crn" //ResourceStatus ... ResourceStatus = "resource_status" //ResourceGroupName ... ResourceGroupName = "resource_group_name" //RelatedCRN ... RelatedCRN = "related_crn" )
const RetryAPIDelay = 5 * time.Second
RetryDelay
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.
Types ¶
type ClientSession ¶
type ClientSession interface { BluemixUserDetails() (*UserConfig, error) ResourceManagementAPIv2() (managementv2.ResourceManagementAPIv2, error) }
ClientSession ...
type Config ¶
type Config struct { //BluemixAPIKey is the Bluemix api key BluemixAPIKey string //Bluemix region Region string //Resource group id ResourceGroup string //Bluemix API timeout BluemixTimeout time.Duration //Retry Count for API calls //Unexposed in the schema at this point as they are used only during session creation for a few calls //When sdk implements it we an expose them for expected behaviour //https://github.com/softlayer/softlayer-go/issues/41 RetryCount int //Constant Retry Delay for API calls RetryDelay time.Duration }
Config stores user provider input
func (*Config) ClientSession ¶
ClientSession configures and returns a fully initialized ClientSession
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 ValidateAllowedStringValue StringLenBetween ValidateRegexpLen ValidateRegexp )
func (FunctionIdentifier) String ¶
func (i FunctionIdentifier) String() string
Use stringer tool to generate this later.
type Map ¶
Map is a wrapper around map[string]string that provides some helpers above it that assume the map is in the format that flatmap expects (the result of Flatten).
All modifying functions such as Delete are done in-place unless otherwise noted.
func Flatten ¶
Flatten takes a structure and turns into a flat map[string]string.
Within the "thing" parameter, only primitive values are allowed. Structs are not supported. Therefore, it can only be slices, maps, primitives, and any combination of those together.
See the tests for examples of what inputs are turned into.
func (Map) Merge ¶
Merge merges the contents of the other Map into this one.
This merge is smarter than a simple map iteration because it will fully replace arrays and other complex structures that are present in this map with the other map's. For example, if this map has a 3 element "foo" list, and m2 has a 2 element "foo" list, then the result will be that m has a 2 element "foo" list.
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 Session ¶
type Session struct { // BluemixSession is the the Bluemix session used to connect to the Bluemix API BluemixSession *bxsession.Session }
Session stores the information required for communication with the SoftLayer and Bluemix API
type UserConfig ¶
type UserConfig struct {
// contains filtered or unexported fields
}
UserConfig ...
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, validateAllowedIntValue, validateAllowedStringValue 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 }
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) String ¶
func (i ValueConstraintType) String() string
Use Stringer tool to generate this later.