io.github.cdklabs.projen.build.BuildWorkflowCommonOptions Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen.build;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:55.035Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.build.BuildWorkflowCommonOptions")
@software.amazon.jsii.Jsii.Proxy(BuildWorkflowCommonOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface BuildWorkflowCommonOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Name of the buildfile (e.g. "build" becomes "build.yml").
*
* Default: "build"
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getName() {
return null;
}
/**
* (experimental) Permissions granted to the build job To limit job permissions for contents
, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }
.
*
* Default: `{ contents: JobPermission.WRITE }`
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.github.workflows.JobPermissions getPermissions() {
return null;
}
/**
* (experimental) Steps to execute before the build.
*
* Default: []
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getPreBuildSteps() {
return null;
}
/**
* (experimental) Build workflow triggers.
*
* Default: "{ pullRequest: {}, workflowDispatch: {} }"
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.github.workflows.Triggers getWorkflowTriggers() {
return null;
}
/**
* @return a {@link Builder} of {@link BuildWorkflowCommonOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link BuildWorkflowCommonOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String name;
io.github.cdklabs.projen.github.workflows.JobPermissions permissions;
java.util.List preBuildSteps;
io.github.cdklabs.projen.github.workflows.Triggers workflowTriggers;
/**
* Sets the value of {@link BuildWorkflowCommonOptions#getName}
* @param name Name of the buildfile (e.g. "build" becomes "build.yml").
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder name(java.lang.String name) {
this.name = name;
return this;
}
/**
* Sets the value of {@link BuildWorkflowCommonOptions#getPermissions}
* @param permissions Permissions granted to the build job To limit job permissions for contents
, the desired permissions have to be explicitly set, e.g.: { contents: JobPermission.NONE }
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder permissions(io.github.cdklabs.projen.github.workflows.JobPermissions permissions) {
this.permissions = permissions;
return this;
}
/**
* Sets the value of {@link BuildWorkflowCommonOptions#getPreBuildSteps}
* @param preBuildSteps Steps to execute before the build.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder preBuildSteps(java.util.List extends io.github.cdklabs.projen.github.workflows.JobStep> preBuildSteps) {
this.preBuildSteps = (java.util.List)preBuildSteps;
return this;
}
/**
* Sets the value of {@link BuildWorkflowCommonOptions#getWorkflowTriggers}
* @param workflowTriggers Build workflow triggers.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder workflowTriggers(io.github.cdklabs.projen.github.workflows.Triggers workflowTriggers) {
this.workflowTriggers = workflowTriggers;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link BuildWorkflowCommonOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public BuildWorkflowCommonOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link BuildWorkflowCommonOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements BuildWorkflowCommonOptions {
private final java.lang.String name;
private final io.github.cdklabs.projen.github.workflows.JobPermissions permissions;
private final java.util.List preBuildSteps;
private final io.github.cdklabs.projen.github.workflows.Triggers workflowTriggers;
/**
* 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.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.permissions = software.amazon.jsii.Kernel.get(this, "permissions", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.github.workflows.JobPermissions.class));
this.preBuildSteps = software.amazon.jsii.Kernel.get(this, "preBuildSteps", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.github.workflows.JobStep.class)));
this.workflowTriggers = software.amazon.jsii.Kernel.get(this, "workflowTriggers", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.github.workflows.Triggers.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.name = builder.name;
this.permissions = builder.permissions;
this.preBuildSteps = (java.util.List)builder.preBuildSteps;
this.workflowTriggers = builder.workflowTriggers;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final io.github.cdklabs.projen.github.workflows.JobPermissions getPermissions() {
return this.permissions;
}
@Override
public final java.util.List getPreBuildSteps() {
return this.preBuildSteps;
}
@Override
public final io.github.cdklabs.projen.github.workflows.Triggers getWorkflowTriggers() {
return this.workflowTriggers;
}
@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.getName() != null) {
data.set("name", om.valueToTree(this.getName()));
}
if (this.getPermissions() != null) {
data.set("permissions", om.valueToTree(this.getPermissions()));
}
if (this.getPreBuildSteps() != null) {
data.set("preBuildSteps", om.valueToTree(this.getPreBuildSteps()));
}
if (this.getWorkflowTriggers() != null) {
data.set("workflowTriggers", om.valueToTree(this.getWorkflowTriggers()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("projen.build.BuildWorkflowCommonOptions"));
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;
BuildWorkflowCommonOptions.Jsii$Proxy that = (BuildWorkflowCommonOptions.Jsii$Proxy) o;
if (this.name != null ? !this.name.equals(that.name) : that.name != null) return false;
if (this.permissions != null ? !this.permissions.equals(that.permissions) : that.permissions != null) return false;
if (this.preBuildSteps != null ? !this.preBuildSteps.equals(that.preBuildSteps) : that.preBuildSteps != null) return false;
return this.workflowTriggers != null ? this.workflowTriggers.equals(that.workflowTriggers) : that.workflowTriggers == null;
}
@Override
public final int hashCode() {
int result = this.name != null ? this.name.hashCode() : 0;
result = 31 * result + (this.permissions != null ? this.permissions.hashCode() : 0);
result = 31 * result + (this.preBuildSteps != null ? this.preBuildSteps.hashCode() : 0);
result = 31 * result + (this.workflowTriggers != null ? this.workflowTriggers.hashCode() : 0);
return result;
}
}
}