Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldAddResourceToWatchlist ¶
ShouldAddResourceToWatchlist determines whether a Resource should be watched by checking if its name matches the skip filter or name filter regex from the ResourceConfig and ReaperConfig. If a resource matches both the skip filter and name filter, then the skip filter wins and the resource will NOT be watched. An empty string for the skip filter will be interpreted as unset, and therefore will not match any resources.
Types ¶
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock is a mock struct for handling time dependency for tests.
type Resource ¶
type Resource struct { Name string Zone string TimeCreated time.Time Type reaperconfig.ResourceType }
A Resource represents a single GCP resource instance of any type supported by the Reaper.
func NewResource ¶
func NewResource(name, zone string, timeCreated time.Time, resourceType reaperconfig.ResourceType) *Resource
NewResource constructs a Resource struct.
type WatchedResource ¶
WatchedResource represents a resource that the Reaper is monitoring.
func CreateWatchlist ¶
func CreateWatchlist(resources []*Resource, ttl string) []*WatchedResource
CreateWatchlist creates a list of WatchedResources with a given time to live (TTL).
func NewWatchedResource ¶
func NewWatchedResource(resource *Resource, ttl string) *WatchedResource
NewWatchedResource constructs a WatchedResource.
func (*WatchedResource) FreezeClock ¶
func (resource *WatchedResource) FreezeClock(instant time.Time)
FreezeClock sets the clock's current time to instant. This is to be used during testing.
func (*WatchedResource) GetDeletionTime ¶
func (resource *WatchedResource) GetDeletionTime() (time.Time, error)
func (*WatchedResource) IsReadyForDeletion ¶
func (resource *WatchedResource) IsReadyForDeletion() bool
IsReadyForDeletion returns if a WatchedResource is past its time to live (TTL) based of the current time of the Clock.