stefunny

package module
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 52 Imported by: 0

README

stefunny

Latest GitHub release Github Actions test Go Report Card License

stefunny is a deployment tool for AWS StepFunctions state machine and the accompanying AWS EventBridge rule and scheudle.

stefunny does,

  • Create a state machine.
  • Create a EventBridge rule and EventBridge Scheduler schedule.
  • Deploy state machine/ EventBridge rule / EventBridge Scheduler schedule/ StateMachine Alias.
  • Rollback to the previous version of the state machine.
  • Manage state machine versions.
  • Show status of the state machine.

That's all for now.

stefunny does not,

  • Manage resources related to the StepFunctions state machine.
    • e.g. IAM Role, Resources called by state machine, Trigger rule that is not a schedule, CloudWatch LogGroup, etc...
  • Manage StepFunctions Activities and Activity Worker.

If you hope to manage these resources collectively, we recommend other deployment tools (AWS SAM, Serverless Framework, etc.).

If you hope to manage these resources partially individually, we recommend the following tools:

Install

Homebrew (macOS and Linux)
$ brew install mashiike/tap/stefunny
aqua

aqua is a declarative CLI Version Manager.

$ aqua g -i mashiike/stefunny
Binary packages

Releases

GitHub Actions

Action mashiike/stefunny@v0 installs stefunny binary for Linux into /usr/local/bin. This action runs install only.

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: mashiike/stefunny@v0
        with:
          version: v0.6.0 
      - run: |
          stefunny deploy

QuickStart

Try migrate your existing StepFunctions StateMachine to stefunny.

$ mkdir hello
$ cd hello
$ stefunny init --state-machine Hello     
2024/02/13 16:07:53 [notice] StateMachine/Hello save config to /home/user/hello/stefunny.yaml
2024/02/13 16:07:53 [notice] StateMachine/Hello save state machine definition to /home/user/hello/definition.asl.json

Edit the definition.asl.json and stefunny.yaml.

Now you can deploy state machine Hello using stefunny deploy.

$ stefunny deploy
2024/02/13 16:18:42 [info] Starting deploy 
2024/02/13 16:18:42 [info] update state machine `arn:aws:states:ap-northeast-1:123456789012:stateMachine:Hello:2`
2024/02/13 16:18:42 [info] update current alias `arn:aws:states:ap-northeast-1:123456789012:stateMachine:Hello:current`
2024/02/13 16:18:42 [info] deploy state machine `Hello`(at `2024-02-13 07:17:48.178 +0000 UTC`)
2024/02/13 16:18:43 [info] finish deploy 

Usage

Usage: stefunny <command>

stefunny is a deployment tool for AWS StepFunctions state machine

Flags:
  -h, --help                      Show context-sensitive help.
      --log-level="info"          Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"    Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING            URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...              external string values for Jsonnet
      --ext-code=,...             external code values for Jsonnet
      --region=""                 AWS region ($AWS_REGION)
      --alias="current"           Alias name for state machine ($STEFUNNY_ALIAS)

Commands:
  version
    Show version

  init --state-machine=STRING
    Initialize stefunny configuration

  delete
    Delete state machine and schedule rules

  deploy
    Deploy state machine and schedule rules

  rollback
    Rollback state machine

  schedule --enabled --disabled
    Enable or disable schedule rules (deprecated)

  render <targets> ...
    Render state machine definition

  execute
    Execute state machine

  versions
    Manage state machine versions

  diff
    Show diff of state machine definition and trigers

  pull
    Pull state machine definition

  studio
    Show Step Functions workflow studio URL

  status
    Show status of state machine

Run "stefunny <command> --help" for more information on a command.
Init

stepfunny init initialize stefunny.yaml and definition file by existing state machine.

Usage: stefunny init --state-machine=STRING

Initialize stefunny configuration

Flags:
  -h, --help                                Show context-sensitive help.
      --log-level="info"                    Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"              Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING                      URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...                        external string values for Jsonnet
      --ext-code=,...                       external code values for Jsonnet
      --region=""                           AWS region ($AWS_REGION)
      --alias="current"                     Alias name for state machine ($STEFUNNY_ALIAS)

      --state-machine=STRING                AWS StepFunctions state machine name ($STATE_MACHINE_NAME)
  -d, --definition="definition.asl.json"    Path to state machine definition file ($DEFINITION_FILE_PATH)
      --env=ENV,...                         templateize environment variables
      --must-env=MUST-ENV,...               templateize must environment variables
      --skip-trigger                        Skip trigger

created file foramt are checked file extension. .json saved as json, .jsonnet saved as jsonnet, .yaml or .yml saved as yaml.

If you manage the aws resources by terraform, you can use --tfstate flag with stefunny init command.

$ export ENV=dev
$ stefunny init --state-machine dev-Hello --tfstate s3://my-bucket/terraform.tfstate --must-env ENV

in this case, saved config and definition file are templatized by text/template

for example, the saved config file is like this.

aws_region: ap-northeast-1
required_version: ">=v0.6.0"
state_machine:
  definition: definition.asl.json
  logging_configuration:
    destinations:
    - cloudwatch_logs_log_group:
        log_group_arn: "{{ tfstate `aws_cloudwatch_log_group.state_machine.arn` }}:*"
    include_execution_data: true
    level: ALL
  name: "{{ must_env `ENV` }}-Hello"
  role_arn: "{{ tfstate `aws_iam_role.state_machine.arn` }}"
  tags:
  - key: Name
    value: "{{ must_env `ENV` }}-Hello"
  tracing_configuration:
    enabled: true
  type: STANDARD
Deploy
Usage: stefunny deploy

Deploy state machine and schedule rules

Flags:
  -h, --help                          Show context-sensitive help.
      --log-level="info"              Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"        Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING                URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...                  external string values for Jsonnet
      --ext-code=,...                 external code values for Jsonnet
      --region=""                     AWS region ($AWS_REGION)
      --alias="current"               Alias name for state machine ($STEFUNNY_ALIAS)

      --dry-run                       Dry run
      --skip-state-machine            Skip deploy state machine
      --skip-trigger                  Skip deploy trigger
      --version-description=STRING    Version description
      --keep-versions=0               Number of latest versions to keep. Older versions will be deleted. (Optional value: default 0)
      --trigger-enabled               Enable trigger
      --trigger-disabled              Disable trigger
      --[no-]unified                  when dry run, output unified diff

stefunny deploy works as below.

  • Create / Update State Machine from config file and definition file(yaml/json/jsonnet)
    • Replace {{ env FOO bar }} syntax in the config file and definition file to environment variable "FOO". If "FOO" is not defined, replaced by "bar"
    • Replace {{ must_env FOO }} syntax in the config file and definition file to environment variable "FOO". If "FOO" is not defined, abort immediately.
    • If a terraform state is given in config, replace the {{tfstate <tf resource name>}} syntax in the config file and definition file with reference to the state content.
  • Publish new version of the state machine.
  • Update the alias to the new version.
  • Create/ Update EventBridge rule.
  • Create/ Update EventBridge Scheduler schedule.
Rollback
Usage: stefunny rollback

Rollback state machine

