use of org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse in project cloudstack by apache.
the class KubernetesVersionManagerImpl method createKubernetesSupportedVersionResponse.
private KubernetesSupportedVersionResponse createKubernetesSupportedVersionResponse(final KubernetesSupportedVersion kubernetesSupportedVersion) {
KubernetesSupportedVersionResponse response = new KubernetesSupportedVersionResponse();
response.setObjectName("kubernetessupportedversion");
response.setId(kubernetesSupportedVersion.getUuid());
response.setName(kubernetesSupportedVersion.getName());
response.setSemanticVersion(kubernetesSupportedVersion.getSemanticVersion());
if (kubernetesSupportedVersion.getState() != null) {
response.setState(kubernetesSupportedVersion.getState().toString());
}
response.setMinimumCpu(kubernetesSupportedVersion.getMinimumCpu());
response.setMinimumRamSize(kubernetesSupportedVersion.getMinimumRamSize());
DataCenterVO zone = dataCenterDao.findById(kubernetesSupportedVersion.getZoneId());
if (zone != null) {
response.setZoneId(zone.getUuid());
response.setZoneName(zone.getName());
}
response.setSupportsHA(compareSemanticVersions(kubernetesSupportedVersion.getSemanticVersion(), KubernetesClusterService.MIN_KUBERNETES_VERSION_HA_SUPPORT) >= 0);
response.setSupportsAutoscaling(versionSupportsAutoscaling(kubernetesSupportedVersion));
TemplateJoinVO template = templateJoinDao.findById(kubernetesSupportedVersion.getIsoId());
if (template != null) {
response.setIsoId(template.getUuid());
response.setIsoName(template.getName());
response.setIsoState(template.getState().toString());
}
return response;
}
use of org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse in project cloudstack by apache.
the class AddKubernetesSupportedVersionCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ServerApiException, ConcurrentOperationException {
try {
KubernetesSupportedVersionResponse response = kubernetesVersionService.addKubernetesSupportedVersion(this);
if (response == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Kubernetes supported version");
}
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (CloudRuntimeException ex) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse in project cloudstack by apache.
the class UpdateKubernetesSupportedVersionCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ServerApiException, ConcurrentOperationException {
try {
KubernetesSupportedVersionResponse response = kubernetesVersionService.updateKubernetesSupportedVersion(this);
if (response == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Kubernetes supported version");
}
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (CloudRuntimeException ex) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
Aggregations