cleanup

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultOperationTimeout is the default timeout for individual AWS API operations
	DefaultOperationTimeout = 30 * time.Second
	// DefaultInstanceTerminationTimeout is the timeout for waiting for instances to terminate
	DefaultInstanceTerminationTimeout = 10 * time.Minute
	// DefaultVPCDeleteRetryDelay is the delay between VPC deletion retries
	DefaultVPCDeleteRetryDelay = 30 * time.Second
)

Default timeouts for cleanup operations

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

type Cleaner struct {
	// contains filtered or unexported fields
}

Cleaner handles cleanup of AWS resources

func New

func New(log *logger.FunLogger, region string,
	opts ...CleanerOption) (*Cleaner, error)

New creates a new AWS resource cleaner. Optional functional options can be provided to customize the cleaner, such as injecting a mock EC2 client for testing.

func (*Cleaner) CheckGitHubJobsCompleted

func (c *Cleaner) CheckGitHubJobsCompleted(ctx context.Context, repository, runID, token string) (bool, error)

CheckGitHubJobsCompleted checks if all GitHub jobs are completed. The provided context controls cancellation and timeout for the HTTP request.

func (*Cleaner) CleanupVPC

func (c *Cleaner) CleanupVPC(ctx context.Context, vpcID string) error

CleanupVPC checks job status and deletes VPC resources if jobs are completed. The provided context controls cancellation and timeout for all operations.

func (*Cleaner) DeleteVPCResources

func (c *Cleaner) DeleteVPCResources(ctx context.Context, vpcID string) error

DeleteVPCResources deletes all resources associated with a VPC. The provided context controls cancellation and timeout for all operations. If the context is cancelled, cleanup will stop and return an error.

func (*Cleaner) GetTagValue

func (c *Cleaner) GetTagValue(ctx context.Context, vpcID, key string) (string, error)

GetTagValue retrieves a tag value for a given VPC. The provided context controls cancellation and timeout for the AWS API call.

type CleanerOption

type CleanerOption func(*Cleaner)

CleanerOption is a functional option for configuring the Cleaner.

func WithEC2Client

func WithEC2Client(client internalaws.EC2Client) CleanerOption

WithEC2Client sets a custom EC2 client for the Cleaner. This is primarily used for testing to inject mock clients.

func WithELBv2Client added in v0.3.1

func WithELBv2Client(client internalaws.ELBv2Client) CleanerOption

WithELBv2Client sets a custom ELBv2 client for the Cleaner. This is primarily used for testing to inject mock clients.

type GitHubJobsResponse

type GitHubJobsResponse struct {
	Jobs []struct {
		Status string `json:"status"`
	} `json:"jobs"`
}

GitHubJobsResponse represents the GitHub API response for job status

Jump to

Keyboard shortcuts

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