ebschedule

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 21 Imported by: 0

README

ebschedule

Update/diff schedule of Amazon EventBridge Scheduler.

Usage

update

Update or create schedule.

Usage:
  ebschedule update [flags]

Flags:
      --create-schedule-group   create schedule group if not exist (default true)
  -h, --help                    help for update
      --schedule string         path/to/schedule.yaml
  • When schedule group does not exist, try to create it if --create-schedule-group is true.

diff

Diff schedule between local and remote.

Usage:
  ebschedule diff [flags]

Flags:
  -h, --help              help for diff
      --schedule string   path/to/schedule.yaml
--- arn:aws:scheduler:ap-northeast-1:99999:schedule/default/hello-task
+++ ./schedule.yml
@@ -6,7 +6,7 @@
 GroupName: default
 KmsKeyArn: null
 Name: hello-task
-ScheduleExpression: cron(*/3 * * * ? *)
+ScheduleExpression: cron(*/5 * * * ? *)
 ScheduleExpressionTimezone: Asia/Tokyo
 StartDate: null
 State: DISABLED

schedule.yaml

  • You can generate template of schedule.yaml by AWS CLI v2
    aws scheduler create-schedule --generate-cli-skeleton yaml-input
    
  • ebschedule read schedule.yaml using go-config, So, You can embed value of environment variables in schedule.yaml.
    Some:
      Key: '{{ env `ENV_VAR_NAME` `default_value` }}'
      PanicIfUndefined: '{{ must_env `ENV_VAR_NAME` }}'
    

Author

Copyright (c) 2023 tckz at.tckz@gmail.com

LICENSE

MIT License

Documentation

Index

Constants

View Source
const (
	OptSchedule            = "schedule"
	OptCreateScheduleGroup = "create-schedule-group"
)

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(in *CommandInput) *cobra.Command

Types

type CommandInput

type CommandInput struct {
	AppName         string
	Version         string
	SchedulerClient SchedulerClient
	OutWriter       io.Writer
}

type SchedulerClient

type SchedulerClient interface {
	GetScheduleGroup(ctx context.Context, params *scheduler.GetScheduleGroupInput, optFns ...func(*scheduler.Options)) (*scheduler.GetScheduleGroupOutput, error)
	CreateScheduleGroup(ctx context.Context, params *scheduler.CreateScheduleGroupInput, optFns ...func(*scheduler.Options)) (*scheduler.CreateScheduleGroupOutput, error)

	GetSchedule(ctx context.Context, params *scheduler.GetScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.GetScheduleOutput, error)
	CreateSchedule(ctx context.Context, params *scheduler.CreateScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.CreateScheduleOutput, error)
	UpdateSchedule(ctx context.Context, params *scheduler.UpdateScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.UpdateScheduleOutput, error)
}

Directories

Path Synopsis
cmd
Package mock_ebschedule is a generated GoMock package.
Package mock_ebschedule is a generated GoMock package.

Jump to

Keyboard shortcuts

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