com.ksyun.api.sdk.kec.transform.TerminateInstancesRequestMarshaller 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.TerminateInstancesRequest;
/**
* TerminateInstancesRequest Marshaller
*/
public class TerminateInstancesRequestMarshaller implements
Marshaller, TerminateInstancesRequest> {
public Request marshall(
TerminateInstancesRequest terminateInstancesRequest) {
if (terminateInstancesRequest == null) {
throw new KscClientException(
"Invalid argument passed to marshall(...)");
}
Request request = new DefaultRequest(
terminateInstancesRequest, "kec");
request.addParameter("Action", "TerminateInstances");
String version = terminateInstancesRequest.getVersion();
if (StringUtils.isNullOrEmpty(version)) {
version = "2016-03-04";
}
request.addParameter("Version", version);
request.setHttpMethod(HttpMethodName.GET);
com.ksc.internal.SdkInternalList instanceIdsList = (com.ksc.internal.SdkInternalList) terminateInstancesRequest
.getInstanceIds();
if (!instanceIdsList.isEmpty() || !instanceIdsList.isAutoConstruct()) {
int instanceIdsListIndex = 1;
for (String instanceIdsListValue : instanceIdsList) {
if (instanceIdsListValue != null) {
request.addParameter("InstanceId." + instanceIdsListIndex,
StringUtils.fromString(instanceIdsListValue));
}
instanceIdsListIndex++;
}
}
return request;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy