tools

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 10

Documentation

Overview

Package tools contains various functions to help with processing of the templates

Index

Constants

This section is empty.

Variables

View Source
var PolicyAsHCL bool

PolicyAsHCL means that content of the policy will be generated using HCL instead of JSON file

Functions

func CheckFiles

func CheckFiles(files ...string) error

CheckFiles verifies if all given files doesn't exist in filesystem

func CreateTFFilename

func CreateTFFilename(resourceName string, tfWorkPath string) string

CreateTFFilename creates full tf file path

func DecorateWithMultilineHandlingFunctions added in v1.10.0

func DecorateWithMultilineHandlingFunctions(additionalFuncs map[string]any) template.FuncMap

DecorateWithMultilineHandlingFunctions adds necessary functions to escape multiline fields in exported terraform files.

func Escape added in v1.5.0

func Escape(str string) string

Escape is correcting values stored in terraform fields by escaping special characters

func EscapeName added in v0.9.0

func EscapeName(s string) (string, error)

EscapeName takes a string and makes it suitable for a tf resource instance name USAGE EXAMPLE: resource "akamai_appsec_waf_mode" "{{ escapename $policyName }}" {

func Float64Ptr

func Float64Ptr(f float64) *float64

Float64Ptr returns the address of the float64

func GetEOT added in v1.10.0

func GetEOT(str string) string

GetEOT generates unique delimiter word for heredoc, by default it is EOT

func Int64Ptr added in v0.9.0

func Int64Ptr(i int64) *int64

Int64Ptr returns the address of the int64

func IntPtr added in v0.9.0

func IntPtr(i int) *int

IntPtr returns the address of the int

func IsMultiline added in v1.10.0

func IsMultiline(str string) bool

IsMultiline returns true if the input string contains at least one new line character

func NoNewlineAtTheEnd added in v1.10.0

func NoNewlineAtTheEnd(str string) bool

NoNewlineAtTheEnd returns true if there is no new line character at the end of the string

func RemoveLastNewline added in v1.10.0

func RemoveLastNewline(str string) string

RemoveLastNewline removes the new line character if this is the last character in the string

func StringPtr

func StringPtr(s string) *string

StringPtr returns the address of the string

func ToJSON added in v0.9.0

func ToJSON(o interface{}) (string, error)

ToJSON returns a JSON representation of the given object USAGE EXAMPLE: "bypassNetworkLists": {{ tojson .BypassNetworkLists }},

func ToList added in v0.9.0

func ToList(l []string) string

ToList returns a list as a comma delimited string USAGE EXAMPLE: security_policy_ids = [ {{ tolist .Siem.FirewallPolicyIds }} ]

Types

This section is empty.

Jump to

Keyboard shortcuts

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