Search in sources :

Example 1 with HostHAResponse

use of org.apache.cloudstack.api.response.HostHAResponse in project cloudstack by apache.

the class DisableHAForHostCmd method setupResponse.

private void setupResponse(final boolean result, final String resourceUuid) {
    final HostHAResponse response = new HostHAResponse();
    response.setId(resourceUuid);
    response.setEnabled(false);
    response.setStatus(result);
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : HostHAResponse(org.apache.cloudstack.api.response.HostHAResponse)

Example 2 with HostHAResponse

use of org.apache.cloudstack.api.response.HostHAResponse in project cloudstack by apache.

the class EnableHAForHostCmd method setupResponse.

private void setupResponse(final boolean result, final String resourceUuid) {
    final HostHAResponse response = new HostHAResponse();
    response.setId(resourceUuid);
    response.setEnabled(true);
    response.setStatus(result);
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : HostHAResponse(org.apache.cloudstack.api.response.HostHAResponse)

Example 3 with HostHAResponse

use of org.apache.cloudstack.api.response.HostHAResponse in project cloudstack by apache.

the class ListHostHAResourcesCmd method setupResponse.

private void setupResponse(final List<HAConfig> hostHAConfigList) {
    final ListResponse<HostHAResponse> response = new ListResponse<>();
    final List<HostHAResponse> hostHAResponses = new ArrayList<>();
    for (final HAConfig config : hostHAConfigList) {
        final Host host = _resourceService.getHost(config.getResourceId());
        if (host == null) {
            continue;
        }
        final HostHAResponse hostHAResponse = new HostHAResponse();
        hostHAResponse.setId(host.getUuid());
        hostHAResponse.setEnabled(config.isEnabled());
        hostHAResponse.setHaState(config.getState());
        hostHAResponse.setProvider(config.getHaProvider());
        hostHAResponses.add(hostHAResponse);
    }
    response.setResponses(hostHAResponses);
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) HAConfig(org.apache.cloudstack.ha.HAConfig) ArrayList(java.util.ArrayList) HostHAResponse(org.apache.cloudstack.api.response.HostHAResponse) Host(com.cloud.host.Host)

Example 4 with HostHAResponse

use of org.apache.cloudstack.api.response.HostHAResponse in project cloudstack by apache.

the class ConfigureHAForHostCmd method setupResponse.

private void setupResponse(final boolean result, final String resourceUuid) {
    final HostHAResponse response = new HostHAResponse();
    response.setId(resourceUuid);
    response.setProvider(getHaProvider().toLowerCase());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : HostHAResponse(org.apache.cloudstack.api.response.HostHAResponse)

Aggregations

HostHAResponse (org.apache.cloudstack.api.response.HostHAResponse)4 Host (com.cloud.host.Host)1 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 HAConfig (org.apache.cloudstack.ha.HAConfig)1