function
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package function contains all interfaces, request types, and responsetypes for a Terraform Provider function implementation.
In Terraform, a function is a concept which enables provider developersto offer practitioners a pure function call in their configuration. Functionsare defined by a function name, such as "parse_xyz", a definitionrepresenting the ordered list of parameters with associated data types anda result data type, and the function logic.
The main starting point for implementations in this package is theFunction type which represents an instance of a function that has its ownargument data when called. TheFunction implementations are referenced by a[provider.Provider] type Functions method, which enables the function forpractitioner and testing usage.
Practitioner feedback is provided by theFuncError type, rather thanthediag.Diagnostic type.
Index¶
- type ArgumentsData
- type BoolParameter
- func (p BoolParameter) GetAllowNullValue() bool
- func (p BoolParameter) GetAllowUnknownValues() bool
- func (p BoolParameter) GetDescription() string
- func (p BoolParameter) GetMarkdownDescription() string
- func (p BoolParameter) GetName() string
- func (p BoolParameter) GetType() attr.Type
- func (p BoolParameter) GetValidators() []BoolParameterValidator
- func (p BoolParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type BoolParameterValidator
- type BoolParameterValidatorRequest
- type BoolParameterValidatorResponse
- type BoolReturn
- type Definition
- type DefinitionRequest
- type DefinitionResponse
- type DefinitionValidateRequest
- type DefinitionValidateResponse
- type DynamicParameter
- func (p DynamicParameter) GetAllowNullValue() bool
- func (p DynamicParameter) GetAllowUnknownValues() bool
- func (p DynamicParameter) GetDescription() string
- func (p DynamicParameter) GetMarkdownDescription() string
- func (p DynamicParameter) GetName() string
- func (p DynamicParameter) GetType() attr.Type
- func (p DynamicParameter) GetValidators() []DynamicParameterValidator
- func (p DynamicParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type DynamicParameterValidator
- type DynamicParameterValidatorRequest
- type DynamicParameterValidatorResponse
- type DynamicReturn
- type Float32Parameter
- func (p Float32Parameter) GetAllowNullValue() bool
- func (p Float32Parameter) GetAllowUnknownValues() bool
- func (p Float32Parameter) GetDescription() string
- func (p Float32Parameter) GetMarkdownDescription() string
- func (p Float32Parameter) GetName() string
- func (p Float32Parameter) GetType() attr.Type
- func (p Float32Parameter) GetValidators() []Float32ParameterValidator
- func (p Float32Parameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type Float32ParameterValidator
- type Float32ParameterValidatorRequest
- type Float32ParameterValidatorResponse
- type Float32Return
- type Float64Parameter
- func (p Float64Parameter) GetAllowNullValue() bool
- func (p Float64Parameter) GetAllowUnknownValues() bool
- func (p Float64Parameter) GetDescription() string
- func (p Float64Parameter) GetMarkdownDescription() string
- func (p Float64Parameter) GetName() string
- func (p Float64Parameter) GetType() attr.Type
- func (p Float64Parameter) GetValidators() []Float64ParameterValidator
- func (p Float64Parameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type Float64ParameterValidator
- type Float64ParameterValidatorRequest
- type Float64ParameterValidatorResponse
- type Float64Return
- type FuncError
- type Function
- type Int32Parameter
- func (p Int32Parameter) GetAllowNullValue() bool
- func (p Int32Parameter) GetAllowUnknownValues() bool
- func (p Int32Parameter) GetDescription() string
- func (p Int32Parameter) GetMarkdownDescription() string
- func (p Int32Parameter) GetName() string
- func (p Int32Parameter) GetType() attr.Type
- func (p Int32Parameter) GetValidators() []Int32ParameterValidator
- func (p Int32Parameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type Int32ParameterValidator
- type Int32ParameterValidatorRequest
- type Int32ParameterValidatorResponse
- type Int32Return
- type Int64Parameter
- func (p Int64Parameter) GetAllowNullValue() bool
- func (p Int64Parameter) GetAllowUnknownValues() bool
- func (p Int64Parameter) GetDescription() string
- func (p Int64Parameter) GetMarkdownDescription() string
- func (p Int64Parameter) GetName() string
- func (p Int64Parameter) GetType() attr.Type
- func (p Int64Parameter) GetValidators() []Int64ParameterValidator
- func (p Int64Parameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type Int64ParameterValidator
- type Int64ParameterValidatorRequest
- type Int64ParameterValidatorResponse
- type Int64Return
- type ListParameter
- func (p ListParameter) GetAllowNullValue() bool
- func (p ListParameter) GetAllowUnknownValues() bool
- func (p ListParameter) GetDescription() string
- func (p ListParameter) GetMarkdownDescription() string
- func (p ListParameter) GetName() string
- func (p ListParameter) GetType() attr.Type
- func (p ListParameter) GetValidators() []ListParameterValidator
- func (p ListParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type ListParameterValidator
- type ListParameterValidatorRequest
- type ListParameterValidatorResponse
- type ListReturn
- type MapParameter
- func (p MapParameter) GetAllowNullValue() bool
- func (p MapParameter) GetAllowUnknownValues() bool
- func (p MapParameter) GetDescription() string
- func (p MapParameter) GetMarkdownDescription() string
- func (p MapParameter) GetName() string
- func (p MapParameter) GetType() attr.Type
- func (p MapParameter) GetValidators() []MapParameterValidator
- func (p MapParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type MapParameterValidator
- type MapParameterValidatorRequest
- type MapParameterValidatorResponse
- type MapReturn
- type MetadataRequest
- type MetadataResponse
- type NumberParameter
- func (p NumberParameter) GetAllowNullValue() bool
- func (p NumberParameter) GetAllowUnknownValues() bool
- func (p NumberParameter) GetDescription() string
- func (p NumberParameter) GetMarkdownDescription() string
- func (p NumberParameter) GetName() string
- func (p NumberParameter) GetType() attr.Type
- func (p NumberParameter) GetValidators() []NumberParameterValidator
- func (p NumberParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type NumberParameterValidator
- type NumberParameterValidatorRequest
- type NumberParameterValidatorResponse
- type NumberReturn
- type ObjectParameter
- func (p ObjectParameter) GetAllowNullValue() bool
- func (p ObjectParameter) GetAllowUnknownValues() bool
- func (p ObjectParameter) GetDescription() string
- func (p ObjectParameter) GetMarkdownDescription() string
- func (p ObjectParameter) GetName() string
- func (p ObjectParameter) GetType() attr.Type
- func (p ObjectParameter) GetValidators() []ObjectParameterValidator
- func (p ObjectParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type ObjectParameterValidator
- type ObjectParameterValidatorRequest
- type ObjectParameterValidatorResponse
- type ObjectReturn
- type Parameter
- type ParameterWithBoolValidators
- type ParameterWithDynamicValidators
- type ParameterWithFloat32Validators
- type ParameterWithFloat64Validators
- type ParameterWithInt32Validators
- type ParameterWithInt64Validators
- type ParameterWithListValidators
- type ParameterWithMapValidators
- type ParameterWithNumberValidators
- type ParameterWithObjectValidators
- type ParameterWithSetValidators
- type ParameterWithStringValidators
- type ResultData
- type Return
- type RunRequest
- type RunResponse
- type SetParameter
- func (p SetParameter) GetAllowNullValue() bool
- func (p SetParameter) GetAllowUnknownValues() bool
- func (p SetParameter) GetDescription() string
- func (p SetParameter) GetMarkdownDescription() string
- func (p SetParameter) GetName() string
- func (p SetParameter) GetType() attr.Type
- func (p SetParameter) GetValidators() []SetParameterValidator
- func (p SetParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type SetParameterValidator
- type SetParameterValidatorRequest
- type SetParameterValidatorResponse
- type SetReturn
- type StringParameter
- func (p StringParameter) GetAllowNullValue() bool
- func (p StringParameter) GetAllowUnknownValues() bool
- func (p StringParameter) GetDescription() string
- func (p StringParameter) GetMarkdownDescription() string
- func (p StringParameter) GetName() string
- func (p StringParameter) GetType() attr.Type
- func (p StringParameter) GetValidators() []StringParameterValidator
- func (p StringParameter) ValidateImplementation(ctx context.Context, req fwfunction.ValidateParameterImplementationRequest, ...)
- type StringParameterValidator
- type StringParameterValidatorRequest
- type StringParameterValidatorResponse
- type StringReturn
- type ValidateParameterRequest
- type ValidateParameterResponse
- type ValidateableParameter
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeArgumentsData¶
type ArgumentsData struct {// contains filtered or unexported fields}ArgumentsData is the zero-based positional argument data sent by Terraformfor a single function call. Use the Get method or GetArgument method in theFunction type Run method to fetch the data.
This data is automatically populated by the framework based on the functiondefinition. For unit testing, use the NewArgumentsData function to manuallycreate the data.
funcNewArgumentsData¶
func NewArgumentsData(values []attr.Value)ArgumentsData
NewArgumentsData creates an ArgumentsData. This is only necessary for unittesting as the framework automatically creates this data.
func (ArgumentsData)Equal¶
func (dArgumentsData) Equal(oArgumentsData)bool
Equal returns true if all the underlying values are equivalent.
func (ArgumentsData)Get¶
func (dArgumentsData) Get(ctxcontext.Context, targets ...any) *FuncError
Get retrieves all argument data and populates the targets with the values.All arguments must be present in the targets, including all parameters and anoptional variadic parameter, otherwise an error diagnostic will be raised.Each target type must be acceptable for the data type in the parameterdefinition.
Variadic parameter argument data must be consumed by a types.Tuple or Go slicetype with an element type appropriate for the parameter definition ([]T). Theframework automatically populates this tuple with elements matching the zero,one, or more arguments passed.
func (ArgumentsData)GetArgument¶
GetArgument retrieves the argument data found at the given zero-basedposition and populates the target with the value. The target type must beacceptable for the data type in the parameter definition.
Variadic parameter argument data must be consumed by a types.Tuple or Go slicetype with an element type appropriate for the parameter definition ([]T) atthe position after all parameters. The framework automatically populates thistuple with elements matching the zero, one, or more arguments passed.
typeBoolParameter¶
type BoolParameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.//// Enabling this requires reading argument values as *bool or [types.Bool].AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.//// Enabling this requires reading argument values as [types.Bool].AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.BoolType]. When retrieving data, the// [basetypes.BoolValuable] implementation associated with this custom// type must be used in place of [types.Bool].CustomTypebasetypes.BoolTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of bool validators that should be applied to the// parameter.Validators []BoolParameterValidator}BoolParameter represents a function parameter that is a boolean.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Bool valuetype.
- If AllowNullValue is enabled, you must usetypes.Bool or *boolvalue types.
- Otherwise, usetypes.Bool or *bool, or bool value types.
Terraform configurations set this parameter's argument data using expressionsthat return a bool or directly via true/false keywords.
func (BoolParameter)GetAllowNullValue¶
func (pBoolParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (BoolParameter)GetAllowUnknownValues¶
func (pBoolParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (BoolParameter)GetDescription¶
func (pBoolParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (BoolParameter)GetMarkdownDescription¶
func (pBoolParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (BoolParameter)GetName¶
func (pBoolParameter) GetName()string
GetName returns the parameter name.
func (BoolParameter)GetType¶
func (pBoolParameter) GetType()attr.Type
GetType returns the parameter data type.
func (BoolParameter)GetValidators¶added inv1.8.0
func (pBoolParameter) GetValidators() []BoolParameterValidator
GetValidators returns the list of validators for the parameter.
func (BoolParameter)ValidateImplementation¶added inv1.9.0
func (pBoolParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeBoolParameterValidator¶added inv1.8.0
type BoolParameterValidator interface {// ValidateParameterBool performs the validation.ValidateParameterBool(context.Context,BoolParameterValidatorRequest, *BoolParameterValidatorResponse)}BoolParameterValidator is a function validator for types.Bool parameters.
typeBoolParameterValidatorRequest¶added inv1.8.0
type BoolParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Bool}BoolParameterValidatorRequest is a request for types.Bool schema validation.
typeBoolParameterValidatorResponse¶added inv1.8.0
type BoolParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}BoolParameterValidatorResponse is a response to a BoolParameterValidatorRequest.
typeBoolReturn¶
type BoolReturn struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.BoolType]. When setting data, the// [basetypes.BoolValuable] implementation associated with this custom// type must be used in place of [types.Bool].CustomTypebasetypes.BoolTypable}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, usetypes.Bool, *bool, or bool.
Return documentation is expected in the functionDefinition documentation.
func (BoolReturn)NewResultData¶
func (rBoolReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeDefinition¶
type Definition struct {// Parameters is the ordered list of function parameters and their// associated data types.Parameters []Parameter// VariadicParameter is an optional final parameter which can accept zero or// more arguments when the function is called. The argument data is sent as// a tuple, where all elements are of the same associated data type.VariadicParameterParameter// Return is the function call response data type.ReturnReturn// Summary is a short description of the function, preferably a single// sentence. Use the Description field for longer documentation about the// function and its implementation.Summarystring// Description is the longer documentation for usage, such as editor// integrations, to give practitioners more information about the purpose of// the function and how its logic is implemented. It should be plaintext// formatted.Descriptionstring// MarkdownDescription is the longer documentation for usage, such as a// registry, to give practitioners more information about the purpose of the// function and how its logic is implemented.MarkdownDescriptionstring// DeprecationMessage defines warning diagnostic details to display when// practitioner configurations use this function. The warning diagnostic// summary is automatically set to "Function Deprecated" along with// configuration source file and line information.DeprecationMessagestring}Definition is a function definition. Always set at least the Result field.
func (Definition)ValidateImplementation¶
func (dDefinition) ValidateImplementation(ctxcontext.Context, reqDefinitionValidateRequest, resp *DefinitionValidateResponse)
ValidateImplementation contains logic for validating the provider-definedimplementation of the definition to prevent unexpected errors or panics. Thislogic runs during the GetProviderSchema RPC, or via provider-defined unittesting, and should never include false positives.
typeDefinitionRequest¶
type DefinitionRequest struct{}DefinitionRequest represents a request for the Function to return itsdefinition, such as its ordered parameters and result. An instance of thisrequest struct is supplied as an argument to the Function type Definitionmethod.
typeDefinitionResponse¶
type DefinitionResponse struct {// Definition is the function definition.DefinitionDefinition// Diagnostics report errors or warnings related to defining the function.// An empty slice indicates success, with no warnings or errors generated.Diagnosticsdiag.Diagnostics}DefinitionResponse represents a response to a DefinitionRequest. An instanceof this response struct is supplied as an argument to the Function typeDefinition method. Always set at least the Definition field.
typeDefinitionValidateRequest¶added inv1.7.0
type DefinitionValidateRequest struct {// FuncName is the name of the function definition being validated.FuncNamestring}DefinitionValidateRequest represents a request for the Function to validate itsdefinition. An instance of this request struct is supplied as an argument tothe Definition type ValidateImplementation method.
typeDefinitionValidateResponse¶added inv1.7.0
type DefinitionValidateResponse struct {// Diagnostics report errors or warnings related to validation of a function// definition. An empty slice indicates success, with no warnings or errors// generated.Diagnosticsdiag.Diagnostics}DefinitionValidateResponse represents a response to a DefinitionValidateRequest.An instance of this response struct is supplied as an argument to the Definitiontype ValidateImplementation method.
typeDynamicParameter¶added inv1.7.0
type DynamicParameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.DynamicType]. When retrieving data, the// [basetypes.DynamicValuable] implementation associated with this custom// type must be used in place of [types.Dynamic].CustomTypebasetypes.DynamicTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of dynamic validators that should be applied to the// parameter.Validators []DynamicParameterValidator}DynamicParameter represents a function parameter that is a dynamic, ratherthan a static type. Static types are always preferable over dynamictypes in Terraform as practitioners will receive less helpful configurationassistance from validation error diagnostics and editor integrations.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- Otherwise, use thetypes.Dynamic value type.
The concrete value type for a dynamic is determined at runtime by Terraform,if defined in the configuration.
func (DynamicParameter)GetAllowNullValue¶added inv1.7.0
func (pDynamicParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (DynamicParameter)GetAllowUnknownValues¶added inv1.7.0
func (pDynamicParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (DynamicParameter)GetDescription¶added inv1.7.0
func (pDynamicParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (DynamicParameter)GetMarkdownDescription¶added inv1.7.0
func (pDynamicParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (DynamicParameter)GetName¶added inv1.7.0
func (pDynamicParameter) GetName()string
GetName returns the parameter name.
func (DynamicParameter)GetType¶added inv1.7.0
func (pDynamicParameter) GetType()attr.Type
GetType returns the parameter data type.
func (DynamicParameter)GetValidators¶added inv1.8.0
func (pDynamicParameter) GetValidators() []DynamicParameterValidator
GetValidators returns the list of validators for the parameter.
func (DynamicParameter)ValidateImplementation¶added inv1.9.0
func (pDynamicParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeDynamicParameterValidator¶added inv1.8.0
type DynamicParameterValidator interface {// ValidateParameterDynamic performs the validation.ValidateParameterDynamic(context.Context,DynamicParameterValidatorRequest, *DynamicParameterValidatorResponse)}DynamicParameterValidator is a function validator for types.Dynamic parameters.
typeDynamicParameterValidatorRequest¶added inv1.8.0
type DynamicParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Dynamic}DynamicParameterValidatorRequest is a request for types.Dynamic schema validation.
typeDynamicParameterValidatorResponse¶added inv1.8.0
type DynamicParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}DynamicParameterValidatorResponse is a response to a DynamicParameterValidatorRequest.
typeDynamicReturn¶added inv1.7.0
type DynamicReturn struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.DynamicType]. When setting data, the// [basetypes.DynamicValuable] implementation associated with this custom// type must be used in place of [types.Dynamic].CustomTypebasetypes.DynamicTypable}DynamicReturn represents a function return that is a dynamic, ratherthan a static type. Static types are always preferable over dynamictypes in Terraform as practitioners will receive less helpful configurationassistance 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 thetypes.Dynamic value type.
Return documentation is expected in the functionDefinition documentation.
func (DynamicReturn)GetType¶added inv1.7.0
func (rDynamicReturn) GetType()attr.Type
GetType returns the return data type.
func (DynamicReturn)NewResultData¶added inv1.7.0
func (rDynamicReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeFloat32Parameter¶added inv1.10.0
type Float32Parameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.Float32Type]. When retrieving data, the// [basetypes.Float32Valuable] implementation associated with this custom// type must be used in place of [types.Float32].CustomTypebasetypes.Float32Typable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of float32 validators that should be applied to the// parameter.Validators []Float32ParameterValidator}Float32Parameter represents a function parameter that is a 32-bit floatingpoint number.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Float32 valuetype.
- If AllowNullValue is enabled, you must usetypes.Float32 or *float32value types.
- Otherwise, usetypes.Float32 or *float32, or float32 value types.
Terraform configurations set this parameter's argument data using expressionsthat return a number or directly via numeric syntax.
func (Float32Parameter)GetAllowNullValue¶added inv1.10.0
func (pFloat32Parameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (Float32Parameter)GetAllowUnknownValues¶added inv1.10.0
func (pFloat32Parameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (Float32Parameter)GetDescription¶added inv1.10.0
func (pFloat32Parameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (Float32Parameter)GetMarkdownDescription¶added inv1.10.0
func (pFloat32Parameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (Float32Parameter)GetName¶added inv1.10.0
func (pFloat32Parameter) GetName()string
GetName returns the parameter name.
func (Float32Parameter)GetType¶added inv1.10.0
func (pFloat32Parameter) GetType()attr.Type
GetType returns the parameter data type.
func (Float32Parameter)GetValidators¶added inv1.10.0
func (pFloat32Parameter) GetValidators() []Float32ParameterValidator
GetValidators returns the list of validators for the parameter.
func (Float32Parameter)ValidateImplementation¶added inv1.10.0
func (pFloat32Parameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeFloat32ParameterValidator¶added inv1.10.0
type Float32ParameterValidator interface {// ValidateParameterFloat32 performs the validation.ValidateParameterFloat32(context.Context,Float32ParameterValidatorRequest, *Float32ParameterValidatorResponse)}Float32ParameterValidator is a function validator for types.Float32 parameters.
typeFloat32ParameterValidatorRequest¶added inv1.10.0
type Float32ParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Float32}Float32ParameterValidatorRequest is a request for types.Float32 schema validation.
typeFloat32ParameterValidatorResponse¶added inv1.10.0
type Float32ParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}Float32ParameterValidatorResponse is a response to a Float32ParameterValidatorRequest.
typeFloat32Return¶added inv1.10.0
type Float32Return struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.Float32Type]. When setting data, the// [basetypes.Float32Valuable] implementation associated with this custom// type must be used in place of [types.Float32].CustomTypebasetypes.Float32Typable}Float32Return represents a function return that is a 32-bit floating pointnumber.
When setting the value for this return:
- If CustomType is set, use its associated value type.- Otherwise, usetypes.Float32, *float32, or float32.
Return documentation is expected in the functionDefinition documentation.
func (Float32Return)GetType¶added inv1.10.0
func (rFloat32Return) GetType()attr.Type
GetType returns the return data type.
func (Float32Return)NewResultData¶added inv1.10.0
func (rFloat32Return) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeFloat64Parameter¶
type Float64Parameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.Float64Type]. When retrieving data, the// [basetypes.Float64Valuable] implementation associated with this custom// type must be used in place of [types.Float64].CustomTypebasetypes.Float64Typable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of float64 validators that should be applied to the// parameter.Validators []Float64ParameterValidator}Float64Parameter represents a function parameter that is a 64-bit floatingpoint number.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Float64 valuetype.
- If AllowNullValue is enabled, you must usetypes.Float64 or *float64value types.
- Otherwise, usetypes.Float64 or *float64, or float64 value types.
Terraform configurations set this parameter's argument data using expressionsthat return a number or directly via numeric syntax.
func (Float64Parameter)GetAllowNullValue¶
func (pFloat64Parameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (Float64Parameter)GetAllowUnknownValues¶
func (pFloat64Parameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (Float64Parameter)GetDescription¶
func (pFloat64Parameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (Float64Parameter)GetMarkdownDescription¶
func (pFloat64Parameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (Float64Parameter)GetName¶
func (pFloat64Parameter) GetName()string
GetName returns the parameter name.
func (Float64Parameter)GetType¶
func (pFloat64Parameter) GetType()attr.Type
GetType returns the parameter data type.
func (Float64Parameter)GetValidators¶added inv1.8.0
func (pFloat64Parameter) GetValidators() []Float64ParameterValidator
GetValidators returns the list of validators for the parameter.
func (Float64Parameter)ValidateImplementation¶added inv1.9.0
func (pFloat64Parameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeFloat64ParameterValidator¶added inv1.8.0
type Float64ParameterValidator interface {// ValidateParameterFloat64 performs the validation.ValidateParameterFloat64(context.Context,Float64ParameterValidatorRequest, *Float64ParameterValidatorResponse)}Float64ParameterValidator is a function validator for types.Float64 parameters.
typeFloat64ParameterValidatorRequest¶added inv1.8.0
type Float64ParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Float64}Float64ParameterValidatorRequest is a request for types.Float64 schema validation.
typeFloat64ParameterValidatorResponse¶added inv1.8.0
type Float64ParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}Float64ParameterValidatorResponse is a response to a Float64ParameterValidatorRequest.
typeFloat64Return¶
type Float64Return struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.Float64Type]. When setting data, the// [basetypes.Float64Valuable] implementation associated with this custom// type must be used in place of [types.Float64].CustomTypebasetypes.Float64Typable}Float64Return represents a function return that is a 64-bit floating pointnumber.
When setting the value for this return:
- If CustomType is set, use its associated value type.- Otherwise, usetypes.Float64, *float64, or float64.
Return documentation is expected in the functionDefinition documentation.
func (Float64Return)GetType¶
func (rFloat64Return) GetType()attr.Type
GetType returns the return data type.
func (Float64Return)NewResultData¶
func (rFloat64Return) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeFuncError¶added inv1.6.0
type FuncError struct {// Text is a practitioner-oriented description of the problem. This should// contain sufficient detail to provide both general and more specific information// regarding the issue. For example "Error executing function: foo can only contain// letters, numbers, and digits."Textstring// FunctionArgument is a zero-based, int64 value that identifies the specific// function argument position that caused the error. Only errors that pertain// to a function argument will include this information.FunctionArgument *int64}FuncError is an error type specifically for function errors.
funcConcatFuncErrors¶added inv1.6.0
ConcatFuncErrors returns a new function error with the text from all suppliedfunction errors concatenated together. If any of the function errors have afunction argument, the first one encountered will be used.
funcFuncErrorFromDiags¶added inv1.6.0
func FuncErrorFromDiags(ctxcontext.Context, diagsdiag.Diagnostics) *FuncError
FuncErrorFromDiags iterates over the given diagnostics and returns a new function errorwith 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 returnedfunction error.
funcNewArgumentFuncError¶added inv1.6.0
NewArgumentFuncError returns a new function error with thegiven message and function argument.
funcNewFuncError¶added inv1.6.0
NewFuncError returns a new function error with thegiven message.
typeFunction¶
type Function interface {// Metadata should return the name of the function, such as parse_xyz.Metadata(context.Context,MetadataRequest, *MetadataResponse)// Definition should return the definition for the function.Definition(context.Context,DefinitionRequest, *DefinitionResponse)// Run should return the result of the function logic. It is called when// Terraform reaches a function call in the configuration. Argument data// values should be read from the [RunRequest] and the result value set in// the [RunResponse].Run(context.Context,RunRequest, *RunResponse)}Function represents an instance of a function. This is the core interfacethat all functions must implement.
Provider-defined functions are supported in Terraform version 1.8 and later.
typeInt32Parameter¶added inv1.10.0
type Int32Parameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.Int32Type]. When retrieving data, the// [basetypes.Int32Valuable] implementation associated with this custom// type must be used in place of [types.Int32].CustomTypebasetypes.Int32Typable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of int32 validators that should be applied to the// parameter.Validators []Int32ParameterValidator}Int32Parameter represents a function parameter that is a 32-bit integer.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Int32 valuetype.
- If AllowNullValue is enabled, you must usetypes.Int32 or *int32value types.
- Otherwise, usetypes.Int32 or *int32, or int32 value types.
Terraform configurations set this parameter's argument data using expressionsthat return a number or directly via numeric syntax.
func (Int32Parameter)GetAllowNullValue¶added inv1.10.0
func (pInt32Parameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (Int32Parameter)GetAllowUnknownValues¶added inv1.10.0
func (pInt32Parameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (Int32Parameter)GetDescription¶added inv1.10.0
func (pInt32Parameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (Int32Parameter)GetMarkdownDescription¶added inv1.10.0
func (pInt32Parameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (Int32Parameter)GetName¶added inv1.10.0
func (pInt32Parameter) GetName()string
GetName returns the parameter name.
func (Int32Parameter)GetType¶added inv1.10.0
func (pInt32Parameter) GetType()attr.Type
GetType returns the parameter data type.
func (Int32Parameter)GetValidators¶added inv1.10.0
func (pInt32Parameter) GetValidators() []Int32ParameterValidator
GetValidators returns the list of validators for the parameter.
func (Int32Parameter)ValidateImplementation¶added inv1.10.0
func (pInt32Parameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeInt32ParameterValidator¶added inv1.10.0
type Int32ParameterValidator interface {// ValidateParameterInt32 performs the validation.ValidateParameterInt32(context.Context,Int32ParameterValidatorRequest, *Int32ParameterValidatorResponse)}Int32ParameterValidator is a function validator for types.Int32 parameters.
typeInt32ParameterValidatorRequest¶added inv1.10.0
type Int32ParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Int32}Int32ParameterValidatorRequest is a request for types.Int32 schema validation.
typeInt32ParameterValidatorResponse¶added inv1.10.0
type Int32ParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}Int32ParameterValidatorResponse is a response to a Int32ParameterValidatorRequest.
typeInt32Return¶added inv1.10.0
type Int32Return struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.Int32Type]. When setting data, the// [basetypes.Int32Valuable] implementation associated with this custom// type must be used in place of [types.Int32].CustomTypebasetypes.Int32Typable}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, usetypes.Int32, *int32, or int32.
Return documentation is expected in the functionDefinition documentation.
func (Int32Return)GetType¶added inv1.10.0
func (rInt32Return) GetType()attr.Type
GetType returns the return data type.
func (Int32Return)NewResultData¶added inv1.10.0
func (rInt32Return) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeInt64Parameter¶
type Int64Parameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.Int64Type]. When retrieving data, the// [basetypes.Int64Valuable] implementation associated with this custom// type must be used in place of [types.Int64].CustomTypebasetypes.Int64Typable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of int64 validators that should be applied to the// parameter.Validators []Int64ParameterValidator}Int64Parameter represents a function parameter that is a 64-bit integer.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Int64 valuetype.
- If AllowNullValue is enabled, you must usetypes.Int64 or *int64value types.
- Otherwise, usetypes.Int64 or *int64, or int64 value types.
Terraform configurations set this parameter's argument data using expressionsthat return a number or directly via numeric syntax.
func (Int64Parameter)GetAllowNullValue¶
func (pInt64Parameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (Int64Parameter)GetAllowUnknownValues¶
func (pInt64Parameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (Int64Parameter)GetDescription¶
func (pInt64Parameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (Int64Parameter)GetMarkdownDescription¶
func (pInt64Parameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (Int64Parameter)GetName¶
func (pInt64Parameter) GetName()string
GetName returns the parameter name.
func (Int64Parameter)GetType¶
func (pInt64Parameter) GetType()attr.Type
GetType returns the parameter data type.
func (Int64Parameter)GetValidators¶added inv1.8.0
func (pInt64Parameter) GetValidators() []Int64ParameterValidator
GetValidators returns the list of validators for the parameter.
func (Int64Parameter)ValidateImplementation¶added inv1.9.0
func (pInt64Parameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeInt64ParameterValidator¶added inv1.8.0
type Int64ParameterValidator interface {// ValidateParameterInt64 performs the validation.ValidateParameterInt64(context.Context,Int64ParameterValidatorRequest, *Int64ParameterValidatorResponse)}Int64ParameterValidator is a function validator for types.Int64 parameters.
typeInt64ParameterValidatorRequest¶added inv1.8.0
type Int64ParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Int64}Int64ParameterValidatorRequest is a request for types.Int64 schema validation.
typeInt64ParameterValidatorResponse¶added inv1.8.0
type Int64ParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}Int64ParameterValidatorResponse is a response to a Int64ParameterValidatorRequest.
typeInt64Return¶
type Int64Return struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.Int64Type]. When setting data, the// [basetypes.Int64Valuable] implementation associated with this custom// type must be used in place of [types.Int64].CustomTypebasetypes.Int64Typable}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, usetypes.Int64, *int64, or int64.
Return documentation is expected in the functionDefinition documentation.
func (Int64Return)GetType¶
func (rInt64Return) GetType()attr.Type
GetType returns the return data type.
func (Int64Return)NewResultData¶
func (rInt64Return) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeListParameter¶
type ListParameter struct {// ElementType is the type for all elements of the list. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this parameter definition with// DynamicParameter instead.ElementTypeattr.Type// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.ListType]. When retrieving data, the// [basetypes.ListValuable] implementation associated with this custom// type must be used in place of [types.List].CustomTypebasetypes.ListTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of list validators that should be applied to the// parameter.Validators []ListParameterValidator}ListParameter represents a function parameter that is an ordered list of asingle element type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.List valuetype.
- Otherwise, usetypes.List or any Go slice value types compatible withthe element type.
Terraform configurations set this parameter's argument data using expressionsthat return a list or directly via list ("[...]") syntax.
func (ListParameter)GetAllowNullValue¶
func (pListParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (ListParameter)GetAllowUnknownValues¶
func (pListParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (ListParameter)GetDescription¶
func (pListParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (ListParameter)GetMarkdownDescription¶
func (pListParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (ListParameter)GetName¶
func (pListParameter) GetName()string
GetName returns the parameter name.
func (ListParameter)GetType¶
func (pListParameter) GetType()attr.Type
GetType returns the parameter data type.
func (ListParameter)GetValidators¶added inv1.8.0
func (pListParameter) GetValidators() []ListParameterValidator
GetValidators returns the list of validators for the parameter.
func (ListParameter)ValidateImplementation¶added inv1.7.0
func (pListParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the parameter to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeListParameterValidator¶added inv1.8.0
type ListParameterValidator interface {// ValidateParameterList performs the validation.ValidateParameterList(context.Context,ListParameterValidatorRequest, *ListParameterValidatorResponse)}ListParameterValidator is a function validator for types.List parameters.
typeListParameterValidatorRequest¶added inv1.8.0
type ListParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.List}ListParameterValidatorRequest is a request for types.List schema validation.
typeListParameterValidatorResponse¶added inv1.8.0
type ListParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}ListParameterValidatorResponse is a response to a ListParameterValidatorRequest.
typeListReturn¶
type ListReturn struct {// ElementType is the type for all elements of the list. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this return definition with// DynamicReturn instead.ElementTypeattr.Type// CustomType enables the use of a custom data type in place of the// default [basetypes.ListType]. When setting data, the// [basetypes.ListValuable] implementation associated with this custom// type must be used in place of [types.List].CustomTypebasetypes.ListTypable}ListReturn represents a function return that is an ordered collection of asingle element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
- If CustomType is set, use its associated value type.
- Otherwise, usetypes.List or a Go slice value type compatible with theelement type.
Return documentation is expected in the functionDefinition documentation.
func (ListReturn)NewResultData¶
func (rListReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
func (ListReturn)ValidateImplementation¶added inv1.7.0
func (pListReturn) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateReturnImplementationRequest, resp *fwfunction.ValidateReturnImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the Return to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeMapParameter¶
type MapParameter struct {// ElementType is the type for all elements of the map. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this parameter definition with// DynamicParameter instead.ElementTypeattr.Type// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.MapType]. When retrieving data, the// [basetypes.MapValuable] implementation associated with this custom// type must be used in place of [types.Map].CustomTypebasetypes.MapTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of map validators that should be applied to the// parameter.Validators []MapParameterValidator}MapParameter represents a function parameter that is a mapping of a singleelement type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Map valuetype.
- Otherwise, usetypes.Map or any Go map value types compatible withthe element type.
Terraform configurations set this parameter's argument data using expressionsthat return a map or directly via map ("{...}") syntax.
func (MapParameter)GetAllowNullValue¶
func (pMapParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (MapParameter)GetAllowUnknownValues¶
func (pMapParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (MapParameter)GetDescription¶
func (pMapParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (MapParameter)GetMarkdownDescription¶
func (pMapParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (MapParameter)GetType¶
func (pMapParameter) GetType()attr.Type
GetType returns the parameter data type.
func (MapParameter)GetValidators¶added inv1.8.0
func (pMapParameter) GetValidators() []MapParameterValidator
GetValidators returns the list of validators for the parameter.
func (MapParameter)ValidateImplementation¶added inv1.7.0
func (pMapParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the parameter to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeMapParameterValidator¶added inv1.8.0
type MapParameterValidator interface {// ValidateParameterMap performs the validation.ValidateParameterMap(context.Context,MapParameterValidatorRequest, *MapParameterValidatorResponse)}MapParameterValidator is a function validator for types.Map parameters.
typeMapParameterValidatorRequest¶added inv1.8.0
type MapParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Map}MapParameterValidatorRequest is a request for types.Map schema validation.
typeMapParameterValidatorResponse¶added inv1.8.0
type MapParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}MapParameterValidatorResponse is a response to a MapParameterValidatorRequest.
typeMapReturn¶
type MapReturn struct {// ElementType is the type for all elements of the map. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this return definition with// DynamicReturn instead.ElementTypeattr.Type// CustomType enables the use of a custom data type in place of the// default [basetypes.MapType]. When setting data, the// [basetypes.MapValuable] implementation associated with this custom// type must be used in place of [types.Map].CustomTypebasetypes.MapTypable}MapReturn represents a function return that is an ordered collect of asingle element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
- If CustomType is set, use its associated value type.
- Otherwise, usetypes.Map or a Go map value type compatible with theelement type.
Return documentation is expected in the functionDefinition documentation.
func (MapReturn)NewResultData¶
func (rMapReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
func (MapReturn)ValidateImplementation¶added inv1.7.0
func (pMapReturn) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateReturnImplementationRequest, resp *fwfunction.ValidateReturnImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the Return to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeMetadataRequest¶
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 anargument to the Function type Metadata method.
typeMetadataResponse¶
type MetadataResponse struct {// Name should be the function name, such as parse_xyz. Unlike data sources// and managed resources, the provider name and an underscore should not be// included as the Terraform configuration syntax for provider function// calls already include the provider name.Namestring}MetadataResponse represents a response to a MetadataRequest. Aninstance of this response struct is supplied as an argument to theFunction type Metadata method.
typeNumberParameter¶
type NumberParameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.NumberType]. When retrieving data, the// [basetypes.NumberValuable] implementation associated with this custom// type must be used in place of [types.Number].CustomTypebasetypes.NumberTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of validators that can be used to validate the// parameter.Validators []NumberParameterValidator}NumberParameter represents a function parameter that is a 512-bit arbitraryprecision number.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Number valuetype.
- Otherwise, usetypes.Number or *big.Float value types.
Terraform configurations set this parameter's argument data using expressionsthat return a number or directly via numeric syntax.
func (NumberParameter)GetAllowNullValue¶
func (pNumberParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (NumberParameter)GetAllowUnknownValues¶
func (pNumberParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (NumberParameter)GetDescription¶
func (pNumberParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (NumberParameter)GetMarkdownDescription¶
func (pNumberParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (NumberParameter)GetName¶
func (pNumberParameter) GetName()string
GetName returns the parameter name.
func (NumberParameter)GetType¶
func (pNumberParameter) GetType()attr.Type
GetType returns the parameter data type.
func (NumberParameter)GetValidators¶added inv1.8.0
func (pNumberParameter) GetValidators() []NumberParameterValidator
GetValidators returns the list of validators for the parameter.
func (NumberParameter)ValidateImplementation¶added inv1.9.0
func (pNumberParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeNumberParameterValidator¶added inv1.8.0
type NumberParameterValidator interface {// ValidateParameterNumber performs the validation.ValidateParameterNumber(context.Context,NumberParameterValidatorRequest, *NumberParameterValidatorResponse)}NumberParameterValidator is a function validator for types.Number parameters.
typeNumberParameterValidatorRequest¶added inv1.8.0
type NumberParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Number}NumberParameterValidatorRequest is a request for types.Number schema validation.
typeNumberParameterValidatorResponse¶added inv1.8.0
type NumberParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}NumberParameterValidatorResponse is a response to a NumberParameterValidatorRequest.
typeNumberReturn¶
type NumberReturn struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.NumberType]. When setting data, the// [basetypes.NumberValuable] implementation associated with this custom// type must be used in place of [types.Number].CustomTypebasetypes.NumberTypable}NumberReturn represents a function return that is a 512-bit arbitraryprecision number.
When setting the value for this return:
- If CustomType is set, use its associated value type.- Otherwise, usetypes.Number or *big.Float.
Return documentation is expected in the functionDefinition documentation.
func (NumberReturn)GetType¶
func (rNumberReturn) GetType()attr.Type
GetType returns the return data type.
func (NumberReturn)NewResultData¶
func (rNumberReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeObjectParameter¶
type ObjectParameter struct {// AttributeTypes is the mapping of underlying attribute names to attribute// types. This field must be set.//// Attribute types that contain a collection with a nested dynamic type (i.e. types.List[types.Dynamic]) are not supported.// If underlying dynamic collection values are required, replace this parameter definition with// DynamicParameter instead.AttributeTypes map[string]attr.Type// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.ObjectType]. When retrieving data, the// [basetypes.ObjectValuable] implementation associated with this custom// type must be used in place of [types.Object].CustomTypebasetypes.ObjectTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of object validators that should be applied to the// parameter.Validators []ObjectParameterValidator}ObjectParameter represents a function parameter that is a mapping ofdefined attribute names to values. Either the AttributeTypes or CustomTypefield must be set.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Object valuetype.
- If AllowNullValue is enabled, you must use thetypes.Object or acompatible Go *struct value type.
- Otherwise, usetypes.Object or compatible *struct/struct value types.
Terraform configurations set this parameter's argument data using expressionsthat return an object or directly via object ("{...}") syntax.
func (ObjectParameter)GetAllowNullValue¶
func (pObjectParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (ObjectParameter)GetAllowUnknownValues¶
func (pObjectParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (ObjectParameter)GetDescription¶
func (pObjectParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (ObjectParameter)GetMarkdownDescription¶
func (pObjectParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (ObjectParameter)GetName¶
func (pObjectParameter) GetName()string
GetName returns the parameter name.
func (ObjectParameter)GetType¶
func (pObjectParameter) GetType()attr.Type
GetType returns the parameter data type.
func (ObjectParameter)GetValidators¶added inv1.8.0
func (pObjectParameter) GetValidators() []ObjectParameterValidator
GetValidators returns the list of validators for the parameter.
func (ObjectParameter)ValidateImplementation¶added inv1.7.0
func (pObjectParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the parameter to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeObjectParameterValidator¶added inv1.8.0
type ObjectParameterValidator interface {// ValidateParameterObject ValidateParameterSet performs the validation.ValidateParameterObject(context.Context,ObjectParameterValidatorRequest, *ObjectParameterValidatorResponse)}ObjectParameterValidator is a function validator for types.Object parameters.
typeObjectParameterValidatorRequest¶added inv1.8.0
type ObjectParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Object}ObjectParameterValidatorRequest is a request for types.Object schema validation.
typeObjectParameterValidatorResponse¶added inv1.8.0
type ObjectParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}ObjectParameterValidatorResponse is a response to a ObjectParameterValidatorRequest.
typeObjectReturn¶
type ObjectReturn struct {// AttributeTypes is the mapping of underlying attribute names to attribute// types. This field must be set.//// Attribute types that contain a collection with a nested dynamic type (i.e. types.List[types.Dynamic]) are not supported.// If underlying dynamic collection values are required, replace this return definition with// DynamicReturn instead.AttributeTypes map[string]attr.Type// CustomType enables the use of a custom data type in place of the// default [basetypes.ObjectType]. When setting data, the// [basetypes.ObjectValuable] implementation associated with this custom// type must be used in place of [types.Object].CustomTypebasetypes.ObjectTypable}ObjectReturn represents a function return that is mapping of definedattribute names to values. When setting the value for this return, usetypes.Object or a compatible Go struct as the value type unless theCustomType field is set. The AttributeTypes field must be set.
Return documentation is expected in the functionDefinition documentation.
func (ObjectReturn)GetType¶
func (rObjectReturn) GetType()attr.Type
GetType returns the return data type.
func (ObjectReturn)NewResultData¶
func (rObjectReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
func (ObjectReturn)ValidateImplementation¶added inv1.7.0
func (pObjectReturn) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateReturnImplementationRequest, resp *fwfunction.ValidateReturnImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the Return to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeParameter¶
type Parameter interface {// GetAllowNullValue should return if the parameter accepts a null value.GetAllowNullValue()bool// GetAllowUnknownValues should return if the parameter accepts an unknown// value.GetAllowUnknownValues()bool// GetDescription should return the plaintext documentation for the// parameter.GetDescription()string// GetMarkdownDescription should return the Markdown documentation for the// parameter.GetMarkdownDescription()string// GetName should return a usage name for the parameter. Parameters are// positional, so this name has no meaning except documentation.//// If the name is returned as an empty string, a default name will be used to prevent Terraform errors for missing names.// The default name will be the prefix "param" with a suffix of the position the parameter is in the function definition. (`param1`, `param2`, etc.)// If the parameter is variadic, the default name will be `varparam`.GetName()string// GetType should return the data type for the parameter, which determines// what data type Terraform requires for configurations setting the argument// during a function call and the argument data type received by the// Function type Run method.GetType()attr.Type}Parameter is the interface for defining function parameters.
typeParameterWithBoolValidators¶added inv1.8.0
type ParameterWithBoolValidators interface {Parameter// GetValidators should return a list of Bool validators.GetValidators() []BoolParameterValidator}ParameterWithBoolValidators is an optional interface on Parameter whichenables Bool validation support.
typeParameterWithDynamicValidators¶added inv1.8.0
type ParameterWithDynamicValidators interface {Parameter// GetValidators should return a list of Dynamic validators.GetValidators() []DynamicParameterValidator}ParameterWithDynamicValidators is an optional interface on Parameter whichenables Dynamic validation support.
typeParameterWithFloat32Validators¶added inv1.10.0
type ParameterWithFloat32Validators interface {Parameter// GetValidators should return a list of Float64 validators.GetValidators() []Float32ParameterValidator}ParameterWithFloat32Validators is an optional interface on Parameter whichenables Float32 validation support.
typeParameterWithFloat64Validators¶added inv1.8.0
type ParameterWithFloat64Validators interface {Parameter// GetValidators should return a list of Float64 validators.GetValidators() []Float64ParameterValidator}ParameterWithFloat64Validators is an optional interface on Parameter whichenables Float64 validation support.
typeParameterWithInt32Validators¶added inv1.10.0
type ParameterWithInt32Validators interface {Parameter// GetValidators should return a list of Int32 validators.GetValidators() []Int32ParameterValidator}ParameterWithInt32Validators is an optional interface on Parameter whichenables Int32 validation support.
typeParameterWithInt64Validators¶added inv1.8.0
type ParameterWithInt64Validators interface {Parameter// GetValidators should return a list of Int64 validators.GetValidators() []Int64ParameterValidator}ParameterWithInt64Validators is an optional interface on Parameter whichenables Int64 validation support.
typeParameterWithListValidators¶added inv1.8.0
type ParameterWithListValidators interface {Parameter// GetValidators should return a list of List validators.GetValidators() []ListParameterValidator}ParameterWithListValidators is an optional interface on Parameter whichenables List validation support.
typeParameterWithMapValidators¶added inv1.8.0
type ParameterWithMapValidators interface {Parameter// GetValidators should return a list of Map validators.GetValidators() []MapParameterValidator}ParameterWithMapValidators is an optional interface on Parameter whichenables Map validation support.
typeParameterWithNumberValidators¶added inv1.8.0
type ParameterWithNumberValidators interface {Parameter// GetValidators should return a list of Map validators.GetValidators() []NumberParameterValidator}ParameterWithNumberValidators is an optional interface on Parameter whichenables Number validation support.
typeParameterWithObjectValidators¶added inv1.8.0
type ParameterWithObjectValidators interface {Parameter// GetValidators should return a list of Object validators.GetValidators() []ObjectParameterValidator}ParameterWithObjectValidators is an optional interface on Parameter whichenables Object validation support.
typeParameterWithSetValidators¶added inv1.8.0
type ParameterWithSetValidators interface {Parameter// GetValidators should return a list of Set validators.GetValidators() []SetParameterValidator}ParameterWithSetValidators is an optional interface on Parameter whichenables Set validation support.
typeParameterWithStringValidators¶added inv1.8.0
type ParameterWithStringValidators interface {Parameter// GetValidators should return a list of String validators.GetValidators() []StringParameterValidator}ParameterWithStringValidators is an optional interface on Parameter whichenables String validation support.
typeResultData¶
type ResultData struct {// contains filtered or unexported fields}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 datafor comparison.
funcNewResultData¶
func NewResultData(valueattr.Value)ResultData
NewResultData creates a ResultData. This is only necessary for unit testingas the framework automatically creates this data for the Function type Runmethod.
func (ResultData)Equal¶
func (dResultData) Equal(oResultData)bool
Equal returns true if the value is equivalent.
typeReturn¶
type Return interface {// GetType should return the data type for the return, which determines// what data type Terraform requires for configurations receiving the// response of a function call and the return data type required from the// Function type Run method.GetType()attr.Type// NewResultData should return a new ResultData with an unknown value (or// best approximation of an invalid value) of the corresponding data type.// The Function type Run method is expected to overwrite the value before// returning.NewResultData(context.Context) (ResultData, *FuncError)}Return is the interface for defining function return data.
typeRunRequest¶
type RunRequest struct {// Arguments is the data sent from Terraform. Use the ArgumentsData type// GetArgument method to retrieve each positional argument.ArgumentsArgumentsData}RunRequest represents a request for the Function to call its implementationlogic. An instance of this request struct is supplied as an argument to theFunction type Run method.
typeRunResponse¶
type RunResponse struct {// Error contains errors related to running the function.// A nil error indicates success, with no errors generated.// [ConcatFuncErrors] can be used to combine multiple errors into a single error.Error *FuncError// Result is the data to be returned to Terraform matching the function// result definition. This must be set or an error diagnostic is raised. Use// the ResultData type Set method to save the data.ResultResultData}RunResponse represents a response to a RunRequest. An instance of thisresponse struct is supplied as an argument to the Function type Run method.
typeSetParameter¶
type SetParameter struct {// ElementType is the type for all elements of the set. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this parameter definition with// DynamicParameter instead.ElementTypeattr.Type// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.SetType]. When retrieving data, the// [basetypes.SetValuable] implementation associated with this custom// type must be used in place of [types.Set].CustomTypebasetypes.SetTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of set validators that should be applied to the// parameter.Validators []SetParameterValidator}SetParameter represents a function parameter that is an unordered set of asingle element type. Either the ElementType or CustomType field must be set.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.Set valuetype.
- Otherwise, usetypes.Set or any Go slice value types compatible withthe element type.
Terraform configurations set this parameter's argument data using expressionsthat return a set or directly via set ("[...]") syntax.
func (SetParameter)GetAllowNullValue¶
func (pSetParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (SetParameter)GetAllowUnknownValues¶
func (pSetParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (SetParameter)GetDescription¶
func (pSetParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (SetParameter)GetMarkdownDescription¶
func (pSetParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (SetParameter)GetType¶
func (pSetParameter) GetType()attr.Type
GetType returns the parameter data type.
func (SetParameter)GetValidators¶added inv1.8.0
func (pSetParameter) GetValidators() []SetParameterValidator
GetValidators returns the list of validators for the parameter.
func (SetParameter)ValidateImplementation¶added inv1.7.0
func (pSetParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the parameter to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeSetParameterValidator¶added inv1.8.0
type SetParameterValidator interface {// ValidateParameterSet performs the validation.ValidateParameterSet(context.Context,SetParameterValidatorRequest, *SetParameterValidatorResponse)}SetParameterValidator is a function validator for types.Set parameters.
typeSetParameterValidatorRequest¶added inv1.8.0
type SetParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.Set}SetParameterValidatorRequest is a request for types.Set schema validation.
typeSetParameterValidatorResponse¶added inv1.8.0
type SetParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}SetParameterValidatorResponse is a response to a SetParameterValidatorRequest.
typeSetReturn¶
type SetReturn struct {// ElementType is the type for all elements of the set. This field must be// set.//// Element types that contain a dynamic type (i.e. types.Dynamic) are not supported.// If underlying dynamic values are required, replace this return definition with// DynamicReturn instead.ElementTypeattr.Type// CustomType enables the use of a custom data type in place of the// default [basetypes.SetType]. When setting data, the// [basetypes.SetValuable] implementation associated with this custom// type must be used in place of [types.Set].CustomTypebasetypes.SetTypable}SetReturn represents a function return that is an unordered collection of asingle element type. Either the ElementType or CustomType field must be set.
When setting the value for this return:
- If CustomType is set, use its associated value type.
- Otherwise, usetypes.Set or a Go slice value type compatible with theelement type.
Return documentation is expected in the functionDefinition documentation.
func (SetReturn)NewResultData¶
func (rSetReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
func (SetReturn)ValidateImplementation¶added inv1.7.0
func (pSetReturn) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateReturnImplementationRequest, resp *fwfunction.ValidateReturnImplementationResponse)
ValidateImplementation contains logic for validating theprovider-defined implementation of the Return to prevent unexpectederrors or panics. This logic runs during the GetProviderSchema RPC andshould never include false positives.
typeStringParameter¶
type StringParameter struct {// AllowNullValue when enabled denotes that a null argument value can be// passed to the function. When disabled, Terraform returns an error if the// argument value is null.AllowNullValuebool// AllowUnknownValues when enabled denotes that an unknown argument value// can be passed to the function. When disabled, Terraform skips the// function call entirely and assumes an unknown value result from the// function.AllowUnknownValuesbool// CustomType enables the use of a custom data type in place of the// default [basetypes.StringType]. When retrieving data, the// [basetypes.StringValuable] implementation associated with this custom// type must be used in place of [types.String].CustomTypebasetypes.StringTypable// Description is used in various tooling, like the language server, to// give practitioners more information about what this parameter is,// what it is for, and how it should be used. It should be written as// plain text, with no special formatting.Descriptionstring// MarkdownDescription is used in various tooling, like the// documentation generator, to give practitioners more information// about what this parameter is, what it is for, and how it should be// used. It should be formatted using Markdown.MarkdownDescriptionstring// Name is a short usage name for the parameter, such as "data". This name// is used in documentation, such as generating a function signature,// however its usage may be extended in the future.//// If no name is provided, this will default to "param" with a suffix of the// position the parameter is in the function definition. ("param1", "param2", etc.)// If the parameter is variadic, the default name will be "varparam".//// This must be a valid Terraform identifier, such as starting with an// alphabetical character and followed by alphanumeric or underscore// characters.Namestring// Validators is a list of string validators that should be applied to the// parameter.Validators []StringParameterValidator}StringParameter represents a function parameter that is a string.
When retrieving the argument value for this parameter:
- If CustomType is set, use its associated value type.
- If AllowUnknownValues is enabled, you must use thetypes.String valuetype.
- If AllowNullValue is enabled, you must usetypes.String or *stringvalue types.
- Otherwise, usetypes.String or *string, or string value types.
Terraform configurations set this parameter's argument data using expressionsthat return a string or directly via double quote ("value") syntax.
func (StringParameter)GetAllowNullValue¶
func (pStringParameter) GetAllowNullValue()bool
GetAllowNullValue returns if the parameter accepts a null value.
func (StringParameter)GetAllowUnknownValues¶
func (pStringParameter) GetAllowUnknownValues()bool
GetAllowUnknownValues returns if the parameter accepts an unknown value.
func (StringParameter)GetDescription¶
func (pStringParameter) GetDescription()string
GetDescription returns the parameter plaintext description.
func (StringParameter)GetMarkdownDescription¶
func (pStringParameter) GetMarkdownDescription()string
GetMarkdownDescription returns the parameter Markdown description.
func (StringParameter)GetName¶
func (pStringParameter) GetName()string
GetName returns the parameter name.
func (StringParameter)GetType¶
func (pStringParameter) GetType()attr.Type
GetType returns the parameter data type.
func (StringParameter)GetValidators¶added inv1.8.0
func (pStringParameter) GetValidators() []StringParameterValidator
GetValidators returns the string validators for the parameter.
func (StringParameter)ValidateImplementation¶added inv1.9.0
func (pStringParameter) ValidateImplementation(ctxcontext.Context, reqfwfunction.ValidateParameterImplementationRequest, resp *fwfunction.ValidateParameterImplementationResponse)
typeStringParameterValidator¶added inv1.8.0
type StringParameterValidator interface {// ValidateParameterString performs the validation.ValidateParameterString(context.Context,StringParameterValidatorRequest, *StringParameterValidatorResponse)}StringParameterValidator is a function validator for types.String parameters.
typeStringParameterValidatorRequest¶added inv1.8.0
type StringParameterValidatorRequest struct {// ArgumentPosition contains the position of the argument for validation.// Use this position for any response diagnostics.ArgumentPositionint64// Value contains the value of the argument for validation.Valuetypes.String}StringParameterValidatorRequest is a request for types.String schema validation.
typeStringParameterValidatorResponse¶added inv1.8.0
type StringParameterValidatorResponse struct {// Error is a function error generated during validation of the Value.Error *FuncError}StringParameterValidatorResponse is a response to a StringParameterValidatorRequest.
typeStringReturn¶
type StringReturn struct {// CustomType enables the use of a custom data type in place of the// default [basetypes.StringType]. When setting data, the// [basetypes.StringValuable] implementation associated with this custom// type must be used in place of [types.String].CustomTypebasetypes.StringTypable}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, usetypes.String, *string, or string.
Return documentation is expected in the functionDefinition documentation.
func (StringReturn)GetType¶
func (rStringReturn) GetType()attr.Type
GetType returns the return data type.
func (StringReturn)NewResultData¶
func (rStringReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)
NewResultData returns a new result data based on the type.
typeValidateParameterRequest¶added inv1.8.0
type ValidateParameterRequest struct {// Position is the zero-ordered position of the parameter being validated.Positionint64}ValidateParameterRequest represents a request for the attr.Value to call itsvalidation logic. An instance of this request struct is supplied as anargument to the attr.Value type ValidateParameter method.
typeValidateParameterResponse¶added inv1.8.0
type ValidateParameterResponse struct {// Error is a function error generated during validation of the attr.Value.Error *FuncError}ValidateParameterResponse represents a response to a ValidateParameterRequest.An instance of this response struct is supplied as an argument to theValidateParameter method.
typeValidateableParameter¶added inv1.8.0
type ValidateableParameter interface {// ValidateParameter returns any error generated during validation// of the parameter. It is generally used to check the data format and ensure// that it complies with the requirements of the attr.Value.ValidateParameter(context.Context,ValidateParameterRequest, *ValidateParameterResponse)}ValidateableParameter defines an interface for validating a parameter value.
Source Files¶
- arguments_data.go
- bool_parameter.go
- bool_parameter_validator.go
- bool_return.go
- definition.go
- doc.go
- dynamic_parameter.go
- dynamic_parameter_validator.go
- dynamic_return.go
- float32_parameter.go
- float32_parameter_validator.go
- float32_return.go
- float64_parameter.go
- float64_parameter_validator.go
- float64_return.go
- func_error.go
- function.go
- int32_parameter.go
- int32_parameter_validator.go
- int32_return.go
- int64_parameter.go
- int64_parameter_validator.go
- int64_return.go
- list_parameter.go
- list_parameter_validator.go
- list_return.go
- map_parameter.go
- map_parameter_validator.go
- map_return.go
- metadata.go
- number_parameter.go
- number_parameter_validator.go
- number_return.go
- object_parameter.go
- object_parameter_validator.go
- object_return.go
- parameter.go
- parameter_validation.go
- result_data.go
- return.go
- run.go
- set_parameter.go
- set_parameter_validator.go
- set_return.go
- string_parameter.go
- string_parameter_validator.go
- string_return.go