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

com.ksyun.api.sdk.kec.transform.ModifyInstanceAttributeRequestMarshaller Maven / Gradle / Ivy

There is a newer version: 2.1.8
Show newest version
package com.ksyun.api.sdk.kec.transform;

import com.ksc.DefaultRequest;
import com.ksc.KscClientException;
import com.ksc.Request;
import com.ksc.http.HttpMethodName;
import com.ksc.transform.Marshaller;
import com.ksc.util.StringUtils;
import com.ksyun.api.sdk.kec.model.ModifyInstanceAttributeRequest;

/**
 * ModifyInstanceAttributeRequest Marshaller
 */

public class ModifyInstanceAttributeRequestMarshaller implements
        Marshaller, ModifyInstanceAttributeRequest> {

    public Request marshall(
            ModifyInstanceAttributeRequest modifyInstanceAttributeRequest) {

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

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

        //AddParameter
        if(modifyInstanceAttributeRequest.getInstanceId()!=null) {
            request.addParameter("InstanceId",
                    StringUtils.fromString(modifyInstanceAttributeRequest.getInstanceId()));
        }
        if(modifyInstanceAttributeRequest.getInstanceName()!=null) {
            request.addParameter("InstanceName",
                    StringUtils.fromString(modifyInstanceAttributeRequest.getInstanceName()));
        }
        if(modifyInstanceAttributeRequest.getInstancePassword()!=null) {
            request.addParameter("InstancePassword",
                    StringUtils.fromString(modifyInstanceAttributeRequest.getInstancePassword()));
        }

        return request;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy