utils

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 11 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 MikrotikStructToTerraformModel added in v0.12.0

func MikrotikStructToTerraformModel(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(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