Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.chavaillaz.client.jenkins.apache.ApacheHttpPipelineApi Maven / Gradle / Ivy
package com.chavaillaz.client.jenkins.apache;
import static org.apache.hc.client5.http.async.methods.SimpleRequestBuilder.get;
import java.util.concurrent.CompletableFuture;
import com.chavaillaz.client.jenkins.JenkinsAuthentication;
import com.chavaillaz.client.jenkins.api.PipelineApi;
import com.chavaillaz.client.jenkins.domain.folder.Path;
import com.chavaillaz.client.jenkins.domain.job.pipeline.Actions;
import com.chavaillaz.client.jenkins.domain.job.pipeline.Artifacts;
import com.chavaillaz.client.jenkins.domain.job.pipeline.Node;
import com.chavaillaz.client.jenkins.domain.job.pipeline.NodeLog;
import com.chavaillaz.client.jenkins.domain.job.pipeline.Run;
import com.chavaillaz.client.jenkins.domain.job.pipeline.Runs;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
/**
* Implementation of {@link PipelineApi} for Apache HTTP.
*/
public class ApacheHttpPipelineApi extends AbstractApacheHttpClient implements PipelineApi {
/**
* Creates a new pipeline client based on Apache HTTP client.
*
* @param client The Apache HTTP client to use
* @param baseUrl The URL of Jenkins
* @param authentication The authentication method
*/
public ApacheHttpPipelineApi(CloseableHttpAsyncClient client, String baseUrl, JenkinsAuthentication authentication) {
super(client, baseUrl, authentication);
}
@Override
public CompletableFuture getRunHistory(Path path, String pipelineName, String branchName) {
return sendAsync(requestBuilder(get(), URL_RUN_HISTORY, path, pipelineName, branchName), Runs.class);
}
@Override
public CompletableFuture getRun(Path path, String pipelineName, String branchName, long buildNumber) {
return sendAsync(requestBuilder(get(), URL_RUN_DETAILS, path, pipelineName, branchName, buildNumber), Run.class);
}
@Override
public CompletableFuture getRunPendingActions(Path path, String pipelineName, String branchName, long buildNumber) {
return sendAsync(requestBuilder(get(), URL_RUN_ACTIONS, path, pipelineName, branchName, buildNumber), Actions.class);
}
@Override
public CompletableFuture getRunArtifacts(Path path, String pipelineName, String branchName, long buildNumber) {
return sendAsync(requestBuilder(get(), URL_RUN_ARTIFACTS, path, pipelineName, branchName, buildNumber), Artifacts.class);
}
@Override
public CompletableFuture getRunNode(Path path, String pipelineName, String branchName, long buildNumber, String nodeId) {
return sendAsync(requestBuilder(get(), URL_RUN_STAGE_DETAILS, path, pipelineName, branchName, buildNumber, nodeId), Node.class);
}
@Override
public CompletableFuture getRunNodeLog(Path path, String pipelineName, String branchName, long buildNumber, String nodeId) {
return sendAsync(requestBuilder(get(), URL_RUN_STAGE_LOGS, path, pipelineName, branchName, buildNumber, nodeId), NodeLog.class);
}
}