Skip to content

Commit

Permalink
Add support for history endpoint (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfespa17 authored Oct 26, 2021
1 parent add8e65 commit d8df408
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api-client-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<gson.version>2.8.6</gson.version>
<feign.version>11.6</feign.version>
<okhttp.version>4.9.1</okhttp.version>
<revision>0.7.0-beta.1</revision>
<revision>0.7.0-beta.2</revision>
<maven.deploy.skip>false</maven.deploy.skip>
<lombok.version>1.18.20</lombok.version>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion api-client-spring-boot-starter-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>Terrakube Spring Boot Starter sample</description>
<properties>
<java.version>11</java.version>
<revision>0.7.0-beta.1</revision>
<revision>0.7.0-beta.2</revision>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import org.azbuilder.api.client.model.organization.provider.version.implementation.Implementation;
import org.azbuilder.api.client.model.organization.vcs.Vcs;
import org.azbuilder.api.client.model.organization.workspace.Workspace;
import org.azbuilder.api.client.model.organization.workspace.history.History;
import org.azbuilder.api.client.model.organization.workspace.history.HistoryAttributes;
import org.azbuilder.api.client.model.organization.workspace.history.HistoryRequest;
import org.azbuilder.api.client.model.organization.workspace.variable.Variable;
import org.azbuilder.api.client.model.response.Response;
import org.junit.jupiter.api.Test;
Expand All @@ -29,6 +32,16 @@ class ApiClientStarterSampleApplicationTests {
@Test
void contextLoads() {
assertNotNull(restClient);
/*
HistoryRequest historyRequest = new HistoryRequest();
History newHistory = new History();
newHistory.setType("history");
HistoryAttributes historyAttributes = new HistoryAttributes();
historyAttributes.setOutput("HolaMundo333333");
newHistory.setAttributes(historyAttributes);
historyRequest.setData(newHistory);
restClient.createHistory(historyRequest,"4918ee6f-ffaf-4532-a370-d8c06e45eb4d", "21bb4721-4760-49f0-a7c7-bd6072081be9" );
/*
restClient.getAllOrganizations().getData().size();
Expand Down
2 changes: 1 addition & 1 deletion api-client-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.7.0-beta.1</revision>
<revision>0.7.0-beta.2</revision>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion api-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>Java Terrakube client</description>
<properties>
<java.version>11</java.version>
<revision>0.7.0-beta.1</revision>
<revision>0.7.0-beta.2</revision>
<feign.version>11.6</feign.version>
<feign-form.version>3.8.0</feign-form.version>
<maven.deploy.skip>false</maven.deploy.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.azbuilder.api.client.model.organization.template.Template;
import org.azbuilder.api.client.model.organization.vcs.Vcs;
import org.azbuilder.api.client.model.organization.workspace.Workspace;
import org.azbuilder.api.client.model.organization.workspace.history.HistoryRequest;
import org.azbuilder.api.client.model.organization.workspace.variable.Variable;
import org.azbuilder.api.client.model.response.Response;
import org.azbuilder.api.client.model.response.ResponseWithInclude;
Expand Down Expand Up @@ -57,6 +58,10 @@ public interface TerrakubeClient {
@Headers("Content-Type: application/vnd.api+json")
void createStep(StepRequest stepRequest, @Param("organizationId") String organizationId, @Param("jobId") String jobId);

@RequestLine("POST /api/v1/organization/{organizationId}/workspace/{workspaceId}/history")
@Headers("Content-Type: application/vnd.api+json")
void createHistory(HistoryRequest historyRequest, @Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("PATCH /api/v1/organization/{organizationId}/job/{jobId}/step/{stepId}")
@Headers("Content-Type: application/vnd.api+json")
void updateStep(StepRequest stepRequest, @Param("organizationId") String organizationId, @Param("jobId") String jobId, @Param("stepId") String stepId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.azbuilder.api.client.model.organization.workspace;

import lombok.Getter;
import lombok.Setter;
import org.azbuilder.api.client.model.generic.Resource;

import java.util.List;

@Getter
@Setter
public class HistoryData {
List<Resource> data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
@Getter
@Setter
public class Relationships {

JobData job;
OrganizationData organization;
VariableData variable;
VcsData vcs;
HistoryData history;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.azbuilder.api.client.model.organization.workspace.history;

import lombok.Getter;
import lombok.Setter;
import org.azbuilder.api.client.model.generic.Resource;

@Getter
@Setter
public class History extends Resource {
HistoryAttributes attributes;
Relationships relationships;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.azbuilder.api.client.model.organization.workspace.history;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class HistoryAttributes {
private String createdBy;
private String createdDate;
private String output;
private String updatedBy;
private String updatedDate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.azbuilder.api.client.model.organization.workspace.history;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class HistoryRequest {
History data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.workspace.history;

import lombok.Getter;
import lombok.Setter;
import org.azbuilder.api.client.model.organization.workspace.variable.WorkspaceData;

@Getter
@Setter
public class Relationships {
WorkspaceData workspace;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.workspace.history;

import lombok.Getter;
import lombok.Setter;
import org.azbuilder.api.client.model.generic.Resource;

@Getter
@Setter
public class WorkspaceData {
Resource data;
}

0 comments on commit d8df408

Please sign in to comment.