Example usage for com.amazonaws DefaultRequest DefaultRequest

List of usage examples for com.amazonaws DefaultRequest DefaultRequest

Introduction

In this page you can find the example usage for com.amazonaws DefaultRequest DefaultRequest.

Prototype

public DefaultRequest(AmazonWebServiceRequest originalRequest, String serviceName) 

Source Link

Document

Constructs a new DefaultRequest with the specified service name and the original, user facing request object.

Usage

From source file:com.github.sjones4.youcan.youserv.model.transform.DescribeServiceCertificatesRequestMarshaller.java

License:Open Source License

public Request<DescribeServiceCertificatesRequest> marshall(
        DescribeServiceCertificatesRequest describeServiceCertificatesRequest) {

    if (describeServiceCertificatesRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }/*from  w  ww  .  j  ava  2 s.  c o m*/

    final Request<DescribeServiceCertificatesRequest> request = new DefaultRequest<>(
            describeServiceCertificatesRequest, "EucalyptusServices");
    request.addParameter("Action", "DescribeServiceCertificates");
    request.addParameter("Version", "eucalyptus");

    if (describeServiceCertificatesRequest.getFormat() != null) {
        request.addParameter("Format", describeServiceCertificatesRequest.getFormat());
    }

    if (describeServiceCertificatesRequest.getFingerprintDigest() != null) {
        request.addParameter("FingerprintDigest", describeServiceCertificatesRequest.getFingerprintDigest());
    }

    final List<Filter> filtersList = describeServiceCertificatesRequest.getFilters();
    int filtersListIndex = 1;

    for (final Filter filtersListValue : filtersList) {
        Filter filterMember = filtersListValue;
        if (filterMember != null) {
            if (filterMember.getName() != null) {
                request.addParameter("Filter." + filtersListIndex + ".Name",
                        StringUtils.fromString(filterMember.getName()));
            }

            if (filterMember.getValues() != null) {
                final List<String> valuesList = filterMember.getValues();
                int valuesListIndex = 1;

                for (final String valuesListValue : valuesList) {
                    if (valuesListValue != null) {
                        request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex,
                                StringUtils.fromString(valuesListValue));
                    }

                    valuesListIndex++;
                }
            }
        }
        filtersListIndex++;
    }

    return request;
}

From source file:com.github.sjones4.youcan.youserv.model.transform.DescribeServicesRequestMarshaller.java

License:Open Source License

public Request<DescribeServicesRequest> marshall(DescribeServicesRequest describeServicesRequest) {

    if (describeServicesRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }/*from   w w w .j  ava 2s .  c  om*/

    final Request<DescribeServicesRequest> request = new DefaultRequest<>(describeServicesRequest,
            "EucalyptusServices");
    request.addParameter("Action", "DescribeServices");
    request.addParameter("Version", "eucalyptus");

    final List<String> servicesList = describeServicesRequest.getServiceNames();
    int servicesListIndex = 1;

    for (final String servicesListValue : servicesList) {
        if (servicesListValue != null) {
            request.addParameter("ServiceName." + servicesListIndex, StringUtils.fromString(servicesListValue));
        }

        servicesListIndex++;
    }

    final List<Filter> filtersList = describeServicesRequest.getFilters();
    int filtersListIndex = 1;

    for (final Filter filtersListValue : filtersList) {
        Filter filterMember = filtersListValue;
        if (filterMember != null) {
            if (filterMember.getName() != null) {
                request.addParameter("Filter." + filtersListIndex + ".Name",
                        StringUtils.fromString(filterMember.getName()));
            }

            if (filterMember.getValues() != null) {
                final List<String> valuesList = filterMember.getValues();
                int valuesListIndex = 1;

                for (final String valuesListValue : valuesList) {
                    if (valuesListValue != null) {
                        request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex,
                                StringUtils.fromString(valuesListValue));
                    }

                    valuesListIndex++;
                }
            }
        }
        filtersListIndex++;
    }

    return request;
}

From source file:com.github.sjones4.youcan.youtoken.model.transform.GetAccessTokenRequestMarshaller.java

License:Open Source License

public Request<GetAccessTokenRequest> marshall(GetAccessTokenRequest getAccessTokenRequest) {

    if (getAccessTokenRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }//from   w  ww.j a  v  a2  s .co m

    Request<GetAccessTokenRequest> request = new DefaultRequest<GetAccessTokenRequest>(getAccessTokenRequest,
            "AWSSecurityTokenService");
    request.addParameter("Action", "GetAccessToken");
    request.addParameter("Version", "2011-06-15");

    if (getAccessTokenRequest.getDurationSeconds() != null) {
        request.addParameter("DurationSeconds",
                StringUtils.fromInteger(getAccessTokenRequest.getDurationSeconds()));
    }

    return request;
}

From source file:com.github.sjones4.youcan.youtoken.model.transform.GetImpersonationTokenRequestMarshaller.java

License:Open Source License

