use of com.cloud.storage.snapshot.SnapshotPolicy in project CloudStack-archive by CloudStack-extras.
the class ListSnapshotPoliciesCmd method execute.
@Override
public void execute() {
List<? extends SnapshotPolicy> result = _snapshotService.listPoliciesforVolume(this);
ListResponse<SnapshotPolicyResponse> response = new ListResponse<SnapshotPolicyResponse>();
List<SnapshotPolicyResponse> policyResponses = new ArrayList<SnapshotPolicyResponse>();
for (SnapshotPolicy policy : result) {
SnapshotPolicyResponse policyResponse = _responseGenerator.createSnapshotPolicyResponse(policy);
policyResponse.setObjectName("snapshotpolicy");
policyResponses.add(policyResponse);
}
response.setResponses(policyResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.storage.snapshot.SnapshotPolicy in project cloudstack by apache.
the class UpdateSnapshotPolicyCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("SnapshotPolicy Id: " + getId());
SnapshotPolicy result = _snapshotService.updateSnapshotPolicy(this);
if (result != null) {
SnapshotPolicyResponse response = _responseGenerator.createSnapshotPolicyResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update snapshot policy");
}
}
Aggregations