Search in sources :

Example 1 with AlertType

use of org.apache.cloudstack.alert.AlertService.AlertType in project cloudstack by apache.

the class GenerateAlertCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    AlertType alertType = AlertService.AlertType.generateAlert(getType(), getName());
    if (_alertSvc.generateAlert(alertType, getZoneId(), getPodId(), getDescription())) {
        SuccessResponse response = new SuccessResponse(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate an alert");
    }
}
Also used : AlertType(org.apache.cloudstack.alert.AlertService.AlertType) SuccessResponse(org.apache.cloudstack.api.response.SuccessResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException)

Aggregations

AlertType (org.apache.cloudstack.alert.AlertService.AlertType)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 SuccessResponse (org.apache.cloudstack.api.response.SuccessResponse)1