com.ksc.network.slb.model.transform.DescribeHealthChecksRequestMarshaller Maven / Gradle / Ivy
package com.ksc.network.slb.model.transform;
import com.ksc.DefaultRequest;
import com.ksc.KscClientException;
import com.ksc.Request;
import com.ksc.http.HttpMethodName;
import com.ksc.model.Filter;
import com.ksc.network.slb.model.DescribeHealthChecksRequest;
import com.ksc.transform.Marshaller;
import com.ksc.util.StringUtils;
/**
* DescribeHealthChecksRequest Marshaller
*/
public class DescribeHealthChecksRequestMarshaller
implements Marshaller, DescribeHealthChecksRequest> {
@Override
public Request marshall(DescribeHealthChecksRequest describeHealthChecksRequest) {
if (describeHealthChecksRequest == null) {
throw new KscClientException("Invalid argument passed to marshall(...)");
}
Request request = new DefaultRequest(
describeHealthChecksRequest, "slb");
request.addParameter("Action", "DescribeHealthChecks");
String version = describeHealthChecksRequest.getVersion();
if (StringUtils.isNullOrEmpty(version)) {
version = "2016-03-04";
}
request.addParameter("Version", version);
request.setHttpMethod(HttpMethodName.GET);
com.ksc.internal.SdkInternalList filtersList = (com.ksc.internal.SdkInternalList) describeHealthChecksRequest
.getFilters();
if (!filtersList.isEmpty() || !filtersList.isAutoConstruct()) {
int filtersListIndex = 1;
for (Filter filtersListValue : filtersList) {
if (filtersListValue.getName() != null) {
request.addParameter("Filter." + filtersListIndex + ".Name",
StringUtils.fromString(filtersListValue.getName()));
}
com.ksc.internal.SdkInternalList valuesList = (com.ksc.internal.SdkInternalList) filtersListValue
.getValues();
if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
int valuesListIndex = 1;
for (String valuesListValue : valuesList) {
if (valuesListValue != null) {
request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex,
StringUtils.fromString(valuesListValue));
}
valuesListIndex++;
}
}
filtersListIndex++;
}
}
com.ksc.internal.SdkInternalList list = (com.ksc.internal.SdkInternalList) describeHealthChecksRequest
.getHealthCheckIds();
if (!list.isEmpty() || !list.isAutoConstruct()) {
int index = 1;
for (String value : list) {
if (value != null) {
request.addParameter("HealthCheckId." + index, StringUtils.fromString(value));
}
index++;
}
}
return request;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy