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

com.ksyun.api.sdk.kec.transform.ModifyInstanceImageRequestMarshaller 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.ModifyInstanceImageRequest;

public class ModifyInstanceImageRequestMarshaller 
       implements Marshaller, ModifyInstanceImageRequest>{
	
	@Override
	public Request marshall(ModifyInstanceImageRequest modifyInstanceImageRequest){
		 if (modifyInstanceImageRequest == null) {
	            throw new KscClientException(
	                    "Invalid argument passed to marshall(...)");
	        }

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

	        if(modifyInstanceImageRequest.getInstanceId() != null){
	        	request.addParameter("InstanceId", 
	        			StringUtils.fromString(modifyInstanceImageRequest.getInstanceId()));
	        }
	        
	        if(modifyInstanceImageRequest.getImageId() != null){
	        	request.addParameter("ImageId", 
                        StringUtils.fromString(modifyInstanceImageRequest.getImageId()));
	        }
	        
	        if(modifyInstanceImageRequest.getInstancePassword() != null){
	        	request.addParameter("InstancePassword", 
                        StringUtils.fromString(modifyInstanceImageRequest.getInstancePassword()));
	        }

	        return request;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy