com.hashicorp.cdktf.FileProvisioner Maven / Gradle / Ivy
Show all versions of cdktf Show documentation
package com.hashicorp.cdktf;
/**
* (experimental) The file provisioner copies files or directories from the machine running Terraform to the newly created resource.
*
* The file provisioner supports both ssh and winrm type connections.
* See {@link https://developer.hashicorp.com/terraform/language/resources/provisioners/file file}
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-11-11T10:07:41.961Z")
@software.amazon.jsii.Jsii(module = com.hashicorp.cdktf.$Module.class, fqn = "cdktf.FileProvisioner")
@software.amazon.jsii.Jsii.Proxy(FileProvisioner.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface FileProvisioner extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The source file or directory.
*
* Specify it either relative to the current working directory or as an absolute path.
* This argument cannot be combined with content.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getDestination();
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getType();
/**
* (experimental) Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Object getConnection() {
return null;
}
/**
* (experimental) The destination path to write to on the remote system.
*
* See Destination Paths below for more information.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getContent() {
return null;
}
/**
* (experimental) The direct content to copy on the destination.
*
* If destination is a file, the content will be written on that file.
* In case of a directory, a file named tf-file-content is created inside that directory.
* We recommend using a file as the destination when using content.
* This argument cannot be combined with source.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getSource() {
return null;
}
/**
* @return a {@link Builder} of {@link FileProvisioner}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link FileProvisioner}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String destination;
java.lang.String type;
java.lang.Object connection;
java.lang.String content;
java.lang.String source;
/**
* Sets the value of {@link FileProvisioner#getDestination}
* @param destination The source file or directory. This parameter is required.
* Specify it either relative to the current working directory or as an absolute path.
* This argument cannot be combined with content.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder destination(java.lang.String destination) {
this.destination = destination;
return this;
}
/**
* Sets the value of {@link FileProvisioner#getType}
* @param type the value to be set. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder type(java.lang.String type) {
this.type = type;
return this;
}
/**
* Sets the value of {@link FileProvisioner#getConnection}
* @param connection Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder connection(com.hashicorp.cdktf.SSHProvisionerConnection connection) {
this.connection = connection;
return this;
}
/**
* Sets the value of {@link FileProvisioner#getConnection}
* @param connection Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder connection(com.hashicorp.cdktf.WinrmProvisionerConnection connection) {
this.connection = connection;
return this;
}
/**
* Sets the value of {@link FileProvisioner#getContent}
* @param content The destination path to write to on the remote system.
* See Destination Paths below for more information.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder content(java.lang.String content) {
this.content = content;
return this;
}
/**
* Sets the value of {@link FileProvisioner#getSource}
* @param source The direct content to copy on the destination.
* If destination is a file, the content will be written on that file.
* In case of a directory, a file named tf-file-content is created inside that directory.
* We recommend using a file as the destination when using content.
* This argument cannot be combined with source.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder source(java.lang.String source) {
this.source = source;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link FileProvisioner}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public FileProvisioner build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link FileProvisioner}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FileProvisioner {
private final java.lang.String destination;
private final java.lang.String type;
private final java.lang.Object connection;
private final java.lang.String content;
private final java.lang.String source;
/**
* 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.destination = software.amazon.jsii.Kernel.get(this, "destination", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.type = software.amazon.jsii.Kernel.get(this, "type", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.connection = software.amazon.jsii.Kernel.get(this, "connection", software.amazon.jsii.NativeType.forClass(java.lang.Object.class));
this.content = software.amazon.jsii.Kernel.get(this, "content", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.source = software.amazon.jsii.Kernel.get(this, "source", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.destination = java.util.Objects.requireNonNull(builder.destination, "destination is required");
this.type = java.util.Objects.requireNonNull(builder.type, "type is required");
this.connection = builder.connection;
this.content = builder.content;
this.source = builder.source;
}
@Override
public final java.lang.String getDestination() {
return this.destination;
}
@Override
public final java.lang.String getType() {
return this.type;
}
@Override
public final java.lang.Object getConnection() {
return this.connection;
}
@Override
public final java.lang.String getContent() {
return this.content;
}
@Override
public final java.lang.String getSource() {
return this.source;
}
@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();
data.set("destination", om.valueToTree(this.getDestination()));
data.set("type", om.valueToTree(this.getType()));
if (this.getConnection() != null) {
data.set("connection", om.valueToTree(this.getConnection()));
}
if (this.getContent() != null) {
data.set("content", om.valueToTree(this.getContent()));
}
if (this.getSource() != null) {
data.set("source", om.valueToTree(this.getSource()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdktf.FileProvisioner"));
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;
FileProvisioner.Jsii$Proxy that = (FileProvisioner.Jsii$Proxy) o;
if (!destination.equals(that.destination)) return false;
if (!type.equals(that.type)) return false;
if (this.connection != null ? !this.connection.equals(that.connection) : that.connection != null) return false;
if (this.content != null ? !this.content.equals(that.content) : that.content != null) return false;
return this.source != null ? this.source.equals(that.source) : that.source == null;
}
@Override
public final int hashCode() {
int result = this.destination.hashCode();
result = 31 * result + (this.type.hashCode());
result = 31 * result + (this.connection != null ? this.connection.hashCode() : 0);
result = 31 * result + (this.content != null ? this.content.hashCode() : 0);
result = 31 * result + (this.source != null ? this.source.hashCode() : 0);
return result;
}
}
}