use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator 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.utils.comparators.CustomArgumentComparator 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.utils.comparators.CustomArgumentComparator 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.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class RetryAfterResponseGenerator method toParamList.
/**
* Retrieves the arguments: response payload, retry after seconds, and status
*/
@Override
public ImmutableList<Arguments> toParamList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.add(new Arguments("int", "RetryAfterSeconds"));
builder.add(new Arguments("Status", "Status"));
if (hasContent(ds3ResponseCodes)) {
final ImmutableList<Arguments> responseCodeArgs = ds3ResponseCodes.stream().filter(//Filter error codes
i -> i.getCode() < ERROR_CODE_THRESHOLD).map(BaseResponseGenerator::toParam).filter(//Filters out empty optional arguments
Optional::isPresent).map(//Get the Arguments object out of the optional
Optional::get).collect(GuavaCollectors.immutableList());
builder.addAll(responseCodeArgs);
}
return builder.build().stream().sorted(//Sorts the arguments by name
new CustomArgumentComparator()).collect(GuavaCollectors.immutableList());
}
Aggregations