org.cdk8s.App Maven / Gradle / Ivy
Show all versions of cdk8s Show documentation
package org.cdk8s;
/**
* Represents a cdk8s application.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.106.0 (build e852934)", date = "2024-12-18T12:15:47.114Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.$Module.class, fqn = "cdk8s.App")
public class App extends software.constructs.Construct {
protected App(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected App(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* Defines an app.
*
* @param props configuration options.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public App(final @org.jetbrains.annotations.Nullable org.cdk8s.AppProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { props });
}
/**
* Defines an app.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public App() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* @param c This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.App of(final @org.jetbrains.annotations.NotNull software.constructs.IConstruct c) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.App.class, "of", software.amazon.jsii.NativeType.forClass(org.cdk8s.App.class), new Object[] { java.util.Objects.requireNonNull(c, "c is required") });
}
/**
* Synthesizes all manifests to the output directory.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void synth() {
software.amazon.jsii.Kernel.call(this, "synth", software.amazon.jsii.NativeType.VOID);
}
/**
* Synthesizes the app into a YAML string.
*
* @return A string with all YAML objects across all charts in this app.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String synthYaml() {
return software.amazon.jsii.Kernel.call(this, "synthYaml", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Returns all the charts in this app, sorted topologically.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.util.List getCharts() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "charts", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.Chart.class))));
}
/**
* The output directory into which manifests will be synthesized.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getOutdir() {
return software.amazon.jsii.Kernel.get(this, "outdir", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* The file extension to use for rendered YAML files.
*
* Default: .k8s.yaml
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getOutputFileExtension() {
return software.amazon.jsii.Kernel.get(this, "outputFileExtension", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Resolvers used by this app.
*
* This includes both custom resolvers
* passed by the resolvers
property, as well as built-in resolvers.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.util.List getResolvers() {
return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "resolvers", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.IResolver.class))));
}
/**
* How to divide the YAML output into files.
*
* Default: YamlOutputType.FILE_PER_CHART
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull org.cdk8s.YamlOutputType getYamlOutputType() {
return software.amazon.jsii.Kernel.get(this, "yamlOutputType", software.amazon.jsii.NativeType.forClass(org.cdk8s.YamlOutputType.class));
}
/**
* A fluent builder for {@link org.cdk8s.App}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private org.cdk8s.AppProps.Builder props;
private Builder() {
}
/**
* 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"
*
* @return {@code this}
* @param outdir The directory to output Kubernetes manifests. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder outdir(final java.lang.String outdir) {
this.props().outdir(outdir);
return this;
}
/**
* The file extension to use for rendered YAML files.
*
* Default: .k8s.yaml
*
* @return {@code this}
* @param outputFileExtension The file extension to use for rendered YAML files. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder outputFileExtension(final java.lang.String outputFileExtension) {
this.props().outputFileExtension(outputFileExtension);
return this;
}
/**
* 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
*
* @return {@code this}
* @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. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder recordConstructMetadata(final java.lang.Boolean recordConstructMetadata) {
this.props().recordConstructMetadata(recordConstructMetadata);
return this;
}
/**
* 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.
*
* @return {@code this}
* @see https://cdk8s.io/docs/latest/basics/app/#resolvers
* @param resolvers A list of resolvers that can be used to replace property values before they are written to the manifest file. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder resolvers(final java.util.List extends org.cdk8s.IResolver> resolvers) {
this.props().resolvers(resolvers);
return this;
}
/**
* How to divide the YAML output into files.
*
* Default: YamlOutputType.FILE_PER_CHART
*
* @return {@code this}
* @param yamlOutputType How to divide the YAML output into files. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder yamlOutputType(final org.cdk8s.YamlOutputType yamlOutputType) {
this.props().yamlOutputType(yamlOutputType);
return this;
}
/**
* @return a newly built instance of {@link org.cdk8s.App}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.App build() {
return new org.cdk8s.App(
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.AppProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.AppProps.Builder();
}
return this.props;
}
}
}