use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class RequestConverterUtil_Test method getRequiredArgsFromRequestHeader_Singleton_Test.
@Test
public void getRequiredArgsFromRequestHeader_Singleton_Test() {
final Ds3Request ds3Request = new Ds3Request("RequestName", null, Classification.amazons3, Requirement.REQUIRED, Requirement.REQUIRED, null, Resource.CAPACITY_SUMMARY, ResourceType.SINGLETON, null, false, null, null, null);
final ImmutableList<Arguments> result = getRequiredArgsFromRequestHeader(ds3Request);
assertThat(result.size(), is(2));
assertThat(result.get(0).getName(), is("BucketName"));
assertThat(result.get(0).getType(), is("String"));
assertThat(result.get(1).getName(), is("ObjectName"));
assertThat(result.get(1).getType(), is("String"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class GoCodeGenerator method generateCommands.
/**
* Generates Go code for requests and responses
*/
private void generateCommands(final ImmutableList<Ds3Request> ds3Requests) throws IOException, TemplateException {
if (isEmpty(ds3Requests)) {
LOG.info("There were no requests to generate.");
return;
}
for (final Ds3Request ds3Request : ds3Requests) {
generateRequest(ds3Request);
generateResponse(ds3Request);
}
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class GoCodeGenerator method generateClient.
/**
* Generates the client files. Each file contains the client commands separated by {@link HttpVerb}
*/
private void generateClient(final ImmutableList<Ds3Request> ds3Requests) throws IOException, TemplateException {
for (final HttpVerb httpVerb : HttpVerb.values()) {
final ImmutableList<Ds3Request> filteredRequests = ds3Requests.stream().filter(ds3Request -> ds3Request.getHttpVerb() == httpVerb).collect(GuavaCollectors.immutableList());
generateClientFile(filteredRequests, httpVerb);
}
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class RequestConverterUtil_Test method getRequiredArgsFromRequestHeader_Null_Test.
@Test
public void getRequiredArgsFromRequestHeader_Null_Test() {
final Ds3Request ds3Request = new Ds3Request("RequestName", null, Classification.amazons3, null, null, null, null, null, null, false, null, null, null);
final ImmutableList<Arguments> result = getRequiredArgsFromRequestHeader(ds3Request);
assertThat(result.size(), is(0));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class BaseClientGenerator method toVoidCommands.
/**
* Converts the Ds3Requests with no response type into Void Commands
*/
protected static ImmutableList<VoidCommand> toVoidCommands(final ImmutableList<Ds3Request> ds3Requests, final Ds3DocSpec docSpec) {
final ImmutableList.Builder<VoidCommand> builder = ImmutableList.builder();
final ImmutableList<Ds3Request> voidRequests = getRequestsBasedOnResponsePayload(ds3Requests, false);
for (final Ds3Request ds3Request : voidRequests) {
builder.add(toVoidCommand(ds3Request, docSpec));
}
return builder.build();
}
Aggregations