Skip to content

Commit

Permalink
fix validations
Browse files Browse the repository at this point in the history
  • Loading branch information
iliapolo committed Apr 6, 2022
1 parent 4e67251 commit a40910e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 23 deletions.
4 changes: 1 addition & 3 deletions packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export class EcsApplication extends Resource implements IEcsApplication {
resourceName: this.physicalName,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
});
}

protected validate(): string[] {
return validateName('Application', this.physicalName);
this.node.addValidation({ validate: () => validateName('Application', this.physicalName) });
}
}
4 changes: 1 addition & 3 deletions packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export class LambdaApplication extends Resource implements ILambdaApplication {
resourceName: this.physicalName,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
});
}

protected validate(): string[] {
return validateName('Application', this.physicalName);
this.node.addValidation({ validate: () => validateName('Application', this.physicalName) });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ export class CustomLambdaDeploymentConfig extends Resource implements ILambdaDep
resources: AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
}

protected validate(): string[] {
return validateName('Deployment config', this.deploymentConfigName);
this.node.addValidation({ validate: () => validateName('Deployment config', this.deploymentConfigName) });
}

// Validate the inputs. The percentage/interval limits come from CodeDeploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy
if (this.deploymentConfig instanceof Construct) {
this.node.addDependency(this.deploymentConfig);
}

this.node.addValidation({ validate: () => validateName('Deployment group', this.physicalName) });
}

/**
Expand Down Expand Up @@ -254,10 +256,6 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy
actions: ['codedeploy:PutLifecycleEventHookExecutionStatus'],
});
}

protected validate(): string[] {
return validateName('Deployment group', this.physicalName);
}
}

/**
Expand Down
5 changes: 2 additions & 3 deletions packages/@aws-cdk/aws-codedeploy/lib/server/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ export class ServerApplication extends Resource implements IServerApplication {
resourceName: this.physicalName,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
});
}

protected validate(): string[] {
return validateName('Application', this.physicalName);
this.node.addValidation({ validate: () => validateName('Application', this.physicalName) });
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ export class ServerDeploymentConfig extends cdk.Resource implements IServerDeplo

this.deploymentConfigName = resource.ref;
this.deploymentConfigArn = arnForDeploymentConfig(this.deploymentConfigName);
}

protected validate(): string[] {
return validateName('Deployment config', this.physicalName);
this.node.addValidation({ validate: () => validateName('Deployment config', this.physicalName) });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase {
resourceName: `${this.application.applicationName}/${this.physicalName}`,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
});

this.node.addValidation({ validate: () => validateName('Deployment group', this.physicalName) });
}

/**
Expand Down Expand Up @@ -341,10 +343,6 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase {
return this._autoScalingGroups.slice();
}

protected validate(): string[] {
return validateName('Deployment group', this.physicalName);
}

private addCodeDeployAgentInstallUserData(asg: autoscaling.IAutoScalingGroup): void {
if (!this.installAgent) {
return;
Expand Down

0 comments on commit a40910e

Please sign in to comment.