org.cdk8s.AppProps Maven / Gradle / Ivy
Show all versions of cdk8s Show documentation
package org.cdk8s;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.95.0 (build f1ff514)", date = "2024-03-07T12:12:06.004Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.$Module.class, fqn = "cdk8s.AppProps")
@software.amazon.jsii.Jsii.Proxy(AppProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface AppProps extends software.amazon.jsii.JsiiSerializable {
/**
* The directory to output Kubernetes manifests.
*
* If you synthesize your application using cdk8s synth
, you must
* also pass this value to the CLI using the --output
option or
* the output
property in the cdk8s.yaml
configuration file.
* Otherwise, the CLI will not know about the output directory,
* and synthesis will fail.
*
* This property is intended for internal and testing use.
*
* Default: - CDK8S_OUTDIR if defined, otherwise "dist"
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getOutdir() {
return null;
}
/**
* The file extension to use for rendered YAML files.
*
* Default: .k8s.yaml
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getOutputFileExtension() {
return null;
}
/**
* When set to true, the output directory will contain a construct-metadata.json
file that holds construct related metadata on every resource in the app.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getRecordConstructMetadata() {
return null;
}
/**
* A list of resolvers that can be used to replace property values before they are written to the manifest file.
*
* When multiple resolvers are passed,
* they are invoked by order in the list, and only the first one that applies
* (e.g calls context.replaceValue
) is invoked.
*
* Default: - no resolvers.
*
* @see https://cdk8s.io/docs/latest/basics/app/#resolvers
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getResolvers() {
return null;
}
/**
* How to divide the YAML output into files.
*
* Default: YamlOutputType.FILE_PER_CHART
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.YamlOutputType getYamlOutputType() {
return null;
}
/**
* @return a {@link Builder} of {@link AppProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link AppProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String outdir;
java.lang.String outputFileExtension;
java.lang.Boolean recordConstructMetadata;
java.util.List resolvers;
org.cdk8s.YamlOutputType yamlOutputType;
/**
* Sets the value of {@link AppProps#getOutdir}
* @param outdir The directory to output Kubernetes manifests.
* If you synthesize your application using cdk8s synth
, you must
* also pass this value to the CLI using the --output
option or
* the output
property in the cdk8s.yaml
configuration file.
* Otherwise, the CLI will not know about the output directory,
* and synthesis will fail.
*
* This property is intended for internal and testing use.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder outdir(java.lang.String outdir) {
this.outdir = outdir;
return this;
}
/**
* Sets the value of {@link AppProps#getOutputFileExtension}
* @param outputFileExtension The file extension to use for rendered YAML files.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder outputFileExtension(java.lang.String outputFileExtension) {
this.outputFileExtension = outputFileExtension;
return this;
}
/**
* Sets the value of {@link AppProps#getRecordConstructMetadata}
* @param recordConstructMetadata When set to true, the output directory will contain a construct-metadata.json
file that holds construct related metadata on every resource in the app.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder recordConstructMetadata(java.lang.Boolean recordConstructMetadata) {
this.recordConstructMetadata = recordConstructMetadata;
return this;
}
/**
* Sets the value of {@link AppProps#getResolvers}
* @param resolvers A list of resolvers that can be used to replace property values before they are written to the manifest file.
* When multiple resolvers are passed,
* they are invoked by order in the list, and only the first one that applies
* (e.g calls context.replaceValue
) is invoked.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder resolvers(java.util.List extends org.cdk8s.IResolver> resolvers) {
this.resolvers = (java.util.List)resolvers;
return this;
}
/**
* Sets the value of {@link AppProps#getYamlOutputType}
* @param yamlOutputType How to divide the YAML output into files.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder yamlOutputType(org.cdk8s.YamlOutputType yamlOutputType) {
this.yamlOutputType = yamlOutputType;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link AppProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public AppProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link AppProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements AppProps {
private final java.lang.String outdir;
private final java.lang.String outputFileExtension;
private final java.lang.Boolean recordConstructMetadata;
private final java.util.List resolvers;
private final org.cdk8s.YamlOutputType yamlOutputType;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.outdir = software.amazon.jsii.Kernel.get(this, "outdir", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.outputFileExtension = software.amazon.jsii.Kernel.get(this, "outputFileExtension", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.recordConstructMetadata = software.amazon.jsii.Kernel.get(this, "recordConstructMetadata", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.resolvers = software.amazon.jsii.Kernel.get(this, "resolvers", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.IResolver.class)));
this.yamlOutputType = software.amazon.jsii.Kernel.get(this, "yamlOutputType", software.amazon.jsii.NativeType.forClass(org.cdk8s.YamlOutputType.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.outdir = builder.outdir;
this.outputFileExtension = builder.outputFileExtension;
this.recordConstructMetadata = builder.recordConstructMetadata;
this.resolvers = (java.util.List)builder.resolvers;
this.yamlOutputType = builder.yamlOutputType;
}
@Override
public final java.lang.String getOutdir() {
return this.outdir;
}
@Override
public final java.lang.String getOutputFileExtension() {
return this.outputFileExtension;
}
@Override
public final java.lang.Boolean getRecordConstructMetadata() {
return this.recordConstructMetadata;
}
@Override
public final java.util.List getResolvers() {
return this.resolvers;
}
@Override
public final org.cdk8s.YamlOutputType getYamlOutputType() {
return this.yamlOutputType;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getOutdir() != null) {
data.set("outdir", om.valueToTree(this.getOutdir()));
}
if (this.getOutputFileExtension() != null) {
data.set("outputFileExtension", om.valueToTree(this.getOutputFileExtension()));
}
if (this.getRecordConstructMetadata() != null) {
data.set("recordConstructMetadata", om.valueToTree(this.getRecordConstructMetadata()));
}
if (this.getResolvers() != null) {
data.set("resolvers", om.valueToTree(this.getResolvers()));
}
if (this.getYamlOutputType() != null) {
data.set("yamlOutputType", om.valueToTree(this.getYamlOutputType()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s.AppProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AppProps.Jsii$Proxy that = (AppProps.Jsii$Proxy) o;
if (this.outdir != null ? !this.outdir.equals(that.outdir) : that.outdir != null) return false;
if (this.outputFileExtension != null ? !this.outputFileExtension.equals(that.outputFileExtension) : that.outputFileExtension != null) return false;
if (this.recordConstructMetadata != null ? !this.recordConstructMetadata.equals(that.recordConstructMetadata) : that.recordConstructMetadata != null) return false;
if (this.resolvers != null ? !this.resolvers.equals(that.resolvers) : that.resolvers != null) return false;
return this.yamlOutputType != null ? this.yamlOutputType.equals(that.yamlOutputType) : that.yamlOutputType == null;
}
@Override
public final int hashCode() {
int result = this.outdir != null ? this.outdir.hashCode() : 0;
result = 31 * result + (this.outputFileExtension != null ? this.outputFileExtension.hashCode() : 0);
result = 31 * result + (this.recordConstructMetadata != null ? this.recordConstructMetadata.hashCode() : 0);
result = 31 * result + (this.resolvers != null ? this.resolvers.hashCode() : 0);
result = 31 * result + (this.yamlOutputType != null ? this.yamlOutputType.hashCode() : 0);
return result;
}
}
}