mirror of https://github.com/apache/cloudstack.git
api: firewall: fix and reformat descriptions
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
This commit is contained in:
parent
f17ab71bdf
commit
897c73867d
|
|
@ -247,7 +247,7 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F
|
|||
}
|
||||
if (getProtocol().equalsIgnoreCase(NetUtils.ALL_PROTO)) {
|
||||
if (getSourcePortStart() != null && getSourcePortEnd() != null) {
|
||||
throw new InvalidParameterValueException("Do not pass ports to protocol ALL, porotocol ALL do not require ports. Unable to create " +
|
||||
throw new InvalidParameterValueException("Do not pass ports to protocol ALL, protocol ALL do not require ports. Unable to create " +
|
||||
"firewall rule for the network id=" + networkId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import com.cloud.network.rules.FirewallRule;
|
|||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given ip address", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
|
||||
@APICommand(name = "createFirewallRule", description = "Creates a firewall rule for a given IP address", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateFirewallRuleCmd.class.getName());
|
||||
|
|
@ -73,10 +73,10 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
@Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule")
|
||||
private Integer publicEndPort;
|
||||
|
||||
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
|
||||
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the CIDR list to forward traffic from")
|
||||
private List<String> cidrlist;
|
||||
|
||||
@Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent")
|
||||
@Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent")
|
||||
private Integer icmpType;
|
||||
|
||||
@Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message")
|
||||
|
|
@ -133,7 +133,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
boolean success = false;
|
||||
FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
|
||||
try {
|
||||
CallContext.current().setEventDetails("Rule Id: " + getEntityId());
|
||||
CallContext.current().setEventDetails("Rule ID: " + getEntityId());
|
||||
success = _firewallService.applyIngressFwRules(rule.getSourceIpAddressId(), callerContext.getCallingAccount());
|
||||
|
||||
// State is different after the rule is applied, so get new object here
|
||||
|
|
@ -154,7 +154,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
|
||||
@Override
|
||||
public long getId() {
|
||||
throw new UnsupportedOperationException("database id can only provided by VO objects");
|
||||
throw new UnsupportedOperationException("database ID can only provided by VO objects");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -215,8 +215,8 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
}
|
||||
|
||||
if (ntwkId == null) {
|
||||
throw new InvalidParameterValueException("Unable to create firewall rule for the ipAddress id=" + ipAddressId +
|
||||
" as ip is not associated with any network and no networkId is passed in");
|
||||
throw new InvalidParameterValueException("Unable to create firewall rule for the IP address ID=" + ipAddressId +
|
||||
" as IP is not associated with any network and no networkId is passed in");
|
||||
}
|
||||
return ntwkId;
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
if (getSourceCidrList() != null) {
|
||||
for (String cidr : getSourceCidrList()) {
|
||||
if (!NetUtils.isValidCIDR(cidr)) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source CIDRs formatting error " + cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
@Override
|
||||
public String getEventDescription() {
|
||||
IpAddress ip = _networkService.getIp(ipAddressId);
|
||||
return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + getProtocol());
|
||||
return ("Creating firewall rule for IP: " + ip.getAddress() + " for protocol:" + getProtocol());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -290,7 +290,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
|||
private IpAddress getIp() {
|
||||
IpAddress ip = _networkService.getIp(ipAddressId);
|
||||
if (ip == null) {
|
||||
throw new InvalidParameterValueException("Unable to find ip address by id " + ipAddressId);
|
||||
throw new InvalidParameterValueException("Unable to find IP address by ID " + ipAddressId);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
|
|||
@Parameter(name = ApiConstants.PROTOCOL,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "the protocol for the port fowarding rule. Valid values are TCP or UDP.")
|
||||
description = "the protocol for the port forwarding rule. Valid values are TCP or UDP.")
|
||||
private String protocol;
|
||||
|
||||
@Parameter(name = ApiConstants.PRIVATE_END_PORT,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
|
||||
@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an ggress firewall rule", responseObject = SuccessResponse.class, entityType = {FirewallRule.class},
|
||||
@APICommand(name = "deleteEgressFirewallRule", description = "Deletes an egress firewall rule", responseObject = SuccessResponse.class, entityType = {FirewallRule.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteEgressFirewallRuleCmd.class.getName());
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return ("Deleting firewall rule id=" + id);
|
||||
return ("Deleting firewall rule ID=" + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -85,7 +85,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
|
|||
if (ownerId == null) {
|
||||
FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
|
||||
if (rule == null) {
|
||||
throw new InvalidParameterValueException("Unable to find firewall rule by id=" + id);
|
||||
throw new InvalidParameterValueException("Unable to find firewall rule by ID=" + id);
|
||||
} else {
|
||||
ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return ("Deleting port forwarding rule for id=" + id);
|
||||
return ("Deleting port forwarding rule for ID=" + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -89,7 +89,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
|
|||
if (ownerId == null) {
|
||||
PortForwardingRule rule = _entityMgr.findById(PortForwardingRule.class, id);
|
||||
if (rule == null) {
|
||||
throw new InvalidParameterValueException("Unable to find port forwarding rule by id=" + id);
|
||||
throw new InvalidParameterValueException("Unable to find port forwarding rule by ID=" + id);
|
||||
} else {
|
||||
ownerId = _entityMgr.findById(PortForwardingRule.class, id).getAccountId();
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Rule Id: " + id);
|
||||
CallContext.current().setEventDetails("Rule ID: " + id);
|
||||
//revoke corresponding firewall rule first
|
||||
boolean result = _firewallService.revokeRelatedFirewallRule(id, true);
|
||||
result = result && _rulesService.revokePortForwardingRule(id, true);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.apache.cloudstack.api.response.NetworkResponse;
|
|||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network id.", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
|
||||
@APICommand(name = "listEgressFirewallRules", description = "Lists all egress firewall rules for network ID.", responseObject = FirewallResponse.class, entityType = {FirewallRule.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListEgressFirewallRulesCmd extends BaseListTaggedResourcesCmd implements IListFirewallRulesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListEgressFirewallRulesCmd.class.getName());
|
||||
|
|
@ -51,13 +51,13 @@ public class ListEgressFirewallRulesCmd extends BaseListTaggedResourcesCmd imple
|
|||
@Parameter(name = ApiConstants.NETWORK_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = NetworkResponse.class,
|
||||
description = "the network id for the egress firewall services")
|
||||
description = "the network ID for the egress firewall services")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = IPAddressResponse.class,
|
||||
description = "the id of IP address of the firewall services")
|
||||
description = "the ID of IP address of the firewall services")
|
||||
private Long ipAddressId;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin})
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd implements
|
|||
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = IPAddressResponse.class,
|
||||
description = "the id of IP address of the firewall services")
|
||||
description = "the ID of IP address of the firewall services")
|
||||
private Long ipAddressId;
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_ID,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd {
|
|||
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = IPAddressResponse.class,
|
||||
description = "the id of IP address of the port forwarding services")
|
||||
description = "the ID of IP address of the port forwarding services")
|
||||
private Long ipAddressId;
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_ID,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd {
|
|||
if (ownerId == null) {
|
||||
FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
|
||||
if (rule == null || rule.getTrafficType() != TrafficType.Egress) {
|
||||
throw new InvalidParameterValueException("Unable to find egress firewall rule by id");
|
||||
throw new InvalidParameterValueException("Unable to find egress firewall rule by ID");
|
||||
} else {
|
||||
ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd {
|
|||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
CallContext.current().setEventDetails("Rule Id: " + id);
|
||||
CallContext.current().setEventDetails("Rule ID: " + id);
|
||||
FirewallRule rule = _firewallService.updateIngressFirewallRule(id, this.getCustomId(), getDisplay());
|
||||
|
||||
FirewallResponse fwResponse = new FirewallResponse();
|
||||
|
|
@ -113,7 +113,7 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd {
|
|||
if (ownerId == null) {
|
||||
FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
|
||||
if (rule == null || rule.getTrafficType() != TrafficType.Ingress) {
|
||||
throw new InvalidParameterValueException("Unable to find firewall rule by id");
|
||||
throw new InvalidParameterValueException("Unable to find firewall rule by ID");
|
||||
} else {
|
||||
ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import com.cloud.utils.net.Ip;
|
|||
|
||||
@APICommand(name = "updatePortForwardingRule",
|
||||
responseObject = FirewallRuleResponse.class,
|
||||
description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {PortForwardingRule.class},
|
||||
description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {PortForwardingRule.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue