xattr

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MPL-2.0 Imports: 5 Imported by: 19

Documentation

Overview

Package xattr contains additional interfaces for attr types. This package is separate from the core attr package to prevent import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TypeWithValidate deprecated

type TypeWithValidate interface {
	attr.Type

	// Validate returns any warnings or errors about the value that is
	// being used to populate the Type. It is generally used to check the
	// data format and ensure that it complies with the requirements of the
	// Type.
	Validate(context.Context, tftypes.Value, path.Path) diag.Diagnostics
}

TypeWithValidate extends the attr.Type interface to include a Validate method, used to bundle consistent validation logic with the Type.

Deprecated: Use the ValidateableAttribute interface instead for schema attribute validation. Use the function.ValidateableParameter interface for provider-defined function parameter validation.

type ValidateAttributeRequest added in v1.8.0

type ValidateAttributeRequest struct {
	// Path is the path to the attribute being validated.
	Path path.Path
}

ValidateAttributeRequest represents a request for the Value to call its validation logic. An instance of this request struct is supplied as an argument to the ValidateAttribute method.

type ValidateAttributeResponse added in v1.8.0

type ValidateAttributeResponse struct {
	// Diagnostics is a collection of warnings or errors generated during
	// validation of the Value.
	Diagnostics diag.Diagnostics
}

ValidateAttributeResponse represents a response to a ValidateAttributeRequest. An instance of this response struct is supplied as an argument to the ValidateAttribute method.

type ValidateableAttribute added in v1.8.0

type ValidateableAttribute interface {
	// ValidateAttribute returns any warnings or errors generated during validation
	// of the attribute. It is generally used to check the data format and ensure
	// that it complies with the requirements of the Value.
	ValidateAttribute(context.Context, ValidateAttributeRequest, *ValidateAttributeResponse)
}

ValidateableAttribute defines an interface for validating an attribute value. The ValidateAttribute method is called implicitly by the framework when value types from Terraform are converted into framework types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL