utils

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConnectionSchema

func AddConnectionSchema(providedSchema map[string]*schema.Schema)

Returns the common connection schema for all the Elasticsearch resources, which defines the fields which can be used to configure the API access

func CheckError

func CheckError(res *esapi.Response, errMsg string) sdkdiag.Diagnostics

func CheckHttpError added in v0.6.0

func CheckHttpError(res *http.Response, errMsg string) sdkdiag.Diagnostics

func CheckHttpErrorFromFW added in v0.11.0

func CheckHttpErrorFromFW(res *http.Response, errMsg string) fwdiag.Diagnostics

func ConvertSettingsKeyToTFFieldKey added in v0.5.0

func ConvertSettingsKeyToTFFieldKey(settingKey string) string

func DiffIndexSettingSuppress added in v0.2.0

func DiffIndexSettingSuppress(k, old, new string, d *schema.ResourceData) bool

func DiffJsonSuppress

func DiffJsonSuppress(k, old, new string, d *schema.ResourceData) bool

func DiffNullMapEntriesSuppress added in v0.6.0

func DiffNullMapEntriesSuppress(key, old, new string, d *schema.ResourceData) bool

func ExpandIndividuallyDefinedSettings added in v0.5.0

func ExpandIndividuallyDefinedSettings(ctx context.Context, d *schema.ResourceData, settingsKeys map[string]schema.ValueType) map[string]interface{}

func ExpandStringSet added in v0.4.0

func ExpandStringSet(set *schema.Set) []string

func FlattenMap

func FlattenMap(m map[string]interface{}) map[string]interface{}

Flattens the multilevel map, and concatenates keys together with dot "." # Examples map of form:

map := map[string]interface{}{
        "index": map[string]interface{}{
                "key": 1
        }
}

becomes:

map := map[string]interface{}{
        "index.key": 1
}

func FlipMap added in v0.7.0

func FlipMap[K comparable, V comparable](m map[K]V) map[V]K

func FormatStrictDateTime added in v0.5.0

func FormatStrictDateTime(t time.Time) string

func IsEmpty

func IsEmpty(v interface{}) bool

func JSONBytesEqual

func JSONBytesEqual(a, b []byte) (bool, error)

Compares the JSON in two byte slices

func MapsEqual

func MapsEqual(m1, m2 interface{}) bool

func MergeSchemaMaps

func MergeSchemaMaps(maps ...map[string]*schema.Schema) map[string]*schema.Schema

func NewDebugTransport added in v0.6.2

func NewDebugTransport(name string, transport http.RoundTripper) *debugRoundTripper

func NormalizeIndexSettings added in v0.2.0

func NormalizeIndexSettings(m map[string]interface{}) map[string]interface{}

func Pointer added in v0.6.0

func Pointer[T any](value T) *T

func PrettyPrintJSONLines added in v0.6.0

func PrettyPrintJSONLines(b []byte) string

PrettyPrintJSONLines iterates through a []byte line-by-line, transforming any lines that are complete json into pretty-printed json.

func StringIsDuration added in v0.6.0

func StringIsDuration(i interface{}, k string) (warnings []string, errors []error)

StringIsDuration is a SchemaValidateFunc which tests to make sure the supplied string is valid duration.

func StringIsElasticDuration added in v0.6.0

func StringIsElasticDuration(i interface{}, k string) (warnings []string, errors []error)

StringIsElasticDuration is a SchemaValidateFunc which tests to make sure the supplied string is valid duration using Elastic time units: d, h, m, s, ms, micros, nanos. (see https://www.elastic.co/guide/en/elasticsearch/reference/current/api-conventions.html#time-units)

func StringToHash added in v0.3.0

func StringToHash(s string) (*string, error)

func TestCheckResourceListAttr added in v0.4.0

func TestCheckResourceListAttr(name, key string, values []string) resource.TestCheckFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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