shared

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTimeout

func DefaultTimeout() time.Duration

func Is404

func Is404(err error) bool

func IsIPv4

func IsIPv4(str string) bool

IsIPv4 checks if the string is an IP version 4. Original function from https://pkg.go.dev/github.com/asaskevich/govalidator#IsIPv4 Shamelessly copied here to avoid importing the entire package

func IsIPv6

func IsIPv6(str string) bool

IsIPv6 checks if the string is an IP version 6. Original function from https://pkg.go.dev/github.com/asaskevich/govalidator#IsIPv6 Shamelessly copied here to avoid importing the entire package

func NewNameOrIdList

func NewNameOrIdList(nameOrIDs types.Set) ([]oxide.NameOrId, diag.Diagnostics)

NewNameOrIdList takes a terraform set and converts is into a slice NameOrIds.

func ReplaceBackticks

func ReplaceBackticks(s string) string

ReplaceBackticks replaces ” with `. It can be used to defined codeblocks in markdown raw strings.

var mdString = ReplaceBackticks(`this is a ''code'' block`)

func RequiresReplaceUnlessEmptyStringOrNull

func RequiresReplaceUnlessEmptyStringOrNull() stringplanmodifier.RequiresReplaceIfFunc

RequiresReplaceUnlessEmptyStringOrNull returns a resource.RequiresReplaceIfFunc that returns true unless the change is from an empty string or null.

This is particularly helpful for creating new nested objects that cannot be modified themselves, but it is possible to add or remove them.

func SliceDiff

func SliceDiff[S []E, E any](a, b S) S

SliceDiff returns a slice of the elements in `a` that aren't in `b`. This function is a bit expensive, but given the fact that the expected number of elements is relatively slow it's not a big deal.

func SliceDiffByID

func SliceDiffByID[S []E, E any](a, b S, idFn func(E) any) S

SliceDiffByID is similar to SliceDiff but takes idFn, which should return a value used to identity slice elements.

Types

This section is empty.

Jump to

Keyboard shortcuts

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