libs

package
v0.0.0-...-5bad065 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoscalingGroup = "ASG"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Aurora

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

func NewAurora

func NewAurora() (*Aurora, error)

func (*Aurora) Sleep

func (r *Aurora) Sleep(args ResourceClientArgs) (ResourcesState, error)

func (*Aurora) WakeUp

func (r *Aurora) WakeUp(args ResourceClientArgs) (ResourcesState, error)

type AuroraTypeClient

type AuroraTypeClient interface {
	StopDBCluster(ctx context.Context, params *rds.StopDBClusterInput, optFns ...func(*rds.Options)) (*rds.StopDBClusterOutput, error)
	StartDBCluster(ctx context.Context, params *rds.StartDBClusterInput, optFns ...func(*rds.Options)) (*rds.StartDBClusterOutput, error)
}

type EC2

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

func NewEC2

func NewEC2() (*EC2, error)

func (*EC2) Sleep

func (e *EC2) Sleep(args ResourceClientArgs) (ResourcesState, error)

func (*EC2) WakeUp

func (e *EC2) WakeUp(args ResourceClientArgs) (ResourcesState, error)

type EC2TypeClient

type EC2TypeClient interface {
	StopInstances(ctx context.Context, params *ec2.StopInstancesInput, optFns ...func(*ec2.Options)) (*ec2.StopInstancesOutput, error)
	StartInstances(ctx context.Context, params *ec2.StartInstancesInput, optFns ...func(*ec2.Options)) (*ec2.StartInstancesOutput, error)
}

type Fargate

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

func NewFargate

func NewFargate() (*Fargate, error)

func (Fargate) Sleep

func (Fargate) WakeUp

func (e Fargate) WakeUp(args ResourceClientArgs) (ResourcesState, error)

type FargateTypeClient

type FargateTypeClient interface {
	UpdateService(ctx context.Context, params *ecs.UpdateServiceInput, optFns ...func(*ecs.Options)) (*ecs.UpdateServiceOutput, error)
}

type MessageBus

type MessageBus interface {
	Send(message string) error
}

type Period

type Period struct {
	Pattern string `json:"pattern"`
}

type RDS

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

func NewRDS

func NewRDS() (*RDS, error)

func (*RDS) Sleep

func (r *RDS) Sleep(args ResourceClientArgs) (ResourcesState, error)

func (*RDS) WakeUp

func (r *RDS) WakeUp(args ResourceClientArgs) (ResourcesState, error)

type RDSTypeClient

type RDSTypeClient interface {
	StopDBInstance(ctx context.Context, params *rds.StopDBInstanceInput, optFns ...func(*rds.Options)) (*rds.StopDBInstanceOutput, error)
	StartDBInstance(ctx context.Context, params *rds.StartDBInstanceInput, optFns ...func(*rds.Options)) (*rds.StartDBInstanceOutput, error)
}

type Report

type Report struct {
	SendReport bool `json:"sendReport"`
	Hour       int  `json:"hour"`
}

type Resource

type Resource struct {
	Type       string `json:"type"`
	Identifier string `json:"identifier"`
}

type ResourceClientArgs

type ResourceClientArgs struct {
	Identifiers    []string
	ResourcesState *ResourcesState
}

type ResourceClientsFactory

type ResourceClientsFactory map[string]ResourcesClient

func NewResourceClientsFactory

func NewResourceClientsFactory() (ResourceClientsFactory, error)

type ResourceState

type ResourceState struct {
	State        string `json:"state"`
	ResourceType string `json:"type"`
}

type Resources

type Resources map[string]Resource

type ResourcesClient

type ResourcesClient interface {
	Sleep(args ResourceClientArgs) (ResourcesState, error)
	WakeUp(args ResourceClientArgs) (ResourcesState, error)
}

type ResourcesState

type ResourcesState map[string]ResourceState

type SNS

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

func NewSNS

func NewSNS() (*SNS, error)

func (SNS) Send

func (e SNS) Send(message string) error

type SSM

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

func NewSSM

func NewSSM() (*SSM, error)

func (SSM) GetConfig

func (s SSM) GetConfig() (*SchedulerConfig, error)

type SSMTypeClient

type SSMTypeClient interface {
	GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
}

type SchedulerConfig

type SchedulerConfig struct {
	Report    Report    `json:"report"`
	Period    Period    `json:"period"`
	TimeZone  string    `json:"timeZone"`
	Resources Resources `json:"resources"`
}

type SchedulerConfigClient

type SchedulerConfigClient struct {
	Config *SchedulerConfig `json:"config"`
	// contains filtered or unexported fields
}

func NewSchedulerConfigClient

func NewSchedulerConfigClient(config *SchedulerConfig) *SchedulerConfigClient

func (SchedulerConfigClient) ShouldSendReport

func (s SchedulerConfigClient) ShouldSendReport() (bool, error)

func (SchedulerConfigClient) ShouldWakeup

func (s SchedulerConfigClient) ShouldWakeup() (bool, error)

type SchedulerService

type SchedulerService struct {
	Config                *SchedulerConfig
	SchedulerConfigClient *SchedulerConfigClient
	Factory               ResourceClientsFactory
	MessageBus            MessageBus
}

func (SchedulerService) Execute

func (s SchedulerService) Execute() (ResourcesState, error)

Jump to

Keyboard shortcuts

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