Documentation
¶
Overview ¶
The content of this file was copied from https://stackoverflow.com/questions/51779243/copy-a-folder-in-go
Index ¶
- Constants
- func AddDefaultPlacementBindingsToNSFile(namespaceFilePath, outputDir string, policiesNamespaces map[string]bool) (err error)
- func AddSourceCRsInTemplateDir(allFilesInInputPath, preRenderSourceCRList []string, ...) (err error)
- func CommentOutMCPLines(inputFile string) (outputFile string, patchList []map[string]interface{}, err error)
- func Copy(src, dst string) (int64, error)
- func CopyAndProcessNSAndKustomizationYAML(nsFilePath, inputFile, outputDir string, skipUpdateNs bool, ...) (err error)
- func CopyDirectory(scrDir, dest string) error
- func CopySourceCrs(outputDir string, preRenderSourceCRList []string) (err error)
- func CopySymLink(source, dest string) error
- func CreateIfNotExists(dir string, perm os.FileMode) error
- func Exists(filePath string) bool
- func GetAllYAMLFilesInPath(path string) (files []string, err error)
- func GetTemplatePaths(baseDir, pgtFilePath, outputDir string) (relativePathTemplate, acmTemplateDir string, err error)
- func PrefixLastPathComponent(originalPath, prefix string) string
- func RenameACMPGsInAllKustomization(inputFile, outputDir string) (err error)
- func RenameACMPGsInKustomization(relativeFilePath, inputDir, outputDir string) (err error)
- func RenderMCPLines(inputFile, mcp string) (outputFile string, err error)
- type AnnotationsOnly
- type KindType
- type Kustomization
- type MetaData
Constants ¶
const ( DefaultFileWritePermissions = 0o600 DefaultDirWritePermissions = 0o755 ACMPrefix = "acm-" SourceCRsDir = "source-crs" KustomizationFileName = "kustomization.yaml" NamespaceFileName = "ns.yaml" )
Variables ¶
This section is empty.
Functions ¶
func AddDefaultPlacementBindingsToNSFile ¶
func AddDefaultPlacementBindingsToNSFile(namespaceFilePath, outputDir string, policiesNamespaces map[string]bool) (err error)
AddDefaultPlacementBindingsToNSFile Adds the default placement bindings for ACM Policy Generator
func AddSourceCRsInTemplateDir ¶
func AddSourceCRsInTemplateDir(allFilesInInputPath, preRenderSourceCRList []string, inputFile, outputDir string) (err error)
AddSourceCRsInTemplateDir Adds a source-crs directory in each directory containing a template (PGT or ACM policy generator)
func CommentOutMCPLines ¶
func CommentOutMCPLines(inputFile string) (outputFile string, patchList []map[string]interface{}, err error)
CommentOutMCPLines Comments out lines containing the "$mcp" keyword
func Copy ¶
Copy function found at https://opensource.com/article/18/6/copying-files-go
func CopyAndProcessNSAndKustomizationYAML ¶
func CopyAndProcessNSAndKustomizationYAML(nsFilePath, inputFile, outputDir string, skipUpdateNs bool, policiesNamespaces map[string]bool) (err error)
CopyAndProcessNSAndKustomizationYAML Performs post processing on ns.yaml and Kustomization.yaml files
func CopyDirectory ¶
CopyDirectory Recursively content of a directory
func CopySourceCrs ¶
CopySourceCrs Copies source CRs to the output ACMPG Directory
func CreateIfNotExists ¶
CreateIfNotExists Creates a directory if it does not exist
func GetAllYAMLFilesInPath ¶
GetAllYAMLFilesInPath Gets All Yaml files in a path
func GetTemplatePaths ¶
func GetTemplatePaths(baseDir, pgtFilePath, outputDir string) (relativePathTemplate, acmTemplateDir string, err error)
GetTemplatePaths gets the path of - the template relative to the base ipnut directory - the output template full directory
func PrefixLastPathComponent ¶
PrefixLastPathComponent Prefixes the file referred to by a path with a given prefix
func RenameACMPGsInAllKustomization ¶
RenameACMPGsInAllKustomization Updates all the old PGT names to ACM PolicyGen format in kustomization file
func RenameACMPGsInKustomization ¶
RenameACMPGsInKustomization copy kustomization.yaml to output directory while renaming policies
func RenderMCPLines ¶
RenderMCPLines Replaces the "$mcp" keyword with the mcp string (worker or master)
Types ¶
type AnnotationsOnly ¶
type AnnotationsOnly struct {
Metadata MetaData `yaml:"metadata"`
}
func GetAnnotationsOnly ¶
func GetAnnotationsOnly(filePath string) (annotations AnnotationsOnly, err error)
GetAnnotationsOnly Gets the manifest kind from the file
type KindType ¶
type KindType struct {
Kind string `yaml:"kind"`
}
Type used to parse the Kind of a K8s Manifest
func GetManifestKind ¶
GetManifestKind Gets the manifest kind from the file