Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Card
This PR adds functionality to cloudfox to support resources in GCP projects. The currently supported resources are artifact registry, bigquery tables and datasets, cloud storage buckets, iam policy bindings, compute engine instances, and secrets.
Details
The code related to each cobra command is in its own file in gcp/commands/. In each of those files there is high level logic to parse command line arguments, call appropriate services that return a GCP resource data structure, and output or present the information using internal/output2.go. Each command file also houses the logic related to defining the CSV / JSON headers, content, and file names based on the data structure returned by service(s).
The code related to retrieving the resource information from the GCP API and structuring them in a custom struct, is in gcp/services/. There each service is named after a given resource type in GCP and attempts to exports few functions that will return data structures ready to be "outputted" by commands.
In addition to adding functionality to support the new resources, a new HandleOutput function was added to the internal/output2.go file that is a flexible way to WriteFullOutput for any command that wants to write to std out or in a file.
New functionality in the internal/log.go was also added from @bishopfaure gcp branch. We plan to coordinate on integrating his code into upcoming functionality for GCP related workflows.
Some strings were added in globals/gcp.go and globals/utils.go to facilitate their use throughout the tool.