Class: AWSCDK::ECS::ForceNewDeployment

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/force_new_deployment.rb

Overview

Configuration for forcing a new deployment of the service.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled:, nonce: nil) ⇒ ForceNewDeployment

Returns a new instance of ForceNewDeployment.

Parameters:

  • enabled (Boolean)

    Whether to enable the force-new-deployment mechanism for the service.

  • nonce (String, nil) (defaults to: nil)

    A unique nonce value that signals Amazon ECS to start a new deployment.



9
10
11
12
13
14
# File 'ecs/force_new_deployment.rb', line 9

def initialize(enabled:, nonce: nil)
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled")
  @nonce = nonce
  Jsii::Type.check_type(@nonce, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nonce") unless @nonce.nil?
end

Instance Attribute Details

#enabledBoolean (readonly)

Whether to enable the force-new-deployment mechanism for the service.

Setting this to true enables the mechanism, but on its own it does not force a new deployment on every cdk deploy: CloudFormation only starts a new deployment when it detects a change in the template, and the signal for that is the nonce value changing between deployments. If nonce is not provided or its value stays the same across deployments, no new deployment is forced. When set to false, the ForceNewDeployment property is rendered with EnableForceNewDeployment: false.

To force a new deployment on every cdk deploy, provide a nonce with a unique, time-varying value such as a timestamp, random string, or sequence number (e.g. Date.now().toString()).



32
33
34
# File 'ecs/force_new_deployment.rb', line 32

def enabled
  @enabled
end

#nonceString? (readonly)

Note:

Default: - no nonce

A unique nonce value that signals Amazon ECS to start a new deployment.

When you change this value, it triggers a new deployment even though no other service parameters have changed. Use a stable, time-varying value like a commit hash, image digest, or version string.

If not provided and enabled is true, only EnableForceNewDeployment is set without a nonce.

Must be between 1 and 255 characters.

Returns:

  • (String, nil)


46
47
48
# File 'ecs/force_new_deployment.rb', line 46

def nonce
  @nonce
end

Class Method Details

.jsii_propertiesObject



48
49
50
51
52
53
# File 'ecs/force_new_deployment.rb', line 48

def self.jsii_properties
  {
    :enabled => "enabled",
    :nonce => "nonce",
  }
end

Instance Method Details

#to_jsiiObject



55
56
57
58
59
60
61
62
# File 'ecs/force_new_deployment.rb', line 55

def to_jsii
  result = {}
  result.merge!({
    "enabled" => @enabled,
    "nonce" => @nonce,
  })
  result.compact
end