Flags:
  -h, --help                      Show context-sensitive help.
      --log-level="info"          Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"    Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING            URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...              external string values for Jsonnet
      --ext-code=,...             external code values for Jsonnet
      --region=""                 AWS region ($AWS_REGION)
      --alias="current"           Alias name for state machine ($STEFUNNY_ALIAS)

      --dry-run                   Dry run
      --keep-version              Keep current version, no delete

stefunny deploy create/update alias current to the published state machine version on deploy.

stefunny rollback works as below.

  1. Find previous one version of state machine.
  2. Update alias current to the previous version.
  3. default delete old version of state machine. (when --keep-version specified, not delete old version of state machine)
Studio and Pull

If you use AWS Step Functions Workflow Studio, you can open the studio URL with stefunny studio command.

Usage: stefunny studio

Show Step Functions workflow studio URL

Flags:
  -h, --help                      Show context-sensitive help.
      --log-level="info"          Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"    Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING            URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...              external string values for Jsonnet
      --ext-code=,...             external code values for Jsonnet
      --region=""                 AWS region ($AWS_REGION)
      --alias="current"           Alias name for state machine ($STEFUNNY_ALIAS)

      --open                      open workflow studio

stefunny studio command shows the studio URL. If --open flag is specified, open the studio URL in the browser. Edit state machine on Workflow Studio, and pull the definition file with stefunny pull command.

Usage: stefunny pull

Pull state machine definition

Flags:
  -h, --help                      Show context-sensitive help.
      --log-level="info"          Set log level (debug, info, notice, warn, error) ($STEFUNNY_LOG_LEVEL)
  -c, --config="stefunny.yaml"    Path to config file ($STEFUNNY_CONFIG)
      --tfstate=STRING            URL to terraform.tfstate referenced in config ($STEFUNNY_TFSTATE)
      --ext-str=,...              external string values for Jsonnet
      --ext-code=,...             external code values for Jsonnet
      --region=""                 AWS region ($AWS_REGION)
      --alias="current"           Alias name for state machine ($STEFUNNY_ALIAS)

      --[no-]templateize          templateize output
      --qualifier=STRING          qualifier for the version

stefunny pull command pull the definition file from the state machine and save it to the file.

config file (yaml)
required_version: ">=v0.6.0"
aws_region: "{{ env `AWS_REGION` `ap-northeast-1` }}"

state_machine:
  name: "{{ must_env `ENV` }}-Hello"
  definition: definition.asl.json
  logging_configuration:
    destinations:
      - cloudwatch_logs_log_group:
          log_group_arn: "{{ tfstate `aws_cloudwatch_log_group.state_machine.arn` }}:*"
    include_execution_data: true
    level: ALL

  role_arn: "{{ tfstate `aws_iam_role.state_machine.arn` }}"
  tracing_configuration:
    enabled: true
  type: STANDARD

tfstate:
  - location: s3://my-tfstate-bucket/terraform.tfstate

trigger:
  schedule:
    - name: "{{ must_env `ENV` }}-stefunny-test"
      group_name: default
      action_after_completion: DELETE
      flexible_time_window:
        maximum_window_in_minutes: 240.0
        mode: FLEXIBLE
      schedule_expression: at(2024-02-29T00:01:00)
      target:
        retry_policy:
          maximum_event_age_in_seconds: 86400.0
          maximum_retry_attempts: 185.0
        role_arn: "{{ tfstate `aws_iam_role.event_bridge_scheduler.arn` }}"

  event:
    - name: "{{ must_env `ENV` }}-stefunny-test"
      event_bus_name: default
      event_pattern: "{{ file `event_pattern.json` | json_escape }}"
      role_arn: "{{ tfstate `aws_iam_role.event_bridge.arn` }}"

Configuration files and definition files are read with text/template, stefunny has template functions env, must_env, file, json_escape and tfstate.

Template syntax

stefunny uses the text/template standard package in Go to render template files, and parses as YAML/JSON/Jsonnet.

env
"{{ env `NAME` `default value` }}"

If the environment variable NAME is set, it will replace with its value. If it's not set, it will replace with "default value".

must_env
"{{ must_env `NAME` }}"

It replaces with the value of the environment variable NAME. If the variable isn't set at the time of execution, stefunny will panic and stop forcefully.

By defining values that can cause issues when running without meaningful values with must_env, you can prevent unintended deployments.

json_escape
"{{ must_env `JSON_VALUE` | json_escape }}"

It escapes values as JSON strings. Use it when you want to escape values that need to be embedded as strings and require escaping, like quotes.

file
"{{ file `path/to/file` }}"
tfstate

If written tfstate section in the configuration file, it will be use tfstate template function. as following.

stefunny.yaml

required_version: ">v0.0.0"

state_machine:
  name: send_sns
  definition: send_sns.asl.jsonnet
  role_arn: "{{ tfstae `aws_iam_role.stepfunctions.arn` }}"
  logging_configuration:
    level: OFF

tfstate:
  - path: "./terraform.tfstate"
  - url: s3://my-bucket/terraform.tfstate
    func_prefix: s3_

send_sns.asl.jsonnet

{
  Comment: "A simple AWS Step Functions state machine that sends a message to an SNS topic", 
  StartAt: "Send SNS Message",
  States: {
    "Send SNS Message": {
      Type: "Task",
      Resource: "arn:aws:states:::sns:publish",
      Parameters: {
        "TopicArn": "{{ s3_tfstate `aws_sns_topic.topic.arn` }}",
        "Message.$": "$"
      },
      End: true,
    }
  }
}

{{ tfstate "resource_type.resource_name.attr" }} will expand to an attribute value of the resource in tfstate.

{{ tfstatef "resource_type.resource_name['%s'].attr" "index" }} is similar to {{ tfstatef "resource_type.resource_name['index'].attr" }}. This function is useful to build a resource address with environment variables.

{{ tfstatef `aws_subnet.ecs['%s'].id` (must_env `SERVICE`) }}

This function uses tfstate-lookup to load tfstate.

Special Thanks

@fujiwara has given me naming idea of stefunny.

Inspire tools

LICENSE

MIT License

Copyright (c) 2021 IKEDA Masashi

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStateMachineDoesNotExist = errors.New("state machine does not exist")
	ErrRollbackTargetNotFound   = errors.New("rollback target not found")
)
View Source
var (
	ErrEventBridgeRuleDoesNotExist = errors.New("schedule rule does not exist")
)
View Source
var ErrScheduleNotFound = errors.New("schedule not found")
View Source
var Version = "v0.8.4"

Functions

func CamelToSnake added in v0.6.0

func CamelToSnake(s string) string

func JSON2Jsonnet added in v0.6.0

func JSON2Jsonnet(filename string, data []byte) ([]byte, error)

func JSONDiffString added in v0.6.0

func JSONDiffString(fromStr, toStr string, opts ...JSONDiffOption) string

func LoggerSetup added in v0.6.0

func LoggerSetup(w io.Writer, minLevel string) func()

func MarshalJSONString added in v0.6.0

func MarshalJSONString(s interface{}, overrides ...any) string

func SnakeToCamel added in v0.6.0

func SnakeToCamel(s string) string

Types

type App

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

func New

func New(ctx context.Context, cfg *Config, opts ...NewAppOption) (*App, error)

New creates a new App

func (*App) Delete

