You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR...
- Refactor ecs.ContainerDefintion.addPortMapping method
- The addPortMapping method had many if statements and it was difficult to understand what was being determined.
- It was also difficult to make changes.
- Therefore, I divided the classes by interest to improve visibility.
Closes#24170 .
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
thrownewError(`Host port (${pm.hostPort}) must be left out or equal to container port ${pm.containerPort} for network mode ${this.taskDefinition.networkMode}`);
572
-
}
573
-
}
574
-
// No empty strings as port mapping names.
575
-
if(pm.name===''){
576
-
thrownewError('Port mapping name cannot be an empty string.');
577
-
}
578
-
// Service connect logic.
579
-
if(pm.name||pm.appProtocol){
580
-
581
-
// Service connect only supports Awsvpc and Bridge network modes.
thrownewError(`Service connect related port mapping fields 'name' and 'appProtocol' are not supported for network mode ${this.taskDefinition.networkMode}`);
584
-
}
585
-
586
-
// Name is not set but App Protocol is; this config is meaningless and we should throw.
587
-
if(!pm.name){
588
-
thrownewError('Service connect-related port mapping field \'appProtocol\' cannot be set without \'name\'');
589
-
}
590
-
591
-
if(this._namedPorts.has(pm.name)){
592
-
thrownewError(`Port mapping name '${pm.name}' already exists on this container`);
0 commit comments