Search in sources :

Example 21 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListAlertsCmd method execute.

@Override
public void execute() {
    List<? extends Alert> result = _mgr.searchForAlerts(this);
    ListResponse<AlertResponse> response = new ListResponse<AlertResponse>();
    List<AlertResponse> alertResponseList = new ArrayList<AlertResponse>();
    for (Alert alert : result) {
        AlertResponse alertResponse = new AlertResponse();
        alertResponse.setId(alert.getId());
        alertResponse.setAlertType(alert.getType());
        alertResponse.setDescription(alert.getSubject());
        alertResponse.setLastSent(alert.getLastSent());
        alertResponse.setObjectName("alert");
        alertResponseList.add(alertResponse);
    }
    response.setResponses(alertResponseList);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) AlertResponse(com.cloud.api.response.AlertResponse) ArrayList(java.util.ArrayList) Alert(com.cloud.alert.Alert)

Example 22 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListDomainChildrenCmd method execute.

@Override
public void execute() {
    List<? extends Domain> result = _domainService.searchForDomainChildren(this);
    ListResponse<DomainResponse> response = new ListResponse<DomainResponse>();
    List<DomainResponse> domainResponses = new ArrayList<DomainResponse>();
    for (Domain domain : result) {
        DomainResponse domainResponse = _responseGenerator.createDomainResponse(domain);
        domainResponse.setObjectName("domain");
        domainResponses.add(domainResponse);
    }
    response.setResponses(domainResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) DomainResponse(com.cloud.api.response.DomainResponse) ArrayList(java.util.ArrayList) Domain(com.cloud.domain.Domain)

Example 23 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListFirewallRulesCmd method execute.

@Override
public void execute() {
    List<? extends FirewallRule> result = _firewallService.listFirewallRules(this);
    ListResponse<FirewallResponse> response = new ListResponse<FirewallResponse>();
    List<FirewallResponse> fwResponses = new ArrayList<FirewallResponse>();
    for (FirewallRule fwRule : result) {
        FirewallResponse ruleData = _responseGenerator.createFirewallResponse(fwRule);
        ruleData.setObjectName("firewallrule");
        fwResponses.add(ruleData);
    }
    response.setResponses(fwResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) FirewallRule(com.cloud.network.rules.FirewallRule) FirewallResponse(com.cloud.api.response.FirewallResponse)

Example 24 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListRecurringSnapshotScheduleCmd method execute.

@Override
public void execute() {
    List<? extends SnapshotSchedule> snapshotSchedules = _snapshotService.findRecurringSnapshotSchedule(this);
    ListResponse<SnapshotScheduleResponse> response = new ListResponse<SnapshotScheduleResponse>();
    List<SnapshotScheduleResponse> snapshotScheduleResponses = new ArrayList<SnapshotScheduleResponse>();
    for (SnapshotSchedule snapshotSchedule : snapshotSchedules) {
        SnapshotScheduleResponse snapSchedResponse = new SnapshotScheduleResponse();
        snapSchedResponse.setId(snapshotSchedule.getId());
        snapSchedResponse.setVolumeId(snapshotSchedule.getVolumeId());
        snapSchedResponse.setSnapshotPolicyId(snapshotSchedule.getPolicyId());
        snapSchedResponse.setScheduled(snapshotSchedule.getScheduledTimestamp());
        snapSchedResponse.setObjectName("snapshot");
        snapshotScheduleResponses.add(snapSchedResponse);
    }
    response.setResponses(snapshotScheduleResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) SnapshotScheduleResponse(com.cloud.api.response.SnapshotScheduleResponse) ArrayList(java.util.ArrayList) SnapshotSchedule(com.cloud.storage.snapshot.SnapshotSchedule)

Example 25 with ListResponse

use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.

the class ListRemoteAccessVpnsCmd method execute.

@Override
public void execute() {
    List<? extends RemoteAccessVpn> vpns = _ravService.searchForRemoteAccessVpns(this);
    ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
    List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
    if (vpns != null && !vpns.isEmpty()) {
        for (RemoteAccessVpn vpn : vpns) {
            vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
        }
    }
    response.setResponses(vpnResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) RemoteAccessVpnResponse(com.cloud.api.response.RemoteAccessVpnResponse) RemoteAccessVpn(com.cloud.network.RemoteAccessVpn)

Aggregations

ListResponse (com.cloud.api.response.ListResponse)57 ArrayList (java.util.ArrayList)54 ServerApiException (com.cloud.api.ServerApiException)7 TemplateResponse (com.cloud.api.response.TemplateResponse)3 ClusterResponse (com.cloud.api.response.ClusterResponse)2 DomainResponse (com.cloud.api.response.DomainResponse)2 HostResponse (com.cloud.api.response.HostResponse)2 Domain (com.cloud.domain.Domain)2 DiscoveryException (com.cloud.exception.DiscoveryException)2 Host (com.cloud.host.Host)2 Cluster (com.cloud.org.Cluster)2 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)2 Alert (com.cloud.alert.Alert)1 AccountResponse (com.cloud.api.response.AccountResponse)1 AlertResponse (com.cloud.api.response.AlertResponse)1 AsyncJobResponse (com.cloud.api.response.AsyncJobResponse)1 ConfigurationResponse (com.cloud.api.response.ConfigurationResponse)1 DiskOfferingResponse (com.cloud.api.response.DiskOfferingResponse)1 DomainRouterResponse (com.cloud.api.response.DomainRouterResponse)1 EventResponse (com.cloud.api.response.EventResponse)1