func (app *App) Delete(ctx context.Context, opt DeleteOption) error

func (*App) Deploy

func (app *App) Deploy(ctx context.Context, opt DeployOption) error

func (*App) Diff added in v0.6.0

func (app *App) Diff(ctx context.Context, opt DiffOption) error

func (*App) Execute added in v0.3.0

func (app *App) Execute(ctx context.Context, opt ExecuteOption) error

func (*App) Init added in v0.1.0

func (app *App) Init(ctx context.Context, opt InitOption) error

func (*App) Pull added in v0.6.0

func (app *App) Pull(ctx context.Context, opt PullOption) error

func (*App) Render

func (app *App) Render(ctx context.Context, opt RenderOption) error

func (*App) Rollback added in v0.6.0

func (app *App) Rollback(ctx context.Context, opt RollbackOption) error

func (*App) SetAliasName added in v0.6.0

func (app *App) SetAliasName(aliasName string)

func (*App) StateMachineAliasName added in v0.6.0

func (app *App) StateMachineAliasName() string

func (*App) Status added in v0.6.0

func (app *App) Status(ctx context.Context, opt StatusOption) error

func (*App) Studio added in v0.6.0

func (app *App) Studio(ctx context.Context, opt StudioOption) error

func (*App) Versions added in v0.6.0

func (app *App) Versions(ctx context.Context, opt VersionsOption) error

type CLI added in v0.6.0

type CLI struct {
	LogLevel  string   `` /* 139-byte string literal not displayed */
	Config    string   `` /* 132-byte string literal not displayed */
	TFState   string   `name:"tfstate" help:"URL to terraform.tfstate referenced in config" env:"STEFUNNY_TFSTATE" json:"tfstate,omitempty"`
	ExtStr    []string `name:"ext-str" help:"external string values for Jsonnet" default:"" json:"ext_str,omitempty"`
	ExtCode   []string `name:"ext-code" help:"external code values for Jsonnet" default:"" json:"ext_code,omitempty"`
	AWSRegion string   `name:"region" help:"AWS region" default:"" env:"AWS_REGION" json:"region,omitempty"`
	AliasName string   `name:"alias" help:"Alias name for state machine" default:"current" env:"STEFUNNY_ALIAS" json:"alias,omitempty"`

	Version  struct{}              `cmd:"" help:"Show version" json:"version,omitempty"`
	Init     InitOption            `cmd:"" help:"Initialize stefunny configuration" json:"init,omitempty"`
	Delete   DeleteOption          `cmd:"" help:"Delete state machine and schedule rules" json:"delete,omitempty"`
	Deploy   DeployCommandOption   `cmd:"" help:"Deploy state machine and schedule rules" json:"deploy,omitempty"`
	Rollback RollbackOption        `cmd:"" help:"Rollback state machine" json:"rollback,omitempty"`
	Schedule ScheduleCommandOption `cmd:"" help:"Enable or disable schedule rules (deprecated)" json:"schedule,omitempty"`
	Render   RenderOption          `cmd:"" help:"Render state machine definition" json:"render,omitempty"`
	Execute  ExecuteOption         `cmd:"" help:"Execute state machine" json:"execute,omitempty"`
	Versions VersionsOption        `cmd:"" help:"Manage state machine versions" json:"versions,omitempty"`
	Diff     DiffOption            `cmd:"" help:"Show diff of state machine definition and trigers" json:"diff,omitempty"`
	Pull     PullOption            `cmd:"" help:"Pull state machine definition" json:"pull,omitempty"`
	Studio   StudioOption          `cmd:"" help:"Show Step Functions workflow studio URL" json:"studio,omitempty"`
	Status   StatusOption          `cmd:"" help:"Show status of state machine" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func NewCLI added in v0.6.0

func NewCLI() *CLI

func (*CLI) Exit added in v0.6.0

func (cli *CLI) Exit(exitFunc func(int))

Exit sets the exit function. for testing

func (*CLI) NewApp added in v0.6.0

func (cli *CLI) NewApp(ctx context.Context) (*App, error)

NewApp creates a new App instance from the CLI configuration

func (*CLI) NoExpandPath added in v0.6.0

func (cli *CLI) NoExpandPath()

NoExpandPath disables path expansion. for testing

func (*CLI) Parse added in v0.6.0

func (cli *CLI) Parse(args []string) (string, error)

Parse parses the command line arguments and returns the command name

func (*CLI) Run added in v0.6.0

func (cli *CLI) Run(ctx context.Context, args []string) error

Run() runs the command

func (*CLI) Writers added in v0.6.0

func (cli *CLI) Writers(stdout, stderr io.Writer)

Writers sets the writers for stdout and stderr. for testing

type CloudWatchLogsClient added in v0.6.0

type CloudWatchLogsClient interface {
	cloudwatchlogs.DescribeLogGroupsAPIClient
}

type Config

type Config struct {
	RequiredVersion string `` /* 153-byte string literal not displayed */
	AWSRegion       string `` /* 128-byte string literal not displayed */

	StateMachine *StateMachineConfig `yaml:"state_machine,omitempty" json:"state_machine,omitempty"`
	Trigger      *TriggerConfig      `yaml:"trigger,omitempty" json:"trigger,omitempty"`
	Schedule     []*ScheduleConfig   `yaml:"schedule,omitempty" json:"schedule,omitempty"`
	Tags         map[string]string   `yaml:"tags,omitempty" json:"tags,omitempty"`

	Endpoints *EndpointsConfig `yaml:"endpoints,omitempty" json:"endpoints,omitempty"`

	TFState []*TFStateConfig `yaml:"tfstate,omitempty" json:"tfstate,omitempty"`

	ConfigDir      string                     `yaml:"-" json:"-"`
	ConfigFileName string                     `yaml:"-" json:"-"`
	Envs           *OrderdMap[string, string] `yaml:"-" json:"-"`
	MustEnvs       *OrderdMap[string, string] `yaml:"-" json:"-"`
	Files          *OrderdMap[string, string] `yaml:"-" json:"-"`
	TemplateFiles  *OrderdMap[string, string] `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) EndpointResolver

func (cfg *Config) EndpointResolver() (aws.EndpointResolverWithOptions, bool)

func (*Config) LoadAWSConfig added in v0.6.0

func (cfg *Config) LoadAWSConfig(ctx context.Context) (aws.Config, error)

func (*Config) NewEventBridgeRules added in v0.6.0

func (cfg *Config) NewEventBridgeRules() EventBridgeRules

func (*Config) NewSchedules added in v0.6.0

func (cfg *Config) NewSchedules() Schedules

func (*Config) NewStateMachine added in v0.6.0

func (cfg *Config) NewStateMachine() *StateMachine

func (*Config) Restrict

func (cfg *Config) Restrict() error

Restrict restricts a configuration.

func (*Config) StateMachineDefinition added in v0.6.0

func (cfg *Config) StateMachineDefinition() string

func (*Config) StateMachineName added in v0.6.0

func (cfg *Config) StateMachineName() string

func (*Config) ValidateVersion

func (cfg *Config) ValidateVersion(version string) error

ValidateVersion validates a version satisfies required_version.

type ConfigLoader added in v0.6.0

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

func NewConfigLoader added in v0.6.0

func NewConfigLoader(extStr, extCode map[string]string) *ConfigLoader

