use of com.cloud.api.response.SwiftResponse in project CloudStack-archive by CloudStack-extras.
the class ListSwiftsCmd method execute.
@Override
public void execute() {
List<? extends Swift> result = _resourceService.listSwifts(this);
ListResponse<SwiftResponse> response = new ListResponse<SwiftResponse>();
List<SwiftResponse> swiftResponses = new ArrayList<SwiftResponse>();
if (result != null) {
SwiftResponse swiftResponse = null;
for (Swift swift : result) {
swiftResponse = _responseGenerator.createSwiftResponse(swift);
swiftResponse.setResponseName(getCommandName());
swiftResponse.setObjectName("swift");
swiftResponses.add(swiftResponse);
}
}
response.setResponses(swiftResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.SwiftResponse in project CloudStack-archive by CloudStack-extras.
the class AddSwiftCmd method execute.
@Override
public void execute() {
try {
Swift result = _resourceService.discoverSwift(this);
SwiftResponse swiftResponse = null;
if (result != null) {
swiftResponse = _responseGenerator.createSwiftResponse(result);
swiftResponse.setResponseName(getCommandName());
swiftResponse.setObjectName("swift");
this.setResponseObject(swiftResponse);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift");
}
} catch (DiscoveryException ex) {
String errMsg = "Failed to add Swift due to " + ex.toString();
s_logger.warn(errMsg, ex);
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg);
}
}
Aggregations