Class: AWSCDK::StepFunctions::CfnStateMachineAlias::DeploymentPreferenceProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
step_functions/cfn_state_machine_alias.rb

Overview

Enables gradual state machine deployments.

CloudFormation automatically shifts traffic from the version the alias currently points to, to a new state machine version that you specify.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state_machine_version_arn:, type:, alarms: nil, interval: nil, percentage: nil) ⇒ DeploymentPreferenceProperty

Returns a new instance of DeploymentPreferenceProperty.

Parameters:

  • state_machine_version_arn (String)

    The Amazon Resource Name (ARN) of the AWS::StepFunctions::StateMachineVersion resource that will be the final version to which the alias points to when the traffic shifting is complete.

  • type (String)

    The type of deployment you want to perform. You can specify one of the following types:.

  • alarms (Array<String>, nil) (defaults to: nil)

    A list of Amazon CloudWatch alarm names to be monitored during the deployment.

  • interval (Numeric, nil) (defaults to: nil)

    The time in minutes between each traffic shifting increment.

  • percentage (Numeric, nil) (defaults to: nil)

    The percentage of traffic to shift to the new version in each increment.



568
569
570
571
572
573
574
575
576
577
578
579
# File 'step_functions/cfn_state_machine_alias.rb', line 568

def initialize(state_machine_version_arn:, type:, alarms: nil, interval: nil, percentage: nil)
  @state_machine_version_arn = state_machine_version_arn
  Jsii::Type.check_type(@state_machine_version_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stateMachineVersionArn")
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @alarms = alarms
  Jsii::Type.check_type(@alarms, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "alarms") unless @alarms.nil?
  @interval = interval
  Jsii::Type.check_type(@interval, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "interval") unless @interval.nil?
  @percentage = percentage
  Jsii::Type.check_type(@percentage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "percentage") unless @percentage.nil?
end

Instance Attribute Details

#alarmsArray<String>? (readonly)

A list of Amazon CloudWatch alarm names to be monitored during the deployment.

The deployment fails and rolls back if any of these alarms go into the ALARM state.

Amazon CloudWatch considers nonexistent alarms to have an OK state. If you provide an invalid alarm name or provide the ARN of an alarm instead of its name, your deployment may not roll back correctly.



610
611
612
# File 'step_functions/cfn_state_machine_alias.rb', line 610

def alarms
  @alarms
end

#intervalNumeric? (readonly)

The time in minutes between each traffic shifting increment.



615
616
617
# File 'step_functions/cfn_state_machine_alias.rb', line 615

def interval
  @interval
end

#percentageNumeric? (readonly)

The percentage of traffic to shift to the new version in each increment.



620
621
622
# File 'step_functions/cfn_state_machine_alias.rb', line 620

def percentage
  @percentage
end

#state_machine_version_arnString (readonly)

The Amazon Resource Name (ARN) of the AWS::StepFunctions::StateMachineVersion resource that will be the final version to which the alias points to when the traffic shifting is complete.

While performing gradual deployments, you can only provide a single state machine version ARN. To explicitly set version weights in a CloudFormation template, use RoutingConfiguration instead.



587
588
589
# File 'step_functions/cfn_state_machine_alias.rb', line 587

def state_machine_version_arn
  @state_machine_version_arn
end

#typeString (readonly)

The type of deployment you want to perform. You can specify one of the following types:.

  • LINEAR - Shifts traffic to the new version in equal increments with an equal number of minutes between each increment.

For example, if you specify the increment percent as 20 with an interval of 600 minutes, this deployment increases traffic by 20 percent every 600 minutes until the new version receives 100 percent of the traffic. This deployment immediately rolls back the new version if any CloudWatch alarms are triggered.

  • ALL_AT_ONCE - Shifts 100 percent of traffic to the new version immediately. CloudFormation monitors the new version and rolls it back automatically to the previous version if any CloudWatch alarms are triggered.
  • CANARY - Shifts traffic in two increments.

In the first increment, a small percentage of traffic, for example, 10 percent is shifted to the new version. In the second increment, before a specified time interval in seconds gets over, the remaining traffic is shifted to the new version. The shift to the new version for the remaining traffic takes place only if no CloudWatch alarms are triggered during the specified time interval.



601
602
603
# File 'step_functions/cfn_state_machine_alias.rb', line 601

def type
  @type
end

Class Method Details

.jsii_propertiesObject



622
623
624
625
626
627
628
629
630
# File 'step_functions/cfn_state_machine_alias.rb', line 622

def self.jsii_properties
  {
    :state_machine_version_arn => "stateMachineVersionArn",
    :type => "type",
    :alarms => "alarms",
    :interval => "interval",
    :percentage => "percentage",
  }
end

Instance Method Details

#to_jsiiObject



632
633
634
635
636
637
638
639
640
641
642
# File 'step_functions/cfn_state_machine_alias.rb', line 632

def to_jsii
  result = {}
  result.merge!({
    "stateMachineVersionArn" => @state_machine_version_arn,
    "type" => @type,
    "alarms" => @alarms,
    "interval" => @interval,
    "percentage" => @percentage,
  })
  result.compact
end