func (*ConfigLoader) AppendFuncMap added in v0.6.0

func (l *ConfigLoader) AppendFuncMap(prefix string, funcMap template.FuncMap) error

func (*ConfigLoader) AppendTFState added in v0.6.0

func (l *ConfigLoader) AppendTFState(ctx context.Context, prefix string, tfState string) error

func (*ConfigLoader) Load added in v0.6.0

func (l *ConfigLoader) Load(ctx context.Context, path string) (*Config, error)

func (*ConfigLoader) SetCloudWatchLogsClient added in v0.6.0

func (l *ConfigLoader) SetCloudWatchLogsClient(client CloudWatchLogsClient)

type DeleteOption

type DeleteOption struct {
	DryRun bool `name:"dry-run" help:"Dry run" json:"dry_run,omitempty"`
	Force  bool `name:"force" help:"delete without confirmation" json:"force,omitempty"`
}

func (DeleteOption) DryRunString

func (opt DeleteOption) DryRunString() string

type DeployCommandOption added in v0.6.0

type DeployCommandOption struct {
	DryRun             bool   `name:"dry-run" help:"Dry run" json:"dry_run,omitempty"`
	SkipStateMachine   bool   `name:"skip-state-machine" help:"Skip deploy state machine" json:"skip_state_machine,omitempty"`
	SkipTrigger        bool   `name:"skip-trigger" help:"Skip deploy trigger" json:"skip_trigger,omitempty"`
	VersionDescription string `name:"version-description" help:"Version description" json:"version_description,omitempty"`
	KeepVersions       int    `` /* 144-byte string literal not displayed */
	TriggerEnabled     bool   `name:"trigger-enabled" help:"Enable trigger" xor:"trigger" json:"trigger_enabled,omitempty"`
	TriggerDisabled    bool   `name:"trigger-disabled" help:"Disable trigger" xor:"trigger" json:"trigger_disabled,omitempty"`
	Unified            bool   `name:"unified" help:"when dry run, output unified diff" negatable:"" default:"true" json:"unified,omitempty"`
}

func (*DeployCommandOption) DeployOption added in v0.6.0

func (cmd *DeployCommandOption) DeployOption() DeployOption

type DeployOption

type DeployOption struct {
	DryRun             bool
	ScheduleEnabled    *bool
	SkipStateMachine   bool
	SkipTrigger        bool
	VersionDescription string
	KeepVersions       int
	Unified            bool
}

func (DeployOption) DryRunString

func (opt DeployOption) DryRunString() string

type DeployStateMachineOutput

type DeployStateMachineOutput struct {
	CreationDate           *time.Time
	UpdateDate             *time.Time
	StateMachineArn        *string
	StateMachineVersionArn *string
}

type DescribeStateMachineInput added in v0.6.0

type DescribeStateMachineInput struct {
	Name      string
	Qualifier string
}

type DiffOption added in v0.6.0

type DiffOption struct {
	Unified   bool   `name:"unified" help:"output in unified format" short:"u" default:"true" negatable:"" json:"unified,omitempty"`
	Qualifier string `name:"qualifier" help:"qualifier for state machine" default:"" json:"qualifier,omitempty"`
}

type EndpointsConfig

type EndpointsConfig struct {
	StepFunctions  string `yaml:"stepfunctions,omitempty" json:"step_functions,omitempty"`
	CloudWatchLogs string `yaml:"cloudwatchlogs,omitempty" json:"cloud_watch_logs,omitempty"`
	STS            string `yaml:"sts,omitempty" json:"sts,omitempty"`
	EventBridge    string `yaml:"eventbridge,omitempty" json:"event_bridge,omitempty"`
}

type EventBridgeRule added in v0.6.0

type EventBridgeRule struct {
	eventbridge.PutRuleInput
	RuleArn           *string                   `yaml:"RuleArn,omitempty" json:"RuleArn,omitempty"`
	CreatedBy         *string                   `yaml:"CreatedBy,omitempty" json:"CreatedBy,omitempty"`
	Target            eventbridgetypes.Target   `yaml:"Target,omitempty" json:"Target,omitempty"`
	AdditionalTargets []eventbridgetypes.Target `yaml:"AdditionalTargets,omitempty" json:"AdditionalTargets,omitempty"`
	ConfigFilePath    *string                   `yaml:"ConfigFilePath,omitempty" json:"ConfigFilePath,omitempty"`
	ConfigFileIndex   int                       `yaml:"ConfigFileIndex,omitempty" json:"ConfigFileIndex,omitempty"`
}

func (*EventBridgeRule) AppendTags added in v0.6.0

func (rule *EventBridgeRule) AppendTags(tags map[string]string)

func (*EventBridgeRule) DeleteTag added in v0.6.0

func (rule *EventBridgeRule) DeleteTag(key string)

func (*EventBridgeRule) DiffString added in v0.6.0

func (rule *EventBridgeRule) DiffString(newRule *EventBridgeRule, unified bool) string

func (*EventBridgeRule) IsManagedBy added in v0.6.0

func (rule *EventBridgeRule) IsManagedBy() bool

func (*EventBridgeRule) SetEnabled added in v0.6.0

func (rule *EventBridgeRule) SetEnabled(enabled bool)

func (*EventBridgeRule) SetStateMachineQualifiedArn added in v0.6.0

func (rule *EventBridgeRule) SetStateMachineQualifiedArn(stateMachineArn string)

func (*EventBridgeRule) Source added in v0.8.4

func (rule *EventBridgeRule) Source() string

func (*EventBridgeRule) String added in v0.6.0

func (rule *EventBridgeRule) String() string

type EventBridgeRules added in v0.6.0

type EventBridgeRules []*EventBridgeRule

func (EventBridgeRules) AppendTags added in v0.7.3

func (rules EventBridgeRules) AppendTags(tags map[string]string)

func (EventBridgeRules) DiffString added in v0.6.0

func (rules EventBridgeRules) DiffString(newRules EventBridgeRules, unified bool) string

func (EventBridgeRules) FindByName added in v0.6.0

func (rules EventBridgeRules) FindByName(name string) (*EventBridgeRule, bool)

func (EventBridgeRules) Len added in v0.6.0

func (rules EventBridgeRules) Len() int

sort.Interfaces

func (EventBridgeRules) Less added in v0.6.0

func (rules EventBridgeRules) Less(i, j int) bool

func (EventBridgeRules) Names added in v0.6.0

func (rules EventBridgeRules) Names() []string

func (EventBridgeRules) SetEnabled added in v0.6.0

func (rules EventBridgeRules) SetEnabled(enabled bool)

func (EventBridgeRules) SetStateMachineQualifiedArn added in v0.6.0

func (rules EventBridgeRules) SetStateMachineQualifiedArn(stateMachineArn string)

func (EventBridgeRules) String added in v0.6.0

func (rules EventBridgeRules) String() string

func (EventBridgeRules) Swap added in v0.6.0

func (rules EventBridgeRules) Swap(i, j int)

func (EventBridgeRules) SyncState added in v0.6.0

func (rules EventBridgeRules) SyncState(other EventBridgeRules)

type EventBridgeService added in v0.6.0

