lib

package
v0.1.1528 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIToDynamicJSON added in v0.1.1009

func APIToDynamicJSON(ctx context.Context, attributePath tfpath.Path, source any, prior types.Dynamic, mapPaths, writeOnly []string, normalization string) (types.Dynamic, diag.Diagnostics)

func APIToDynamicSiblingDiscriminator added in v0.1.936

func APIToDynamicSiblingDiscriminator(ctx context.Context, attributePath path.Path, source any, selector string, variants []JSONSchemaVariant, prior types.Dynamic) (types.Dynamic, diag.Diagnostics)

func AlignMembersByEmail added in v0.1.1362

func AlignMembersByEmail(ctx context.Context, source any, prior attr.Value) any

AlignMembersByEmail puts Share Group members in the order and email spelling of prior, the configured or prior state value. Rails matches members by email ignoring letter case, keeps the stored spelling and returns them in its own order. Unmatched members follow in API order. source is the members value of the response body.

func AtLeastOneOfAttributes added in v0.1.867

func AtLeastOneOfAttributes(names ...string) validator.Object

func AttributeToInterface

func AttributeToInterface(ctx context.Context, path path.Path, source attr.Value) (dest interface{}, diags diag.Diagnostics)

func CaptureResponseBody added in v0.1.1362

func CaptureResponseBody(body *[]byte) files_sdk.RequestResponseOption

CaptureResponseBody keeps a copy of the response body in body and gives the SDK an identical reader to decode. The Go SDK decodes some fields into strings with omitempty, which cannot tell an empty string from null.

func CurrentFormFields added in v0.1.1362

func CurrentFormFields(formFieldSet files_sdk.FormFieldSet, fields any) any

CurrentFormFields returns the fields listed in form_layout, in that order. Authenticated Form Field Set responses also contain historical definitions that existing registration answers use. fields is the form_fields value of the response body, as ResponseProperty returns it.

func DeprecatedJSONEncoding added in v0.1.1009

func DeprecatedJSONEncoding(rule, example, deadline string, valueTypes map[string]string, requiredPaths []string, nestedPaths ...string) validator.Dynamic

DeprecatedJSONEncoding warns about JSON-encoded values. valueTypes maps fields of the typed schema to "integer", "boolean" or "list", with "[]" for list items and "*" for map values, for example {"user_ids[]": "integer"}. A configured value of another type gets guidance for its field, in the same warning when the value is also encoded. requiredPaths name fields, in the same form, that the typed schema requires although the API also accepts null for them. A configured null there gets guidance, because Terraform treats it as missing. An unknown value does not. nestedPaths name the discriminator of list union items that the typed schema moves under their variant name, for example "folder_behaviors[].behavior". An item that still has it uses the old nesting and gets example as guidance.

func DeprecatedSiblingDiscriminatorValue added in v0.1.936

func DeprecatedSiblingDiscriminatorValue(rule, selector string, variants []JSONSchemaVariant, warning string) validator.Dynamic

func DynamicSiblingDiscriminatorToAPI added in v0.1.936

