io.linguarobot.aws.cdk.maven.TemplateRef 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;
import java.util.Objects;
/**
* A reference to a template. It can be either template url or template body.
*/
public class TemplateRef {
private final String url;
private final String body;
private TemplateRef(@Nullable String url, @Nullable String body) {
this.url = url;
this.body = body;
}
/**
* Returns a template url or {@code null} in case this is a reference to the template body.
*/
@Nullable
public String getUrl() {
return url;
}
/**
* Returns a template body or {@code null} if the template is uploaded to S3 and the reference represents template
* URL.
*/
@Nullable
public String getBody() {
return body;
}
public static TemplateRef fromUrl(String url) {
return new TemplateRef(url, null);
}
public static TemplateRef fromString(String templateBody) {
return new TemplateRef(null, templateBody);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TemplateRef that = (TemplateRef) o;
return Objects.equals(url, that.url) &&
Objects.equals(body, that.body);
}
@Override
public int hashCode() {
return Objects.hash(url, body);
}
@Override
public String toString() {
return url != null ? "fromUrl(\"" + url + "\")" : "fromString(...)";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy