mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-06 08:21:23 +00:00
181 lines
6.8 KiB
HTML
181 lines
6.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>GHDeploymentBuilder.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">GitHub API for Java</a> > <a href="index.source.html" class="el_package">org.kohsuke.github</a> > <span class="el_source">GHDeploymentBuilder.java</span></div><h1>GHDeploymentBuilder.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
|
|
|
|
import org.kohsuke.github.internal.Previews;
|
|
|
|
import java.io.IOException;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* The type GHDeploymentBuilder.
|
|
*/
|
|
// Based on https://developer.github.com/v3/repos/deployments/#create-a-deployment
|
|
public class GHDeploymentBuilder {
|
|
private final GHRepository repo;
|
|
private final Requester builder;
|
|
|
|
/**
|
|
* Instantiates a new Gh deployment builder.
|
|
*
|
|
* @param repo
|
|
* the repo
|
|
*/
|
|
<span class="fc" id="L22"> public GHDeploymentBuilder(GHRepository repo) {</span>
|
|
<span class="fc" id="L23"> this.repo = repo;</span>
|
|
<span class="fc" id="L24"> this.builder = repo.root.createRequest()</span>
|
|
<span class="fc" id="L25"> .withPreview(Previews.ANT_MAN)</span>
|
|
<span class="fc" id="L26"> .withPreview(Previews.FLASH)</span>
|
|
<span class="fc" id="L27"> .method("POST");</span>
|
|
<span class="fc" id="L28"> }</span>
|
|
|
|
/**
|
|
* Instantiates a new Gh deployment builder.
|
|
*
|
|
* @param repo
|
|
* the repo
|
|
* @param ref
|
|
* the ref
|
|
*/
|
|
public GHDeploymentBuilder(GHRepository repo, String ref) {
|
|
<span class="fc" id="L39"> this(repo);</span>
|
|
<span class="fc" id="L40"> ref(ref);</span>
|
|
<span class="fc" id="L41"> }</span>
|
|
|
|
/**
|
|
* Ref gh deployment builder.
|
|
*
|
|
* @param branch
|
|
* the branch
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder ref(String branch) {
|
|
<span class="fc" id="L52"> builder.with("ref", branch);</span>
|
|
<span class="fc" id="L53"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Task gh deployment builder.
|
|
*
|
|
* @param task
|
|
* the task
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder task(String task) {
|
|
<span class="nc" id="L65"> builder.with("task", task);</span>
|
|
<span class="nc" id="L66"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Auto merge gh deployment builder.
|
|
*
|
|
* @param autoMerge
|
|
* the auto merge
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder autoMerge(boolean autoMerge) {
|
|
<span class="nc" id="L78"> builder.with("auto_merge", autoMerge);</span>
|
|
<span class="nc" id="L79"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Required contexts gh deployment builder.
|
|
*
|
|
* @param requiredContexts
|
|
* the required contexts
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder requiredContexts(List<String> requiredContexts) {
|
|
<span class="nc" id="L91"> builder.with("required_contexts", requiredContexts);</span>
|
|
<span class="nc" id="L92"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Payload gh deployment builder.
|
|
*
|
|
* @param payload
|
|
* the payload
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder payload(String payload) {
|
|
<span class="fc" id="L104"> builder.with("payload", payload);</span>
|
|
<span class="fc" id="L105"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Environment gh deployment builder.
|
|
*
|
|
* @param environment
|
|
* the environment
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder environment(String environment) {
|
|
<span class="fc" id="L117"> builder.with("environment", environment);</span>
|
|
<span class="fc" id="L118"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Specifies if the given environment is specific to the deployment and will no longer exist at some point in the
|
|
* future.
|
|
*
|
|
* @deprecated until preview feature has graduated to stable
|
|
*
|
|
* @param transientEnvironment
|
|
* the environment is transient
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
@Deprecated
|
|
@Preview(Previews.ANT_MAN)
|
|
public GHDeploymentBuilder transientEnvironment(boolean transientEnvironment) {
|
|
<span class="nc" id="L135"> builder.with("transient_environment", transientEnvironment);</span>
|
|
<span class="nc" id="L136"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Specifies if the given environment is one that end-users directly interact with.
|
|
*
|
|
* @deprecated until preview feature has graduated to stable
|
|
*
|
|
* @param productionEnvironment
|
|
* the environment is used by end-users directly
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
@Deprecated
|
|
@Preview(Previews.ANT_MAN)
|
|
public GHDeploymentBuilder productionEnvironment(boolean productionEnvironment) {
|
|
<span class="nc" id="L152"> builder.with("production_environment", productionEnvironment);</span>
|
|
<span class="nc" id="L153"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Description gh deployment builder.
|
|
*
|
|
* @param description
|
|
* the description
|
|
*
|
|
* @return the gh deployment builder
|
|
*/
|
|
public GHDeploymentBuilder description(String description) {
|
|
<span class="fc" id="L165"> builder.with("description", description);</span>
|
|
<span class="fc" id="L166"> return this;</span>
|
|
}
|
|
|
|
/**
|
|
* Create gh deployment.
|
|
*
|
|
* @return the gh deployment
|
|
*
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public GHDeployment create() throws IOException {
|
|
<span class="fc" id="L178"> return builder.withUrlPath(repo.getApiTailUrl("deployments")).fetch(GHDeployment.class).wrap(repo);</span>
|
|
}
|
|
}
|
|
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html> |