io.linguarobot.aws.cdk.maven.BootstrapException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-cdk-maven-plugin Show documentation
Show all versions of aws-cdk-maven-plugin Show documentation
The AWS CDK Maven plugin produces and deploys CloudFormation templates based on the cloud infrastructure defined
by means of CDK. The goal of the project is to improve the experience of Java developers while working with
CDK by eliminating the need for installing Node.js and interacting with the CDK application by means of CDK
Toolkit.
package io.linguarobot.aws.cdk.maven;
import javax.annotation.Nullable;
public class BootstrapException extends CdkPluginException {
private final String stackName;
private final ResolvedEnvironment environment;
private BootstrapException(String stackName, ResolvedEnvironment environment, String message, @Nullable Throwable cause) {
super(message, cause);
this.stackName = stackName;
this.environment = environment;
}
public String getStackName() {
return stackName;
}
public ResolvedEnvironment getEnvironment() {
return environment;
}
public static Builder deploymentError(String toolkitStackName, ResolvedEnvironment environment) {
String baseMessage = "Unable to deploy toolkit stack '" + toolkitStackName + "' for the environment " +
environment.getName();
return new Builder(toolkitStackName, environment, baseMessage);
}
public static Builder invalidStateError(String toolkitStackName, ResolvedEnvironment environment) {
String baseMessage = "The toolkit stack '" + toolkitStackName + "' for the environment " + environment +
" is invalid";
return new Builder(toolkitStackName, environment, baseMessage);
}
public static class Builder {
private final String stackName;
private final ResolvedEnvironment environment;
private final String baseMessage;
private String detailedMessage;
private Throwable cause;
private Builder(String stackName, ResolvedEnvironment environment, String baseMessage) {
this.stackName = stackName;
this.environment = environment;
this.baseMessage = baseMessage;
}
public Builder withCause(String detailedMessage) {
this.detailedMessage = detailedMessage;
return this;
}
public Builder withCause(Throwable cause) {
this.cause = cause;
return this;
}
public BootstrapException build() {
String message = baseMessage;
if (detailedMessage != null) {
message += ". " + detailedMessage;
}
return new BootstrapException(stackName, environment, message, cause);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy