Movatterモバイル変換


[0]ホーム

URL:


function

package
v1.17.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:MPL-2.0Imports:11Imported by:46

Details

Repository

github.com/hashicorp/terraform-plugin-framework

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

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

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

func (dArgumentsData) GetArgument(ctxcontext.Context, positionint, targetany) *FuncError

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)GetValidatorsadded inv1.8.0

func (pBoolParameter) GetValidators() []BoolParameterValidator

GetValidators returns the list of validators for the parameter.

typeBoolParameterValidatoradded inv1.8.0

type BoolParameterValidator interface {// ValidateParameterBool performs the validation.ValidateParameterBool(context.Context,BoolParameterValidatorRequest, *BoolParameterValidatorResponse)}

BoolParameterValidator is a function validator for types.Bool parameters.

typeBoolParameterValidatorRequestadded 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.

typeBoolParameterValidatorResponseadded 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)GetType

func (rBoolReturn) GetType()attr.Type

GetType returns the return data type.

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.

typeDefinitionValidateRequestadded 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.

typeDefinitionValidateResponseadded 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.

typeDynamicParameteradded 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)GetAllowNullValueadded inv1.7.0

func (pDynamicParameter) GetAllowNullValue()bool

GetAllowNullValue returns if the parameter accepts a null value.

func (DynamicParameter)GetAllowUnknownValuesadded inv1.7.0

func (pDynamicParameter) GetAllowUnknownValues()bool

GetAllowUnknownValues returns if the parameter accepts an unknown value.

func (DynamicParameter)GetDescriptionadded inv1.7.0

func (pDynamicParameter) GetDescription()string

GetDescription returns the parameter plaintext description.

func (DynamicParameter)GetMarkdownDescriptionadded inv1.7.0

func (pDynamicParameter) GetMarkdownDescription()string

GetMarkdownDescription returns the parameter Markdown description.

func (DynamicParameter)GetNameadded inv1.7.0

func (pDynamicParameter) GetName()string

GetName returns the parameter name.

func (DynamicParameter)GetTypeadded inv1.7.0

func (pDynamicParameter) GetType()attr.Type

GetType returns the parameter data type.

func (DynamicParameter)GetValidatorsadded inv1.8.0

GetValidators returns the list of validators for the parameter.

typeDynamicParameterValidatoradded inv1.8.0

type DynamicParameterValidator interface {// ValidateParameterDynamic performs the validation.ValidateParameterDynamic(context.Context,DynamicParameterValidatorRequest, *DynamicParameterValidatorResponse)}

DynamicParameterValidator is a function validator for types.Dynamic parameters.

typeDynamicParameterValidatorRequestadded 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.

typeDynamicParameterValidatorResponseadded 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.

typeDynamicReturnadded 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)GetTypeadded inv1.7.0

func (rDynamicReturn) GetType()attr.Type

GetType returns the return data type.

func (DynamicReturn)NewResultDataadded inv1.7.0

func (rDynamicReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)

NewResultData returns a new result data based on the type.

typeFloat32Parameteradded 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)GetAllowNullValueadded inv1.10.0

func (pFloat32Parameter) GetAllowNullValue()bool

GetAllowNullValue returns if the parameter accepts a null value.

func (Float32Parameter)GetAllowUnknownValuesadded inv1.10.0

func (pFloat32Parameter) GetAllowUnknownValues()bool

GetAllowUnknownValues returns if the parameter accepts an unknown value.

func (Float32Parameter)GetDescriptionadded inv1.10.0

func (pFloat32Parameter) GetDescription()string

GetDescription returns the parameter plaintext description.

func (Float32Parameter)GetMarkdownDescriptionadded inv1.10.0

func (pFloat32Parameter) GetMarkdownDescription()string

GetMarkdownDescription returns the parameter Markdown description.

func (Float32Parameter)GetNameadded inv1.10.0

func (pFloat32Parameter) GetName()string

GetName returns the parameter name.

func (Float32Parameter)GetTypeadded inv1.10.0

func (pFloat32Parameter) GetType()attr.Type

GetType returns the parameter data type.

func (Float32Parameter)GetValidatorsadded inv1.10.0

GetValidators returns the list of validators for the parameter.

typeFloat32ParameterValidatoradded inv1.10.0

type Float32ParameterValidator interface {// ValidateParameterFloat32 performs the validation.ValidateParameterFloat32(context.Context,Float32ParameterValidatorRequest, *Float32ParameterValidatorResponse)}

Float32ParameterValidator is a function validator for types.Float32 parameters.

typeFloat32ParameterValidatorRequestadded 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.

typeFloat32ParameterValidatorResponseadded 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.

typeFloat32Returnadded 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)GetTypeadded inv1.10.0

func (rFloat32Return) GetType()attr.Type

GetType returns the return data type.

