Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.cloudstack.acl.RolePermissionEntity.Permission;
import org.apache.cloudstack.acl.Rule;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
Expand All @@ -32,8 +31,7 @@ public abstract class BaseRolePermissionCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.RULE, type = CommandType.STRING, required = true, description = "The API name or wildcard rule such as list*",
validations = {ApiArgValidator.NotNullOrEmpty})
@Parameter(name = ApiConstants.RULE, type = CommandType.STRING, required = true, description = "The API name or wildcard rule such as list*")
private String rule;

@Parameter(name = ApiConstants.PERMISSION, type = CommandType.STRING, required = true, description = "The rule permission, allow or deny. Default: deny.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.response.RoleResponse;
import org.apache.cloudstack.context.CallContext;

Expand All @@ -42,7 +41,7 @@ public class CreateRoleCmd extends RoleCmd {
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,
description = "Creates a role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
description = "Creates a role with this unique name")
private String roleName;

@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.Rule;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.ApiServerService;
Expand All @@ -56,7 +55,7 @@ public class ImportRoleCmd extends RoleCmd {
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,
description = "Creates a role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
description = "Creates a role with this unique name")
private String roleName;

@Parameter(name = ApiConstants.RULES, type = CommandType.MAP, required = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand All @@ -42,7 +41,7 @@ public class CreateProjectRoleCmd extends ProjectRoleCmd {
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true,
description = "creates a project role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
description = "creates a project role with this unique name")
private String projectRoleName;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class CreateProjectRolePermissionCmd extends BaseRolePermissionCmd {
private Long projectRoleId;

@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, required = true, entityType = ProjectResponse.class,
description = "ID of project where project role permission is to be created", validations = {ApiArgValidator.NotNullOrEmpty})
description = "ID of project where project role permission is to be created")
private Long projectId;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.cloudstack.api.command.admin.acl.project;

import org.apache.cloudstack.acl.ProjectRole;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
Expand All @@ -31,7 +30,7 @@ public abstract class ProjectRoleCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, required = true, entityType = ProjectResponse.class,
description = "ID of project where role is being created", validations = {ApiArgValidator.NotNullOrEmpty})
description = "ID of project where role is being created")
private Long projectId;

@Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, description = "The description of the Project role")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class UpdateProjectRolePermissionCmd extends BaseCmd {
private Long projectRoleId;

@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, required = true, entityType = ProjectResponse.class,
description = "ID of project where project role permission is to be updated", validations = {ApiArgValidator.NotNullOrEmpty})
description = "ID of project where project role permission is to be updated")
private Long projectId;

@Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectRolePermissionResponse.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ public class RunDiagnosticsCmd extends BaseAsyncCmd {
private Long id;

@Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = true,
validations = {ApiArgValidator.NotNullOrEmpty},
description = "The IP/Domain address to test connection to")
private String address;

@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true,
validations = {ApiArgValidator.NotNullOrEmpty},
description = "The system VM diagnostics type valid options are: ping, traceroute, arping")
private String type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public final class ConfigureHAForHostCmd extends BaseAsyncCmd {
private Long hostId;

@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING,
description = "HA provider", required = true, validations = {ApiArgValidator.NotNullOrEmpty})
description = "HA provider", required = true)
private String haProvider;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.common.base.Enums;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
Expand Down Expand Up @@ -57,7 +56,7 @@ public final class ListHostHAProvidersCmd extends BaseCmd {
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true,
description = "Hypervisor type of the resource", validations = {ApiArgValidator.NotNullOrEmpty})
description = "Hypervisor type of the resource")
private String hypervisorType;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,19 @@ public class CreateManagementNetworkIpRangeCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.GATEWAY,
type = CommandType.STRING,
required = true,
description = "The gateway for the management network.",
validations = {ApiArgValidator.NotNullOrEmpty})
description = "The gateway for the management network.")
private String gateway;

@Parameter(name = ApiConstants.NETMASK,
type = CommandType.STRING,
required = true,
description = "The netmask for the management network.",
validations = {ApiArgValidator.NotNullOrEmpty})
description = "The netmask for the management network.")
private String netmask;

@Parameter(name = ApiConstants.START_IP,
type = CommandType.STRING,
required = true,
description = "The starting IP address.",
validations = {ApiArgValidator.NotNullOrEmpty})
description = "The starting IP address.")
private String startIp;

@Parameter(name = ApiConstants.END_IP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public class CreateNetworkOfferingCmd extends BaseCmd {

@Parameter(name = ApiConstants.SUPPORTED_SERVICES,
type = CommandType.LIST,
required = true,
collectionType = CommandType.STRING,
description = "services supported by the network offering")
private List<String> supportedServices;
Expand Down Expand Up @@ -205,7 +204,7 @@ public Long getServiceOfferingId() {
}

public List<String> getSupportedServices() {
return supportedServices;
return supportedServices == null ? new ArrayList<String>() : supportedServices;
}

public String getGuestIpType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ public class DeleteManagementNetworkIpRangeCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.START_IP,
type = CommandType.STRING,
required = true,
description = "The starting IP address.",
validations = ApiArgValidator.NotNullOrEmpty)
description = "The starting IP address.")
private String startIp;

@Parameter(name = ApiConstants.END_IP,
type = CommandType.STRING,
required = true,
description = "The ending IP address.",
validations = ApiArgValidator.NotNullOrEmpty)
description = "The ending IP address.")
private String endIp;

@Parameter(name = ApiConstants.VLAN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class IssueOutOfBandManagementPowerActionCmd extends BaseAsyncCmd {
private Long actionTimeout;

@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true,
validations = {ApiArgValidator.NotNullOrEmpty}, description = "out-of-band management power actions, valid actions are: ON, OFF, CYCLE, RESET, SOFT, STATUS")
description = "out-of-band management power actions, valid actions are: ON, OFF, CYCLE, RESET, SOFT, STATUS")
private String powerAction;

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.cloudstack.api.command.user.project;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
Expand Down Expand Up @@ -60,7 +59,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "ID of the account owning a project")
private Long accountId;

@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, validations = ApiArgValidator.NotNullOrEmpty, description = "name of the project")
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the project")
private String name;

@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "display text of the project")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiArgValidator;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
Expand All @@ -43,9 +42,7 @@ public class ListDetailOptionsCmd extends BaseCmd {
/////////////////////////////////////////////////////

@Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true,
description = "the resource type such as UserVm, Template etc.",
validations = {ApiArgValidator.NotNullOrEmpty}
)
description = "the resource type such as UserVm, Template etc.")
private String resourceType;

@Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public void processParameters(final BaseCmd cmd, final Map params) {
}
continue;
}
if (parameterAnnotation.required()){
validateNonEmptyString(paramObj, parameterAnnotation.name());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - my only worry is if it causes a regression as it create a new behaviour (nit)

}

// marshall the parameter into the correct type and set the field value
try {
Expand Down