public Request<GetImpersonationTokenRequest> marshall(
        GetImpersonationTokenRequest getImpersonationTokenRequest) {

    if (getImpersonationTokenRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }/*from w  ww . ja  v  a  2  s  .  c  o m*/

    Request<GetImpersonationTokenRequest> request = new DefaultRequest<GetImpersonationTokenRequest>(
            getImpersonationTokenRequest, "AWSSecurityTokenService");
    request.addParameter("Action", "GetImpersonationToken");
    request.addParameter("Version", "2011-06-15");

    if (getImpersonationTokenRequest.getAccountAlias() != null) {
        request.addParameter("AccountAlias",
                StringUtils.fromString(getImpersonationTokenRequest.getAccountAlias()));
    }
    if (getImpersonationTokenRequest.getUserName() != null) {
        request.addParameter("UserName", StringUtils.fromString(getImpersonationTokenRequest.getUserName()));
    }
    if (getImpersonationTokenRequest.getUserId() != null) {
        request.addParameter("UserId", StringUtils.fromString(getImpersonationTokenRequest.getUserId()));
    }

    return request;
}

From source file:com.github.sjones4.youcan.youtwo.model.transform.DescribeInstanceTypesRequestMarshaller.java

License:Open Source License

public Request<DescribeInstanceTypesRequest> marshall(
        DescribeInstanceTypesRequest describeInstanceTypesRequest) {

    if (describeInstanceTypesRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }/*from www.  ja v  a  2s. co  m*/

    Request<DescribeInstanceTypesRequest> request = new DefaultRequest<>(describeInstanceTypesRequest,
            "AmazonEC2");
    request.addParameter("Action", "DescribeInstanceTypes");
    request.addParameter("Version", "2013-10-15");

    List<String> instanceTypesList = describeInstanceTypesRequest.getInstanceTypes();
    int instanceTypesListIndex = 1;

    for (String instanceTypesListValue : instanceTypesList) {
        if (instanceTypesListValue != null) {
            request.addParameter("InstanceType." + instanceTypesListIndex,
                    StringUtils.fromString(instanceTypesListValue));
        }

        instanceTypesListIndex++;
    }
    if (describeInstanceTypesRequest.getAvailability() != null) {
        request.addParameter("Availability",
                StringUtils.fromBoolean(describeInstanceTypesRequest.getAvailability()));
    }
    if (describeInstanceTypesRequest.getVerbose() != null) {
        request.addParameter("Verbose", StringUtils.fromBoolean(describeInstanceTypesRequest.getVerbose()));
    }

    return request;
}

From source file:com.github.sjones4.youcan.youtwo.model.transform.ModifyInstanceTypeAttributeRequestMarshaller.java

License:Open Source License

@Override
public Request<ModifyInstanceTypeAttributeRequest> marshall(
        final ModifyInstanceTypeAttributeRequest modifyInstanceTypeRequest) {
    if (modifyInstanceTypeRequest == null) {
        throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }/*from w w  w .  j a v a  2s . c  om*/

    Request<ModifyInstanceTypeAttributeRequest> request = new DefaultRequest<>(modifyInstanceTypeRequest,
            "AmazonEC2");
    request.addParameter("Action", "ModifyInstanceTypeAttribute");
    request.addParameter("Version", "2013-10-15");

    if (modifyInstanceTypeRequest.getName() != null) {
        request.addParameter("Name", StringUtils.fromString(modifyInstanceTypeRequest.getName()));
    }

    if (modifyInstanceTypeRequest.getCpu() != null) {
        request.addParameter("Cpu", StringUtils.fromInteger(modifyInstanceTypeRequest.getCpu()));
    }

    if (modifyInstanceTypeRequest.getDisk() != null) {
        request.addParameter("Disk", StringUtils.fromInteger(modifyInstanceTypeRequest.getDisk()));
    }

    if (modifyInstanceTypeRequest.getMemory() != null) {
        request.addParameter("Memory", StringUtils.fromInteger(modifyInstanceTypeRequest.getMemory()));
    }

    return request;
}

From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechGetRequestMarshaller.java

License:Open Source License

public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) {
    if (createSpeechRequest == null) {
        throw new AmazonClientException("null createSpeechRequest passed to marshall(...)");
    }/*from w  w  w  .  j  a  va2  s  . co m*/

    Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    setRequestParameters(request, createSpeechRequest);
    request.setHttpMethod(HttpMethodName.GET);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechPostRequestMarshaller.java

License:Open Source License

public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) {

    if (createSpeechRequest == null) {
        throw new AmazonClientException("null createSpeechRequest passed to marshall(...)");
    }// www  .j a va 2  s .  c  o  m

    Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, createSpeechRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.DeleteLexiconPostRequestMarshaller.java

License:Open Source License

public Request<DeleteLexiconRequest> marshall(DeleteLexiconRequest deleteLexiconRequest) {
    if (deleteLexiconRequest == null) {
        throw new AmazonClientException("null deleteLexiconRequest passed to marshall(...)");
    }/*  w w  w.  java  2  s.co m*/

    Request<DeleteLexiconRequest> request = new DefaultRequest<DeleteLexiconRequest>(deleteLexiconRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, deleteLexiconRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.GetLexiconPostRequestMarshaller.java

License:Open Source License

public Request<GetLexiconRequest> marshall(GetLexiconRequest getLexiconRequest) {
    if (getLexiconRequest == null) {
        throw new AmazonClientException("null getLexiconRequest passed to marshall(...)");
    }//from   w  w w . ja v  a  2  s .co  m

    Request<GetLexiconRequest> request = new DefaultRequest<GetLexiconRequest>(getLexiconRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, getLexiconRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}