func (Float32Return)NewResultDataadded 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)GetValidatorsadded inv1.8.0

GetValidators returns the list of validators for the parameter.

typeFloat64ParameterValidatoradded inv1.8.0

type Float64ParameterValidator interface {// ValidateParameterFloat64 performs the validation.ValidateParameterFloat64(context.Context,Float64ParameterValidatorRequest, *Float64ParameterValidatorResponse)}

Float64ParameterValidator is a function validator for types.Float64 parameters.

typeFloat64ParameterValidatorRequestadded 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.

typeFloat64ParameterValidatorResponseadded 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.

typeFuncErroradded 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.

funcConcatFuncErrorsadded inv1.6.0

func ConcatFuncErrors(funcErrs ...*FuncError) *FuncError

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.

funcFuncErrorFromDiagsadded 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.

funcNewArgumentFuncErroradded inv1.6.0

func NewArgumentFuncError(functionArgumentint64, textstring) *FuncError

NewArgumentFuncError returns a new function error with thegiven message and function argument.

funcNewFuncErroradded inv1.6.0

func NewFuncError(textstring) *FuncError

NewFuncError returns a new function error with thegiven message.

func (*FuncError)Equaladded inv1.6.0

func (fe *FuncError) Equal(other *FuncError)bool

Equal returns true if the other function error is wholly equivalent.

func (*FuncError)Erroradded inv1.6.0

func (fe *FuncError) Error()string

Error returns the error text.

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.

typeInt32Parameteradded 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)GetAllowNullValueadded inv1.10.0

func (pInt32Parameter) GetAllowNullValue()bool

GetAllowNullValue returns if the parameter accepts a null value.

func (Int32Parameter)GetAllowUnknownValuesadded inv1.10.0

func (pInt32Parameter) GetAllowUnknownValues()bool

GetAllowUnknownValues returns if the parameter accepts an unknown value.

func (Int32Parameter)GetDescriptionadded inv1.10.0

func (pInt32Parameter) GetDescription()string

GetDescription returns the parameter plaintext description.

func (Int32Parameter)GetMarkdownDescriptionadded inv1.10.0

func (pInt32Parameter) GetMarkdownDescription()string

GetMarkdownDescription returns the parameter Markdown description.

func (Int32Parameter)GetNameadded inv1.10.0

func (pInt32Parameter) GetName()string

GetName returns the parameter name.

func (Int32Parameter)GetTypeadded inv1.10.0

func (pInt32Parameter) GetType()attr.Type

GetType returns the parameter data type.

func (Int32Parameter)GetValidatorsadded inv1.10.0

func (pInt32Parameter) GetValidators() []Int32ParameterValidator

GetValidators returns the list of validators for the parameter.

typeInt32ParameterValidatoradded inv1.10.0

type Int32ParameterValidator interface {// ValidateParameterInt32 performs the validation.ValidateParameterInt32(context.Context,Int32ParameterValidatorRequest, *Int32ParameterValidatorResponse)}

Int32ParameterValidator is a function validator for types.Int32 parameters.

typeInt32ParameterValidatorRequestadded 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.

typeInt32ParameterValidatorResponseadded 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.

typeInt32Returnadded 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)GetTypeadded inv1.10.0

func (rInt32Return) GetType()attr.Type

GetType returns the return data type.

func (Int32Return)NewResultDataadded 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)GetValidatorsadded inv1.8.0

func (pInt64Parameter) GetValidators() []Int64ParameterValidator

GetValidators returns the list of validators for the parameter.

typeInt64ParameterValidatoradded inv1.8.0

type Int64ParameterValidator interface {// ValidateParameterInt64 performs the validation.ValidateParameterInt64(context.Context,Int64ParameterValidatorRequest, *Int64ParameterValidatorResponse)}

Int64ParameterValidator is a function validator for types.Int64 parameters.

typeInt64ParameterValidatorRequestadded 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.

typeInt64ParameterValidatorResponseadded 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)GetValidatorsadded inv1.8.0

func (pListParameter) GetValidators() []ListParameterValidator

GetValidators returns the list of validators for the parameter.

func (ListParameter)ValidateImplementationadded inv1.7.0

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.

typeListParameterValidatoradded inv1.8.0

type ListParameterValidator interface {// ValidateParameterList performs the validation.ValidateParameterList(context.Context,ListParameterValidatorRequest, *ListParameterValidatorResponse)}

ListParameterValidator is a function validator for types.List parameters.

typeListParameterValidatorRequestadded 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.

typeListParameterValidatorResponseadded 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)GetType

func (rListReturn) GetType()attr.Type

GetType returns the return data type.

func (ListReturn)NewResultData

func (rListReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)

NewResultData returns a new result data based on the type.

func (ListReturn)ValidateImplementationadded inv1.7.0

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)GetName

