Class: AWSCDK::ECS::CfnExpressGatewayService::ExpressGatewayContainerProperty

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

Overview

Defines the configuration for the primary container in an Express service.

This container receives traffic from the Application Load Balancer and runs your application code.

The container configuration includes the container image, port mapping, logging settings, environment variables, and secrets. The container image is the only required parameter, with sensible defaults provided for other settings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, aws_logs_configuration: nil, command: nil, container_port: nil, environment: nil, repository_credentials: nil, secrets: nil) ⇒ ExpressGatewayContainerProperty

Returns a new instance of ExpressGatewayContainerProperty.

Parameters:



924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
# File 'ecs/cfn_express_gateway_service.rb', line 924

def initialize(image:, aws_logs_configuration: nil, command: nil, container_port: nil, environment: nil, repository_credentials: nil, secrets: nil)
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image")
  @aws_logs_configuration = aws_logs_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnExpressGatewayService::ExpressGatewayServiceAWSLogsConfigurationProperty.new(**aws_logs_configuration.transform_keys(&:to_sym)) : aws_logs_configuration
  Jsii::Type.check_type(@aws_logs_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuRXhwcmVzc0dhdGV3YXlTZXJ2aWNlLkV4cHJlc3NHYXRld2F5U2VydmljZUF3c0xvZ3NDb25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "awsLogsConfiguration") unless @aws_logs_configuration.nil?
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @container_port = container_port
  Jsii::Type.check_type(@container_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "containerPort") unless @container_port.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmbkV4cHJlc3NHYXRld2F5U2VydmljZS5LZXlWYWx1ZVBhaXJQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "environment") unless @environment.nil?
  @repository_credentials = repository_credentials.is_a?(Hash) ? ::AWSCDK::ECS::CfnExpressGatewayService::ExpressGatewayRepositoryCredentialsProperty.new(**repository_credentials.transform_keys(&:to_sym)) : repository_credentials
  Jsii::Type.check_type(@repository_credentials, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuRXhwcmVzc0dhdGV3YXlTZXJ2aWNlLkV4cHJlc3NHYXRld2F5UmVwb3NpdG9yeUNyZWRlbnRpYWxzUHJvcGVydHkifV19fQ==")), "repositoryCredentials") unless @repository_credentials.nil?
  @secrets = secrets
  Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNmbkV4cHJlc3NHYXRld2F5U2VydmljZS5TZWNyZXRQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "secrets") unless @secrets.nil?
end

Instance Attribute Details

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

The log configuration for the container.



954
955
956
# File 'ecs/cfn_express_gateway_service.rb', line 954

def aws_logs_configuration
  @aws_logs_configuration
end

#commandArray<String>? (readonly)

The command that is passed to the container.



959
960
961
# File 'ecs/cfn_express_gateway_service.rb', line 959

def command
  @command
end

#container_portNumeric? (readonly)

Note:

Default: - 80

The port number on the container that receives traffic from the load balancer.

Default is 80.



967
968
969
# File 'ecs/cfn_express_gateway_service.rb', line 967

def container_port
  @container_port
end

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

The environment variables to pass to the container.



972
973
974
# File 'ecs/cfn_express_gateway_service.rb', line 972

def environment
  @environment
end

#imageString (readonly)

The image used to start a container.

This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest .

For Express services, the image typically contains a web application that listens on the specified container port. The image can be stored in Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.



949
950
951
# File 'ecs/cfn_express_gateway_service.rb', line 949

def image
  @image
end

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

The configuration for repository credentials for private registry authentication.



977
978
979
# File 'ecs/cfn_express_gateway_service.rb', line 977

def repository_credentials
  @repository_credentials
end

Class Method Details

.jsii_propertiesObject



984
985
986
987
988
989
990
991
992
993
994
# File 'ecs/cfn_express_gateway_service.rb', line 984

def self.jsii_properties
  {
    :image => "image",
    :aws_logs_configuration => "awsLogsConfiguration",
    :command => "command",
    :container_port => "containerPort",
    :environment => "environment",
    :repository_credentials => "repositoryCredentials",
    :secrets => "secrets",
  }
end

Instance Method Details

#to_jsiiObject



996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
# File 'ecs/cfn_express_gateway_service.rb', line 996

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "awsLogsConfiguration" => @aws_logs_configuration,
    "command" => @command,
    "containerPort" => @container_port,
    "environment" => @environment,
    "repositoryCredentials" => @repository_credentials,
    "secrets" => @secrets,
  })
  result.compact
end