pluginsdk

package
v1.44.1-0...-2cd6497 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeInvalid = schema.TypeInvalid
	TypeBool    = schema.TypeBool
	TypeInt     = schema.TypeInt
	TypeFloat   = schema.TypeFloat
	TypeString  = schema.TypeString
	TypeList    = schema.TypeList
	TypeMap     = schema.TypeMap
	TypeSet     = schema.TypeSet
)
View Source
const (
	SchemaConfigModeAuto  = schema.SchemaConfigModeAuto
	SchemaConfigModeAttr  = schema.SchemaConfigModeAttr
	SchemaConfigModeBlock = schema.SchemaConfigModeBlock
)
View Source
const (
	TimeoutCreate  = schema.TimeoutCreate
	TimeoutRead    = schema.TimeoutRead
	TimeoutUpdate  = schema.TimeoutUpdate
	TimeoutDelete  = schema.TimeoutDelete
	TimeoutDefault = schema.TimeoutDefault
)

Variables

View Source
var (
	ExpandJsonFromString = structure.ExpandJsonFromString
	FlattenJsonToString  = structure.FlattenJsonToString
	SuppressJsonDiff     = structure.SuppressJsonDiff
)

Functions

func CustomDiffInSequence

func CustomDiffInSequence(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc

CustomDiffInSequence returns a CustomizeDiffFunc that runs all of the given CustomizeDiffFuncs in sequence, stopping at the first one that returns an error and returning that error.

If all functions succeed, the combined function also succeeds.

func CustomDiffWithAll

func CustomDiffWithAll(funcs ...CustomizeDiffFunc) schema.CustomizeDiffFunc

CustomDiffWithAll returns a CustomizeDiffFunc that runs all of the given CustomizeDiffFuncs and returns all of the errors produced.

If one function produces an error, functions after it are still run. If this is not desirable, use function Sequence instead.

If multiple functions returns errors, the result is a multierror.

func CustomizeDiffShim

func CustomizeDiffShim(diffFunc CustomizeDiffFunc) schema.CustomizeDiffFunc

CustomizeDiffShim is a shim around the Terraform Plugin SDK which allows us to switch out the version of the Plugin SDK being used without breaking open PR's

func DefaultTimeout

func DefaultTimeout(tx interface{}) *time.Duration

func HashString

func HashString(input interface{}) int

HashString hashes strings. If you want a Set of strings, this is the SchemaSetFunc you want.

func ImporterValidatingResourceId

func ImporterValidatingResourceId(validateFunc IDValidationFunc) *schema.ResourceImporter

ImporterValidatingResourceId validates the ID provided at import time is valid using the validateFunc.

func ImporterValidatingResourceIdThen

func ImporterValidatingResourceIdThen(validateFunc IDValidationFunc, thenFunc ImporterFunc) *schema.ResourceImporter

ImporterValidatingResourceIdThen validates the ID provided at import time is valid using the validateFunc then runs the 'thenFunc', allowing the import to be customised.

func IsExplicitlyNullInConfig

func IsExplicitlyNullInConfig(d *ResourceData, configFieldName string) bool

IsExplicitlyNullInConfig determines whether the specified 'configFieldName' exists in the configuration file or not.

Returns 'true' if the 'configFieldName' is not found in the configuration file or 'false' if the 'configFieldName' is found in the configuration file.

func Retry

func Retry(timeout time.Duration, f RetryFunc) error

Retry is a basic wrapper around StateChangeConf that will just retry a function until it no longer returns an error.

func ValueChangeConditionShim

func ValueChangeConditionShim(shimFunc ValueChangeConditionFunc) customdiff.ValueChangeConditionFunc

ValueChangeConditionShim is a shim around the Terraform Plugin SDK which allows us to switch out the version of the Plugin SDK being used without breaking open PR's

Types

type BasicMapReader

type BasicMapReader = schema.BasicMapReader

type CreateFunc

type CreateFunc = schema.CreateFunc //nolint:staticcheck

lint:ignore SA1019 SDKv2 migration - staticcheck's own linter directives are currently being ignored under golanci-lint

type CustomizeDiffFunc

type CustomizeDiffFunc = func(context.Context, *ResourceDiff, interface{}) error

func ForceNewIf

ForceNewIf returns a CustomizeDiffFunc that flags the given key as requiring a new resource if the given condition function returns true.

The return value of the condition function is ignored if the old and new values of the field compare equal, since no attribute diff is generated in that case.

func ForceNewIfChange

func ForceNewIfChange(key string, f ValueChangeConditionFunc) CustomizeDiffFunc

ForceNewIfChange returns a CustomizeDiffFunc that flags the given key as requiring a new resource if the given condition function returns true.

The return value of the condition function is ignored if the old and new values compare equal, since no attribute diff is generated in that case.

This function is similar to ForceNewIf but provides the condition function only the old and new values of the given key, which leads to more compact and explicit code in the common case where the decision can be made with only the specific field value.

type DeleteFunc

type DeleteFunc = schema.DeleteFunc //nolint:staticcheck

type ExistsFunc

type ExistsFunc = schema.ExistsFunc //nolint:staticcheck

type IDValidationFunc

type IDValidationFunc func(id string) error

type ImporterFunc

type ImporterFunc = func(ctx context.Context, d *ResourceData, meta interface{}) ([]*ResourceData, error)

type InstanceState

type InstanceState = terraform.InstanceState

type MapFieldReader

type MapFieldReader = schema.MapFieldReader

type MapFieldWriter

type MapFieldWriter = schema.MapFieldWriter

type ReadFunc

type ReadFunc = schema.ReadFunc //nolint:staticcheck

type Resource

type Resource = schema.Resource

type ResourceConditionFunc

type ResourceConditionFunc = func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool

type ResourceData

type ResourceData = schema.ResourceData

type ResourceDiff

type ResourceDiff = schema.ResourceDiff

type ResourceTimeout

type ResourceTimeout = schema.ResourceTimeout

type RetryError

type RetryError = retry.RetryError

RetryError is the required return type of RetryFunc. It forces client code to choose whether or not a given error is retryable. TODO: deprecate this in the future

func NonRetryableError

func NonRetryableError(err error) *RetryError

NonRetryableError is a helper to create a RetryError that's _not_ retryable from a given error.

func RetryableError

func RetryableError(err error) *RetryError

RetryableError is a helper to create a RetryError that's retryable from a given error.

type RetryFunc

type RetryFunc = retry.RetryFunc

RetryFunc is the function retried until it succeeds.

type Schema

type Schema = schema.Schema

type SchemaDiffSuppressFunc

type SchemaDiffSuppressFunc = schema.SchemaDiffSuppressFunc

type SchemaSetFunc

type SchemaSetFunc = schema.SchemaSetFunc

func HashResource

func HashResource(resource *Resource) SchemaSetFunc

HashResource hashes complex structures that are described using a *Resource. This is the default set implementation used when a set's element type is a full resource.

type SchemaValidateFunc

type SchemaValidateFunc = func(interface{}, string) ([]string, []error)

type Set

type Set = schema.Set

func NewSet

func NewSet(f SchemaSetFunc, items []interface{}) *Set

NewSet is a convenience method for creating a new set with the given items.

type State

type State = terraform.State

type StateChangeConf

type StateChangeConf = retry.StateChangeConf

type StateRefreshFunc

type StateRefreshFunc = retry.StateRefreshFunc

type StateUpgrade

type StateUpgrade interface {
	// Schema is a point-in-time reference to the Schema at the time of this version
	//
	// This only needs to include the Fields and Optional/Required/Computed/Defaults
	// it does not need to include validation functions so can/should be simplified
	//
	// NOTE: This also shouldn't reference the existing schema since it's a
	// point-in-time reference
	Schema() map[string]*Schema

	// UpgradeFunc is the upgrade function which should be run when upgrading this
	// from the "current" version to the "next" version of this Resource.
	UpgradeFunc() StateUpgraderFunc
}

type StateUpgrader

type StateUpgrader = schema.StateUpgrader

func StateUpgrades

func StateUpgrades(upgrades map[int]StateUpgrade) []StateUpgrader

StateUpgrades is a wrapper around the Plugin SDK's State Upgraders which allows us to upgrade the Plugin SDK without breaking all open PR's and attempts to make this interface a little less verbose.

type StateUpgraderFunc

type StateUpgraderFunc = func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error)

type TestCheckFunc

type TestCheckFunc = resource.TestCheckFunc

type UpdateFunc

type UpdateFunc = schema.UpdateFunc //nolint:staticcheck

type ValueChangeConditionFunc

type ValueChangeConditionFunc = func(ctx context.Context, old, new, meta interface{}) bool

type ValueType

type ValueType = schema.ValueType

Jump to

Keyboard shortcuts

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