Class: AWSCDK::ECS::CfnService::ServiceConnectClientAliasProperty

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

Overview

Each alias ("endpoint") is a fully-qualified name and port number that other tasks ("clients") can use to connect to this service.

Each name and port mapping must be unique within the namespace.

Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port:, dns_name: nil, test_traffic_rules: nil) ⇒ ServiceConnectClientAliasProperty

Returns a new instance of ServiceConnectClientAliasProperty.

Parameters:

  • port (Numeric)

    The listening port number for the Service Connect proxy.

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

    The dnsName is the name that you use in the applications of client tasks to connect to this service.

  • test_traffic_rules (AWSCDK::IResolvable, AWSCDK::ECS::CfnService::ServiceConnectTestTrafficRulesProperty, nil) (defaults to: nil)

    The configuration for test traffic routing rules used during blue/green deployments with Amazon ECS Service Connect.



2461
2462
2463
2464
2465
2466
2467
2468
# File 'ecs/cfn_service.rb', line 2461

def initialize(port:, dns_name: nil, test_traffic_rules: nil)
  @port = port
  Jsii::Type.check_type(@port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "port")
  @dns_name = dns_name
  Jsii::Type.check_type(@dns_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dnsName") unless @dns_name.nil?
  @test_traffic_rules = test_traffic_rules.is_a?(Hash) ? ::AWSCDK::ECS::CfnService::ServiceConnectTestTrafficRulesProperty.new(**test_traffic_rules.transform_keys(&:to_sym)) : test_traffic_rules
  Jsii::Type.check_type(@test_traffic_rules, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuU2VydmljZS5TZXJ2aWNlQ29ubmVjdFRlc3RUcmFmZmljUnVsZXNQcm9wZXJ0eSJ9XX19")), "testTrafficRules") unless @test_traffic_rules.nil?
end

Instance Attribute Details

#dns_nameString? (readonly)

The dnsName is the name that you use in the applications of client tasks to connect to this service.

The name must be a valid DNS name but doesn't need to be fully-qualified. The name can include up to 127 characters. The name can include lowercase letters, numbers, underscores (_), hyphens (-), and periods (.). The name can't start with a hyphen.

If this parameter isn't specified, the default value of discoveryName.namespace is used. If the discovery_name isn't specified, the port mapping name from the task definition is used in portName.namespace .

To avoid changing your applications in client Amazon ECS services, set this to the same name that the client application uses by default. For example, a few common names are database , db , or the lowercase name of a database, such as mysql or redis . For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .



2489
2490
2491
# File 'ecs/cfn_service.rb', line 2489

def dns_name
  @dns_name
end

#portNumeric (readonly)

The listening port number for the Service Connect proxy.

This port is available inside of all of the tasks within the same namespace.

To avoid changing your applications in client Amazon ECS services, set this to the same port that the client application uses by default. For more information, see Service Connect in the Amazon Elastic Container Service Developer Guide .



2478
2479
2480
# File 'ecs/cfn_service.rb', line 2478

def port
  @port
end

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

The configuration for test traffic routing rules used during blue/green deployments with Amazon ECS Service Connect.

This allows you to route a portion of traffic to the new service revision of your service for testing before shifting all production traffic.



2496
2497
2498
# File 'ecs/cfn_service.rb', line 2496

def test_traffic_rules
  @test_traffic_rules
end

Class Method Details

.jsii_propertiesObject



2498
2499
2500
2501
2502
2503
2504
# File 'ecs/cfn_service.rb', line 2498

def self.jsii_properties
  {
    :port => "port",
    :dns_name => "dnsName",
    :test_traffic_rules => "testTrafficRules",
  }
end

Instance Method Details

#to_jsiiObject



2506
2507
2508
2509
2510
2511
2512
2513
2514
# File 'ecs/cfn_service.rb', line 2506

def to_jsii
  result = {}
  result.merge!({
    "port" => @port,
    "dnsName" => @dns_name,
    "testTrafficRules" => @test_traffic_rules,
  })
  result.compact
end