Permalink
Browse files

Merge pull request #79 from rundeck/feature/apiv19

Support API v19 job file input
  • Loading branch information...
gschueler committed Apr 11, 2017
2 parents 82754a0 + b2e5c9d commit 6cc6ea70d9d7025a1cf1a5dc2f2381666e73b0ed
@@ -28,7 +28,7 @@
*/
public class Rundeck {
public static final String USER_AGENT = Version.NAME + "/" + Version.VERSION;
public static final int API_VERS = 18;
public static final int API_VERS = 19;
public static final Pattern API_VERS_PATTERN = Pattern.compile("^(.*)(/api/(\\d+)/?)$");
public static final String ENV_BYPASS_URL = "RD_BYPASS_URL";
public static final String ENV_INSECURE_SSL = "RD_INSECURE_SSL";
@@ -46,19 +46,93 @@
@Path("jobid") String jobid
);
/**
* Get uploaded file info
*
* @param fileid
*
* @return
*/
@Headers("Accept: application/json")
@GET("jobs/file/{fileid}")
Call<JobFileItem> getJobFileInfo(
@Path("fileid") String fileid
);
/**
* List uploaded files for a job
*
* @param jobid job id
* @param fileState file state
*
* @return
*/
@Headers("Accept: application/json")
@GET("job/{jobid}/input/files")
Call<JobFileItemList> listJobFiles(
@Path("jobid") String jobid,
@Query("fileState") String fileState,
@Query("offset") int offset,
@Query("max") int max
);
/**
* List uploaded files for a job in state 'temp'
*
* @param jobid job id
*
* @return
*/
@Headers("Accept: application/json")
@GET("job/{jobid}/input/files")
Call<JobFileItemList> listJobFiles(
@Path("jobid") String jobid,
@Query("offset") int offset,
@Query("max") int max
);
/**
* List uploaded files for an execution
*
* @param execid execution id
*
* @return
*/
@Headers("Accept: application/json")
@GET("execution/{execid}/input/files")
Call<JobFileItemList> listExecutionFiles(
@Path("execid") String execid,
@Query("offset") int offset,
@Query("max") int max
);
@Headers("Accept: application/json")
@POST("job/{jobid}/input/file")
Call<JobFileUploadResult> uploadJobOptionFile(
@Path("jobid") String jobid,
@Query("optionName") String optionName,
@Query("fileName") String fileName,
@Body RequestBody body
);
/**
* enable execution for a job
*
* @param jobid
*
* @return
*/
@Headers("Accept: application/json")
@POST("job/{jobid}/execution/enable")
Call<Simple> jobExecutionEnable(
@Path("jobid") String jobid
);
/**
* disable schedule for a job
*
* @param jobid
*
* @return
*/
@Headers("Accept: application/json")
@@ -69,7 +143,9 @@
/**
* enable schedule for a job
*
* @param jobid
*
* @return
*/
@Headers("Accept: application/json")
@@ -80,7 +156,9 @@
/**
* disable schedule for a job
*
* @param jobid
*
* @return
*/
@Headers("Accept: application/json")
@@ -193,8 +271,10 @@
/**
* Export project archive (<=v18)
*
* @param project project
* @param ids option execution IDs, or null for all contents
* @param ids option execution IDs, or null for all contents
*
* @return archive response
*/
@Headers("Accept: application/zip")
@@ -205,15 +285,16 @@
);
/**
*
* Export project archive (>=v19)
*
* @param project
* @param all
* @param jobs
* @param execs
* @param configs
* @param readmes
* @param acls
*
* @return
*/
@Headers("Accept: application/json")
@@ -227,11 +308,13 @@
@Query("exportReadmes") boolean readmes,
@Query("exportAcls") boolean acls
);
/**
*
* Export project archive (>=v19)
*
* @param project
* @param ids option execution IDs, or null for all contents
* @param ids option execution IDs, or null for all contents
*
* @return
*/
@Headers("Accept: application/json")
@@ -243,8 +326,10 @@
/**
* Async project export status
*
* @param project
* @param token
*
* @return
*/
@Headers("Accept: application/json")
@@ -256,8 +341,10 @@
/**
* Async project export download
*
* @param project
* @param token
*
* @return
*/
@Headers("Accept: application/zip")
@@ -269,8 +356,9 @@
/**
* Export project archive (<=v18)
*
* @param project project
* @param ids option execution IDs, or null for all contents
*
* @return archive response
*/
@Headers("Accept: application/json")
@@ -0,0 +1,157 @@
package org.rundeck.client.api.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.simplifyops.toolbelt.Formatable;
import org.simpleframework.xml.Root;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author greg
* @since 3/1/17
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@Root(strict = false)
public class JobFileItem implements Formatable {
private String id;
private String user;
private String optionName;
private String fileState;
private String sha;
private String jobId;
private String dateCreated;
private String serverNodeUUID;
private String fileName;
private Long size;
private String expirationDate;
private Long execId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getOptionName() {
return optionName;
}
public void setOptionName(String optionName) {
this.optionName = optionName;
}
public String getFileState() {
return fileState;
}
public void setFileState(String fileState) {
this.fileState = fileState;
}
public String getSha() {
return sha;
}
public void setSha(String sha) {
this.sha = sha;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getDateCreated() {
return dateCreated;
}
public DateInfo dateInfoDateCreated() {
return new DateInfo(dateCreated);
}
public void setDateCreated(String dateCreated) {
this.dateCreated = dateCreated;
}
public String getServerNodeUUID() {
return serverNodeUUID;
}
public void setServerNodeUUID(String serverNodeUUID) {
this.serverNodeUUID = serverNodeUUID;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public String getExpirationDate() {
return expirationDate;
}
public DateInfo dateInfoExpirationDate() {
return new DateInfo(expirationDate);
}
public void setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public Long getExecId() {
return execId;
}
public void setExecId(Long execId) {
this.execId = execId;
}
@Override
public List<?> asList() {
return null;
}
@Override
public Map<?, ?> asMap() {
HashMap<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("user", user);
map.put("optionName", optionName);
map.put("fileState", fileState);
map.put("sha", sha);
map.put("jobId", jobId);
map.put("dateCreated", dateCreated);
map.put("serverNodeUUID", serverNodeUUID);
map.put("fileName", fileName);
map.put("size", size);
map.put("expirationDate", expirationDate);
map.put("execId", execId);
return map;
}
}
@@ -0,0 +1,31 @@
package org.rundeck.client.api.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
/**
* @author greg
* @since 3/2/17
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class JobFileItemList {
private Paging paging;
private List<JobFileItem> files;
public Paging getPaging() {
return paging;
}
public void setPaging(Paging paging) {
this.paging = paging;
}
public List<JobFileItem> getFiles() {
return files;
}
public void setFiles(List<JobFileItem> files) {
this.files = files;
}
}
Oops, something went wrong.

0 comments on commit 6cc6ea7

Please sign in to comment.