use of org.gitlab4j.api.models.Variable in project octane-gitlab-service by MicroFocus.
the class GitLabAPiClientImpl method getInstanceVariables.
public List<Variable> getInstanceVariables() {
List<Variable> variableList = new ArrayList<>();
try {
URL url = this.getApiUrl(INSTANCE_VARIABLES_PATH);
Response r = this.get(null, url);
if (r.getStatus() == Response.Status.OK.getStatusCode()) {
return VariablesHelper.convertJSONArrayToVariables(new JSONArray(r.readEntity(String.class)));
} else {
log.info("no variables are found, status code is" + r.getStatus());
}
} catch (IOException e) {
log.error("getting error when trying to get instance variables", e);
}
return variableList;
}
use of org.gitlab4j.api.models.Variable in project choerodon-starters by open-hand.
the class PipelineApi method updatePipelineScheduleVariable.
/**
* Update a pipeline schedule variable.
*
* <pre><code>GitLab Endpoint: PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param pipelineScheduleId the pipelineSchedule ID
* @param key the key of an existing pipeline schedule variable
* @param value the new value for the variable
* @return a Pipeline instance with the updated variable
* @throws GitLabApiException if any exception occurs during execution
*/
public Variable updatePipelineScheduleVariable(Object projectIdOrPath, Integer pipelineScheduleId, String key, String value) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("value", value, true);
Response response = this.putWithFormData(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId, "variables", key);
return (response.readEntity(Variable.class));
}
Aggregations