use of org.apache.cloudstack.api.response.ImageStoreResponse in project cloudstack by apache.
the class AddImageStoreCmd method execute.
@Override
public void execute() {
try {
ImageStore result = _storageService.discoverImageStore(getName(), getUrl(), getProviderName(), getZoneId(), getDetails());
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("imagestore");
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.api.response.ImageStoreResponse in project cloudstack by apache.
the class CreateSecondaryStagingStoreCmd method execute.
@Override
public void execute() {
try {
ImageStore result = _storageService.createSecondaryStagingStore(this);
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
} catch (Exception ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.api.response.ImageStoreResponse in project cloudstack by apache.
the class UpdateImageStoreCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
ImageStore result = _storageService.updateImageStoreStatus(getId(), getReadonly());
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName() + "response");
storeResponse.setObjectName("imagestore");
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Image store status");
}
}
use of org.apache.cloudstack.api.response.ImageStoreResponse in project cloudstack by apache.
the class AddImageStoreS3CMD method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
Map<String, String> dm = new HashMap();
dm.put(ApiConstants.S3_ACCESS_KEY, getAccessKey());
dm.put(ApiConstants.S3_SECRET_KEY, getSecretKey());
dm.put(ApiConstants.S3_END_POINT, getEndPoint());
dm.put(ApiConstants.S3_BUCKET_NAME, getBucketName());
if (getSigner() != null && (getSigner().equals(ApiConstants.S3_V3_SIGNER) || getSigner().equals(ApiConstants.S3_V4_SIGNER))) {
dm.put(ApiConstants.S3_SIGNER, getSigner());
}
if (isHttps() != null) {
dm.put(ApiConstants.S3_HTTPS_FLAG, isHttps().toString());
}
if (getConnectionTimeout() != null) {
dm.put(ApiConstants.S3_CONNECTION_TIMEOUT, getConnectionTimeout().toString());
}
if (getMaxErrorRetry() != null) {
dm.put(ApiConstants.S3_MAX_ERROR_RETRY, getMaxErrorRetry().toString());
}
if (getSocketTimeout() != null) {
dm.put(ApiConstants.S3_SOCKET_TIMEOUT, getSocketTimeout().toString());
}
if (getConnectionTtl() != null) {
dm.put(ApiConstants.S3_CONNECTION_TTL, getConnectionTtl().toString());
}
if (getUseTCPKeepAlive() != null) {
dm.put(ApiConstants.S3_USE_TCP_KEEPALIVE, getUseTCPKeepAlive().toString());
}
try {
ImageStore result = _storageService.discoverImageStore(null, null, "S3", null, dm);
ImageStoreResponse storeResponse;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("imagestore");
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 Image Store.");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.api.response.ImageStoreResponse in project cloudstack by apache.
the class ListSwiftsCmd method execute.
@Override
public void execute() {
ListImageStoresCmd cmd = new ListImageStoresCmd();
cmd.setProvider("Swift");
ListResponse<ImageStoreResponse> response = _queryService.searchForImageStores(cmd);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations