com.ksyun.api.sdk.kec.transform.CreateImageRequestMarshaller Maven / Gradle / Ivy
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.CreateImageRequest;
/**
* 创建镜像
*
*/
public class CreateImageRequestMarshaller
implements Marshaller, CreateImageRequest>{
@Override
public Request marshall(CreateImageRequest createImageRequest){
if (createImageRequest == null) {
throw new KscClientException(
"Invalid argument passed to marshall(...)");
}
Request request = new DefaultRequest(
createImageRequest, "kec");
request.addParameter("Action", "CreateImage");
String version=createImageRequest.getVersion();
if(StringUtils.isNullOrEmpty(version)){
version="2016-03-04";
}
request.addParameter("Version", version);
request.setHttpMethod(HttpMethodName.GET);
if(createImageRequest.getInstanceId() != null){
request.addParameter("InstanceId",
StringUtils.fromString(createImageRequest.getInstanceId()));
}
if(createImageRequest.getName() != null){
request.addParameter("Name",
StringUtils.fromString(createImageRequest.getName()));
}
return request;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy