Skip to content

Commit e981f87

Browse files
laazyjsanyamk23
authored andcommitted
fix(ecs): route new namespace method via field
Merging main brought in addExistingDefaultCloudMapNamespace (#36812), which reads and writes the private _defaultCloudMapNamespace backing field that this branch replaces with a readonly defaultCloudMapNamespace field written through setDefaultCloudMapNamespace. The two sides touched different hunks so git merged them without conflict, but the new method no longer compiled (TS2551) and the build failed at jsii. Route the new method through the field and its helper.
1 parent f6ca1d1 commit e981f87

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/aws-cdk-lib/aws-ecs/lib/cluster.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ export class Cluster extends Resource implements ICluster {
556556
*/
557557
@MethodMetadata()
558558
public addExistingDefaultCloudMapNamespace(options: ExistingCloudMapNamespaceOptions): cloudmap.INamespace {
559-
if (this._defaultCloudMapNamespace !== undefined) {
559+
if (this.defaultCloudMapNamespace !== undefined) {
560560
throw new ValidationError(lit`OnlyDefaultNamespaceOnce`, 'Can only add default namespace once.', this);
561561
}
562562

@@ -585,7 +585,7 @@ export class Cluster extends Resource implements ICluster {
585585
'same VPC as this ECS cluster for service discovery to function correctly.');
586586
}
587587

588-
this._defaultCloudMapNamespace = options.namespace;
588+
setDefaultCloudMapNamespace(this, options.namespace);
589589
if (options.useForServiceConnect) {
590590
// Validate ARN is well-formed for imported namespaces
591591
const nsArn = options.namespace.namespaceArn;

0 commit comments

Comments
 (0)