func DynamicSiblingDiscriminatorToAPI(ctx context.Context, attributePath path.Path, source types.Dynamic, selector string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

func DynamicSiblingDiscriminatorUpdateToAPI added in v0.1.936

func DynamicSiblingDiscriminatorUpdateToAPI(ctx context.Context, attributePath path.Path, source types.Dynamic, prior types.Dynamic, selector string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

func DynamicToInterface added in v0.1.391

func DynamicToInterface(ctx context.Context, path path.Path, source types.Dynamic) (interface{}, diag.Diagnostics)

func DynamicToStringMap

func DynamicToStringMap(ctx context.Context, path path.Path, source types.Dynamic) (map[string]interface{}, diag.Diagnostics)

func DynamicToStringMapSlice

func DynamicToStringMapSlice(ctx context.Context, path path.Path, source types.Dynamic) ([]map[string]interface{}, diag.Diagnostics)

func ElementsToInterfaces added in v0.1.867

func ElementsToInterfaces(ctx context.Context, path path.Path, elements []attr.Value) (dest []interface{}, diags diag.Diagnostics)

func ElementsToStringMap

func ElementsToStringMap(ctx context.Context, path path.Path, attrs map[string]attr.Value) (dest map[string]interface{}, diags diag.Diagnostics)

func ExactlyOneOfAttributes added in v0.1.867

func ExactlyOneOfAttributes(names ...string) validator.Object

func FixedRecordIDs added in v0.1.1362

func FixedRecordIDs(key string, serverFilled []string) fixedRecordIDs

FixedRecordIDs plans records that the API keeps under an ID, such as form fields. Rails keeps a record whose request names a current ID: it keeps every stored value that the request leaves out, and it stores a changed value under a new ID. key is the ID field. serverFilled fields get an API value for a new record too, such as a default.

For a typed list, a record that names a stored ID plans each left-out value as the stored value, and a new record plans each left-out value as null, except serverFilled fields. A configured value that differs from the stored record is an error, because the API would replace the ID. An unknown value is checked when Terraform plans again with the final values, before apply. A Dynamic value holds only the configured keys, so it is only checked.

func GroupStructuralUnionAtPath added in v0.1.867

func GroupStructuralUnionAtPath(ctx context.Context, attributePath path.Path, source any, names []string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

func JSONToStringMapSlice added in v0.1.1009

func JSONToStringMapSlice(attributePath tfpath.Path, value any) ([]map[string]any, diag.Diagnostics)

func JSONValueHas added in v0.1.1362

func JSONValueHas(value any, valuePath string) bool

JSONValueHas reports whether value has a value other than null at valuePath, with "[]" for list items and "*" for map values, for example "folder_behaviors[].behavior".

func JSONValueToAPI added in v0.1.1009

func JSONValueToAPI(ctx context.Context, attributePath tfpath.Path, source attr.Value) (any, diag.Diagnostics)

func KnownKeys added in v0.1.1362

func KnownKeys(detail string, names ...string) validator.Dynamic

KnownKeys rejects a value that is not an object, and top-level keys outside names, for a Dynamic object whose unknown keys the API removes when it saves, so the value read back never matches the configuration.

func ListToStringMapSlice

func ListToStringMapSlice(ctx context.Context, path path.Path, elements []attr.Value) (dest []map[string]interface{}, diags diag.Diagnostics)

func ListValueToString

func ListValueToString(ctx context.Context, path path.Path, list types.List, delim string) (string, diag.Diagnostics)

func NullRemovedSiblingFields added in v0.1.1362

func NullRemovedSiblingFields(ctx context.Context, attributePath path.Path, value any, prior attr.Value, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

NullRemovedSiblingFields sends null for each writable field that prior, the typed value in state, sets and value, the unwrapped request value, no longer sets. Rails merges a Behavior value on update and removes only fields sent as null.

func ParseDecimalAttribute added in v0.1.1114

func ParseDecimalAttribute(text string) (exact *string, legacy float64, err error)

ParseDecimalAttribute reads a string attribute that earlier provider versions parsed with strconv.ParseFloat before sending it as a number. Decimal text such as "1.5" or "2e-3" comes back unchanged as exact, so the API receives it without float rounding. Other spellings ParseFloat accepts, such as hexadecimal floats or digits separated by underscores, keep their former float64 value and rounding, with a nil exact. NaN, infinities and values ParseFloat rejects are errors.

func ReadLegacyTruthyAtPath added in v0.1.1362

func ReadLegacyTruthyAtPath(_ context.Context, attributePath path.Path, source any, names []string) (any, diag.Diagnostics)

Read marked boolean fields using Ruby truthiness, rather than parsing strings such as "false".

func RejectEmptyList added in v0.1.1362

func RejectEmptyList(detail string) rejectEmptyListValidator

RejectEmptyList rejects an empty list for a property whose empty list the API ignores, so the value read back never matches it. It validates a typed list and a Dynamic value, native or JSON-encoded.

func RejectJSONNull added in v0.1.1362

func RejectJSONNull(detail string) validator.Dynamic

RejectJSONNull rejects a JSON-encoded null, such as jsonencode(null), for a property whose null the API ignores, so the value read back never matches it. Native null and an omitted value are not affected.

func ResponseProperty added in v0.1.1362

func ResponseProperty(attributePath path.Path, body []byte, name string) (any, diag.Diagnostics)

ResponseProperty returns the named top-level property of the JSON object in body exactly as the API sent it. A missing property is nil, like a null one. A body that is not a JSON object is an error.

func SchemaAttributeToInterface added in v0.1.867

func SchemaAttributeToInterface(ctx context.Context, path path.Path, source attr.Value) (dest interface{}, diags diag.Diagnostics)

func SettleUnchangedPlan added in v0.1.1362

func SettleUnchangedPlan(config tfsdk.Config, state tfsdk.State, plan *tfsdk.Plan) error

SettleUnchangedPlan keeps prior state when the plan differs from it only in computed attributes that have no configuration and are unknown. Terraform proposes null for an omitted Optional and Computed typed object whose prior value has fields that are not Computed. The framework then marks every computed attribute without configuration unknown, although the object's UseStateForUnknown plan modifier keeps its prior value. Without this, every plan would show an update that changes nothing.

func SiblingDiscriminatorMatches added in v0.1.1362

func SiblingDiscriminatorMatches(discriminator string) validator.Object

SiblingDiscriminatorMatches requires a typed value to set the attribute named by its sibling discriminator, such as files_behavior.value under the name in behavior. Without it, a mismatch fails only at apply, when the request is built.

func TimeToStringType

func TimeToStringType(ctx context.Context, path path.Path, source *time.Time, dest *types.String) error

func ToDynamic

func ToDynamic(ctx context.Context, path path.Path, source any, plan attr.Value) (dest types.Dynamic, diags diag.Diagnostics)

func ToList added in v0.1.867

func ToList(ctx context.Context, path path.Path, source any, plan types.List) (types.List, diag.Diagnostics)

func ToMap added in v0.1.867

func ToMap(ctx context.Context, path path.Path, source any, plan types.Map) (types.Map, diag.Diagnostics)

func ToObject added in v0.1.867

func ToObject(ctx context.Context, path path.Path, source any, plan types.Object) (types.Object, diag.Diagnostics)

func UngroupStructuralUnionAtPath added in v0.1.867

func UngroupStructuralUnionAtPath(ctx context.Context, attributePath path.Path, source any, names []string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

func UnwrapDiscriminatedUnionAtPath added in v0.1.867

func UnwrapDiscriminatedUnionAtPath(ctx context.Context, attributePath path.Path, source any, names []string, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

UnwrapDiscriminatedUnionAtPath turns typed list union items, such as {"file_expiration": {"value": ...}}, into API items, such as {"behavior": "file_expiration", "value": ...}. Items that already have the discriminator are API items and stay as they are, so a Dynamic value can use either nesting.

func UnwrapSiblingDiscriminator added in v0.1.936

func UnwrapSiblingDiscriminator(_ context.Context, attributePath path.Path, source any, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

func ValidJSONEncoding added in v0.1.1362

func ValidJSONEncoding() validator.Dynamic

ValidJSONEncoding rejects a JSON-encoded string that does not decode, at plan time, for a property that stays Dynamic in every release. Native values and valid JSON strings pass without a warning.

func WrapDiscriminatedUnionAtPath added in v0.1.867

func WrapDiscriminatedUnionAtPath(ctx context.Context, attributePath path.Path, source any, names []string, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

WrapDiscriminatedUnionAtPath turns API list union items into typed items under their variant name. Items that are already typed, as in state that a Dynamic value stored with the typed nesting, stay as they are.

func WrapDiscriminatedUnionLikeConfigAtPath added in v0.1.1362

func WrapDiscriminatedUnionLikeConfigAtPath(ctx context.Context, attributePath path.Path, source any, configured attr.Value, names []string, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

WrapDiscriminatedUnionLikeConfigAtPath wraps an API list union item only where the configured item at the same position uses the typed nesting. A Dynamic value read back then keeps the nesting of each configured item.

func WrapLegacySingleItemAtPath added in v0.1.1362

func WrapLegacySingleItemAtPath(_ context.Context, attributePath path.Path, source any, names []string) (any, diag.Diagnostics)

WrapLegacySingleItemAtPath reads one stored item at a list marked x-files-legacy-single-item as a one-item list, so 5 becomes [5]. Lists and null stay as they are. The item conversion that follows still turns "5" into 5 and rejects values that are not valid items.

func WrapSiblingDiscriminator added in v0.1.936

func WrapSiblingDiscriminator(_ context.Context, attributePath path.Path, source any, discriminator string, variants []JSONSchemaVariant) (any, diag.Diagnostics)

Types

type JSONSchemaVariant added in v0.1.867

type JSONSchemaVariant struct {
	Name           string
	Value          string
	RootType       string
	Required       []string
	Allowed        []string
	Writable       []string
	WriteOnly      []string
	LegacyProperty string
	LegacyList     bool
	ValueTypes     map[string]string
}

type Logger

type Logger struct {
	Ctx context.Context
}

func (Logger) Debug

func (l Logger) Debug(msg string, args ...interface{})

func (Logger) Error

func (l Logger) Error(msg string, args ...interface{})

func (Logger) Info

func (l Logger) Info(msg string, args ...interface{})

func (Logger) Printf

func (l Logger) Printf(msg string, args ...interface{})

func (Logger) Warn

func (l Logger) Warn(msg string, args ...interface{})

type SortedElementString added in v0.1.184

type SortedElementString struct {
	basetypes.StringValue
}

func SortedElementStringValue added in v0.1.184

func SortedElementStringValue(value string) SortedElementString

func (SortedElementString) StringSemanticEquals added in v0.1.184

func (v SortedElementString) StringSemanticEquals(ctx context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)

func (SortedElementString) Type added in v0.1.184

type SortedElementStringType added in v0.1.184

type SortedElementStringType struct {
	basetypes.StringType
}

func (SortedElementStringType) Equal added in v0.1.184

func (SortedElementStringType) String added in v0.1.184

func (t SortedElementStringType) String() string

func (SortedElementStringType) ValueFromString added in v0.1.184

func (SortedElementStringType) ValueFromTerraform added in v0.1.184

func (t SortedElementStringType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

func (SortedElementStringType) ValueType added in v0.1.184

Jump to

Keyboard shortcuts

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