gcp

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalRegion = "global"

GlobalRegion is the region name used for GCP resources that are not region-scoped.

Variables

This section is empty.

Functions

func IsNukeable added in v0.47.0

func IsNukeable(resourceType string, resourceTypes []string, excludeResourceTypes []string) bool

IsNukeable checks whether a resource type should be nuked based on the requested resource types and exclude lists. An empty include list or the special value "all" means nuke everything, minus any excluded types.

func ListResourceTypes

func ListResourceTypes() []string

ListResourceTypes returns a sorted list of resources which can be passed to --resource-type

func NukeAllResources

func NukeAllResources(ctx context.Context, account *GcpProjectResources, regions []string, collector *reporting.Collector) error

NukeAllResources nukes all GCP resources across the given regions.

Types

type GcpConfig added in v0.47.0

type GcpConfig = resources.GcpConfig

GcpConfig holds the configuration needed to initialize a GCP resource.

type GcpProjectResources

type GcpProjectResources = resources.GcpProjectResources

GcpProjectResources is a struct that represents the resources found in a single GCP project.

func GetAllResources

func GetAllResources(ctx context.Context, query *Query, configObj config.Config, collector *reporting.Collector) (*GcpProjectResources, error)

GetAllResources lists all GCP resources that can be deleted.

type GcpResource

type GcpResource = resources.GcpResource

GcpResource is an interface that represents a single GCP resource.

func GetAllRegisteredResources added in v0.47.0

func GetAllRegisteredResources() []*GcpResource

GetAllRegisteredResources returns pointers to all registered GCP resources (both global and regional), without initializing them.

func GetAndInitRegisteredResources added in v0.47.0

func GetAndInitRegisteredResources(cfg resources.GcpConfig, region string) []*GcpResource

GetAndInitRegisteredResources returns initialized GCP resources for the given region. Global resources are returned for GlobalRegion; regional resources for any other region.

type GcpResources

type GcpResources = resources.GcpResources

GcpResources is a struct to hold multiple instances of GcpResource.

type Query added in v0.47.0

type Query struct {
	ProjectID            string
	ResourceTypes        []string
	ExcludeResourceTypes []string
	Regions              []string
	ExcludeRegions       []string
	ExcludeAfter         *time.Time
	IncludeAfter         *time.Time
	Timeout              *time.Duration
	ExcludeFirstSeen     bool
}

Query represents the desired parameters for scanning GCP resources. This mirrors the aws.Query struct for interface consistency.

func (*Query) Validate added in v0.47.0

func (q *Query) Validate() error

Validate ensures the query has valid defaults. If no regions are specified, it defaults to GlobalRegion. ExcludeRegions are filtered out from the region list.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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