io.github.cdklabs.projen.circleci.WorkflowJob Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen.circleci;
/**
* (experimental) A Job is part of Workflow.
*
* A Job can be created with {@link Job} or it can be provided by the orb
*
* @see https://circleci.com/docs/2.0/configuration-reference/#jobs-in-workflow
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:55.173Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.circleci.WorkflowJob")
@software.amazon.jsii.Jsii.Proxy(WorkflowJob.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface WorkflowJob extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) name of dynamic key *.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getIdentifier();
/**
* (experimental) The name of the context(s).
*
* The initial default name is org-global. Each context name must be unique.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getContext() {
return null;
}
/**
* (experimental) Job Filters can have the key branches or tags.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.circleci.Filter getFilters() {
return null;
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.circleci.Matrix getMatrix() {
return null;
}
/**
* (experimental) A replacement for the job name.
*
* Useful when calling a job multiple times
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getName() {
return null;
}
/**
* (experimental) Parameters passed to job when referencing a job from orb.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getOrbParameters() {
return null;
}
/**
* (experimental) A list of jobs that must succeed for the job to start.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getRequires() {
return null;
}
/**
* (experimental) A job may have a type of approval indicating it must be manually approved before downstream jobs may proceed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.circleci.JobType getType() {
return null;
}
/**
* @return a {@link Builder} of {@link WorkflowJob}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link WorkflowJob}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String identifier;
java.util.List context;
io.github.cdklabs.projen.circleci.Filter filters;
io.github.cdklabs.projen.circleci.Matrix matrix;
java.lang.String name;
java.util.Map orbParameters;
java.util.List requires;
io.github.cdklabs.projen.circleci.JobType type;
/**
* Sets the value of {@link WorkflowJob#getIdentifier}
* @param identifier name of dynamic key *. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder identifier(java.lang.String identifier) {
this.identifier = identifier;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getContext}
* @param context The name of the context(s).
* The initial default name is org-global. Each context name must be unique.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder context(java.util.List context) {
this.context = context;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getFilters}
* @param filters Job Filters can have the key branches or tags.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder filters(io.github.cdklabs.projen.circleci.Filter filters) {
this.filters = filters;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getMatrix}
* @param matrix the value to be set.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder matrix(io.github.cdklabs.projen.circleci.Matrix matrix) {
this.matrix = matrix;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getName}
* @param name A replacement for the job name.
* Useful when calling a job multiple times
* @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 WorkflowJob#getOrbParameters}
* @param orbParameters Parameters passed to job when referencing a job from orb.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder orbParameters(java.util.Map orbParameters) {
this.orbParameters = (java.util.Map)orbParameters;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getRequires}
* @param requires A list of jobs that must succeed for the job to start.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder requires(java.util.List requires) {
this.requires = requires;
return this;
}
/**
* Sets the value of {@link WorkflowJob#getType}
* @param type A job may have a type of approval indicating it must be manually approved before downstream jobs may proceed.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder type(io.github.cdklabs.projen.circleci.JobType type) {
this.type = type;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link WorkflowJob}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public WorkflowJob build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link WorkflowJob}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements WorkflowJob {
private final java.lang.String identifier;
private final java.util.List context;
private final io.github.cdklabs.projen.circleci.Filter filters;
private final io.github.cdklabs.projen.circleci.Matrix matrix;
private final java.lang.String name;
private final java.util.Map orbParameters;
private final java.util.List requires;
private final io.github.cdklabs.projen.circleci.JobType type;
/**
* 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.identifier = software.amazon.jsii.Kernel.get(this, "identifier", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.context = software.amazon.jsii.Kernel.get(this, "context", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.filters = software.amazon.jsii.Kernel.get(this, "filters", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.circleci.Filter.class));
this.matrix = software.amazon.jsii.Kernel.get(this, "matrix", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.circleci.Matrix.class));
this.name = software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.orbParameters = software.amazon.jsii.Kernel.get(this, "orbParameters", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)));
this.requires = software.amazon.jsii.Kernel.get(this, "requires", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.type = software.amazon.jsii.Kernel.get(this, "type", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.circleci.JobType.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.identifier = java.util.Objects.requireNonNull(builder.identifier, "identifier is required");
this.context = builder.context;
this.filters = builder.filters;
this.matrix = builder.matrix;
this.name = builder.name;
this.orbParameters = (java.util.Map)builder.orbParameters;
this.requires = builder.requires;
this.type = builder.type;
}
@Override
public final java.lang.String getIdentifier() {
return this.identifier;
}
@Override
public final java.util.List getContext() {
return this.context;
}
@Override
public final io.github.cdklabs.projen.circleci.Filter getFilters() {
return this.filters;
}
@Override
public final io.github.cdklabs.projen.circleci.Matrix getMatrix() {
return this.matrix;
}
@Override
public final java.lang.String getName() {
return this.name;
}
@Override
public final java.util.Map getOrbParameters() {
return this.orbParameters;
}
@Override
public final java.util.List getRequires() {
return this.requires;
}
@Override
public final io.github.cdklabs.projen.circleci.JobType getType() {
return this.type;
}
@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("identifier", om.valueToTree(this.getIdentifier()));
if (this.getContext() != null) {
data.set("context", om.valueToTree(this.getContext()));
}
if (this.getFilters() != null) {
data.set("filters", om.valueToTree(this.getFilters()));
}
if (this.getMatrix() != null) {
data.set("matrix", om.valueToTree(this.getMatrix()));
}
if (this.getName() != null) {
data.set("name", om.valueToTree(this.getName()));
}
if (this.getOrbParameters() != null) {
data.set("orbParameters", om.valueToTree(this.getOrbParameters()));
}
if (this.getRequires() != null) {
data.set("requires", om.valueToTree(this.getRequires()));
}
if (this.getType() != null) {
data.set("type", om.valueToTree(this.getType()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("projen.circleci.WorkflowJob"));
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;
WorkflowJob.Jsii$Proxy that = (WorkflowJob.Jsii$Proxy) o;
if (!identifier.equals(that.identifier)) return false;
if (this.context != null ? !this.context.equals(that.context) : that.context != null) return false;
if (this.filters != null ? !this.filters.equals(that.filters) : that.filters != null) return false;
if (this.matrix != null ? !this.matrix.equals(that.matrix) : that.matrix != null) return false;
if (this.name != null ? !this.name.equals(that.name) : that.name != null) return false;
if (this.orbParameters != null ? !this.orbParameters.equals(that.orbParameters) : that.orbParameters != null) return false;
if (this.requires != null ? !this.requires.equals(that.requires) : that.requires != null) return false;
return this.type != null ? this.type.equals(that.type) : that.type == null;
}
@Override
public final int hashCode() {
int result = this.identifier.hashCode();
result = 31 * result + (this.context != null ? this.context.hashCode() : 0);
result = 31 * result + (this.filters != null ? this.filters.hashCode() : 0);
result = 31 * result + (this.matrix != null ? this.matrix.hashCode() : 0);
result = 31 * result + (this.name != null ? this.name.hashCode() : 0);
result = 31 * result + (this.orbParameters != null ? this.orbParameters.hashCode() : 0);
result = 31 * result + (this.requires != null ? this.requires.hashCode() : 0);
result = 31 * result + (this.type != null ? this.type.hashCode() : 0);
return result;
}
}
}