Search in sources :

Example 1 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class RequestConverter method buildRequestPayloadMap.

public static ImmutableMap<String, Parameter> buildRequestPayloadMap() {
    final ImmutableMap.Builder<String, Parameter> requestPayloadMap = ImmutableMap.builder();
    requestPayloadMap.put("get_bulk_job_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("put_bulk_job_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("verify_bulk_job_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("eject_storage_domain_blobs_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("get_physical_placement_for_objects_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("get_physical_placement_for_objects_with_full_details_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("verify_physical_placement_for_objects_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("verify_physical_placement_for_objects_with_full_details_spectra_s3_request", new Parameter(ParameterModifier.CONST, "ds3_bulk_object_list_response", "object_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("complete_multi_part_upload_request", new Parameter(ParameterModifier.CONST, "ds3_complete_multipart_upload_response", "mpu_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("put_multi_part_upload_part_request", new Parameter(ParameterModifier.CONST, "void", "user_data", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("put_object_request", new Parameter(ParameterModifier.CONST, "void", "user_data", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("delete_objects_request", // List<String>
    new Parameter(ParameterModifier.CONST, "ds3_delete_objects_response", "objects_list", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("get_blob_persistence_spectra_s3_request", // String
    new Parameter(ParameterModifier.CONST, "char", "payload", ParameterPointerType.SINGLE_POINTER, true));
    requestPayloadMap.put("replicate_put_job_spectra_s3_request", // String
    new Parameter(ParameterModifier.CONST, "char", "payload", ParameterPointerType.SINGLE_POINTER, true));
    return requestPayloadMap.build();
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 2 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class RequestConverter method getRequiredQueryParams.

private static ImmutableList<Parameter> getRequiredQueryParams(final Ds3Request ds3Request, final Ds3DocSpec docSpec) {
    final ImmutableList.Builder<Parameter> requiredArgsBuilder = ImmutableList.builder();
    if (hasContent(ds3Request.getRequiredQueryParams())) {
        for (final Ds3Param ds3Param : ds3Request.getRequiredQueryParams()) {
            if (ds3Param == null)
                continue;
            if (ds3Request.getClassification() == Classification.spectrads3 && ds3Request.getOperation() != null && ds3Param.getName().equalsIgnoreCase("Operation")) {
                // Special Case - Parameter.Type needs to be Request.Operation value
                LOG.debug("\tRequired QueryParam: " + ds3Param.getName() + "=" + ds3Request.getOperation().name());
                requiredArgsBuilder.add(new Parameter(ParameterModifier.CONST, "operation", ds3Request.getOperation().name(), ParameterPointerType.NONE, true));
            } else {
                final Parameter requiredParam = ParameterConverter.toParameter(ds3Param, true, toParamDocs(Helper.unqualifiedName(ds3Param.getName()), docSpec));
                LOG.debug("\tRequired QueryParam: " + requiredParam.toString());
                requiredArgsBuilder.add(requiredParam);
            }
        }
    }
    // Add 'length' if 'offset' is given
    if (hasContent(ds3Request.getOptionalQueryParams())) {
        for (final Ds3Param ds3Param : ds3Request.getOptionalQueryParams()) {
            if (ds3Param == null)
                continue;
            if (ds3Param.getName().equalsIgnoreCase("Offset")) {
                final Parameter lengthParam = new Parameter(ParameterModifier.CONST, "uint64_t", "length", ParameterPointerType.NONE, true);
                LOG.debug("\tFound Optional Offset, adding Length QueryParam:\n" + lengthParam.toString());
                requiredArgsBuilder.add(lengthParam);
            }
        }
    }
    return requiredArgsBuilder.build();
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) ImmutableList(com.google.common.collect.ImmutableList) Parameter(com.spectralogic.ds3autogen.c.models.Parameter)

Example 3 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class RequestConverter method getParamList.

public static ImmutableList<Parameter> getParamList(final String responseType, final Ds3DocSpec docSpec) {
    final ImmutableList.Builder<Parameter> builder = ImmutableList.builder();
    builder.add(new Parameter(ParameterModifier.CONST, "ds3_client", "client", ParameterPointerType.SINGLE_POINTER, true));
    builder.add(new Parameter(ParameterModifier.CONST, "ds3_request", "request", ParameterPointerType.SINGLE_POINTER, true));
    if (!responseType.isEmpty()) {
        builder.add(new Parameter(ParameterModifier.NONE, responseType, "response", ParameterPointerType.DOUBLE_POINTER, true, toParamDocs(Helper.underscoreToCamel(responseType), docSpec)));
    }
    return builder.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) Parameter(com.spectralogic.ds3autogen.c.models.Parameter)

Example 4 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class Parameter_Test method testSetQueryParamSignatureInt.

@Test
public void testSetQueryParamSignatureInt() {
    final Parameter parm = new Parameter(ParameterModifier.CONST, "int", "max_keys", ParameterPointerType.NONE, false);
    final String parmSig = ParameterHelper.generateSetQueryParamSignature(parm);
    System.out.println(parmSig);
    assertThat(parmSig, is("void ds3_request_set_max_keys(const ds3_request* request, const int value)"));
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 5 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class Parameter_Test method testSetQueryParamSignatureDs3Bool.

@Test
public void testSetQueryParamSignatureDs3Bool() {
    final Parameter parm = new Parameter(ParameterModifier.CONST, "ds3_bool", "force", ParameterPointerType.NONE, false);
    final String parmSig = ParameterHelper.generateSetQueryParamSignature(parm);
    assertThat(parmSig, is("void ds3_request_set_force(const ds3_request* request, ds3_bool value)"));
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Aggregations

Parameter (com.spectralogic.ds3autogen.c.models.Parameter)14 Test (org.junit.Test)10 ImmutableList (com.google.common.collect.ImmutableList)3 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)3 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)1