utils

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigTemplate

func ConfigTemplate(driverConfig *eUtils.DriverConfig,
	modifier *helperkv.Modifier,
	emptyFilePath string,
	secretMode bool,
	project string,
	service string,
	cert bool,
	zc bool) (string, map[int]string, bool, error)

ConfigTemplate takes a modifier object, a file path where the template is located, the target path, and two maps of data to populate the template with. It configures the template and writes it to the specified file path.

func ConfigTemplateRaw

func ConfigTemplateRaw(driverConfig *eUtils.DriverConfig, mod *helperkv.Modifier, emptyFilePath string, configuredFilePath string, secretMode bool, project string, service string, cert bool, zc bool, exitOnFailure bool) ([]byte, error)

ConfigTemplateRaw - gets a raw unpopulated template.

func FilterPaths

func FilterPaths(templatePaths []string, endPaths []string, fileFilter []string, prefix bool) ([]string, []string)

FilterPaths -- filters based on provided fileFilter

func GenerateConfigsFromVault

func GenerateConfigsFromVault(ctx eUtils.ProcessContext, configCtx *eUtils.ConfigContext, driverConfig *eUtils.DriverConfig) (interface{}, error)

GenerateConfigsFromVault configures the templates in trc_templates and writes them to trcconfig

func GetPathsFromProject

func GetPathsFromProject(config *core.CoreConfig, mod *helperkv.Modifier, projects []string, services []string) ([]string, error)

func GetProjectService

func GetProjectService(driverConfig *eUtils.DriverConfig, templateFile string) (string, string, string)

GetProjectService - returns project, service, and path to template on filesystem. templateFile - full path to template file returns project, service, templatePath

func GetTemplate

func GetTemplate(driverConfig *eUtils.DriverConfig, modifier *helperkv.Modifier, templatePath string) (string, error)

GetTemplate makes a request to the vault for the template found in <project>/<service>/<file>/template-file Returns the template data in base64 and the template's extension. Returns any errors generated by vault

func PopulateTemplate

func PopulateTemplate(driverConfig *eUtils.DriverConfig,
	emptyTemplate string,
	modifier *helperkv.Modifier,
	secretMode bool,
	project string,
	service string,
	filename string,
	cert bool) (string, map[int]string, error)

PopulateTemplate takes an empty template and a modifier. It populates the template and returns it in a string.

Types

type ConfigDataStore

type ConfigDataStore struct {
	Regions []string
	// contains filtered or unexported fields
}

ConfigDataStore stores the data needed to configure the specified template files

func (*ConfigDataStore) GetConfigValue

func (cds *ConfigDataStore) GetConfigValue(service string, config string, key string) (string, bool)

GetConfigValue gets an invididual configuration value for a service from the data store.

func (*ConfigDataStore) GetConfigValues

func (cds *ConfigDataStore) GetConfigValues(service string, config string) (map[string]interface{}, bool)

GetConfigValues gets a set of configuration values for a service from the data store.

func (*ConfigDataStore) GetValue

func (cds *ConfigDataStore) GetValue(service string, keyPath []string, key string) (string, error)

GetValue Provides data from the vault

func (*ConfigDataStore) Init

func (cds *ConfigDataStore) Init(config *core.CoreConfig,
	mod *helperkv.Modifier,
	secretMode bool,
	useDirs bool,
	project string,
	commonPaths []string,
	servicesWanted ...string) error

func (*ConfigDataStore) InitTemplateVersionData

func (cds *ConfigDataStore) InitTemplateVersionData(config *core.CoreConfig, mod *helperkv.Modifier, useDirs bool, project string, file string, servicesWanted ...string) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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