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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations