/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace ECS { namespace Model { /** *

Details on the network bindings between a container and its host container * instance. After a task reaches the RUNNING status, manual and * automatic host and container port assignments are visible in the * networkBindings section of DescribeTasks API * responses.

See Also:

AWS * API Reference

*/ class NetworkBinding { public: AWS_ECS_API NetworkBinding(); AWS_ECS_API NetworkBinding(Aws::Utils::Json::JsonView jsonValue); AWS_ECS_API NetworkBinding& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_ECS_API Aws::Utils::Json::JsonValue Jsonize() const; /** *

The IP address that the container is bound to on the container instance.

*/ inline const Aws::String& GetBindIP() const{ return m_bindIP; } /** *

The IP address that the container is bound to on the container instance.

*/ inline bool BindIPHasBeenSet() const { return m_bindIPHasBeenSet; } /** *

The IP address that the container is bound to on the container instance.

*/ inline void SetBindIP(const Aws::String& value) { m_bindIPHasBeenSet = true; m_bindIP = value; } /** *

The IP address that the container is bound to on the container instance.

*/ inline void SetBindIP(Aws::String&& value) { m_bindIPHasBeenSet = true; m_bindIP = std::move(value); } /** *

The IP address that the container is bound to on the container instance.

*/ inline void SetBindIP(const char* value) { m_bindIPHasBeenSet = true; m_bindIP.assign(value); } /** *

The IP address that the container is bound to on the container instance.

*/ inline NetworkBinding& WithBindIP(const Aws::String& value) { SetBindIP(value); return *this;} /** *

The IP address that the container is bound to on the container instance.

*/ inline NetworkBinding& WithBindIP(Aws::String&& value) { SetBindIP(std::move(value)); return *this;} /** *

The IP address that the container is bound to on the container instance.

*/ inline NetworkBinding& WithBindIP(const char* value) { SetBindIP(value); return *this;} /** *

The port number on the container that's used with the network binding.

*/ inline int GetContainerPort() const{ return m_containerPort; } /** *

The port number on the container that's used with the network binding.

*/ inline bool ContainerPortHasBeenSet() const { return m_containerPortHasBeenSet; } /** *

The port number on the container that's used with the network binding.

*/ inline void SetContainerPort(int value) { m_containerPortHasBeenSet = true; m_containerPort = value; } /** *

The port number on the container that's used with the network binding.

*/ inline NetworkBinding& WithContainerPort(int value) { SetContainerPort(value); return *this;} /** *

The port number on the host that's used with the network binding.

*/ inline int GetHostPort() const{ return m_hostPort; } /** *

The port number on the host that's used with the network binding.

*/ inline bool HostPortHasBeenSet() const { return m_hostPortHasBeenSet; } /** *

The port number on the host that's used with the network binding.

*/ inline void SetHostPort(int value) { m_hostPortHasBeenSet = true; m_hostPort = value; } /** *

The port number on the host that's used with the network binding.

*/ inline NetworkBinding& WithHostPort(int value) { SetHostPort(value); return *this;} /** *

The protocol used for the network binding.

*/ inline const TransportProtocol& GetProtocol() const{ return m_protocol; } /** *

The protocol used for the network binding.

*/ inline bool ProtocolHasBeenSet() const { return m_protocolHasBeenSet; } /** *

The protocol used for the network binding.

*/ inline void SetProtocol(const TransportProtocol& value) { m_protocolHasBeenSet = true; m_protocol = value; } /** *

The protocol used for the network binding.

*/ inline void SetProtocol(TransportProtocol&& value) { m_protocolHasBeenSet = true; m_protocol = std::move(value); } /** *

The protocol used for the network binding.

*/ inline NetworkBinding& WithProtocol(const TransportProtocol& value) { SetProtocol(value); return *this;} /** *

The protocol used for the network binding.

*/ inline NetworkBinding& WithProtocol(TransportProtocol&& value) { SetProtocol(std::move(value)); return *this;} /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline const Aws::String& GetContainerPortRange() const{ return m_containerPortRange; } /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline bool ContainerPortRangeHasBeenSet() const { return m_containerPortRangeHasBeenSet; } /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline void SetContainerPortRange(const Aws::String& value) { m_containerPortRangeHasBeenSet = true; m_containerPortRange = value; } /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline void SetContainerPortRange(Aws::String&& value) { m_containerPortRangeHasBeenSet = true; m_containerPortRange = std::move(value); } /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline void SetContainerPortRange(const char* value) { m_containerPortRangeHasBeenSet = true; m_containerPortRange.assign(value); } /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline NetworkBinding& WithContainerPortRange(const Aws::String& value) { SetContainerPortRange(value); return *this;} /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline NetworkBinding& WithContainerPortRange(Aws::String&& value) { SetContainerPortRange(std::move(value)); return *this;} /** *

The port number range on the container that's bound to the dynamically mapped * host port range.

The following rules apply when you specify a * containerPortRange:

  • You must use either the * bridge network mode or the awsvpc network mode.

    *
  • This parameter is available for both the EC2 and Fargate launch * types.

  • This parameter is available for both the Linux and * Windows operating systems.

  • The container instance must have at * least version 1.67.0 of the container agent and at least version 1.67.0-1 of the * ecs-init package

  • You can specify a maximum of * 100 port ranges per container.

  • You do not specify a * hostPortRange. The value of the hostPortRange is set * as follows:

    • For containers in a task with the * awsvpc network mode, the hostPort is set to the same * value as the containerPort. This is a static mapping strategy.

      *
    • For containers in a task with the bridge network * mode, the Amazon ECS agent finds open host ports from the default ephemeral * range and passes it to docker to bind them to the container ports.

    • *
  • The containerPortRange valid values are between * 1 and 65535.

  • A port can only be included in one port mapping * per container.

  • You cannot specify overlapping port ranges.

    *
  • The first port in the range must be less than last port in the * range.

  • Docker recommends that you turn off the docker-proxy in * the Docker daemon config file when you have a large number of ports.

    For * more information, see Issue * #11185 on the Github website.

    For information about how to turn off * the docker-proxy in the Docker daemon config file, see Docker * daemon in the Amazon ECS Developer Guide.

You can * call * DescribeTasks to view the hostPortRange which are * the host ports that are bound to the container ports.

*/ inline NetworkBinding& WithContainerPortRange(const char* value) { SetContainerPortRange(value); return *this;} /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline const Aws::String& GetHostPortRange() const{ return m_hostPortRange; } /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline bool HostPortRangeHasBeenSet() const { return m_hostPortRangeHasBeenSet; } /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline void SetHostPortRange(const Aws::String& value) { m_hostPortRangeHasBeenSet = true; m_hostPortRange = value; } /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline void SetHostPortRange(Aws::String&& value) { m_hostPortRangeHasBeenSet = true; m_hostPortRange = std::move(value); } /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline void SetHostPortRange(const char* value) { m_hostPortRangeHasBeenSet = true; m_hostPortRange.assign(value); } /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline NetworkBinding& WithHostPortRange(const Aws::String& value) { SetHostPortRange(value); return *this;} /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline NetworkBinding& WithHostPortRange(Aws::String&& value) { SetHostPortRange(std::move(value)); return *this;} /** *

The port number range on the host that's used with the network binding. This * is assigned is assigned by Docker and delivered by the Amazon ECS agent.

*/ inline NetworkBinding& WithHostPortRange(const char* value) { SetHostPortRange(value); return *this;} private: Aws::String m_bindIP; bool m_bindIPHasBeenSet = false; int m_containerPort; bool m_containerPortHasBeenSet = false; int m_hostPort; bool m_hostPortHasBeenSet = false; TransportProtocol m_protocol; bool m_protocolHasBeenSet = false; Aws::String m_containerPortRange; bool m_containerPortRangeHasBeenSet = false; Aws::String m_hostPortRange; bool m_hostPortRangeHasBeenSet = false; }; } // namespace Model } // namespace ECS } // namespace Aws