All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ksc.network.eip.model.transform.AssociateAddressRequestMarshaller Maven / Gradle / Ivy

There is a newer version: 2.1.8
Show newest version
package com.ksc.network.eip.model.transform;

import com.ksc.DefaultRequest;
import com.ksc.KscClientException;
import com.ksc.Request;
import com.ksc.http.HttpMethodName;
import com.ksc.network.eip.model.AssociateAddressRequest;
import com.ksc.transform.Marshaller;
import com.ksc.util.StringUtils;

/**
 * AssociateAddressRequest Marshaller
 */

public class AssociateAddressRequestMarshaller implements
        Marshaller, AssociateAddressRequest> {

    public Request marshall(
    		AssociateAddressRequest associateAddressRequest) {

        if (associateAddressRequest == null) {
            throw new KscClientException(
                    "Invalid argument passed to marshall(...)");
        }

        Request request = new DefaultRequest(
        		associateAddressRequest, "eip");
        request.addParameter("Action", "AssociateAddress");
        String version = associateAddressRequest.getVersion();
        if (StringUtils.isNullOrEmpty(version)) {
            version = "2016-03-04";
        }
        request.addParameter("Version", version);
        request.setHttpMethod(HttpMethodName.GET);

        if (!StringUtils.isNullOrEmpty(associateAddressRequest.getAllocationId())) {
            request.addParameter("AllocationId", associateAddressRequest.getAllocationId());
        }

        if (!StringUtils.isNullOrEmpty(associateAddressRequest.getInstanceType())) {
            request.addParameter("InstanceType", associateAddressRequest.getInstanceType());
        }
        
        if (!StringUtils.isNullOrEmpty(associateAddressRequest.getInstanceId())) {
            request.addParameter("InstanceId", associateAddressRequest.getInstanceId());
        }
        
        if (!StringUtils.isNullOrEmpty(associateAddressRequest.getNetworkInterfaceId())) {
            request.addParameter("NetworkInterfaceId", associateAddressRequest.getNetworkInterfaceId());
        }
 
        return request;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy