utils

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportStateContextUppercaseWrapper

func ImportStateContextUppercaseWrapper(wrappedFunc schema.StateContextFunc) schema.StateContextFunc

ImportStateContextUppercaseWrapper changes the ID of the resource to upper case before passing it to wrappedFunction

This wrapper is useful when resource ID is MikroTik's .id. Due to wierd behavior, listing via MikroTik's CLI reports lowercase .id, but find request with this id via API fails as it expects upper case string.

Usage in resource definition.

SDKv2

schema.Resource{
	Importer: &schema.ResourceImporter{
		StateContext: utils.ImportStateContextUppercaseWrapper(schema.ImportStatePassthroughContext),
	}
}

func ImportUppercaseWrapper added in v0.15.0

func ImportUppercaseWrapper(wrappedFunc importStateFunc) importStateFunc

ImportUppercaseWrapper is ImportStateContextUppercaseWrapper equivalent for PluginFramework.

func MikrotikStructToTerraformModel added in v0.12.0

func MikrotikStructToTerraformModel(ctx context.Context, src client.Resource, dest interface{}) error

MikrotikStructToTerraformModel is a wrapper for copyStruct() to ensure proper src/dest typing

func ParseBool

func ParseBool(v string) (bool, error)

ParseBool is wrapper around strconv.ParseBool to save few lines of code

func TerraformModelToMikrotikStruct added in v0.12.0

func TerraformModelToMikrotikStruct(ctx context.Context, src interface{}, dest client.Resource) error

TerraformModelToMikrotikStruct is a wrapper for copyStruct() to ensure proper src/dest typing

Types

This section is empty.

Jump to

Keyboard shortcuts

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