Skip to content

Commit 9714aae

Browse files
committed
remove required constraint on both vmid and id params for the delete bkp schedule command
1 parent 5e39348 commit 9714aae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ public class DeleteBackupScheduleCmd extends BaseCmd {
5555
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
5656
type = CommandType.UUID,
5757
entityType = UserVmResponse.class,
58-
required = true,
5958
description = "ID of the VM")
6059
private Long vmId;
6160

6261
@Parameter(name = ApiConstants.ID,
6362
type = CommandType.UUID,
6463
entityType = BackupScheduleResponse.class,
65-
required = true,
6664
description = "ID of the schedule",
6765
since = "4.20.1")
6866
private Long id;

server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ public List<BackupSchedule> listBackupSchedule(final Long vmId) {
470470
public boolean deleteBackupSchedule(DeleteBackupScheduleCmd cmd) {
471471
Long vmId = cmd.getVmId();
472472
Long id = cmd.getId();
473+
if (Objects.isNull(vmId) && Objects.isNull(id)) {
474+
throw new InvalidParameterValueException("Either instance ID or ID of backup schedule needs to be specified");
475+
}
473476
if (Objects.nonNull(vmId)) {
474477
final VMInstanceVO vm = findVmById(vmId);
475478
validateForZone(vm.getDataCenterId());

0 commit comments

Comments
 (0)