util

package
v1.60.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastInt

func CastInt(v any) int

func CastInt64

func CastInt64(v any) int64

func Dedent added in v1.55.0

func Dedent(s string) string

Dedent is a helper function that dedent a tab indented text. The first line defines the number of tabs to remove for the rest of the text.

func FormatID

func FormatID[T ~int | ~int64](v T) string

func InvalidImportID added in v1.54.0

func InvalidImportID(expected string, id string) diag.Diagnostic

func MarkdownDescription added in v1.55.0

func MarkdownDescription(s string) string

MarkdownDescription is a helper function that transforms a Go friendly markdown text into real markdown.

- Dedent the description - Replace 2 single quote with a backtick

func ParseID

func ParseID(v string) (int64, error)

func SetSchemaFromAttributes

func SetSchemaFromAttributes(d *schema.ResourceData, attrs map[string]any)

func TitleCase added in v1.56.0

func TitleCase(s string) string

Types

type ModelFromAPI added in v1.54.0

type ModelFromAPI[API any] interface {
	FromAPI(ctx context.Context, hc API) diag.Diagnostics
}

ModelFromAPI defines a model than can be read from an API resource.

type ModelFromTerraform added in v1.54.0

type ModelFromTerraform[TF any] interface {
	FromTerraform(ctx context.Context, tf TF) diag.Diagnostics
}

ModelFromTerraform defines a model than can be read from a Terraform type.

type ModelToAPI added in v1.54.0

type ModelToAPI[API any] interface {
	ToAPI(ctx context.Context) (API, diag.Diagnostics)
}

ModelToAPI defines a model than can be written to an API resource.

type ModelToTerraform added in v1.54.0

type ModelToTerraform[TF any] interface {
	ToTerraform(ctx context.Context) (TF, diag.Diagnostics)
}

ModelToTerraform defines a model than can be written to a Terraform type.

Jump to

Keyboard shortcuts

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