use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class StartKubernetesClusterCmd method execute.
@Override
public void execute() throws ServerApiException, ConcurrentOperationException {
final KubernetesCluster kubernetesCluster = validateRequest();
try {
if (!kubernetesClusterService.startKubernetesCluster(kubernetesCluster.getId(), false)) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to start Kubernetes cluster ID: %d", getId()));
}
final KubernetesClusterResponse response = kubernetesClusterService.createKubernetesClusterResponse(kubernetesCluster.getId());
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (CloudRuntimeException ex) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class CreateKubernetesClusterCmd method create.
@Override
public void create() throws CloudRuntimeException {
try {
KubernetesCluster cluster = kubernetesClusterService.createKubernetesCluster(this);
if (cluster == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Kubernetes cluster");
}
setEntityId(cluster.getId());
setEntityUuid(cluster.getUuid());
} catch (CloudRuntimeException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
use of com.cloud.kubernetes.cluster.KubernetesCluster in project cloudstack by apache.
the class ScaleKubernetesClusterCmd method getEventDescription.
@Override
public String getEventDescription() {
String description = "Scaling Kubernetes cluster";
KubernetesCluster cluster = _entityMgr.findById(KubernetesCluster.class, getId());
if (cluster != null) {
description += String.format(" ID: %s", cluster.getUuid());
} else {
description += String.format(" ID: %d", getId());
}
return description;
}
Aggregations