type EventBridgeService interface {
	SearchRelatedRules(ctx context.Context, params *SearchRelatedRulesInput) (EventBridgeRules, error)
	DeployRules(ctx context.Context, stateMachineArn string, rules EventBridgeRules, keepState bool) error
}

type EventBridgeServiceImpl added in v0.6.0

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

func NewEventBridgeService added in v0.6.0

func NewEventBridgeService(client EventBridgeClient) *EventBridgeServiceImpl

func (*EventBridgeServiceImpl) DeployRules added in v0.6.0

func (svc *EventBridgeServiceImpl) DeployRules(ctx context.Context, stateMachineArn string, rules EventBridgeRules, keepState bool) error

func (*EventBridgeServiceImpl) SearchRelatedRules added in v0.6.0

func (svc *EventBridgeServiceImpl) SearchRelatedRules(ctx context.Context, params *SearchRelatedRulesInput) (EventBridgeRules, error)

type ExecuteOption added in v0.3.0

type ExecuteOption struct {
	Stdout io.Writer `kong:"-" json:"-"`
	Stderr io.Writer `kong:"-" json:"-"`

	Input         string  `name:"input" help:"input JSON string" default:"-" type:"existingfile" json:"input,omitempty"`
	ExecutionName string  `name:"name" help:"execution name" default:"" json:"name,omitempty"`
	Async         bool    `name:"async" help:"start execution and return immediately" json:"async,omitempty"`
	DumpHistory   bool    `name:"dump-history" help:"dump execution history" json:"dump_history,omitempty"`
	Qualifier     *string `name:"qualifier" help:"state machine version qualifier" json:"qualifier,omitempty"`
}

type GetStateMachineArnInput added in v0.6.0

type GetStateMachineArnInput struct {
	Name string
}

type HistoryEvent added in v0.3.0

type HistoryEvent struct {
	StartDate time.Time
	Step      string
	sfntypes.HistoryEvent
}

func (HistoryEvent) Elapsed added in v0.3.0

func (event HistoryEvent) Elapsed() time.Duration

type InitOption added in v0.6.0

type InitOption struct {
	StateMachineName   string   ``                                                                                  /* 137-byte string literal not displayed */
	DefinitionFilePath string   ``                                                                                  /* 149-byte string literal not displayed */
	TFState            string   `kong:"-" help:"Path to terraform state file" type:"path" json:"tfstate,omitempty"` // TODO: if removed global flag, not ignore this flag for kong
	Envs               []string `name:"env" help:"templateize environment variables" json:"envs,omitempty"`
	MustEnvs           []string `name:"must-env" help:"templateize must environment variables" json:"must_envs,omitempty"`
	SkipTrigger        bool     `name:"skip-trigger" help:"Skip trigger" json:"skip_trigger,omitempty"`
	ConfigPath         string   `kong:"-" json:"-"`
	AWSRegion          string   `kong:"-" json:"-"`
}

type JSONDiffOption added in v0.6.0

type JSONDiffOption func(*jsonDiffParams)

func JSONDiffFromURI added in v0.6.0

func JSONDiffFromURI(uri string) JSONDiffOption

func JSONDiffToURI added in v0.6.0

func JSONDiffToURI(uri string) JSONDiffOption

func JSONDiffUnified added in v0.6.0

func JSONDiffUnified(b bool) JSONDiffOption

type KeysToSnakeCase added in v0.6.0

type KeysToSnakeCase[T any] struct {
	Value  T
	Strict bool `yaml:"-"`
}

KeysToSnakeCase converts the keys of the given object to snake case. The given object is expected struct, json struct key is CamelCase.

func NewKeysToSnakeCase added in v0.6.0

func NewKeysToSnakeCase[T any](v T) KeysToSnakeCase[T]

func (KeysToSnakeCase[T]) MarshalJSON added in v0.6.0

func (k KeysToSnakeCase[T]) MarshalJSON() ([]byte, error)

func (KeysToSnakeCase[T]) MarshalYAML added in v0.6.0

func (k KeysToSnakeCase[T]) MarshalYAML() (interface{}, error)

func (*KeysToSnakeCase[T]) UnmarshalJSON added in v0.6.0

func (k *KeysToSnakeCase[T]) UnmarshalJSON(bs []byte) error

type ListStateMachineVersionsOutput added in v0.6.0

type ListStateMachineVersionsOutput struct {
	StateMachineArn string
	Versions        []StateMachineVersionListItem
}

type NewAppOption added in v0.6.0

type NewAppOption func(*newAppOptions)

func WithAWSConfig added in v0.6.0

func WithAWSConfig(awsCfg aws.Config) NewAppOption

WithAWSConfig sets the AWS config for New(ctx, cfg, opts...) this is for testing

func WithEventBridgeClient added in v0.6.0

func WithEventBridgeClient(eventBridgeClient EventBridgeClient) NewAppOption

WithEventBridgeClient sets the EventBridge client for New(ctx, cfg, opts...) this is for testing

func WithEventBridgeService added in v0.6.0

func WithEventBridgeService(eventBridgeService EventBridgeService) NewAppOption

WithEventBridgeService sets the EventBridge service for New(ctx, cfg, opts...)

func WithSFnClient added in v0.6.0

func WithSFnClient(sfnClient SFnClient) NewAppOption

WithSFNClient sets the SFn client for New(ctx, cfg, opts...) this is for testing

func WithSFnService added in v0.6.0

func WithSFnService(sfnService SFnService) NewAppOption

WithSFnService sets the SFn service for New(ctx, cfg, opts...)

func WithSchedulerClient added in v0.6.0

func WithSchedulerClient(schedulerClient SchedulerClient) NewAppOption

func WithSchedulerService added in v0.6.0

func WithSchedulerService(schedulerService SchedulerService) NewAppOption

type OrderdMap added in v0.6.0

type OrderdMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func ListResourcesFromTFState added in v0.6.0

func ListResourcesFromTFState(ctx context.Context, loc string) (*OrderdMap[string, string], error)

ListResourcesFromTFState returns resource arn, security group id, vpc id, subnet id, and caller account_id

func NewOrderdMap added in v0.6.0

func NewOrderdMap[K comparable, V any]() *OrderdMap[K, V]

func (*OrderdMap[K, V]) Get added in v0.6.0

func (m *OrderdMap[K, V]) Get(key K) (V, bool)

func (*OrderdMap[K, V]) Keys added in v0.6.0

func (m *OrderdMap[K, V]) Keys() []K

func (*OrderdMap[K, V]) Len added in v0.6.0

func (m *OrderdMap[K, V]) Len() int

func (*OrderdMap[K, V]) Set added in v0.6.0

func (m *OrderdMap[K, V]) Set(key K, value V)

func (*OrderdMap[K, V]) Values added in v0.6.0

func (m *OrderdMap[K, V]) Values() []V

type OutputFormatter added in v0.6.0

type OutputFormatter struct {
	Data   *ListStateMachineVersionsOutput
	Format string
}

func (OutputFormatter) JSON added in v0.6.0

func (f OutputFormatter) JSON() string

func (OutputFormatter) String added in v0.6.0

func (f OutputFormatter) String() string

func (OutputFormatter) TSV added in v0.6.0

func (f OutputFormatter) TSV() string

func (OutputFormatter) Table added in v0.6.0

