use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListSnapshotsCmd method execute.
@Override
public void execute() {
List<? extends Snapshot> result = _snapshotService.listSnapshots(this);
ListResponse<SnapshotResponse> response = new ListResponse<SnapshotResponse>();
List<SnapshotResponse> snapshotResponses = new ArrayList<SnapshotResponse>();
for (Snapshot snapshot : result) {
SnapshotResponse snapshotResponse = _responseGenerator.createSnapshotResponse(snapshot);
snapshotResponse.setObjectName("snapshot");
snapshotResponses.add(snapshotResponse);
}
response.setResponses(snapshotResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListLBStickinessPoliciesCmd method execute.
@Override
public void execute() {
List<LBStickinessResponse> spResponses = new ArrayList<LBStickinessResponse>();
LoadBalancer lb = _lbService.findById(getLbRuleId());
ListResponse<LBStickinessResponse> response = new ListResponse<LBStickinessResponse>();
if (lb != null) {
//check permissions
Account caller = UserContext.current().getCaller();
_accountService.checkAccess(caller, null, true, lb);
List<? extends StickinessPolicy> stickinessPolicies = _lbService.searchForLBStickinessPolicies(this);
LBStickinessResponse spResponse = _responseGenerator.createLBStickinessPolicyResponse(stickinessPolicies, lb);
spResponses.add(spResponse);
response.setResponses(spResponses);
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListNetworkOfferingsCmd method execute.
@Override
public void execute() {
List<? extends NetworkOffering> offerings = _configService.searchForNetworkOfferings(this);
ListResponse<NetworkOfferingResponse> response = new ListResponse<NetworkOfferingResponse>();
List<NetworkOfferingResponse> offeringResponses = new ArrayList<NetworkOfferingResponse>();
for (NetworkOffering offering : offerings) {
NetworkOfferingResponse offeringResponse = _responseGenerator.createNetworkOfferingResponse(offering);
offeringResponses.add(offeringResponse);
}
response.setResponses(offeringResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project CloudStack-archive by CloudStack-extras.
the class ListPortForwardingRulesCmd method execute.
@Override
public void execute() {
List<? extends PortForwardingRule> result = _rulesService.listPortForwardingRules(this);
ListResponse<FirewallRuleResponse> response = new ListResponse<FirewallRuleResponse>();
List<FirewallRuleResponse> fwResponses = new ArrayList<FirewallRuleResponse>();
for (PortForwardingRule fwRule : result) {
FirewallRuleResponse ruleData = _responseGenerator.createPortForwardingRuleResponse(fwRule);
ruleData.setObjectName("portforwardingrule");
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 ListProjectAccountsCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
List<? extends ProjectAccount> projectAccounts = _projectService.listProjectAccounts(projectId, accountName, role, this.getStartIndex(), this.getPageSizeVal());
ListResponse<ProjectAccountResponse> response = new ListResponse<ProjectAccountResponse>();
List<ProjectAccountResponse> projectResponses = new ArrayList<ProjectAccountResponse>();
for (ProjectAccount projectAccount : projectAccounts) {
ProjectAccountResponse projectAccountResponse = _responseGenerator.createProjectAccountResponse(projectAccount);
projectResponses.add(projectAccountResponse);
}
response.setResponses(projectResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations