use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class ObjectsPayloadGenerator method toRequiredConstructorParams.
/**
* Gets the sorted list of required constructor parameters including the request payload
*/
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
builder.addAll(getAssignmentArguments(ds3Request));
if (hasRequiredFileObjectListPayload(ds3Request)) {
builder.add(new Arguments(FILE_OBJECTS_TYPE, OBJECTS_NAME));
}
if (isMultiFileDeleteRequest(ds3Request)) {
builder.add(new Arguments(DELETE_OBJECTS_TYPE, OBJECTS_NAME));
}
if (isCompleteMultiPartUploadRequest(ds3Request)) {
builder.add(new Arguments(PARTS_TYPE, PARTS_NAME));
}
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class ObjectsPayloadGenerator method toOptionalConstructorParams.
/**
* Gets the sorted list of optional constructor parameters including the request payload
*/
@Override
public ImmutableList<ConstructorParam> toOptionalConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(toOptionalArgumentsList(ds3Request.getOptionalQueryParams()));
if (isEjectStorageDomainBlobsRequest(ds3Request)) {
builder.add(new Arguments(FILE_OBJECTS_TYPE, OBJECTS_NAME));
}
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), true)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class PutObjectRequestGenerator method toOptionalConstructorParams.
/**
* Gets the sorted list of optional constructor params with headers
*/
@Override
public ImmutableList<ConstructorParam> toOptionalConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(toOptionalArgumentsList(ds3Request.getOptionalQueryParams()));
builder.add(new Arguments("", "headers"));
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), true)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class ObjectsPayloadGenerator_Test method getAdditionalContent_OptionalFileObjectList_Test.
@Test
public void getAdditionalContent_OptionalFileObjectList_Test() {
final String expected = "if object_list is not None:\n" + " if not isinstance(object_list, FileObjectList):\n" + " raise TypeError('com.spectralogic.s3.server.handler.reqhandler.spectrads3.tape.EjectStorageDomainRequestHandler should have request payload of type: FileObjectList')\n" + " self.body = xmldom.tostring(object_list.to_xml())\n";
final Ds3Request request = getEjectStorageDomainBlobsRequest();
final String result = generator.getAdditionalContent(request, request.getName());
assertThat(result, is(expected));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Request in project ds3_autogen by SpectraLogic.
the class ObjectsPayloadGenerator_Test method getAdditionalContent_Error_Test.
@Test(expected = IllegalArgumentException.class)
public void getAdditionalContent_Error_Test() {
final Ds3Request request = getRequestCreateNotification();
generator.getAdditionalContent(request, request.getName());
}
Aggregations