func (f OutputFormatter) Table() string

type PullOption added in v0.6.0

type PullOption struct {
	Templateize bool   `name:"templateize" default:"true" negatable:"" help:"templateize output"`
	Qualifier   string `name:"qualifier" help:"qualifier for the version"`
}

type RenderOption

type RenderOption struct {
	Writer  io.Writer `kong:"-" json:"-"`
	Targets []string  `arg:"" help:"target to render (config, definition, def)" enum:"config,definition,def" json:"targets,omitempty"`
	Format  string    `name:"format" help:"output format(json, jsonnet, yaml)" default:"" enum:",json,jsonnet,yaml" json:"format,omitempty"`
}

type Renderer added in v0.6.0

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

func NewRenderer added in v0.6.0

func NewRenderer(cfg *Config) *Renderer

func (*Renderer) CreateConfigFile added in v0.6.0

func (r *Renderer) CreateConfigFile(ctx context.Context, path string, template bool) error

func (*Renderer) CreateDefinitionFile added in v0.6.0

func (r *Renderer) CreateDefinitionFile(ctx context.Context, path string, template bool) error

func (*Renderer) RenderConfig added in v0.6.0

func (r *Renderer) RenderConfig(ctx context.Context, w io.Writer, format string, template bool) error

func (*Renderer) RenderStateMachine added in v0.6.0

func (r *Renderer) RenderStateMachine(ctx context.Context, w io.Writer, format string, template bool) error

type RollbackOption added in v0.6.0

type RollbackOption struct {
	DryRun      bool `name:"dry-run" help:"Dry run" json:"dry_run,omitempty"`
	KeepVersion bool `name:"keep-version" help:"Keep current version, no delete" json:"keep_version,omitempty"`
}

func (RollbackOption) DryRunString added in v0.6.0

func (opt RollbackOption) DryRunString() string

type RulesStatus added in v0.6.0

type RulesStatus struct {
	RuleArn            string  `json:"rule_arn,omitempty"`
	RuleName           string  `json:"rule_name"`
	Status             string  `json:"status"`
	ScheduleExpression *string `json:"schedule_expression,omitempty"`
	EventPattern       *string `json:"event_pattern,omitempty"`
	Target             string  `json:"target,omitempty"`
}

func (*RulesStatus) String added in v0.6.0

func (r *RulesStatus) String() string

type SFnClient

type SFnClient interface {
	sfn.ListStateMachinesAPIClient
	sfnx.ListStateMachineAliasesAPIClient
	sfnx.ListStateMachineVersionsAPIClient
	CreateStateMachine(ctx context.Context, params *sfn.CreateStateMachineInput, optFns ...func(*sfn.Options)) (*sfn.CreateStateMachineOutput, error)
	CreateStateMachineAlias(ctx context.Context, params *sfn.CreateStateMachineAliasInput, optFns ...func(*sfn.Options)) (*sfn.CreateStateMachineAliasOutput, error)
	DescribeStateMachine(ctx context.Context, params *sfn.DescribeStateMachineInput, optFns ...func(*sfn.Options)) (*sfn.DescribeStateMachineOutput, error)
	DescribeStateMachineAlias(ctx context.Context, params *sfn.DescribeStateMachineAliasInput, optFns ...func(*sfn.Options)) (*sfn.DescribeStateMachineAliasOutput, error)
	UpdateStateMachine(ctx context.Context, params *sfn.UpdateStateMachineInput, optFns ...func(*sfn.Options)) (*sfn.UpdateStateMachineOutput, error)
	UpdateStateMachineAlias(ctx context.Context, params *sfn.UpdateStateMachineAliasInput, optFns ...func(*sfn.Options)) (*sfn.UpdateStateMachineAliasOutput, error)
	DeleteStateMachine(ctx context.Context, params *sfn.DeleteStateMachineInput, optFns ...func(*sfn.Options)) (*sfn.DeleteStateMachineOutput, error)
	DeleteStateMachineVersion(ctx context.Context, params *sfn.DeleteStateMachineVersionInput, optFns ...func(*sfn.Options)) (*sfn.DeleteStateMachineVersionOutput, error)
	ListTagsForResource(ctx context.Context, params *sfn.ListTagsForResourceInput, optFns ...func(*sfn.Options)) (*sfn.ListTagsForResourceOutput, error)
	StartExecution(ctx context.Context, params *sfn.StartExecutionInput, optFns ...func(*sfn.Options)) (*sfn.StartExecutionOutput, error)
	StartSyncExecution(ctx context.Context, params *sfn.StartSyncExecutionInput, optFns ...func(*sfn.Options)) (*sfn.StartSyncExecutionOutput, error)
	DescribeExecution(ctx context.Context, params *sfn.DescribeExecutionInput, optFns ...func(*sfn.Options)) (*sfn.DescribeExecutionOutput, error)
	StopExecution(ctx context.Context, params *sfn.StopExecutionInput, optFns ...func(*sfn.Options)) (*sfn.StopExecutionOutput, error)
	GetExecutionHistory(ctx context.Context, params *sfn.GetExecutionHistoryInput, optFns ...func(*sfn.Options)) (*sfn.GetExecutionHistoryOutput, error)
	TagResource(ctx context.Context, params *sfn.TagResourceInput, optFns ...func(*sfn.Options)) (*sfn.TagResourceOutput, error)
}

type SFnService added in v0.6.0

type SFnService interface {
	DescribeStateMachine(ctx context.Context, params *DescribeStateMachineInput) (*StateMachine, error)
	GetStateMachineArn(ctx context.Context, params *GetStateMachineArnInput) (string, error)
	DeployStateMachine(ctx context.Context, stateMachine *StateMachine) (*DeployStateMachineOutput, error)
	DeleteStateMachine(ctx context.Context, stateMachine *StateMachine) error
	RollbackStateMachine(ctx context.Context, stateMachine *StateMachine, keepVersion bool, dryRun bool) error
	ListStateMachineVersions(ctx context.Context, stateMachine *StateMachine) (*ListStateMachineVersionsOutput, error)
	PurgeStateMachineVersions(ctx context.Context, stateMachine *StateMachine, keepVersions int) error
	StartExecution(ctx context.Context, stateMachine *StateMachine, params *StartExecutionInput) (*StartExecutionOutput, error)
	GetExecutionHistory(ctx context.Context, executionArn string) ([]HistoryEvent, error)
	SetAliasName(aliasName string)
}

type SFnServiceImpl added in v0.6.0

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

func NewSFnService added in v0.6.0

func NewSFnService(client SFnClient) *SFnServiceImpl

func (*SFnServiceImpl) DeleteStateMachine added in v0.6.0

func (svc *SFnServiceImpl) DeleteStateMachine(ctx context.Context, stateMachine *StateMachine) error

func (*SFnServiceImpl) DeployStateMachine added in v0.6.0

func (svc *SFnServiceImpl) DeployStateMachine(ctx context.Context, stateMachine *StateMachine) (*DeployStateMachineOutput, error)

func (*SFnServiceImpl) DescribeStateMachine added in v0.6.0

func (svc *SFnServiceImpl) DescribeStateMachine(ctx context.Context, params *DescribeStateMachineInput) (*StateMachine, error)

