Search in sources :

Example 1 with KubernetesSupportedVersionResponse

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;
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) TemplateJoinVO(com.cloud.api.query.vo.TemplateJoinVO) KubernetesSupportedVersionResponse(org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse)

Example 2 with KubernetesSupportedVersionResponse

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());
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) KubernetesSupportedVersionResponse(org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse)

Example 3 with KubernetesSupportedVersionResponse

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());
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) KubernetesSupportedVersionResponse(org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse)

Aggregations

KubernetesSupportedVersionResponse (org.apache.cloudstack.api.response.KubernetesSupportedVersionResponse)3 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)1 DataCenterVO (com.cloud.dc.DataCenterVO)1