api: Remove redundant API parameters (#6143)

This commit is contained in:
Pearl Dsilva 2022-03-25 23:11:38 +05:30 committed by GitHub
parent aa00ef90c9
commit add657a899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 32 deletions

View File

@ -38,14 +38,11 @@ import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.response.BackupOfferingResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.IsoVmResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
@ -69,9 +66,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
@Parameter(name = ApiConstants.GROUP_ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "the group ID")
private Long groupId;
@Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID")
private Long hostId;
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the virtual machine")
private Long id;
@ -81,9 +75,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)")
private String name;
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the pod ID")
private Long podId;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.")
private String state;
@ -101,12 +92,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the target hypervisor for the template")
private String hypervisor;
@Parameter(name = ApiConstants.STORAGE_ID,
type = CommandType.UUID,
entityType = StoragePoolResponse.class,
description = "the storage ID where vm's volumes belong to")
private Long storageId;
@Parameter(name = ApiConstants.DETAILS,
type = CommandType.LIST,
collectionType = CommandType.STRING,
@ -222,18 +207,6 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
return keypair;
}
public Long getHostId() {
return hostId;
}
public Long getPodId() {
return podId;
}
public Long getStorageId() {
return storageId;
}
public Long getSecurityGroupId() {
return securityGroupId;
}

View File

@ -1002,12 +1002,12 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
Object hostId = null;
Object storageId = null;
if (_accountMgr.isRootAdmin(caller.getId())) {
pod = cmd.getPodId();
if (cmd instanceof ListVMsCmdByAdmin) {
clusterId = ((ListVMsCmdByAdmin)cmd).getClusterId();
pod = ((ListVMsCmdByAdmin) cmd).getPodId();
clusterId = ((ListVMsCmdByAdmin) cmd).getClusterId();
hostId = ((ListVMsCmdByAdmin) cmd).getHostId();
storageId = ((ListVMsCmdByAdmin) cmd).getStorageId();
}
hostId = cmd.getHostId();
storageId = cmd.getStorageId();
}
sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
@ -1193,7 +1193,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
}
if (_accountMgr.isRootAdmin(caller.getId())) {
if (cmd.getPodId() != null) {
if (pod != null) {
sc.setParameters("podId", pod);
if (state == null) {