func (*SFnServiceImpl) GetExecutionHistory added in v0.6.0

func (svc *SFnServiceImpl) GetExecutionHistory(ctx context.Context, executionArn string) ([]HistoryEvent, error)

func (*SFnServiceImpl) GetStateMachineArn added in v0.6.0

func (svc *SFnServiceImpl) GetStateMachineArn(ctx context.Context, params *GetStateMachineArnInput) (string, error)

func (*SFnServiceImpl) ListStateMachineVersions added in v0.6.0

func (svc *SFnServiceImpl) ListStateMachineVersions(ctx context.Context, stateMachine *StateMachine) (*ListStateMachineVersionsOutput, error)

func (*SFnServiceImpl) PurgeStateMachineVersions added in v0.6.0

func (svc *SFnServiceImpl) PurgeStateMachineVersions(ctx context.Context, stateMachine *StateMachine, keepVerions int) error

func (*SFnServiceImpl) RollbackStateMachine added in v0.6.0

func (svc *SFnServiceImpl) RollbackStateMachine(ctx context.Context, stateMachine *StateMachine, keepVersion bool, dryRun bool) error

func (*SFnServiceImpl) SetAliasName added in v0.6.0

func (svc *SFnServiceImpl) SetAliasName(aliasName string)

func (*SFnServiceImpl) StartExecution added in v0.6.0

func (svc *SFnServiceImpl) StartExecution(ctx context.Context, stateMachine *StateMachine, params *StartExecutionInput) (*StartExecutionOutput, error)

type Schedule added in v0.6.0

type Schedule struct {
	scheduler.CreateScheduleInput
	ScheduleArn     *string    `min:"1" type:"string"`
	CreationDate    *time.Time `type:"timestamp"`
	ConfigFilePath  *string
	ConfigFileIndex int
}

func (*Schedule) DiffString added in v0.6.0

func (s *Schedule) DiffString(newSchedule *Schedule, unified bool) string

func (*Schedule) HasItPassed added in v0.6.0

func (s *Schedule) HasItPassed() bool

func (*Schedule) SetEnabled added in v0.6.0

func (s *Schedule) SetEnabled(enabled bool)

func (*Schedule) SetStateMachineQualifiedArn added in v0.6.0

func (s *Schedule) SetStateMachineQualifiedArn(stateMachineArn string)

func (*Schedule) Source added in v0.8.4

func (s *Schedule) Source() string

func (*Schedule) String added in v0.6.0

func (s *Schedule) String() string

type ScheduleCommandOption added in v0.6.0

type ScheduleCommandOption struct {
	DryRun   bool `name:"dry-run" help:"Dry run" json:"dry_run,omitempty"`
	Enabled  bool `name:"enabled" help:"Enable schedule" xor:"schedule" required:"" json:"enabled,omitempty"`
	Disabled bool `name:"disabled" help:"Disable schedule" xor:"schedule" required:"" json:"disabled,omitempty"`
}

func (*ScheduleCommandOption) DeployOption added in v0.6.0

func (cmd *ScheduleCommandOption) DeployOption() DeployOption

type ScheduleConfig

