list
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 list contains all interfaces, request types, and responsetypes for an list resource implementation.
In Terraform, an list resource is a concept which enables providerdevelopers to offer practitioners list values, which will not be storedin any artifact produced by Terraform (plan/state). List resources canoptionally implement renewal logic via the (ListResource).Renew methodand cleanup logic via the (ListResource).Close method.
List resources are not saved into the Terraform plan or state and canonly be referenced in other list values, such as provider configurationattributes. List resources are defined by a type/name, such as "examplecloud_thing",a schema representing the structure and data types of configuration, and lifecycle logic.
The main starting point for implementations in this package is theListResource type which represents an instance of an list resourcethat has its own configuration and lifecycle logic. Thelist.ListResourceimplementations are referenced by the [provider.ProviderWithListResources] typeListResources method, which enables the list resource practitioner usage.
Index¶
- Variables
- func ListResultsStreamDiagnostics(diags diag.Diagnostics) iter.Seq[ListResult]
- type ConfigValidator
- type ConfigureRequest
- type ConfigureResponse
- type ListRequest
- type ListResource
- type ListResourceSchemaRequest
- type ListResourceSchemaResponse
- type ListResourceWithConfigValidators
- type ListResourceWithConfigure
- type ListResourceWithRawV5Schemas
- type ListResourceWithRawV6Schemas
- type ListResourceWithValidateConfig
- type ListResult
- type ListResultsStream
- type MetadataRequest
- type MetadataResponse
- type RawV5SchemaRequest
- type RawV5SchemaResponse
- type RawV6SchemaRequest
- type RawV6SchemaResponse
- type ValidateConfigRequest
- type ValidateConfigResponse
Constants¶
This section is empty.
Variables¶
var NoListResults = func(push func(ListResult)bool) {}NoListResults is an iterator that pushes zero results.
Functions¶
funcListResultsStreamDiagnostics¶
func ListResultsStreamDiagnostics(diagsdiag.Diagnostics)iter.Seq[ListResult]
ListResultsStreamDiagnostics returns a function that yields a singleListResult with the given Diagnostics
Types¶
typeConfigValidator¶
type ConfigValidator interface {// Description describes the validation in plain text formatting.//// This information may be automatically added to list resource plain text// descriptions by external tooling.Description(context.Context)string// MarkdownDescription describes the validation in Markdown formatting.//// This information may be automatically added to list resource Markdown// descriptions by external tooling.MarkdownDescription(context.Context)string// ValidateResource performs the validation.//// This method name is separate from ConfigValidators in resource and other packages in// order to allow generic validators.ValidateListResourceConfig(context.Context,ValidateConfigRequest, *ValidateConfigResponse)}ConfigValidator describes reusable ListResource configuration validationfunctionality.
typeConfigureRequest¶
type ConfigureRequest struct {// ProviderData is the data set in the// [provider.ConfigureResponse.ListResourceData] field. This data is// provider-specifc and therefore can contain any necessary remote system// clients, custom provider data, or anything else pertinent to the// functionality of the ListResource.//// This data is only set after the ConfigureProvider RPC has been called// by Terraform.ProviderDataany}ConfigureRequest represents a request for the provider to configure anlist resource, i.e., set provider-level data or clients. An instance ofthis request struct is supplied as an argument to the ListResource typeConfigure method.
typeConfigureResponse¶
type ConfigureResponse struct {// Diagnostics report errors or warnings related to configuring of the// ListResource. An empty slice indicates a successful operation with no// warnings or errors generated.Diagnosticsdiag.Diagnostics}ConfigureResponse represents a response to a ConfigureRequest. Aninstance of this response struct is supplied as an argument to theListResource type Configure method.
typeListRequest¶
type ListRequest struct {// Config is the configuration the user supplied for listing resource// instances.Configtfsdk.Config// IncludeResource indicates whether the provider should populate the// [ListResult.Resource] field.IncludeResourcebool// Limit specifies the maximum number of results that Terraform is// expecting.Limitint64ResourceSchemafwschema.SchemaResourceIdentitySchemafwschema.Schema}ListRequest represents a request for the provider to list instances of amanaged resource type that satisfy a user-defined request. An instance ofthis request struct is passed as an argument to the provider's Listfunction implementation.
func (ListRequest)NewListResult¶
func (rListRequest) NewListResult(ctxcontext.Context)ListResult
NewListResult creates a newListResult with convenient defaultsfor each field.
typeListResource¶
type ListResource interface {// Metadata should return the full name of the list resource such as// examplecloud_thing. This name should match the full name of the managed// resource to be listed; otherwise, the GetMetadata RPC will return an// error diagnostic.//// The method signature is intended to be compatible with the Metadata// method signature in the Resource interface. One implementation of// Metadata can satisfy both interfaces.Metadata(context.Context,resource.MetadataRequest, *resource.MetadataResponse)// ListResourceConfigSchema should return the schema for list blocks.ListResourceConfigSchema(context.Context,ListResourceSchemaRequest, *ListResourceSchemaResponse)// List is called when the provider must list instances of a managed// resource type that satisfy a user-provided request.List(context.Context,ListRequest, *ListResultsStream)}ListResource represents an implementation of listing instances of a managed resourceThis is the core interface for all list resource implementations.
ListResource implementations can optionally implement these additional concepts:
- Configure: Include provider-level data or clients.
- Validation: Schema-based or entire configuration viaListResourceWithConfigValidators or ListResourceWithValidateConfig.
typeListResourceSchemaRequest¶
type ListResourceSchemaRequest struct{}ListResourceSchemaRequest represents a request for the ListResource toreturn its schema. An instance of this request struct is supplied as anargument to the ListResource type ListResourceSchema method.
typeListResourceSchemaResponse¶
type ListResourceSchemaResponse struct {// Schema is the schema of the list resource.Schemaschema.Schema// Diagnostics report errors or warnings related to retrieving the list// resource schema. An empty slice indicates success, with no warnings// or errors generated.Diagnosticsdiag.Diagnostics}ListResourceSchemaResponse represents a response to aListResourceSchemaRequest. An instance of this response struct is suppliedas an argument to the ListResource type ListResourceResourceSchema method.
typeListResourceWithConfigValidators¶
type ListResourceWithConfigValidators interface {ListResource// ConfigValidators returns a list of functions which will all be performed during validation.ListResourceConfigValidators(context.Context) []ConfigValidator}ListResourceWithConfigValidators is an interface type that extendsListResource to include declarative validations.
Declaring validation using this methodology simplifies implementation ofreusable functionality. These also include descriptions, which can be usedfor automating documentation.
Validation will include ListResourceConfigValidators andValidateListResourceConfig, if both are implemented, in addition to anyAttribute or Type validation.
typeListResourceWithConfigure¶
type ListResourceWithConfigure interface {ListResource// Configure enables provider-level data or clients to be set. The method// signature is intended to be compatible with the Configure method// signature in the Resource interface. One implementation of Configure can// satisfy both interfaces.Configure(context.Context,resource.ConfigureRequest, *resource.ConfigureResponse)}ListResourceWithConfigure is an interface type that extends ListResource to include a methodwhich the framework will automatically call so provider developers have theopportunity to setup any necessary provider-level data or clients.
typeListResourceWithRawV5Schemas¶
type ListResourceWithRawV5Schemas interface {ListResource// RawV5Schemas is called to provide the ProtoV5 representations of the resource and resource identity schemas.RawV5Schemas(context.Context,RawV5SchemaRequest, *RawV5SchemaResponse)}ListResourceWithRawV5Schemas is an interface type that extends ListResource to include a methodwhich allows provider developers to supply the ProtoV5 representations of resource and resource identityschemas. This is necessary if list functionality is being used with a resource that is not defined with Framework.
typeListResourceWithRawV6Schemas¶
type ListResourceWithRawV6Schemas interface {ListResource// RawV6Schemas is called to provide the ProtoV6 representations of the resource and resource identity schemas.RawV6Schemas(context.Context,RawV6SchemaRequest, *RawV6SchemaResponse)}ListResourceWithRawV6Schemas is an interface type that extends ListResource to include a methodwhich allows provider developers to supply the ProtoV6 representations of resource and resource identityschemas. This is necessary if list functionality is being used with a resource that is not defined with Framework.
typeListResourceWithValidateConfig¶
type ListResourceWithValidateConfig interface {ListResource// ValidateListResourceConfig performs the validation.ValidateListResourceConfig(context.Context,ValidateConfigRequest, *ValidateConfigResponse)}ListResourceWithValidateConfig is an interface type that extends ListResource to includeimperative validation.
Declaring validation using this methodology simplifies one-offfunctionality that typically applies to a single resource. Any documentationof this functionality must be manually added into schema descriptions.
Validation will include ListResourceConfigValidators and ValidateListResourceConfig, if bothare implemented, in addition to any Attribute or Type validation.
typeListResult¶
type ListResult struct {// Identity is the identity of the managed resource instance.//// A nil value will raise an error diagnostic.Identity *tfsdk.ResourceIdentity// Resource is the provider's representation of the attributes of the// listed managed resource instance.//// If [ListRequest.IncludeResource] is true, a nil value will raise// a warning diagnostic.Resource *tfsdk.Resource// DisplayName is a provider-defined human-readable description of the// listed managed resource instance, intended for CLI and browser UIs.DisplayNamestring// Diagnostics report errors or warnings related to the listed managed// resource instance. An empty slice indicates a successful operation with// no warnings or errors generated.Diagnosticsdiag.Diagnostics}ListResult represents a listed managed resource instance. For convenience,create new values using [NewListResult] instead of struct literals.
typeListResultsStream¶
type ListResultsStream struct {// Results is a function that emits [ListResult] values via its push// function argument.//// To indicate a fatal processing error, push a [ListResult] that contains// a [diag.ErrorDiagnostic].Resultsiter.Seq[ListResult]}ListResultsStream represents a streaming response to aListRequest. Aninstance of this struct is supplied as an argument to the provider's[ListResource.List] function. The provider should set a Results iteratorfunction that pushes zero or more results of typeListResult.
For convenience, a provider implementation may choose to convert a slice ofresults into an iterator usingslices.Values.
typeMetadataRequest¶
type MetadataRequest struct {// ProviderTypeName is the string returned from// [provider.MetadataResponse.TypeName], if the Provider type implements// the Metadata method. This string should prefix the ListResource type name// with an underscore in the response.ProviderTypeNamestring}MetadataRequest represents a request for the ListResource to return metadata,such as its type name. An instance of this request struct is supplied asan argument to the ListResource type Metadata method.
typeMetadataResponse¶
type MetadataResponse struct {// TypeName should be the full list resource type, including the provider// type prefix and an underscore. For example, examplecloud_thing.TypeNamestring}MetadataResponse represents a response to a MetadataRequest. Aninstance of this response struct is supplied as an argument to theListResource type Metadata method.
typeRawV5SchemaRequest¶
type RawV5SchemaRequest struct{}RawV5SchemaRequest represents a request for the ListResource to return theProtoV5 schemas. An instance of this request struct is supplied as an argumentto the ListResource type RawV5Schemas method.
typeRawV5SchemaResponse¶
type RawV5SchemaResponse struct {// ProtoV5IdentitySchema is the ProtoV5 representation of the resource identity// schema. This should only be supplied if framework functionality is being used// with a legacy resource. Currently, this only applies to list.ProtoV5IdentitySchema *tfprotov5.ResourceIdentitySchema// ProtoV5Schema is the ProtoV5 representation of the resource schema// This should only be supplied if framework functionality is being used// with a legacy resource. Currently, this only applies to list.ProtoV5Schema *tfprotov5.Schema}RawV5SchemaResponse represents a response that is populated by the RawV5Schemas methodand is used to pass along the ProtoV5 representations of the resource and resource identity schemas.
typeRawV6SchemaRequest¶
type RawV6SchemaRequest struct{}RawV6SchemaRequest represents a request for the ListResource to return theProtoV6 schemas. An instance of this request struct is supplied as an argumentto the ListResource type RawV6Schemas method.
typeRawV6SchemaResponse¶
type RawV6SchemaResponse struct {// ProtoV6IdentitySchema is the ProtoV6 representation of the resource identity// schema. This should only be supplied if framework functionality is being used// with a legacy resource. Currently, this only applies to list.ProtoV6IdentitySchema *tfprotov6.ResourceIdentitySchema// ProtoV6Schema is the ProtoV6 representation of the resource schema// This should only be supplied if framework functionality is being used// with a legacy resource. Currently, this only applies to list.ProtoV6Schema *tfprotov6.Schema}RawV6SchemaResponse represents a response that is populated by the RawV6Schemas methodand is used to pass along the ProtoV6 representations of the resource and resource identity schemas.
typeValidateConfigRequest¶
type ValidateConfigRequest struct {// Config is the configuration the user supplied for the resource.//// This configuration may contain unknown values if a user uses// interpolation or other functionality that would prevent Terraform// from knowing the value at request time.Configtfsdk.Config}ValidateConfigRequest represents a request to validate the configuration ofa list resource. An instance of this request struct is supplied as anargument to the [ListResourceWithValidateConfig.ValidateListResourceConfig]receiver method or automatically passed through to eachConfigValidator.
typeValidateConfigResponse¶
type ValidateConfigResponse struct {// Diagnostics report errors or warnings related to validating the list// configuration. An empty slice indicates success, with no warnings// or errors generated.Diagnosticsdiag.Diagnostics}ValidateConfigResponse represents a response to aValidateConfigRequest.An instance of this response struct is supplied as an argument to thelist.ValidateListResourceConfig receiver method or automatically passedthrough to eachConfigValidator.