inout

package
v0.0.0-...-4464eaa Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package inout contains functions that deal with io operations, reading and writing the contents of the files generated by [scf]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTfmoduleEntryPoints

func CheckTfmoduleEntryPoints(yaml YamlMapping)

func ReadMultipleResourceGroups

func ReadMultipleResourceGroups(src string, newFolder string) (string, string)

func WriteToCsv

func WriteToCsv(resources []CsvResources, filename string)

WriteToCsv it takes the structure []CsvResources and writes it into the csv filename provided

func WriteToFile

func WriteToFile(content string, path string, success string)

WriteToFile It takes the content, the filename path and a success string and writes the content to the file and prints the success string

func WriteYaml

func WriteYaml(filename string, resources []ModuleResource)

WriteYaml It takes an filename and the resources and transform them to module syntax to write the Yaml file

Types

type BackendConf

type BackendConf struct {
	Resource_group_name  string `yaml:"resource_group_name"`
	Storage_account_name string `yaml:"storage_account_name"`
	Container_name       string `yaml:"container_name"`
	Key_prefix           string `yaml:"key_prefix"`
}

type BlockInnerKey

type BlockInnerKey struct {
	MainKey        string `json:"MainKey"`
	InnerKey       string `json:"InnerKey"`
	SecondInnerKey string `json:"SecondInnerKey"`
	Line           string `json:"Line"`
}

type CommonVar

type CommonVar struct {
	Name  string
	Value []string
}

type CsvResources

type CsvResources struct {
	Resource string `json:"Resource"`
	Module   string `json:"Module"`
	Quantity int    `json:"Quantity"`
}

type Imports

type Imports struct {
	Resource_key int
	Resource_id  string
}

type ModuleResource

type ModuleResource struct {
	Module       string
	ResourceType string
	Quantity     string
}

func ParseCSV

func ParseCSV(filename string) []ModuleResource

ParseCSV read the csv file provided and parse each resource with is module into an array of structured ModuleResource

type Modules

type Modules struct {
	Name       string   `yaml:"name"`
	EntryPoint string   `yaml:"entry_point"`
	Resources  []string `yaml:"resources"`
}

type Outputs

type Outputs struct {
	OuputModule     string
	OputputResource string
	OuptutModuleRef string
}

type ParsedTf

type ParsedTf struct {
	Providers []string
	Resources []string
}

func ReadTf

func ReadTf(raw []byte) ParsedTf

ReadTf parses the contents provided of the raw []byte and returns a structure of ParsedTf with the providers and resources

func ReadTfFiles

func ReadTfFiles(fileName string) ParsedTf

ParseConfig read the contents of the tf files and parses into a ParsedTf structure

type Resource

type Resource struct {
	ResourceID   string `json:"resource_id"`
	ResourceType string `json:"resource_type"`
	ResourceName string `json:"resource_name"`
}

func JsonParser

func JsonParser(fileName string) []Resource

JsonParser read the json file provided and parse each resource into an array of structured Resource

type Template

type Template struct {
	//Subscription_ID   string //no
	UnmappedResources []string
	NotFoundResources []UnmappedOutputs
	FoundResources    []UnmappedOutputs
}

type UnmappedOutputs

type UnmappedOutputs struct {
	ResourceName     string
	ResourceVariable string
}

type YamlMapping

type YamlMapping struct {
	Modules    []Modules   `yaml:"modules"`
	CommonVars []CommonVar `yaml:"common"`
	Confg      []string    `yaml:"config"`
	Backend    BackendConf `yaml:"backend"`
}
var Yaml_mapping YamlMapping

func ParseConfig

func ParseConfig(conf []byte) YamlMapping

ParseConfig parses the contents of the provided yaml file into a YamlMapping structure

func ReadConfig

func ReadConfig(fileName string) YamlMapping

ReadConfig creates a structured YamlMapping to use in tfvars, variables, modules, etc.

Jump to

Keyboard shortcuts

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