org.projen.github.GithubWorkflow Maven / Gradle / Ivy
Show all versions of projen Show documentation
package org.projen.github;
/**
* (experimental) Workflow for GitHub.
*
* A workflow is a configurable automated process made up of one or more jobs.
*
* @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.34.0 (build 9b72778)", date = "2021-09-05T18:03:09.274Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.projen.$Module.class, fqn = "projen.github.GithubWorkflow")
public class GithubWorkflow extends org.projen.Component {
protected GithubWorkflow(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected GithubWorkflow(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param github This parameter is required.
* @param name This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public GithubWorkflow(final @org.jetbrains.annotations.NotNull org.projen.github.GitHub github, final @org.jetbrains.annotations.NotNull java.lang.String name, final @org.jetbrains.annotations.Nullable org.projen.github.GithubWorkflowOptions options) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(github, "github is required"), java.util.Objects.requireNonNull(name, "name is required"), options });
}
/**
* @param github This parameter is required.
* @param name This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public GithubWorkflow(final @org.jetbrains.annotations.NotNull org.projen.github.GitHub github, final @org.jetbrains.annotations.NotNull java.lang.String name) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(github, "github is required"), java.util.Objects.requireNonNull(name, "name is required") });
}
/**
* (experimental) Add jobs to the workflow.
*
* @param jobs Jobs to add. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addJobs(final @org.jetbrains.annotations.NotNull java.util.Map jobs) {
software.amazon.jsii.Kernel.call(this, "addJobs", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(jobs, "jobs is required") });
}
/**
* (experimental) Add events to triggers the workflow.
*
* @param events The event(s) to trigger the workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void on(final @org.jetbrains.annotations.NotNull org.projen.github.workflows.Triggers events) {
software.amazon.jsii.Kernel.call(this, "on", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(events, "events is required") });
}
/**
* (experimental) The name of the workflow.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getName() {
return software.amazon.jsii.Kernel.get(this, "name", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) The workflow YAML file.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable org.projen.YamlFile getFile() {
return software.amazon.jsii.Kernel.get(this, "file", software.amazon.jsii.NativeType.forClass(org.projen.YamlFile.class));
}
/**
* (experimental) A fluent builder for {@link org.projen.github.GithubWorkflow}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param github This parameter is required.
* @param name This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final org.projen.github.GitHub github, final java.lang.String name) {
return new Builder(github, name);
}
private final org.projen.github.GitHub github;
private final java.lang.String name;
private org.projen.github.GithubWorkflowOptions.Builder options;
private Builder(final org.projen.github.GitHub github, final java.lang.String name) {
this.github = github;
this.name = name;
}
/**
* (experimental) Force the creation of the workflow even if `workflows` is disabled in `GitHub`.
*
* Default: false
*
* @return {@code this}
* @param force Force the creation of the workflow even if `workflows` is disabled in `GitHub`. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder force(final java.lang.Boolean force) {
this.options().force(force);
return this;
}
/**
* @returns a newly built instance of {@link org.projen.github.GithubWorkflow}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.projen.github.GithubWorkflow build() {
return new org.projen.github.GithubWorkflow(
this.github,
this.name,
this.options != null ? this.options.build() : null
);
}
private org.projen.github.GithubWorkflowOptions.Builder options() {
if (this.options == null) {
this.options = new org.projen.github.GithubWorkflowOptions.Builder();
}
return this.options;
}
}
}