Documentation ¶
Index ¶
- Constants
- Variables
- func All[T any](items []T, cond func(*T) bool) bool
- func Any[T any](items []T, cond func(*T) bool) bool
- func AskToContinue() bool
- func Contains[T comparable](items []T, value *T) bool
- func Count[T any](items []T, cond func(*T) bool) int
- func Delete[T any](items []T, cond func(*T) bool) []T
- func FastDelete[T any](items []T, cond func(*T) bool) []T
- func Filter[T any](items []T, cond func(*T) bool) []T
- func FirstOrDefault[T any](items []T, cond func(*T) bool) *T
- func FirstOrNil[T any](items []T, cond func(*T) bool) *T
- func GetEnv(key string, fallback string) string
- func Map[T, V any](items []T, conv func(i int, t *T) *V) []V
- type AwsClient
- type BundleInfo
- type Bundler
- func (b *Bundler) Activate(ctx context.Context, targetType TargetType, bundleValue string) error
- func (b *Bundler) Download(ctx context.Context, targetType TargetType) error
- func (b *Bundler) ListBundles(ctx context.Context) error
- func (b *Bundler) Register(ctx context.Context, uploadFile string, bundleName string) error
- type Config
- type DefaultAwsClient
- func (c *DefaultAwsClient) CreateS3Bucket(ctx context.Context, bucket string, region string) error
- func (c *DefaultAwsClient) DeleteS3BucketObject(ctx context.Context, bucket string, key string) error
- func (c *DefaultAwsClient) DeleteScheduledAction(ctx context.Context, autoScalingGroupName string, scheduledActionName string) error
- func (c *DefaultAwsClient) DescribeALBTargetGroup(ctx context.Context, targetGroupArn string) (*albTypes.TargetGroup, error)
- func (c *DefaultAwsClient) DescribeALBTargetHealth(ctx context.Context, targetGroupArn string) ([]albTypes.TargetHealthDescription, error)
- func (c *DefaultAwsClient) DescribeAutoScalingGroup(ctx context.Context, name string) (*asgTypes.AutoScalingGroup, error)
- func (c *DefaultAwsClient) DescribeScheduledActions(ctx context.Context, name string) ([]asgTypes.ScheduledUpdateGroupAction, error)
- func (c *DefaultAwsClient) DisableS3BucketPublicAccess(ctx context.Context, bucket string) error
- func (c *DefaultAwsClient) EnableS3BucketVersioning(ctx context.Context, bucket string) error
- func (c *DefaultAwsClient) GetALBListenerRule(ctx context.Context, listenerRuleArn string) (*albTypes.Rule, error)
- func (c *DefaultAwsClient) GetS3BucketObject(ctx context.Context, bucket string, key string) (*s3.GetObjectOutput, error)
- func (c *DefaultAwsClient) GetSSMParameter(ctx context.Context, name string, withDecription bool) (*ssmTypes.Parameter, error)
- func (c *DefaultAwsClient) HeadS3Bucket(ctx context.Context, bucket string) error
- func (c *DefaultAwsClient) ListS3BucketObjects(ctx context.Context, bucket string, prefix string) ([]s3Types.Object, error)
- func (c *DefaultAwsClient) MakeS3BucketAclPrivate(ctx context.Context, bucket string) error
- func (c *DefaultAwsClient) ModifyALBListenerRule(ctx context.Context, listenerRuleArn string, ...) error
- func (c *DefaultAwsClient) PutS3BucketObjectAsBinaryFile(ctx context.Context, bucket string, key string, file *os.File) error
- func (c *DefaultAwsClient) PutS3BucketObjectAsTextFile(ctx context.Context, bucket string, key string, value string) error
- func (c *DefaultAwsClient) PutScheduledUpdateGroupAction(ctx context.Context, name string, action *asgTypes.ScheduledUpdateGroupAction) error
- func (c *DefaultAwsClient) Region() string
- func (c *DefaultAwsClient) UpdateAutoScalingGroup(ctx context.Context, name string, desiredCapacity *int32, minSize *int32, ...) error
- type DefaultLogger
- type DeployInfo
- type DeployTarget
- type Deployer
- func (d *Deployer) CleanupAutoScalingGroup(ctx context.Context, autoScalingGroupName string) error
- func (d *Deployer) Deploy(ctx context.Context, swap bool, cleanupBeforeDeploy bool, ...) error
- func (d *Deployer) GetDeployInfo(ctx context.Context) (*DeployInfo, error)
- func (d *Deployer) GetDeployTarget(ctx context.Context, rule *albTypes.Rule, targetType TargetType) (*DeployTarget, error)
- func (d *Deployer) HealthCheck(ctx context.Context, targetGroupArn string, autoScalingGroupName string) error
- func (d *Deployer) MoveScheduledActions(ctx context.Context, fromAutoScalingGroupName string, ...) error
- func (d *Deployer) ShowStatus(ctx context.Context) error
- func (d *Deployer) SwapTraffic(ctx context.Context, duration *time.Duration) error
- func (d *Deployer) UpdateAutoScalingGroup(ctx context.Context, autoScalingGroupName string, desiredCapacity *int32, ...) error
- func (d *Deployer) UpdateAutoScalingGroupByTarget(ctx context.Context, targetType TargetType, desiredCapacity *int32, ...) error
- func (d *Deployer) UpdateTraffic(ctx context.Context, blueWeight int32, greenWeight int32) error
- type FixedIntervalRetryer
- type HealthInfo
- type Logger
- type RetryPolicy
- type RetryResult
- type Retryer
- type Target
- type TargetSet
- type TargetType
- type TimeZone
Constants ¶
View Source
const ( BundlePrefix string = "bundles/" ActiveBundleKeyPrefix string = "active_bundle_" MaxKeepBundles int = 100 )
View Source
const ( FinishRetry = true ContinueRetry = false )
Variables ¶
View Source
var CancellationError = errors.New("CancellationError")
View Source
var RetryTimeout = errors.New("RetryTimeout")
Functions ¶
func AskToContinue ¶
func AskToContinue() bool
func Contains ¶
func Contains[T comparable](items []T, value *T) bool
func FastDelete ¶
FastDelete Fast deletion (order is no longer guaranteed) see: https://zenn.dev/mattn/articles/31dfed3c89956d#%E9%A0%86%E3%82%92%E8%80%83%E3%81%88%E3%81%AA%E3%81%84%E5%89%8A%E9%99%A4(%E3%81%8A%E3%81%BE%E3%81%91)
func FirstOrDefault ¶
func FirstOrNil ¶
Types ¶
type AwsClient ¶
type AwsClient interface { Region() string ListS3BucketObjects(ctx context.Context, bucket string, prefix string) ([]s3Types.Object, error) HeadS3Bucket(ctx context.Context, bucket string) error CreateS3Bucket(ctx context.Context, bucket string, region string) error EnableS3BucketVersioning(ctx context.Context, bucket string) error MakeS3BucketAclPrivate(ctx context.Context, bucket string) error DisableS3BucketPublicAccess(ctx context.Context, bucket string) error DeleteS3BucketObject(ctx context.Context, bucket string, key string) error PutS3BucketObjectAsBinaryFile(ctx context.Context, bucket string, key string, file *os.File) error PutS3BucketObjectAsTextFile(ctx context.Context, bucket string, key string, value string) error GetS3BucketObject(ctx context.Context, bucket string, key string) (*s3.GetObjectOutput, error) GetALBListenerRule(ctx context.Context, listenerRuleArn string) (*albTypes.Rule, error) ModifyALBListenerRule(ctx context.Context, listenerRuleArn string, forwardAction *albTypes.ForwardActionConfig) error DescribeALBTargetHealth(ctx context.Context, targetGroupArn string) ([]albTypes.TargetHealthDescription, error) DescribeALBTargetGroup(ctx context.Context, targetGroupArn string) (*albTypes.TargetGroup, error) DescribeAutoScalingGroup(ctx context.Context, name string) (*asgTypes.AutoScalingGroup, error) UpdateAutoScalingGroup(ctx context.Context, name string, desiredCapacity *int32, minSize *int32, maxSize *int32) error DescribeScheduledActions(ctx context.Context, name string) ([]asgTypes.ScheduledUpdateGroupAction, error) PutScheduledUpdateGroupAction(ctx context.Context, name string, action *asgTypes.ScheduledUpdateGroupAction) error DeleteScheduledAction(ctx context.Context, autoScalingGroupName string, scheduledActionName string) error GetSSMParameter(ctx context.Context, name string, withDecription bool) (*ssmTypes.Parameter, error) }
type BundleInfo ¶
type Bundler ¶
type Bundler struct {
// contains filtered or unexported fields
}
func NewBundler ¶
type Config ¶
type Config struct { BundleBucket string `json:"bundleBucket" validate:"required"` ListenerRuleArn string `json:"listenerRuleArn" validate:"required"` Target *TargetSet `json:"target" validate:"required"` RetryPolicy *RetryPolicy `json:"retryPolicy" validate:"required"` TimeZone *TimeZone `json:"timeZone" validate:"required"` }
type DefaultAwsClient ¶
type DefaultAwsClient struct {
// contains filtered or unexported fields
}
func NewDefaultAwsClient ¶
func NewDefaultAwsClient(ctx context.Context) (*DefaultAwsClient, error)
func (*DefaultAwsClient) CreateS3Bucket ¶
func (*DefaultAwsClient) DeleteS3BucketObject ¶
func (*DefaultAwsClient) DeleteScheduledAction ¶
func (*DefaultAwsClient) DescribeALBTargetGroup ¶
func (c *DefaultAwsClient) DescribeALBTargetGroup(ctx context.Context, targetGroupArn string) (*albTypes.TargetGroup, error)
func (*DefaultAwsClient) DescribeALBTargetHealth ¶
func (c *DefaultAwsClient) DescribeALBTargetHealth(ctx context.Context, targetGroupArn string) ([]albTypes.TargetHealthDescription, error)
func (*DefaultAwsClient) DescribeAutoScalingGroup ¶
func (c *DefaultAwsClient) DescribeAutoScalingGroup(ctx context.Context, name string) (*asgTypes.AutoScalingGroup, error)
func (*DefaultAwsClient) DescribeScheduledActions ¶
func (c *DefaultAwsClient) DescribeScheduledActions(ctx context.Context, name string) ([]asgTypes.ScheduledUpdateGroupAction, error)
func (*DefaultAwsClient) DisableS3BucketPublicAccess ¶
func (c *DefaultAwsClient) DisableS3BucketPublicAccess(ctx context.Context, bucket string) error
func (*DefaultAwsClient) EnableS3BucketVersioning ¶
func (c *DefaultAwsClient) EnableS3BucketVersioning(ctx context.Context, bucket string) error
func (*DefaultAwsClient) GetALBListenerRule ¶
func (*DefaultAwsClient) GetS3BucketObject ¶
func (c *DefaultAwsClient) GetS3BucketObject(ctx context.Context, bucket string, key string) (*s3.GetObjectOutput, error)
func (*DefaultAwsClient) GetSSMParameter ¶
func (*DefaultAwsClient) HeadS3Bucket ¶
func (c *DefaultAwsClient) HeadS3Bucket(ctx context.Context, bucket string) error
func (*DefaultAwsClient) ListS3BucketObjects ¶
func (*DefaultAwsClient) MakeS3BucketAclPrivate ¶
func (c *DefaultAwsClient) MakeS3BucketAclPrivate(ctx context.Context, bucket string) error
func (*DefaultAwsClient) ModifyALBListenerRule ¶
func (c *DefaultAwsClient) ModifyALBListenerRule(ctx context.Context, listenerRuleArn string, forwardAction *albTypes.ForwardActionConfig) error
func (*DefaultAwsClient) PutS3BucketObjectAsBinaryFile ¶
func (*DefaultAwsClient) PutS3BucketObjectAsTextFile ¶
func (*DefaultAwsClient) PutScheduledUpdateGroupAction ¶
func (c *DefaultAwsClient) PutScheduledUpdateGroupAction(ctx context.Context, name string, action *asgTypes.ScheduledUpdateGroupAction) error
func (*DefaultAwsClient) Region ¶
func (c *DefaultAwsClient) Region() string
func (*DefaultAwsClient) UpdateAutoScalingGroup ¶
type DefaultLogger ¶
type DefaultLogger struct {
Verbose bool
}
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(message string)
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(message string, error error)
func (*DefaultLogger) Fatal ¶
func (l *DefaultLogger) Fatal(message string, error error)
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(message string)
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(message string, error error)
type DeployInfo ¶
type DeployInfo struct { IdlingTarget *DeployTarget RunningTarget *DeployTarget }
type DeployTarget ¶
type DeployTarget struct { Type TargetType TargetGroup *albTypes.TargetGroupTuple AutoScalingGroup *asgTypes.AutoScalingGroup }
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
func NewDeployer ¶
func (*Deployer) CleanupAutoScalingGroup ¶
func (*Deployer) GetDeployInfo ¶
func (d *Deployer) GetDeployInfo(ctx context.Context) (*DeployInfo, error)
func (*Deployer) GetDeployTarget ¶
func (d *Deployer) GetDeployTarget( ctx context.Context, rule *albTypes.Rule, targetType TargetType) (*DeployTarget, error)
func (*Deployer) HealthCheck ¶
func (*Deployer) MoveScheduledActions ¶
func (*Deployer) SwapTraffic ¶
func (*Deployer) UpdateAutoScalingGroup ¶
func (*Deployer) UpdateAutoScalingGroupByTarget ¶
type FixedIntervalRetryer ¶
type FixedIntervalRetryer struct {
// contains filtered or unexported fields
}
func NewFixedIntervalRetryer ¶
func NewFixedIntervalRetryer(maxLimit int, interval *time.Duration) *FixedIntervalRetryer
func (FixedIntervalRetryer) Start ¶
func (r FixedIntervalRetryer) Start(hendler func(index int, interval *time.Duration) (RetryResult, error)) error
type HealthInfo ¶
type RetryPolicy ¶
type RetryResult ¶
type RetryResult bool
type TargetType ¶
type TargetType string
const ( BlueTargetType TargetType = "blue" GreenTargetType TargetType = "green" )
Click to show internal directories.
Click to hide internal directories.