func (pMapParameter) GetName()string

GetName returns the parameter name.

func (MapParameter)GetType

func (pMapParameter) GetType()attr.Type

GetType returns the parameter data type.

func (MapParameter)GetValidatorsadded inv1.8.0

func (pMapParameter) GetValidators() []MapParameterValidator

GetValidators returns the list of validators for the parameter.

func (MapParameter)ValidateImplementationadded inv1.7.0

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.

typeMapParameterValidatoradded inv1.8.0

type MapParameterValidator interface {// ValidateParameterMap performs the validation.ValidateParameterMap(context.Context,MapParameterValidatorRequest, *MapParameterValidatorResponse)}

MapParameterValidator is a function validator for types.Map parameters.

typeMapParameterValidatorRequestadded 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.

typeMapParameterValidatorResponseadded 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)GetType

func (rMapReturn) GetType()attr.Type

GetType returns the return data type.

func (MapReturn)NewResultData

func (rMapReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)

NewResultData returns a new result data based on the type.

func (MapReturn)ValidateImplementationadded inv1.7.0

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)GetValidatorsadded inv1.8.0

func (pNumberParameter) GetValidators() []NumberParameterValidator

GetValidators returns the list of validators for the parameter.

typeNumberParameterValidatoradded inv1.8.0

type NumberParameterValidator interface {// ValidateParameterNumber performs the validation.ValidateParameterNumber(context.Context,NumberParameterValidatorRequest, *NumberParameterValidatorResponse)}

NumberParameterValidator is a function validator for types.Number parameters.

typeNumberParameterValidatorRequestadded 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.

typeNumberParameterValidatorResponseadded 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)GetValidatorsadded inv1.8.0

func (pObjectParameter) GetValidators() []ObjectParameterValidator

GetValidators returns the list of validators for the parameter.

func (ObjectParameter)ValidateImplementationadded inv1.7.0

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.

typeObjectParameterValidatoradded 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.

typeObjectParameterValidatorRequestadded 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.

typeObjectParameterValidatorResponseadded 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)ValidateImplementationadded inv1.7.0

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.

typeParameterWithBoolValidatorsadded 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.

typeParameterWithDynamicValidatorsadded 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.

typeParameterWithFloat32Validatorsadded 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.

typeParameterWithFloat64Validatorsadded 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.

typeParameterWithInt32Validatorsadded 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.

typeParameterWithInt64Validatorsadded 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.

typeParameterWithListValidatorsadded 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.

typeParameterWithMapValidatorsadded 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.

typeParameterWithNumberValidatorsadded 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.

typeParameterWithObjectValidatorsadded 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.

typeParameterWithSetValidatorsadded 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.

typeParameterWithStringValidatorsadded 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.

func (*ResultData)Set

func (d *ResultData) Set(ctxcontext.Context, valueany) *FuncError

Set saves the result data. The value type must be acceptable for the datatype in the result definition.

func (ResultData)Value

func (dResultData) Value()attr.Value

Value returns the saved value.

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)GetName

func (pSetParameter) GetName()string

GetName returns the parameter name.

func (SetParameter)GetType

func (pSetParameter) GetType()attr.Type

GetType returns the parameter data type.

func (SetParameter)GetValidatorsadded inv1.8.0

func (pSetParameter) GetValidators() []SetParameterValidator

GetValidators returns the list of validators for the parameter.

func (SetParameter)ValidateImplementationadded inv1.7.0

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.

typeSetParameterValidatoradded inv1.8.0

type SetParameterValidator interface {// ValidateParameterSet performs the validation.ValidateParameterSet(context.Context,SetParameterValidatorRequest, *SetParameterValidatorResponse)}

SetParameterValidator is a function validator for types.Set parameters.

typeSetParameterValidatorRequestadded 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.

typeSetParameterValidatorResponseadded 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)GetType

func (rSetReturn) GetType()attr.Type

GetType returns the return data type.

func (SetReturn)NewResultData

func (rSetReturn) NewResultData(ctxcontext.Context) (ResultData, *FuncError)

NewResultData returns a new result data based on the type.

func (SetReturn)ValidateImplementationadded inv1.7.0

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)GetValidatorsadded inv1.8.0

func (pStringParameter) GetValidators() []StringParameterValidator

GetValidators returns the string validators for the parameter.

typeStringParameterValidatoradded inv1.8.0

type StringParameterValidator interface {// ValidateParameterString performs the validation.ValidateParameterString(context.Context,StringParameterValidatorRequest, *StringParameterValidatorResponse)}

StringParameterValidator is a function validator for types.String parameters.

typeStringParameterValidatorRequestadded 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.

typeStringParameterValidatorResponseadded 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.

typeValidateParameterRequestadded 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.

typeValidateParameterResponseadded 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.

typeValidateableParameteradded 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

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp