transform

package
v0.80.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package transform provides helper methods to introspect and modify existing ARM templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAzureParametersFile

func BuildAzureParametersFile(content string) (string, error)

BuildAzureParametersFile will add the correct schema and contentversion information

func MapValues

func MapValues(m map[string]APIModelValue, setFlagValues []string)

MapValues converts an arraw of rwa ApiModel values (like ["masterProfile.count=4","linuxProfile.adminUsername=admin"]) to a map

func MergeValuesWithAPIModel

func MergeValuesWithAPIModel(apiModelPath string, m map[string]APIModelValue) (string, error)

MergeValuesWithAPIModel takes the path to an ApiModel JSON file, loads it and merges it with the values in the map to another temp file

func PrettyPrintArmTemplate

func PrettyPrintArmTemplate(template string) (string, error)

PrettyPrintArmTemplate will pretty print the arm template ensuring ordered by params, vars, resources, and outputs

func PrettyPrintJSON

func PrettyPrintJSON(content string) (string, error)

PrettyPrintJSON will pretty print the json into

func RemoveNsgDependency

func RemoveNsgDependency(logger *logrus.Entry, resourceName string, resourceMap map[string]interface{})

RemoveNsgDependency Removes the nsg dependency from the resource

Types

type APIModelValue

type APIModelValue struct {
	// contains filtered or unexported fields
}

APIModelValue represents a value in the APIModel JSON file

type Transformer

type Transformer struct {
	Translator Translator
}

Transformer represents the object that transforms template

func (*Transformer) NormalizeForK8sAddVMASPool

func (t *Transformer) NormalizeForK8sAddVMASPool(l *logrus.Entry, templateMap map[string]interface{}) error

NormalizeForK8sAddVMASPool takes a template and removes elements that are unwanted in a K8s VMAS add pool case

func (*Transformer) NormalizeForK8sSLBScalingOrUpgrade

func (t *Transformer) NormalizeForK8sSLBScalingOrUpgrade(logger *logrus.Entry, templateMap map[string]interface{}) error

NormalizeForK8sSLBScalingOrUpgrade takes a template and removes elements that are unwanted in a K8s Standard LB cluster scale up/down case

func (*Transformer) NormalizeForK8sVMASScalingUp

func (t *Transformer) NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]interface{}) error

NormalizeForK8sVMASScalingUp takes a template and removes elements that are unwanted in a K8s VMAS scale up/down case

func (*Transformer) NormalizeMasterResourcesForVMSSPoolUpgrade

func (t *Transformer) NormalizeMasterResourcesForVMSSPoolUpgrade(logger *logrus.Entry, templateMap map[string]interface{}) error

NormalizeMasterResourcesForVMSSPoolUpgrade removes superfluous template resources for upgrading VMSS nodes

func (*Transformer) NormalizeResourcesForK8sAgentUpgrade

func (t *Transformer) NormalizeResourcesForK8sAgentUpgrade(logger *logrus.Entry, templateMap map[string]interface{}, isMasterManagedDisk bool, agentPoolsToPreserve map[string]bool) error

NormalizeResourcesForK8sAgentUpgrade takes a template and removes elements that are unwanted in any scale/upgrade case

func (*Transformer) NormalizeResourcesForK8sMasterUpgrade

func (t *Transformer) NormalizeResourcesForK8sMasterUpgrade(logger *logrus.Entry, templateMap map[string]interface{}, isMasterManagedDisk bool, agentPoolsToPreserve map[string]bool) error

NormalizeResourcesForK8sMasterUpgrade takes a template and removes elements that are unwanted in any scale up/down case

func (*Transformer) RemoveImmutableResourceProperties

func (t *Transformer) RemoveImmutableResourceProperties(logger *logrus.Entry, templateMap map[string]interface{})

func (*Transformer) RemoveJumpboxResourcesFromTemplate

func (t *Transformer) RemoveJumpboxResourcesFromTemplate(logger *logrus.Entry, templateMap map[string]interface{}) error

func (*Transformer) RemoveKMSResourcesFromTemplate

func (t *Transformer) RemoveKMSResourcesFromTemplate(logger *logrus.Entry, templateMap map[string]interface{}) error

func (*Transformer) RemoveResourcesAndOutputsForScaling

func (t *Transformer) RemoveResourcesAndOutputsForScaling(logger *logrus.Entry, templateMap map[string]interface{}) error

RemoveResourcesAndOutputsForScaling takes a template and removes elements that are unwanted in any scale up/down case

type Translator

type Translator interface {
	// T translates a text string, based on GNU's gettext library.
	T(msgid string, vars ...interface{}) string
	// NT translates a text string into the appropriate plural form, based on GNU's gettext library.
	NT(msgid, msgidPlural string, n int, vars ...interface{}) string
	// Errorf produces an error with a translated error string.
	Errorf(msgid string, vars ...interface{}) error
	// NErrorf produces an error with a translated error string in the appropriate plural form.
	NErrorf(msgid, msgidPlural string, n int, vars ...interface{}) error
}

Translator defines all required interfaces for i18n.Translator.

Jump to

Keyboard shortcuts

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