aws-cdk-lib.aws_ecs.ServiceConnect

class ServiceConnect

LanguageType name
.NETAmazon.CDK.AWS.ECS.ServiceConnect
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#ServiceConnect
Javasoftware.amazon.awscdk.services.ecs.ServiceConnect
Pythonaws_cdk.aws_ecs.ServiceConnect
TypeScript (source)aws-cdk-lib » aws_ecs » ServiceConnect

ServiceConnect ValueObjectClass having by ContainerDefinition.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';

declare const appProtocol: ecs.AppProtocol;
const serviceConnect = new ecs.ServiceConnect(ecs.NetworkMode.NONE, {
  containerPort: 123,

  // the properties below are optional
  appProtocol: appProtocol,
  hostPort: 123,
  name: 'name',
  protocol: ecs.Protocol.TCP,
});

Initializer

new ServiceConnect(networkmode: NetworkMode, pm: PortMapping)

Parameters

  • networkmode NetworkMode
  • pm PortMapping

Properties

NameTypeDescription
networkmodeNetworkModeThe networking mode to use for the containers in the task.
portmappingPortMappingPort mappings allow containers to access ports on the host container instance to send or receive traffic.

networkmode

Type: NetworkMode

The networking mode to use for the containers in the task.


portmapping

Type: PortMapping

Port mappings allow containers to access ports on the host container instance to send or receive traffic.

Methods

NameDescription
isServiceConnect()Judge parameters can be serviceconnect logick.
validate()Judge serviceconnect parametes are valid.

isServiceConnect()

public isServiceConnect(): boolean

Returns

  • boolean

Judge parameters can be serviceconnect logick.

If parameters can be serviceConnect return true.


validate()

public validate(): void

Judge serviceconnect parametes are valid.

If invalid, throw Error.