mirror of https://github.com/apache/cloudstack.git
DB and response changes
This commit is contained in:
parent
7ca858ad48
commit
102a2b0a64
|
|
@ -51,6 +51,10 @@ public class FirewallResponse extends BaseResponse {
|
|||
@Param(description = "The Network ID of the firewall rule")
|
||||
private String networkId;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_ID)
|
||||
@Param(description = "The VPC ID of the firewall rule")
|
||||
private String vpcId;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS)
|
||||
@Param(description = "The public IP address for the firewall rule")
|
||||
private String publicIpAddress;
|
||||
|
|
@ -115,6 +119,10 @@ public class FirewallResponse extends BaseResponse {
|
|||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public void setVpcId(String vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,3 +131,6 @@ CREATE TABLE IF NOT EXISTS `cloud_usage`.`quota_tariff_usage` (
|
|||
-- Add the 'keep_mac_address_on_public_nic' column to the 'cloud.networks' and 'cloud.vpc' tables
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.networks', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1');
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1');
|
||||
|
||||
-- This is part of allowing firewall rules on public IP addresses in VPC network
|
||||
ALTER TABLE `cloud`.`firewall_rules` MODIFY COLUMN `network_id` BIGINT UNSIGNED NULL;
|
||||
|
|
|
|||
|
|
@ -2965,6 +2965,14 @@ public class ApiResponseHelper implements ResponseGenerator, ResourceIdSupport {
|
|||
}
|
||||
}
|
||||
|
||||
Long vpcId = fwRule.getVpcId();
|
||||
if (vpcId != null) {
|
||||
Vpc vpc = ApiDBUtils.findVpcById(vpcId);
|
||||
if (vpc != null) {
|
||||
response.setVpcId(vpc.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
FirewallRule.State state = fwRule.getState();
|
||||
String stateToSet = state.toString();
|
||||
if (state.equals(FirewallRule.State.Revoke)) {
|
||||
|
|
@ -5410,8 +5418,27 @@ public class ApiResponseHelper implements ResponseGenerator, ResourceIdSupport {
|
|||
response.setIcmpCode(fwRule.getIcmpCode());
|
||||
response.setIcmpType(fwRule.getIcmpType());
|
||||
|
||||
Network network = ApiDBUtils.findNetworkById(fwRule.getNetworkId());
|
||||
response.setNetworkId(network.getUuid());
|
||||
Long networkId = fwRule.getNetworkId();
|
||||
if (networkId != null) {
|
||||
Network network = ApiDBUtils.findNetworkById(networkId);
|
||||
if (network != null) {
|
||||
response.setNetworkId(network.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
Long vpcId = fwRule.getVpcId();
|
||||
if (vpcId == null && networkId != null) {
|
||||
Network network = ApiDBUtils.findNetworkById(networkId);
|
||||
if (network != null) {
|
||||
vpcId = network.getVpcId();
|
||||
}
|
||||
}
|
||||
if (vpcId != null) {
|
||||
Vpc vpc = ApiDBUtils.findVpcById(vpcId);
|
||||
if (vpc != null) {
|
||||
response.setVpcId(vpc.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
FirewallRule.State state = fwRule.getState();
|
||||
String stateToSet = state.toString();
|
||||
|
|
|
|||
Loading…
Reference in New Issue