Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "report", Short: "Generate inventory reports based on CAI outputs in a directory.", Long: `Generate inventory reports for resources in Cloud Asset Inventory (CAI) output files, with reports defined in rego (in '<path_to_cloud-foundation-toolkit>/reports/sample' folder). Example: cft report --query-path <path_to_cloud-foundation-toolkit>/reports/sample \ --dir-path <path-to-directory-containing-cai-export> \ --report-path <path-to-directory-for-report-output> `, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { err := GenerateReports(flags.dirName, flags.queryPath, flags.outputPath, viper.GetString("report-format")) if err != nil { return err } return nil }, }
Cmd represents the base report command
Functions ¶
func GenerateReports ¶
func GenerateReports(dirPath string, queryPath string, outputPath string, reportFormat string) error
GenerateReports takes raw CAI exports from <dirPath> directory, run rego queries defined <queryPath> directory, and generate output of <reportFormat> in <outputPath> directory
func ListAvailableReports ¶
ListAvailableReports lists the names of available reports in queryPath
func ReadFilesAndConcat ¶
ReadFilesAndConcat reads json files in a directory that are one object per row, and concats all objects into one single array
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.