Example usage for com.amazonaws.util StringUtils fromString

List of usage examples for com.amazonaws.util StringUtils fromString

Introduction

In this page you can find the example usage for com.amazonaws.util StringUtils fromString.

Prototype

public static String fromString(String value) 

Source Link

Usage

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(...)");
    }/*w  w w . jav  a 2s . com*/

    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(...)");
    }//w  ww. j  a va2 s.  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 va  2  s .c  o  m*/

    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;
}