Skip to content

Commit

Permalink
Merge pull request #9 from AzBuilder/refactor-variable
Browse files Browse the repository at this point in the history
Refactor variable
  • Loading branch information
alfespa17 authored Sep 7, 2021
2 parents 35cb851 + 1d4ca86 commit 19c4ada
Show file tree
Hide file tree
Showing 19 changed files with 32 additions and 158 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.1</feign.version>
<okhttp.version>4.9.1</okhttp.version>
<revision>0.4.1</revision>
<revision>0.5.0-beta</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>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<revision>0.4.1</revision>
<revision>0.5.0-beta</revision>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.azbuilder.api.client.model.organization.Organization;
import org.azbuilder.api.client.model.organization.provider.version.Version;
import org.azbuilder.api.client.model.organization.provider.version.implementation.Implementation;
import org.azbuilder.api.client.model.organization.workspace.Workspace;
import org.azbuilder.api.client.model.organization.workspace.variable.Variable;
import org.azbuilder.api.client.model.response.Response;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -21,9 +23,9 @@ class ApiClientStarterSampleApplicationTests {
@Test
void contextLoads() {
assertNotNull(restClient);
/*
/*
restClient.getAllOrganizations().getData().size();
Response<List<Organization>> organizationResponse = restClient.getOrganizationByName("organization1");
Response<List<Organization>> organizationResponse = restClient.getOrganizationByName("hashicorp");
System.out.println("Organization");
System.out.println(organizationResponse.getData().size());
Expand All @@ -43,13 +45,15 @@ void contextLoads() {
System.out.println(restClient.getAllEnvironmentVariables(organizationId, workspaceData.getId()).getData().size());
System.out.println(restClient.getAllSecrets(organizationId, workspaceData.getId()).getData().size());
System.out.println("pending");
System.out.println(restClient.getAllOrganizationsWithJobStatus("pending").getIncluded().size());
//System.out.println("pending");
//System.out.println(restClient.getAllOrganizationsWithJobStatus("pending").getIncluded().size());
restClient.getWorkspaceByIdWithEnvironmentVariables(organizationId, workspaceData.getId());
restClient.getWorkspaceByIdWithVariables(organizationId, workspaceData.getId());
restClient.getWorkspaceByIdWithSecrets(organizationId, workspaceData.getId());
for (Variable variable : restClient.getWorkspaceByIdWithVariables(organizationId, workspaceData.getId()).getIncluded()) {
System.out.println(variable.getAttributes().getCategory());
System.out.println(variable.getAttributes().getValue());
}
/*
Job job = restClient.getJobById(organizationId, "1").getData();
job.getAttributes().setStatus("completed");
Expand All @@ -61,9 +65,7 @@ void contextLoads() {
restClient.updateJob(jobRequest,organizationId, "1");
System.out.println(restClient.getModuleByNameAndProvider(organizationId, "azure","azurerm").getData().get(0).getAttributes().getSource());
*/
/*
Response<List<Organization>> listResponse =
restClient.getOrganizationsByNameAndProvider("sampleOrg","sampleProvider");
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.4.1</revision>
<revision>0.5.0-beta</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>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<revision>0.4.1</revision>
<revision>0.5.0-beta</revision>
<feign.version>11.1</feign.version>
<feign-form.version>3.8.0</feign-form.version>
<maven.deploy.skip>false</maven.deploy.skip>
Expand Down
20 changes: 9 additions & 11 deletions api-client/src/main/java/org/azbuilder/api/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import org.azbuilder.api.client.model.organization.provider.version.Version;
import org.azbuilder.api.client.model.organization.provider.version.implementation.Implementation;
import org.azbuilder.api.client.model.organization.workspace.Workspace;
import org.azbuilder.api.client.model.organization.workspace.environment.Environment;
import org.azbuilder.api.client.model.organization.workspace.secret.Secret;
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 All @@ -26,14 +24,14 @@ public interface RestClient {
@RequestLine("GET /api/v1/organization?filter[job]=status=={jobStatus}&include=job")
ResponseWithInclude<List<Organization>, Job> getAllOrganizationsWithJobStatus(@Param("jobStatus") String jobStatus);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/secret")
Response<List<Secret>> getAllSecrets(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);
@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/variable?filter[variable]=sensitive==true;category==terraform")
Response<List<Variable>> getAllSecrets(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/variable")
@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/variable?filter[variable]=sensitive==false;category==terraform")
Response<List<Variable>> getAllVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/environment")
Response<List<Environment>> getAllEnvironmentVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);
@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}/variable?filter[variable]=category==env")
Response<List<Variable>> getAllEnvironmentVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace")
Response<List<Workspace>> getAllWorkspaces(@Param("organizationId") String organizationId);
Expand All @@ -44,11 +42,11 @@ public interface RestClient {
@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}?include=variable")
ResponseWithInclude<Workspace, Variable> getWorkspaceByIdWithVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}?include=secret")
ResponseWithInclude<Workspace, Secret> getWorkspaceByIdWithSecrets(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);
//@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}?include=secret") //*
//ResponseWithInclude<Workspace, Secret> getWorkspaceByIdWithSecrets(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}?include=environment")
ResponseWithInclude<Workspace, Environment> getWorkspaceByIdWithEnvironmentVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);
//@RequestLine("GET /api/v1/organization/{organizationId}/workspace/{workspaceId}?include=environment") //*
//ResponseWithInclude<Workspace, Environment> getWorkspaceByIdWithEnvironmentVariables(@Param("organizationId") String organizationId, @Param("workspaceId") String workspaceId);

@RequestLine("PATCH /api/v1/organization/{organizationId}/job/{jobId}")
@Headers("Content-Type: application/vnd.api+json")
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.azbuilder.api.client.model.organization.workspace;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Relationships {

DefinitionData definition;
EnvironmentData environment;
JobData job;
OrganizationData organization;
SecretData secret;
VariableData variable;
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
public class VariableAttributes {
private String key;
private String value;
private boolean sensitive;
private boolean hcl;
private String category;
private String description;
}

0 comments on commit 19c4ada

Please sign in to comment.