type ScheduleConfig struct {
	ID          string `yaml:"id,omitempty" json:"id,omitempty"`
	RuleName    string `yaml:"rule_name,omitempty" json:"rule_name,omitempty"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	Expression  string `yaml:"expression,omitempty" json:"expression,omitempty"`
	RoleArn     string `yaml:"role_arn,omitempty" json:"role_arn,omitempty"`
}

type ScheduleStatus added in v0.6.0

type ScheduleStatus struct {
	ScheduleName               string `json:"schedule_name"`
	ScheduleArn                string `json:"schedule_arn,omitempty"`
	Status                     string `json:"status"`
	ScheduleExpression         string `json:"schedule_expression"`
	ScheduleExpressionTimezone string `json:"schedule_expression_timezone"`
	Target                     string `json:"target,omitempty"`
}

func (*ScheduleStatus) String added in v0.6.0

func (s *ScheduleStatus) String() string

type SchedulerClient added in v0.6.0

type SchedulerClient interface {
	CreateSchedule(ctx context.Context, params *scheduler.CreateScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.CreateScheduleOutput, error)
	DeleteSchedule(ctx context.Context, params *scheduler.DeleteScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.DeleteScheduleOutput, error)
	GetSchedule(ctx context.Context, params *scheduler.GetScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.GetScheduleOutput, error)
	ListSchedules(ctx context.Context, params *scheduler.ListSchedulesInput, optFns ...func(*scheduler.Options)) (*scheduler.ListSchedulesOutput, error)
	UpdateSchedule(ctx context.Context, params *scheduler.UpdateScheduleInput, optFns ...func(*scheduler.Options)) (*scheduler.UpdateScheduleOutput, error)
}

type SchedulerService added in v0.6.0

type SchedulerService interface {
	SearchRelatedSchedules(ctx context.Context, params *SearchRelatedSchedulesInput) (Schedules, error)
	DeploySchedules(ctx context.Context, stateMachineArn string, rules Schedules, keepState bool) error
}

type SchedulerServiceImpl added in v0.6.0

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

func NewSchedulerService added in v0.6.0

func NewSchedulerService(client SchedulerClient) *SchedulerServiceImpl

func (*SchedulerServiceImpl) DeploySchedules added in v0.6.0

func (svc *SchedulerServiceImpl) DeploySchedules(ctx context.Context, stateMachineArn string, schedules Schedules, keepState bool) error

func (*SchedulerServiceImpl) SearchRelatedSchedules added in v0.6.0

func (svc *SchedulerServiceImpl) SearchRelatedSchedules(ctx context.Context, params *SearchRelatedSchedulesInput) (Schedules, error)

type Schedules added in v0.6.0

type Schedules []*Schedule

func (Schedules) DiffString added in v0.6.0

func (s Schedules) DiffString(newSchedules Schedules, unified bool) string

func (Schedules) FilterPassed added in v0.6.0

func (s Schedules) FilterPassed() (result, passed Schedules)

func (Schedules) FindByName added in v0.6.0

func (s Schedules) FindByName(name string) (*Schedule, bool)

func (Schedules) Len added in v0.6.0

func (s Schedules) Len() int

func (Schedules) Less added in v0.6.0

func (s Schedules) Less(i, j int) bool

func (Schedules) Names added in v0.6.0

func (s Schedules) Names() []string

func (Schedules) SetEnabled added in v0.6.0

func (s Schedules) SetEnabled(enabled bool)

func (Schedules) SetStateMachineQualifiedArn added in v0.6.0

func (s Schedules) SetStateMachineQualifiedArn(stateMachineArn string)

func (Schedules) String added in v0.6.0

func (s Schedules) String() string

func (Schedules) Swap added in v0.6.0

func (s Schedules) Swap(i, j int)

func (Schedules) SyncState added in v0.6.0

func (s Schedules) SyncState(other Schedules)

type SearchRelatedRulesInput added in v0.6.0

type SearchRelatedRulesInput struct {
	StateMachineQualifiedArn string
	RuleNames                []string
}

type SearchRelatedSchedulesInput added in v0.6.0

type SearchRelatedSchedulesInput struct {
	StateMachineQualifiedArn string
	ScheduleNames            []string
}

type StartExecutionInput added in v0.6.0

type StartExecutionInput struct {
	ExecutionName string
	Input         string
	Qualifier     *string
	Target        string
	Async         bool
}

type StartExecutionOutput added in v0.3.0

type StartExecutionOutput struct {
	CanNotDumpHistory bool
	ExecutionArn      string
	StartDate         time.Time
	Success           *bool
	Failed            *bool
	StopDate          *time.Time
	Output            *string
	Datail            interface{}
}

func (*StartExecutionOutput) Elapsed added in v0.6.0

func (o *StartExecutionOutput) Elapsed() time.Duration

type StateMachine

type StateMachine struct {
	sfn.CreateStateMachineInput
	CreationDate    *time.Time
	LastUpdateDate  *time.Time
	StateMachineArn *string
	Status          sfntypes.StateMachineStatus
	ConfigFilePath  *string
	DefinitionPath  *string
}

func (*StateMachine) AppendTags added in v0.6.0

func (s *StateMachine) AppendTags(tags map[string]string)

func (*StateMachine) DefinitionSource added in v0.8.4

func (s *StateMachine) DefinitionSource() string

func (*StateMachine) DeleteTag added in v0.6.0

func (s *StateMachine) DeleteTag(key string)

func (*StateMachine) DiffString

func (s *StateMachine) DiffString(newStateMachine *StateMachine, unified bool) string

func (*StateMachine) IsManagedBy added in v0.6.0

func (s *StateMachine) IsManagedBy() bool

func (*StateMachine) QualifiedArn added in v0.6.0

func (s *StateMachine) QualifiedArn(name string) string

func (*StateMachine) Source added in v0.8.4

func (s *StateMachine) Source() string

func (*StateMachine) String

func (s *StateMachine) String() string

type StateMachineConfig

type StateMachineConfig struct {
	KeysToSnakeCase[sfn.CreateStateMachineInput] `yaml:",inline" json:",inline"`
	DefinitionPath                               string `yaml:"definition_path,omitempty" json:"definition_path,omitempty"`

	Logging *StateMachineLogging           `yaml:"-,omitempty"`
	Tracing *sfntypes.TracingConfiguration `yaml:"-,omitempty"`
}

func (*StateMachineConfig) Restrict

func (cfg *StateMachineConfig) Restrict() error

Restrict restricts a configuration.

func (*StateMachineConfig) SetDefinition added in v0.6.0

func (cfg *StateMachineConfig) SetDefinition(definition string)

func (*StateMachineConfig) SetDetinitionPath added in v0.6.0

func (cfg *StateMachineConfig) SetDetinitionPath(path string)

func (*StateMachineConfig) UnmarshalJSON added in v0.6.0

func (cfg *StateMachineConfig) UnmarshalJSON(b []byte) error

type StateMachineLogging added in v0.6.0

type StateMachineLogging struct {
	Level                string                          `yaml:"level,omitempty" json:"level,omitempty"`
	IncludeExecutionData bool                            `yaml:"include_execution_data,omitempty" json:"include_execution_data,omitempty"`
	Destination          *StateMachineLoggingDestination `yaml:"destination,omitempty" json:"destination,omitempty"`
}

type StateMachineLoggingDestination added in v0.6.0

type StateMachineLoggingDestination struct {
	LogGroup string `yaml:"log_group,omitempty" json:"log_group,omitempty"`
}

type StateMachineStatus added in v0.6.0

type StateMachineStatus struct {
	Arn            string `json:"arn"`
	Name           string `json:"name"`
	CurrentVersion int    `json:"current_version"`
	Status         string `json:"status"`
	CreatedAt      string `json:"created_at"`
}

func (*StateMachineStatus) String added in v0.6.0

func (s *StateMachineStatus) String() string

type StateMachineVersionListItem added in v0.6.0

type StateMachineVersionListItem struct {
	StateMachineVersionArn string
	Version                int       `json:"version"`
	Aliases                []string  `json:"aliases,omitempty"`
	Description            string    `json:"description,omitempty"`
	CreationDate           time.Time `json:"creation_date"`
	RevisionID             string    `json:"revision_id,omitempty"`
}

type StatusOption added in v0.6.0

type StatusOption struct {
	Format string `name:"format" help:"output format(text,json)" default:"text" enum:"text,json" json:"format,omitempty"`
	Latest bool   `name:"latest" help:"show latest state machine" default:"false" json:"latest,omitempty"`
}

type StatusOutput added in v0.6.0

type StatusOutput struct {
	StateMachine         *StateMachineStatus `json:"state_machine"`
	EventBridge          []*RulesStatus      `json:"event_bridge,omitempty"`
	EventBridgeScheduler []*ScheduleStatus   `json:"event_bridge_scheduler,omitempty"`
}

func (*StatusOutput) String added in v0.6.0

func (s *StatusOutput) String() string

type StudioOption added in v0.6.0

type StudioOption struct {
	Open bool `name:"open" help:"open workflow studio"`
}

type TFStateConfig added in v0.6.0

type TFStateConfig struct {
	FuncPrefix string `yaml:"func_prefix,omitempty" json:"func_prefix,omitempty"`
	Location   string `yaml:"location,omitempty" json:"location,omitempty"`
}

type TriggerConfig added in v0.6.0

type TriggerConfig struct {
	Schedule []TriggerScheduleConfig `yaml:"schedule,omitempty" json:"schedule,omitempty"`
	Event    []TriggerEventConfig    `yaml:"event,omitempty" json:"event,omitempty"`
}

func (*TriggerConfig) Restrict added in v0.6.0

func (cfg *TriggerConfig) Restrict(stateMachineName string) error

type TriggerEventConfig added in v0.6.0

type TriggerEventConfig struct {
	KeysToSnakeCase[TriggerEventConfigInner] `yaml:",inline" json:",inline"`
}

func (*TriggerEventConfig) Restrict added in v0.6.0

func (cfg *TriggerEventConfig) Restrict(i int, stateMachineName string) error

func (*TriggerEventConfig) UnmarshalJSON added in v0.6.0

func (cfg *TriggerEventConfig) UnmarshalJSON(b []byte) error

type TriggerEventConfigInner added in v0.6.0

type TriggerEventConfigInner struct {
	eventbridge.PutRuleInput `yaml:",inline"`
	Target                   eventbridgetypes.Target `yaml:"Target,omitempty" json:"Target,omitempty"`
}

type TriggerScheduleConfig added in v0.6.0

type TriggerScheduleConfig struct {
	KeysToSnakeCase[scheduler.CreateScheduleInput] `yaml:",inline" json:",inline"`
}

func (*TriggerScheduleConfig) Restrict added in v0.6.0

func (cfg *TriggerScheduleConfig) Restrict(i int, stateMachineName string) error

func (*TriggerScheduleConfig) UnmarshalJSON added in v0.6.0

func (cfg *TriggerScheduleConfig) UnmarshalJSON(b []byte) error

type VersionsOption added in v0.6.0

type VersionsOption struct {
	Format       string `help:"versions list format" default:"table" enum:"table,json,tsv" json:"format,omitempty"`
	Delete       bool   `help:"delete older versions" default:"false" json:"delete,omitempty"`
	KeepVersions int    `` /* 130-byte string literal not displayed */
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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