templateUtils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TerraformerTemplates = "services/terraformer/templates"
	AnsiblerTemplates    = "services/ansibler/templates"
	KuberTemplates       = "services/kuber/templates"
	KubeElevenTemplates  = "services/kube-eleven/templates"
	TestingTemplates     = "templates" //due to how tests are run, the path to templates is absolute to testing-framework directory
)

Variables

This section is empty.

Functions

func AssignPriority

func AssignPriority(index int) int

AssignPriority returns a priority for firewall rule with basePriority + index

func EnableAccNet

func EnableAccNet(vmSize string) string

EnableAccNet will check if accelerated networking can be enabled based on conditions specified here https://azure.microsoft.com/en-us/updates/accelerated-networking-in-expanded-preview/ we will look only at VM sizes, since all regions are supported now all reasonable operating systems

func ExtractNetmaskFromCIDR added in v0.1.2

func ExtractNetmaskFromCIDR(cidr string) string

ExtractNetmaskFromCIDR extracts the netmask from the CIDR notation.

func ExtractTargetPorts

func ExtractTargetPorts(loadBalancers []*pb.LBcluster) []int

ExtractTargetPorts extracts target ports defined inside the role in the LoadBalancer.

func GetCIDR

func GetCIDR(baseCIDR string, position, value int) string

GetCIDR function returns CIDR in IPv4 format, with position replaced by value The function does not check if it is a valid CIDR/can be used in subnet spec Example GetCIDR("10.0.0.0/8", 2, 1) will return "10.0.1.0/8" GetCIDR("10.0.0.0/8", 3, 1) will return "10.0.0.1/8"

func IsMissing

func IsMissing[K comparable](item K, items []K) bool

IsMissing checks if item is missing in the list of items.

func ProtocolNameToAzureProtocolString

func ProtocolNameToAzureProtocolString(protocol string) string

ProtocolNameToAzureProtocolString returns string constants for transport protocols

func ProtocolNameToOCIProtocolNumber

func ProtocolNameToOCIProtocolNumber(protocol string) int

ProtocolNameToOCIProtocolNumber translates between a string version of a protocol to a number version that can be used within OCI. More info in the following link: https://docs.oracle.com/en-us/iaas/tools/terraform-provider-oci/4.96/docs/r/core_security_list.html

Types

type TemplateLoader

type TemplateLoader struct {
	Directory string
}

directory - template directory MUST be relative to base directory, i.e. services/terraformer/etc

func (TemplateLoader) LoadTemplate

func (tl TemplateLoader) LoadTemplate(tplFile string) (*template.Template, error)

loads the template from directory specified in TemplateLoader the directory MUST be relative to base directory, i.e. services/terraformer/templates

type Templates

type Templates struct {
	Directory string
}

directory - output directory MUST be relative to base directory, i.e. services/terraformer/etc

func (Templates) Generate

func (t Templates) Generate(tpl *template.Template, outputFile string, d interface{}) error

creates a file from template and saves it to the directory specified in Templates the directory MUST be relative to base directory, i.e. services/terraformer/templates

func (Templates) GenerateToString

func (t Templates) GenerateToString(tpl *template.Template, d interface{}) (string, error)

creates a file from template and returns it as a string variable returns error if not successful, generated template as a string and nil otherwise

Jump to

Keyboard shortcuts

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