Documentation
¶
Index ¶
- Constants
- type Cleaner
- func (c *Cleaner) CheckGitHubJobsCompleted(ctx context.Context, repository, runID, token string) (bool, error)
- func (c *Cleaner) CleanupVPC(ctx context.Context, vpcID string) error
- func (c *Cleaner) DeleteVPCResources(ctx context.Context, vpcID string) error
- func (c *Cleaner) GetTagValue(ctx context.Context, vpcID, key string) (string, error)
- type CleanerOption
- type GitHubJobsResponse
Constants ¶
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 ¶
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 ¶
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 ¶
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.
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