action

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAllZonesNotAllowed         = errors.New("all regions is not allowed")
	ErrZonesRequired              = errors.New("regions is required")
	ErrAgeInHoursInvalid          = errors.New("age in hours is invalid")
	ErrCredentialsRequired        = errors.New("credentials are required")
	ErrProjectIDRequired          = errors.New("project id is required")
	ErrResourceLabelKeyRequired   = errors.New("resource label key is required")
	ErrResourceLabelValueRequired = errors.New("resource label value is required")
)

Functions

func Log

func Log(msg string, a ...interface{})

Log will write a log entry to stdout.

func LogDebug

func LogDebug(msg string, a ...interface{})

LogDebug will write a debug message command to stdout.

func LogError

func LogError(msg string, a ...interface{})

LogError will write a error message command to stdout.

func LogErrorAndExit

func LogErrorAndExit(msg string, a ...interface{})

LogErrorAndExit will write a error message command to stdout and exit with a non-zero exit code.

func LogWarning

func LogWarning(msg string, a ...interface{})

LogWarning will write a warning message command to stdout.

Types

type Cleaner

type Cleaner struct {
	Service string
	Run     CleanupFunc
}

type CleanupFunc

type CleanupFunc func(ctx context.Context, input *CleanupScope) error

type CleanupScope

type CleanupScope struct {
	CredentialsJSON    []byte
	Zones              []string
	ProjectID          string
	AgeInHours         int
	DryRun             bool
	ResourceLabelKey   string
	ResourceLabelValue string
}

type GCPJanitorAction

type GCPJanitorAction interface {
	Cleanup(ctx context.Context, input *Input) error
}

func New

func New(dryrun bool) GCPJanitorAction

type Input

type Input struct {
	CredentialsJSON    string `env:"INPUT_CREDENTIALS-JSON"`
	Zones              string `env:"INPUT_ZONES"`
	ProjectID          string `env:"INPUT_PROJECT-ID"`
	ResourceLabelKey   string `env:"INPUT_RESOURCE-LABEL-KEY"`
	ResourceLabelValue string `env:"INPUT_RESOURCE-LABEL-VALUE"`
	AgeInHours         int    `env:"INPUT_AGE-IN-HOURS"`
	DryRun             bool   `env:"INPUT_DRY-RUN"`
}

func NewInput

func NewInput() (*Input, error)

NewInput creates a new input from the environment variables.

func (*Input) Validate

func (i *Input) Validate() error

Jump to

Keyboard shortcuts

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