Class: AWSCDK::ECS::CfnService::DeploymentLifecycleHookProperty

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

Overview

A deployment lifecycle hook runs custom logic at specific stages of the deployment process.

Currently, you can use Lambda functions as hook targets.

For more information, see Lifecycle hooks for Amazon ECS service deployments in the Amazon Elastic Container Service Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lifecycle_stages:, hook_details: nil, hook_target_arn: nil, role_arn: nil, target_type: nil, timeout_configuration: nil) ⇒ DeploymentLifecycleHookProperty

Returns a new instance of DeploymentLifecycleHookProperty.

Parameters:

  • lifecycle_stages (Array<String>)

    The lifecycle stages at which to run the hook. Choose from these valid values:.

  • hook_details (Object, nil) (defaults to: nil)

    Use this field to specify custom parameters that Amazon ECS passes to your hook target invocations (such as a Lambda function).

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

    The Amazon Resource Name (ARN) of the hook target. Currently, only Lambda function ARNs are supported.

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

    The Amazon Resource Name (ARN) of the IAM role that grants Amazon ECS permission to call Lambda functions on your behalf.

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

    The type of action the lifecycle hook performs.

  • timeout_configuration (AWSCDK::IResolvable, AWSCDK::ECS::CfnService::HookTimeoutConfigProperty, nil) (defaults to: nil)


1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
# File 'ecs/cfn_service.rb', line 1548

def initialize(lifecycle_stages:, hook_details: nil, hook_target_arn: nil, role_arn: nil, target_type: nil, timeout_configuration: nil)
  @lifecycle_stages = lifecycle_stages
  Jsii::Type.check_type(@lifecycle_stages, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "lifecycleStages")
  @hook_details = hook_details
  Jsii::Type.check_type(@hook_details, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "hookDetails") unless @hook_details.nil?
  @hook_target_arn = hook_target_arn
  Jsii::Type.check_type(@hook_target_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hookTargetArn") unless @hook_target_arn.nil?
  @role_arn = role_arn
  Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleArn") unless @role_arn.nil?
  @target_type = target_type
  Jsii::Type.check_type(@target_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "targetType") unless @target_type.nil?
  @timeout_configuration = timeout_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::HookTimeoutConfigProperty.new(**timeout_configuration.transform_keys(&:to_sym)) : timeout_configuration
  Jsii::Type.check_type(@timeout_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5Ib29rVGltZW91dENvbmZpZ1Byb3BlcnR5In1dfX0=")), "timeoutConfiguration") unless @timeout_configuration.nil?
end

Instance Attribute Details

#hook_detailsObject? (readonly)

Use this field to specify custom parameters that Amazon ECS passes to your hook target invocations (such as a Lambda function).

This field must be a JSON object as a string.



1618
1619
1620
# File 'ecs/cfn_service.rb', line 1618

def hook_details
  @hook_details
end

#hook_target_arnString? (readonly)

The Amazon Resource Name (ARN) of the hook target. Currently, only Lambda function ARNs are supported.

You must provide this parameter when configuring a deployment lifecycle hook.



1625
1626
1627
# File 'ecs/cfn_service.rb', line 1625

def hook_target_arn
  @hook_target_arn
end

#lifecycle_stagesArray<String> (readonly)

The lifecycle stages at which to run the hook. Choose from these valid values:.

  • RECONCILE_SERVICE

The reconciliation stage that only happens when you start a new service deployment with more than 1 service revision in an ACTIVE state.

You can use a lifecycle hook for this stage.

  • PRE_SCALE_UP

The green service revision has not started. The blue service revision is handling 100% of the production traffic. There is no test traffic.

You can use a lifecycle hook for this stage.

  • POST_SCALE_UP

The green service revision has started. The blue service revision is handling 100% of the production traffic. There is no test traffic.

You can use a lifecycle hook for this stage.

  • TEST_TRAFFIC_SHIFT

The blue and green service revisions are running. The blue service revision handles 100% of the production traffic. The green service revision is migrating from 0% to 100% of test traffic.

You can use a lifecycle hook for this stage.

  • POST_TEST_TRAFFIC_SHIFT

The test traffic shift is complete. The green service revision handles 100% of the test traffic.

You can use a lifecycle hook for this stage.

  • PRODUCTION_TRAFFIC_SHIFT

Production traffic is shifting to the green service revision. The green service revision is migrating from 0% to 100% of production traffic.

You can use a lifecycle hook for this stage.

  • POST_PRODUCTION_TRAFFIC_SHIFT

The production traffic shift is complete.

You can use a lifecycle hook for this stage.

You must provide this parameter when configuring a deployment lifecycle hook.



1611
1612
1613
# File 'ecs/cfn_service.rb', line 1611

def lifecycle_stages
  @lifecycle_stages
end

#role_arnString? (readonly)

The Amazon Resource Name (ARN) of the IAM role that grants Amazon ECS permission to call Lambda functions on your behalf.

For more information, see Permissions required for Lambda functions in Amazon ECS blue/green deployments in the Amazon Elastic Container Service Developer Guide .



1632
1633
1634
# File 'ecs/cfn_service.rb', line 1632

def role_arn
  @role_arn
end

#target_typeString? (readonly)

The type of action the lifecycle hook performs.

Valid values are:

  • AWS_LAMBDA - Invokes a Lambda function at the specified lifecycle stage. This is the default value.
  • PAUSE - Pauses the deployment at the specified lifecycle stage until you call ContinueServiceDeployment to continue or roll back.

This field is optional. If not specified, the default value is AWS_LAMBDA.



1644
1645
1646
# File 'ecs/cfn_service.rb', line 1644

def target_type
  @target_type
end

#timeout_configurationAWSCDK::IResolvable, ... (readonly)



1647
1648
1649
# File 'ecs/cfn_service.rb', line 1647

def timeout_configuration
  @timeout_configuration
end

Class Method Details

.jsii_propertiesObject



1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
# File 'ecs/cfn_service.rb', line 1649

def self.jsii_properties
  {
    :lifecycle_stages => "lifecycleStages",
    :hook_details => "hookDetails",
    :hook_target_arn => "hookTargetArn",
    :role_arn => "roleArn",
    :target_type => "targetType",
    :timeout_configuration => "timeoutConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
# File 'ecs/cfn_service.rb', line 1660

def to_jsii
  result = {}
  result.merge!({
    "lifecycleStages" => @lifecycle_stages,
    "hookDetails" => @hook_details,
    "hookTargetArn" => @hook_target_arn,
    "roleArn" => @role_arn,
    "targetType" => @target_type,
    "timeoutConfiguration" => @timeout_configuration,
  })
  result.compact
end