Skip to content

Commit

Permalink
Merge pull request #6 from AzBuilder/provider-support
Browse files Browse the repository at this point in the history
Provider support
  • Loading branch information
alfespa17 authored Jul 24, 2021
2 parents 0126bbe + 39d2f6e commit d685712
Show file tree
Hide file tree
Showing 22 changed files with 232 additions and 7 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.3.1</revision>
<revision>0.4.0</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.3.1</revision>
<revision>0.4.0</revision>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package org.azbuilder.api.client.sample;

import org.azbuilder.api.client.model.organization.Organization;
import org.azbuilder.api.client.model.organization.job.Job;
import org.azbuilder.api.client.model.organization.job.JobRequest;
import org.azbuilder.api.client.model.organization.workspace.Workspace;
import org.azbuilder.api.client.model.organization.provider.version.Version;
import org.azbuilder.api.client.model.organization.provider.version.file.File;
import org.azbuilder.api.client.model.response.Response;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -64,5 +63,34 @@ void contextLoads() {
System.out.println(restClient.getModuleByNameAndProvider(organizationId, "azure","azurerm").getData().get(0).getAttributes().getSource());
*/

/*
Response<List<Organization>> listResponse =
restClient.getOrganizationsByNameAndProvider("sampleOrg","sampleProvider");
System.out.println(listResponse.getData().get(0).getId());
System.out.println(listResponse.getData().get(0).getRelationships().getProvider().getData().get(0).getId());
Response<List<Version>> listVersion =
restClient.getVersionsByOrganizationIdAndProviderIdAndVersionNumber(
listResponse.getData().get(0).getId(),
listResponse.getData().get(0).getRelationships().getProvider().getData().get(0).getId(),
"1");
Response<List<File>> files= restClient.getFileByOsArchVersion(
listResponse.getData().get(0).getId(),
listResponse.getData().get(0).getRelationships().getProvider().getData().get(0).getId(),
listVersion.getData().get(0).getId(),
"linux",
"amd64");
System.out.println(files.getData().get(0).getId());
System.out.println(files.getData().get(0).getAttributes().getFilename());
System.out.println(restClient.getAllVersionsByProvider(listResponse.getData().get(0).getId(),
listResponse.getData().get(0).getRelationships().getProvider().getData().get(0).getId()).getIncluded().size());*/

}
}
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.3.1</revision>
<revision>0.4.0</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.3.1</revision>
<revision>0.4.0</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
13 changes: 13 additions & 0 deletions api-client/src/main/java/org/azbuilder/api/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.azbuilder.api.client.model.organization.job.Job;
import org.azbuilder.api.client.model.organization.job.JobRequest;
import org.azbuilder.api.client.model.organization.module.Module;
import org.azbuilder.api.client.model.organization.provider.version.Version;
import org.azbuilder.api.client.model.organization.provider.version.file.File;
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;
Expand Down Expand Up @@ -61,5 +63,16 @@ public interface RestClient {
@RequestLine("GET /api/v1/organization/{organizationId}/module?filter[module]=name=={moduleName};provider=={providerName}")
Response<List<Module>> getModuleByNameAndProvider(@Param("organizationId") String organizationId, @Param("moduleName") String moduleName, @Param("providerName") String providerName);

@RequestLine("GET /api/v1/organization?filter[organization]=name=={organizationName}&filter[provider]=name=={providerName}")
Response<List<Organization>> getOrganizationsByNameAndProvider(@Param("organizationName") String organizationName, @Param("providerName") String providerName);

@RequestLine("GET /api/v1/organization/{organizationId}/provider/{providerId}/version?include=file")
ResponseWithInclude<List<Version>, File> getAllVersionsByProviderWithFile(@Param("organizationId") String organizationId, @Param("providerId") String providerId);

@RequestLine("GET /api/v1/organization/{organizationId}/provider/{providerId}/version?filter[version]=versionNumber=={versionNumber}")
Response<List<Version>> getVersionsByOrganizationIdAndProviderIdAndVersionNumber(@Param("organizationId") String organizationId, @Param("providerId") String providerId, @Param("versionNumber") String versionNumber);

@RequestLine("GET /api/v1/organization/{organizationId}/provider/{providerId}/version/{versionId}/file?filter[file]=os=={os};arch=={arch}")
Response<List<File>> getFileByOsArchVersion(@Param("organizationId") String organizationId, @Param("providerId") String providerId, @Param("versionId") String versionId, @Param("os") String os, @Param("arch") String arch);

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

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

import java.util.List;

@Getter
@Setter
public class ProviderData {
List<Resource> data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class Relationships {
JobData job;
ModuleData module;
WorkspaceData workspace;
ProviderData provider;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider;

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

@Getter
@Setter
public class OrganizationData {
Resource data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.azbuilder.api.client.model.organization.provider;

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

@Getter
@Setter
public class Provider extends Resource {
ProviderAttributes attributes;
Relationships relationships;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ProviderAttributes {
private String name;
private String description;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Relationships {
OrganizationData organization;
VersionData version;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.azbuilder.api.client.model.organization.provider;

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

import java.util.List;

@Getter
@Setter
public class VersionData {
List<Resource> data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.azbuilder.api.client.model.organization.provider.version;

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

import java.util.List;

@Getter
@Setter
public class FileData {
List<Resource> data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider.version;

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

@Getter
@Setter
public class ProviderData {
Resource data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider.version;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Relationships {
FileData file;
ProviderData provider;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.azbuilder.api.client.model.organization.provider.version;

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

@Getter
@Setter
public class Version extends Resource {
VersionAttributes attributes;
Relationships relationships;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.azbuilder.api.client.model.organization.provider.version;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class VersionAttributes {
private String versionNumber;
private String protocols;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.azbuilder.api.client.model.organization.provider.version.file;

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

@Getter
@Setter
public class File extends Resource {
FileAttributes attributes;
Relationships relationships;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.azbuilder.api.client.model.organization.provider.version.file;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class FileAttributes {
private String os;
private String arch;
private String filename;
private String downloadUrl;
private String shasumsUrl;
private String shasumsSignatureUrl;
private String shasum;
private String keyId;
private String asciiArmor;
private String trustSignature;
private String source;
private String sourceUrl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.azbuilder.api.client.model.organization.provider.version.file;

import lombok.Getter;
import lombok.Setter;

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

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

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

0 comments on commit d685712

Please sign in to comment.