Package function contains all interfaces, request types, and response types for a Terraform Provider function implementation.
In Terraform, a function is a concept which enables provider developers to offer practitioners a pure function call in their configuration. Functions are defined by a function name, such as "parse_xyz", a definition representing the ordered list of parameters with associated data types and a result data type, and the function logic.
The main starting point for implementations in this package is the Function type which represents an instance of a function that has its own argument data when called. The Function implementations are referenced by a [provider.Provider] type Functions method, which enables the function for practitioner and testing usage.
Practitioner feedback is provided by the FuncError type, rather than the diag.Diagnostic type.
This section is empty.
This section is empty.
This section is empty.
type ArgumentsData struct { }
ArgumentsData is the zero-based positional argument data sent by Terraform for a single function call. Use the Get method or GetArgument method in the Function type Run method to fetch the data.
This data is automatically populated by the framework based on the function definition. For unit testing, use the NewArgumentsData function to manually create the data.
NewArgumentsData creates an ArgumentsData. This is only necessary for unit testing as the framework automatically creates this data.
Equal returns true if all the underlying values are equivalent.
Get retrieves all argument data and populates the targets with the values. All arguments must be present in the targets, including all parameters and an optional variadic parameter, otherwise an error diagnostic will be raised. Each target type must be acceptable for the data type in the parameter definition.
Variadic parameter argument data must be consumed by a types.Tuple or Go slice type with an element type appropriate for the parameter definition ([]T). The framework automatically populates this tuple with elements matching the zero, one, or more arguments passed.
GetArgument retrieves the argument data found at the given zero-based position and populates the target with the value. The target type must be acceptable for the data type in the parameter definition.
Variadic parameter argument data must be consumed by a types.Tuple or Go slice type with an element type appropriate for the parameter definition ([]T) at the position after all parameters. The framework automatically populates this tuple with elements matching the zero, one, or more arguments passed.
BoolParameter represents a function parameter that is a boolean.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a bool or directly via true/false keywords.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
BoolParameterValidator is a function validator for types.Bool parameters.
type BoolParameterValidatorRequest struct { ArgumentPosition int64 Value types.Bool }
BoolParameterValidatorRequest is a request for types.Bool schema validation.
type BoolParameterValidatorResponse struct { Error *FuncError }
BoolParameterValidatorResponse is a response to a BoolParameterValidatorRequest.
BoolReturn represents a function return that is a boolean.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Bool, *bool, or bool.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
Definition is a function definition. Always set at least the Result field.
ValidateImplementation contains logic for validating the provider-defined implementation of the definition to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC, or via provider-defined unit testing, and should never include false positives.
type DefinitionRequest struct{}
DefinitionRequest represents a request for the Function to return its definition, such as its ordered parameters and result. An instance of this request struct is supplied as an argument to the Function type Definition method.
DefinitionResponse represents a response to a DefinitionRequest. An instance of this response struct is supplied as an argument to the Function type Definition method. Always set at least the Definition field.
type DefinitionValidateRequest struct { FuncName string }
DefinitionValidateRequest represents a request for the Function to validate its definition. An instance of this request struct is supplied as an argument to the Definition type ValidateImplementation method.
DefinitionValidateResponse represents a response to a DefinitionValidateRequest. An instance of this response struct is supplied as an argument to the Definition type ValidateImplementation method.
DynamicParameter represents a function parameter that is a dynamic, rather than a static type. Static types are always preferable over dynamic types in Terraform as practitioners will receive less helpful configuration assistance from validation error diagnostics and editor integrations.
When retrieving the argument value for this parameter:
The concrete value type for a dynamic is determined at runtime by Terraform, if defined in the configuration.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
DynamicParameterValidator is a function validator for types.Dynamic parameters.
type DynamicParameterValidatorRequest struct { ArgumentPosition int64 Value types.Dynamic }
DynamicParameterValidatorRequest is a request for types.Dynamic schema validation.
type DynamicParameterValidatorResponse struct { Error *FuncError }
DynamicParameterValidatorResponse is a response to a DynamicParameterValidatorRequest.
DynamicReturn represents a function return that is a dynamic, rather than a static type. Static types are always preferable over dynamic types in Terraform as practitioners will receive less helpful configuration assistance from validation error diagnostics and editor integrations.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use the types.Dynamic value type.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
Float32Parameter represents a function parameter that is a 32-bit floating point number.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a number or directly via numeric syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
Float32ParameterValidator is a function validator for types.Float32 parameters.
type Float32ParameterValidatorRequest struct { ArgumentPosition int64 Value types.Float32 }
Float32ParameterValidatorRequest is a request for types.Float32 schema validation.
type Float32ParameterValidatorResponse struct { Error *FuncError }
Float32ParameterValidatorResponse is a response to a Float32ParameterValidatorRequest.
Float32Return represents a function return that is a 32-bit floating point number.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Float32, *float32, or float32.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
Float64Parameter represents a function parameter that is a 64-bit floating point number.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a number or directly via numeric syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
Float64ParameterValidator is a function validator for types.Float64 parameters.
type Float64ParameterValidatorRequest struct { ArgumentPosition int64 Value types.Float64 }
Float64ParameterValidatorRequest is a request for types.Float64 schema validation.
type Float64ParameterValidatorResponse struct { Error *FuncError }
Float64ParameterValidatorResponse is a response to a Float64ParameterValidatorRequest.
Float64Return represents a function return that is a 64-bit floating point number.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Float64, *float64, or float64.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
type FuncError struct { Text string FunctionArgument *int64 }
FuncError is an error type specifically for function errors.
ConcatFuncErrors returns a new function error with the text from all supplied function errors concatenated together. If any of the function errors have a function argument, the first one encountered will be used.
FuncErrorFromDiags iterates over the given diagnostics and returns a new function error with the summary and detail text from all error diagnostics concatenated together. Diagnostics with a severity of warning are logged but are not included in the returned function error.
NewArgumentFuncError returns a new function error with the given message and function argument.
NewFuncError returns a new function error with the given message.
Equal returns true if the other function error is wholly equivalent.
Error returns the error text.
Function represents an instance of a function. This is the core interface that all functions must implement.
Provider-defined functions are supported in Terraform version 1.8 and later.
Int32Parameter represents a function parameter that is a 32-bit integer.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a number or directly via numeric syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
Int32ParameterValidator is a function validator for types.Int32 parameters.
type Int32ParameterValidatorRequest struct { ArgumentPosition int64 Value types.Int32 }
Int32ParameterValidatorRequest is a request for types.Int32 schema validation.
type Int32ParameterValidatorResponse struct { Error *FuncError }
Int32ParameterValidatorResponse is a response to a Int32ParameterValidatorRequest.
Int32Return represents a function return that is a 32-bit integer number.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Int32, *int32, or int32.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
Int64Parameter represents a function parameter that is a 64-bit integer.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a number or directly via numeric syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
Int64ParameterValidator is a function validator for types.Int64 parameters.
type Int64ParameterValidatorRequest struct { ArgumentPosition int64 Value types.Int64 }
Int64ParameterValidatorRequest is a request for types.Int64 schema validation.
type Int64ParameterValidatorResponse struct { Error *FuncError }
Int64ParameterValidatorResponse is a response to a Int64ParameterValidatorRequest.
Int64Return represents a function return that is a 64-bit integer number.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Int64, *int64, or int64.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ListParameter represents a function parameter that is an ordered list of a single element type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a list or directly via list ("[...]") syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
ValidateImplementation contains logic for validating the provider-defined implementation of the parameter to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
ListParameterValidator is a function validator for types.List parameters.
type ListParameterValidatorRequest struct { ArgumentPosition int64 Value types.List }
ListParameterValidatorRequest is a request for types.List schema validation.
type ListParameterValidatorResponse struct { Error *FuncError }
ListParameterValidatorResponse is a response to a ListParameterValidatorRequest.
ListReturn represents a function return that is an ordered collection of a single element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ValidateImplementation contains logic for validating the provider-defined implementation of the Return to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
MapParameter represents a function parameter that is a mapping of a single element type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a map or directly via map ("{...}") syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
ValidateImplementation contains logic for validating the provider-defined implementation of the parameter to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
MapParameterValidator is a function validator for types.Map parameters.
type MapParameterValidatorRequest struct { ArgumentPosition int64 Value types.Map }
MapParameterValidatorRequest is a request for types.Map schema validation.
type MapParameterValidatorResponse struct { Error *FuncError }
MapParameterValidatorResponse is a response to a MapParameterValidatorRequest.
MapReturn represents a function return that is an ordered collect of a single element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ValidateImplementation contains logic for validating the provider-defined implementation of the Return to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
type MetadataRequest struct{}
MetadataRequest represents a request for the Function to return metadata, such as its name. An instance of this request struct is supplied as an argument to the Function type Metadata method.
type MetadataResponse struct { Name string }
MetadataResponse represents a response to a MetadataRequest. An instance of this response struct is supplied as an argument to the Function type Metadata method.
NumberParameter represents a function parameter that is a 512-bit arbitrary precision number.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a number or directly via numeric syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
NumberParameterValidator is a function validator for types.Number parameters.
type NumberParameterValidatorRequest struct { ArgumentPosition int64 Value types.Number }
NumberParameterValidatorRequest is a request for types.Number schema validation.
type NumberParameterValidatorResponse struct { Error *FuncError }
NumberParameterValidatorResponse is a response to a NumberParameterValidatorRequest.
NumberReturn represents a function return that is a 512-bit arbitrary precision number.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.Number or *big.Float.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ObjectParameter represents a function parameter that is a mapping of defined attribute names to values. Either the AttributeTypes or CustomType field must be set.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return an object or directly via object ("{...}") syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
ValidateImplementation contains logic for validating the provider-defined implementation of the parameter to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
ObjectParameterValidator is a function validator for types.Object parameters.
type ObjectParameterValidatorRequest struct { ArgumentPosition int64 Value types.Object }
ObjectParameterValidatorRequest is a request for types.Object schema validation.
type ObjectParameterValidatorResponse struct { Error *FuncError }
ObjectParameterValidatorResponse is a response to a ObjectParameterValidatorRequest.
ObjectReturn represents a function return that is mapping of defined attribute names to values. When setting the value for this return, use types.Object or a compatible Go struct as the value type unless the CustomType field is set. The AttributeTypes field must be set.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ValidateImplementation contains logic for validating the provider-defined implementation of the Return to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
type Parameter interface { GetAllowNullValue() bool GetAllowUnknownValues() bool GetDescription() string GetMarkdownDescription() string GetName() string GetType() attr.Type }
Parameter is the interface for defining function parameters.
ParameterWithBoolValidators is an optional interface on Parameter which enables Bool validation support.
ParameterWithDynamicValidators is an optional interface on Parameter which enables Dynamic validation support.
ParameterWithFloat32Validators is an optional interface on Parameter which enables Float32 validation support.
ParameterWithFloat64Validators is an optional interface on Parameter which enables Float64 validation support.
ParameterWithInt32Validators is an optional interface on Parameter which enables Int32 validation support.
ParameterWithInt64Validators is an optional interface on Parameter which enables Int64 validation support.
ParameterWithListValidators is an optional interface on Parameter which enables List validation support.
ParameterWithMapValidators is an optional interface on Parameter which enables Map validation support.
ParameterWithNumberValidators is an optional interface on Parameter which enables Number validation support.
ParameterWithObjectValidators is an optional interface on Parameter which enables Object validation support.
ParameterWithSetValidators is an optional interface on Parameter which enables Set validation support.
ParameterWithStringValidators is an optional interface on Parameter which enables String validation support.
type ResultData struct { }
ResultData is the response data sent to Terraform for a single function call. Use the Set method in the Function type Run method to set the result data.
For unit testing, use the NewResultData function to manually create the data for comparison.
NewResultData creates a ResultData. This is only necessary for unit testing as the framework automatically creates this data for the Function type Run method.
Equal returns true if the value is equivalent.
Set saves the result data. The value type must be acceptable for the data type in the result definition.
Value returns the saved value.
Return is the interface for defining function return data.
RunRequest represents a request for the Function to call its implementation logic. An instance of this request struct is supplied as an argument to the Function type Run method.
RunResponse represents a response to a RunRequest. An instance of this response struct is supplied as an argument to the Function type Run method.
SetParameter represents a function parameter that is an unordered set of a single element type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a set or directly via set ("[...]") syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the list of validators for the parameter.
ValidateImplementation contains logic for validating the provider-defined implementation of the parameter to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
SetParameterValidator is a function validator for types.Set parameters.
type SetParameterValidatorRequest struct { ArgumentPosition int64 Value types.Set }
SetParameterValidatorRequest is a request for types.Set schema validation.
type SetParameterValidatorResponse struct { Error *FuncError }
SetParameterValidatorResponse is a response to a SetParameterValidatorRequest.
SetReturn represents a function return that is an unordered collection of a single element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
ValidateImplementation contains logic for validating the provider-defined implementation of the Return to prevent unexpected errors or panics. This logic runs during the GetProviderSchema RPC and should never include false positives.
StringParameter represents a function parameter that is a string.
When retrieving the argument value for this parameter:
Terraform configurations set this parameter's argument data using expressions that return a string or directly via double quote ("value") syntax.
GetAllowNullValue returns if the parameter accepts a null value.
GetAllowUnknownValues returns if the parameter accepts an unknown value.
GetDescription returns the parameter plaintext description.
GetMarkdownDescription returns the parameter Markdown description.
GetName returns the parameter name.
GetType returns the parameter data type.
GetValidators returns the string validators for the parameter.
StringParameterValidator is a function validator for types.String parameters.
type StringParameterValidatorRequest struct { ArgumentPosition int64 Value types.String }
StringParameterValidatorRequest is a request for types.String schema validation.
type StringParameterValidatorResponse struct { Error *FuncError }
StringParameterValidatorResponse is a response to a StringParameterValidatorRequest.
StringReturn represents a function return that is a string.
When setting the value for this return:
- If CustomType is set, use its associated value type. - Otherwise, use types.String, *string, or string.
Return documentation is expected in the function Definition documentation.
GetType returns the return data type.
NewResultData returns a new result data based on the type.
type ValidateParameterRequest struct { Position int64 }
ValidateParameterRequest represents a request for the attr.Value to call its validation logic. An instance of this request struct is supplied as an argument to the attr.Value type ValidateParameter method.
type ValidateParameterResponse struct { Error *FuncError }
ValidateParameterResponse represents a response to a ValidateParameterRequest. An instance of this response struct is supplied as an argument to the ValidateParameter method.
ValidateableParameter defines an interface for validating a parameter value.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4