resources

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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWaitTimeout = 5 * time.Minute
	DefaultBatchSize   = 50
)

Variables

This section is empty.

Functions

func WrapGcpInitClient added in v0.47.0

func WrapGcpInitClient[C any](fn GcpInitClientFunc[C]) func(r *resource.Resource[C], cfg any)

WrapGcpInitClient converts a GcpInitClientFunc to the generic InitClient signature. Panics on type assertion failure since that indicates a programming error.

Types

type GcpConfig added in v0.47.0

type GcpConfig struct {
	ProjectID string
	Region    string
}

GcpConfig holds the configuration needed to initialize a GCP resource, mirroring how AWS uses aws.Config as the init argument.

type GcpInitClientFunc added in v0.47.0

type GcpInitClientFunc[C any] func(r *resource.Resource[C], cfg GcpConfig)

GcpInitClientFunc is the type-safe client initialization function signature.

type GcpProjectResources added in v0.47.0

type GcpProjectResources struct {
	Resources map[string]GcpResources
}

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

func (*GcpProjectResources) GetRegion added in v0.47.0

func (g *GcpProjectResources) GetRegion(region string) GcpResources

func (*GcpProjectResources) MapResourceTypeToIdentifiers added in v0.47.0

func (g *GcpProjectResources) MapResourceTypeToIdentifiers() map[string][]string

MapResourceTypeToIdentifiers converts a slice of Resources to a map of resource types to their found identifiers

func (*GcpProjectResources) TotalResourceCount added in v0.47.0

func (g *GcpProjectResources) TotalResourceCount() int

TotalResourceCount returns the number of resources found, that are eligible for nuking

type GcpResource added in v0.47.0

type GcpResource interface {
	resource.NukeableResource
	Init(cfg GcpConfig)
}

GcpResource is an interface that represents a single GCP resource. This interface is satisfied by GcpResourceAdapter[C] which wraps resource.Resource[C].

func NewArtifactRegistryRepositories added in v0.47.0

func NewArtifactRegistryRepositories() GcpResource

NewArtifactRegistryRepositories creates a new Artifact Registry resource using the generic resource pattern.

func NewCloudFunctions added in v0.47.0

func NewCloudFunctions() GcpResource

NewCloudFunctions creates a new Cloud Functions resource using the generic resource pattern.

func NewGCSBuckets added in v0.47.0

func NewGCSBuckets() GcpResource

NewGCSBuckets creates a new GCS Buckets resource using the generic resource pattern.

func NewGcpResource added in v0.47.0

func NewGcpResource[C any](r *resource.Resource[C]) GcpResource

NewGcpResource creates a GcpResourceAdapter from a generic Resource.

func NewPubSubTopics added in v0.47.0

func NewPubSubTopics() GcpResource

NewPubSubTopics creates a new Pub/Sub topic resource using the generic resource pattern.

type GcpResourceAdapter added in v0.47.0

type GcpResourceAdapter[C any] struct {
	*resource.Resource[C]
}

GcpResourceAdapter wraps a generic Resource to satisfy the GcpResource interface.

func (*GcpResourceAdapter[C]) Init added in v0.47.0

func (g *GcpResourceAdapter[C]) Init(cfg GcpConfig)

Init initializes the resource with GCP configuration.

func (*GcpResourceAdapter[C]) Nuke added in v0.47.0

func (g *GcpResourceAdapter[C]) Nuke(ctx context.Context, identifiers []string) ([]resource.NukeResult, error)

Nuke deletes the resources with the given identifiers.

type GcpResources added in v0.47.0

type GcpResources struct {
	Resources []*GcpResource
}

GcpResources is a struct to hold multiple instances of GcpResource.

Jump to

Keyboard shortcuts

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