| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7cd0ad3 commit 8065ee4
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,11 +114,12 @@ public interface NetworkACLService { | |||
| 114 | 114 | * @param sourcePortEnd | |
| 115 | 115 | * @param icmpCode | |
| 116 | 116 | * @param icmpType | |
| 117 | + * @param newUUID TODO | ||
| 117 | 118 | * @return | |
| 118 | 119 | * @throws ResourceUnavailableException | |
| 119 | 120 | */ | |
| 120 | 121 | NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, | |
| 121 | - Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType) throws ResourceUnavailableException; | ||
| 122 | + Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException; | ||
| 122 | 123 | ||
| 123 | 124 | /** | |
| 124 | 125 | * Associates ACL with specified Network | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,9 +66,10 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName | |||
| 66 | 66 | * @param vpcId | |
| 67 | 67 | * @param vpcName | |
| 68 | 68 | * @param displayText | |
| 69 | + * @param customId TODO | ||
| 69 | 70 | * @return | |
| 70 | 71 | */ | |
| 71 | - public Vpc updateVpc(long vpcId, String vpcName, String displayText); | ||
| 72 | + public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId); | ||
| 72 | 73 | ||
| 73 | 74 | /** | |
| 74 | 75 | * Lists VPC(s) based on the parameters passed to the method call | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,24 +18,23 @@ | |||
| 18 | 18 | ||
| 19 | 19 | import java.util.List; | |
| 20 | 20 | ||
| 21 | - import org.apache.log4j.Logger; | ||
| 22 | - | ||
| 23 | 21 | import org.apache.cloudstack.api.APICommand; | |
| 24 | 22 | import org.apache.cloudstack.api.ApiConstants; | |
| 25 | 23 | import org.apache.cloudstack.api.ApiErrorCode; | |
| 26 | - import org.apache.cloudstack.api.BaseAsyncCmd; | ||
| 24 | + import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; | ||
| 27 | 25 | import org.apache.cloudstack.api.Parameter; | |
| 28 | 26 | import org.apache.cloudstack.api.ServerApiException; | |
| 29 | 27 | import org.apache.cloudstack.api.response.NetworkACLItemResponse; | |
| 30 | 28 | import org.apache.cloudstack.context.CallContext; | |
| 29 | + import org.apache.log4j.Logger; | ||
| 31 | 30 | ||
| 32 | 31 | import com.cloud.event.EventTypes; | |
| 33 | 32 | import com.cloud.exception.ResourceUnavailableException; | |
| 34 | 33 | import com.cloud.network.vpc.NetworkACLItem; | |
| 35 | 34 | import com.cloud.user.Account; | |
| 36 | 35 | ||
| 37 | 36 | @APICommand(name = "updateNetworkACLItem", description = "Updates ACL Item with specified Id", responseObject = NetworkACLItemResponse.class) | |
| 38 | - public class UpdateNetworkACLItemCmd extends BaseAsyncCmd { | ||
| 37 | + public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd { | ||
| 39 | 38 | public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName()); | |
| 40 | 39 | ||
| 41 | 40 | private static final String s_name = "createnetworkaclresponse"; | |
@@ -165,7 +164,7 @@ public void execute() throws ResourceUnavailableException { | |||
| 165 | 164 | CallContext.current().setEventDetails("Rule Id: " + getId()); | |
| 166 | 165 | NetworkACLItem aclItem = | |
| 167 | 166 | _networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(), | |
| 168 | - getSourcePortEnd(), getIcmpCode(), getIcmpType()); | ||
| 167 | + getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId()); | ||
| 169 | 168 | if (aclItem == null) { | |
| 170 | 169 | throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item"); | |
| 171 | 170 | } | |
@@ -174,4 +173,11 @@ public void execute() throws ResourceUnavailableException { | |||
| 174 | 173 | aclResponse.setResponseName(getCommandName()); | |
| 175 | 174 | } | |
| 176 | 175 | ||
| 176 | + @Override | ||
| 177 | + public void checkUuid(String id, Class<?> cls) { | ||
| 178 | + if (this.getCustomId() != null) { | ||
| 179 | + _uuidMgr.checkUuid(this.getCustomId(), NetworkACLItem.class); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + | ||
| 177 | 183 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,22 +16,22 @@ | |||
| 16 | 16 | // under the License. | |
| 17 | 17 | package org.apache.cloudstack.api.command.user.vpc; | |
| 18 | 18 | ||
| 19 | - import org.apache.log4j.Logger; | ||
| 20 | - | ||
| 21 | 19 | import org.apache.cloudstack.api.APICommand; | |
| 22 | 20 | import org.apache.cloudstack.api.ApiConstants; | |
| 23 | 21 | import org.apache.cloudstack.api.ApiErrorCode; | |
| 24 | 22 | import org.apache.cloudstack.api.BaseAsyncCmd; | |
| 23 | + import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; | ||
| 25 | 24 | import org.apache.cloudstack.api.Parameter; | |
| 26 | 25 | import org.apache.cloudstack.api.ServerApiException; | |
| 27 | 26 | import org.apache.cloudstack.api.response.VpcResponse; | |
| 27 | + import org.apache.log4j.Logger; | ||
| 28 | 28 | ||
| 29 | 29 | import com.cloud.event.EventTypes; | |
| 30 | 30 | import com.cloud.network.vpc.Vpc; | |
| 31 | 31 | import com.cloud.user.Account; | |
| 32 | 32 | ||
| 33 | 33 | @APICommand(name = "updateVPC", description = "Updates a VPC", responseObject = VpcResponse.class) | |
| 34 | - public class UpdateVPCCmd extends BaseAsyncCmd { | ||
| 34 | + public class UpdateVPCCmd extends BaseAsyncCustomIdCmd { | ||
| 35 | 35 | public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName()); | |
| 36 | 36 | private static final String Name = "updatevpcresponse"; | |
| 37 | 37 | ||
@@ -84,7 +84,7 @@ public long getEntityOwnerId() { | |||
| 84 | 84 | ||
| 85 | 85 | @Override | |
| 86 | 86 | public void execute() { | |
| 87 | - Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText()); | ||
| 87 | + Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), this.getCustomId()); | ||
| 88 | 88 | if (result != null) { | |
| 89 | 89 | VpcResponse response = _responseGenerator.createVpcResponse(result); | |
| 90 | 90 | response.setResponseName(getCommandName()); | |
@@ -113,4 +113,11 @@ public String getSyncObjType() { | |||
| 113 | 113 | public Long getSyncObjId() { | |
| 114 | 114 | return getId(); | |
| 115 | 115 | } | |
| 116 | + | ||
| 117 | + @Override | ||
| 118 | + public void checkUuid(String id, Class<?> cls) { | ||
| 119 | + if (this.getCustomId() != null) { | ||
| 120 | + _uuidMgr.checkUuid(this.getCustomId(), Vpc.class); | ||
| 121 | + } | ||
| 122 | + } | ||
| 116 | 123 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,11 +130,12 @@ NetworkACLItem createNetworkACLItem(Integer sourcePortStart, Integer sourcePortE | |||
| 130 | 130 | * @param sourcePortEnd | |
| 131 | 131 | * @param icmpCode | |
| 132 | 132 | * @param icmpType | |
| 133 | + * @param customId TODO | ||
| 133 | 134 | * @return | |
| 134 | 135 | * @throws ResourceUnavailableException | |
| 135 | 136 | */ | |
| 136 | 137 | NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, | |
| 137 | - Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType) throws ResourceUnavailableException; | ||
| 138 | + Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException; | ||
| 138 | 139 | ||
| 139 | 140 | /** | |
| 140 | 141 | * Associates acl with a network and applies the ACLItems | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -241,4 +241,8 @@ public void setNumber(int number) { | |||
| 241 | 241 | public void setAction(Action action) { | |
| 242 | 242 | this.action = action; | |
| 243 | 243 | } | |
| 244 | + | ||
| 245 | + public void setUuid(String uuid) { | ||
| 246 | + this.uuid = uuid; | ||
| 247 | + } | ||
| 244 | 248 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,7 @@ | |||
| 31 | 31 | @Entity | |
| 32 | 32 | @Table(name = "vpc") | |
| 33 | 33 | public class VpcVO implements Vpc { | |
| 34 | + | ||
| 34 | 35 | @Id | |
| 35 | 36 | @Column(name = "id") | |
| 36 | 37 | long id; | |
@@ -177,4 +178,8 @@ public void setRestartRequired(boolean restartRequired) { | |||
| 177 | 178 | public boolean isRestartRequired() { | |
| 178 | 179 | return restartRequired; | |
| 179 | 180 | } | |
| 181 | + | ||
| 182 | + public void setUuid(String uuid) { | ||
| 183 | + this.uuid = uuid; | ||
| 184 | + } | ||
| 180 | 185 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,9 +22,8 @@ | |||
| 22 | 22 | import javax.ejb.Local; | |
| 23 | 23 | import javax.inject.Inject; | |
| 24 | 24 | ||
| 25 | - import org.apache.log4j.Logger; | ||
| 26 | - | ||
| 27 | 25 | import org.apache.cloudstack.context.CallContext; | |
| 26 | + import org.apache.log4j.Logger; | ||
| 28 | 27 | ||
| 29 | 28 | import com.cloud.configuration.ConfigurationManager; | |
| 30 | 29 | import com.cloud.event.ActionEvent; | |
@@ -399,7 +398,7 @@ public boolean applyACLToNetwork(long networkId) throws ResourceUnavailableExcep | |||
| 399 | 398 | ||
| 400 | 399 | @Override | |
| 401 | 400 | public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, | |
| 402 | - Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType) throws ResourceUnavailableException { | ||
| 401 | + Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException { | ||
| 403 | 402 | NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); | |
| 404 | 403 | aclItem.setState(State.Add); | |
| 405 | 404 | ||
@@ -443,6 +442,10 @@ public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String | |||
| 443 | 442 | aclItem.setIcmpType(icmpType); | |
| 444 | 443 | } | |
| 445 | 444 | ||
| 445 | + if (customId != null) { | ||
| 446 | + aclItem.setUuid(customId); | ||
| 447 | + } | ||
| 448 | + | ||
| 446 | 449 | if (_networkACLItemDao.update(id, aclItem)) { | |
| 447 | 450 | if (applyNetworkACL(aclItem.getAclId())) { | |
| 448 | 451 | return aclItem; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,17 +23,15 @@ | |||
| 23 | 23 | import javax.ejb.Local; | |
| 24 | 24 | import javax.inject.Inject; | |
| 25 | 25 | ||
| 26 | - import com.cloud.network.vpc.dao.VpcDao; | ||
| 27 | - import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd; | ||
| 28 | - import org.apache.commons.lang.StringUtils; | ||
| 29 | - import org.apache.log4j.Logger; | ||
| 30 | - import org.springframework.stereotype.Component; | ||
| 31 | - | ||
| 32 | 26 | import org.apache.cloudstack.api.ApiErrorCode; | |
| 33 | 27 | import org.apache.cloudstack.api.ServerApiException; | |
| 34 | 28 | import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd; | |
| 29 | + import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd; | ||
| 35 | 30 | import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd; | |
| 36 | 31 | import org.apache.cloudstack.context.CallContext; | |
| 32 | + import org.apache.commons.lang.StringUtils; | ||
| 33 | + import org.apache.log4j.Logger; | ||
| 34 | + import org.springframework.stereotype.Component; | ||
| 37 | 35 | ||
| 38 | 36 | import com.cloud.exception.InvalidParameterValueException; | |
| 39 | 37 | import com.cloud.exception.ResourceUnavailableException; | |
@@ -43,6 +41,7 @@ | |||
| 43 | 41 | import com.cloud.network.dao.NetworkDao; | |
| 44 | 42 | import com.cloud.network.dao.NetworkVO; | |
| 45 | 43 | import com.cloud.network.vpc.dao.NetworkACLDao; | |
| 44 | + import com.cloud.network.vpc.dao.VpcDao; | ||
| 46 | 45 | import com.cloud.network.vpc.dao.VpcGatewayDao; | |
| 47 | 46 | import com.cloud.projects.Project.ListProjectResourcesCriteria; | |
| 48 | 47 | import com.cloud.server.ResourceTag.ResourceObjectType; | |
@@ -606,7 +605,7 @@ public boolean revokeNetworkACLItem(long ruleId) { | |||
| 606 | 605 | ||
| 607 | 606 | @Override | |
| 608 | 607 | public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, | |
| 609 | - Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType) throws ResourceUnavailableException { | ||
| 608 | + Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException { | ||
| 610 | 609 | NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); | |
| 611 | 610 | if (aclItem == null) { | |
| 612 | 611 | throw new InvalidParameterValueException("Unable to find ACL Item cannot be found"); | |
@@ -635,7 +634,7 @@ public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String | |||
| 635 | 634 | validateNetworkACLItem((sourcePortStart == null) ? aclItem.getSourcePortStart() : sourcePortStart, (sourcePortEnd == null) ? aclItem.getSourcePortEnd() | |
| 636 | 635 | : sourcePortEnd, sourceCidrList, protocol, icmpCode, (icmpType == null) ? aclItem.getIcmpType() : icmpType, action, number); | |
| 637 | 636 | ||
| 638 | - return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType); | ||
| 637 | + return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID); | ||
| 639 | 638 | } | |
| 640 | 639 | ||
| 641 | 640 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,8 +32,6 @@ | |||
| 32 | 32 | import javax.inject.Inject; | |
| 33 | 33 | import javax.naming.ConfigurationException; | |
| 34 | 34 | ||
| 35 | - import org.apache.log4j.Logger; | ||
| 36 | - | ||
| 37 | 35 | import org.apache.cloudstack.acl.ControlledEntity.ACLType; | |
| 38 | 36 | import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd; | |
| 39 | 37 | import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd; | |
@@ -42,6 +40,7 @@ | |||
| 42 | 40 | import org.apache.cloudstack.framework.config.ConfigDepot; | |
| 43 | 41 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; | |
| 44 | 42 | import org.apache.cloudstack.managed.context.ManagedContextRunnable; | |
| 43 | + import org.apache.log4j.Logger; | ||
| 45 | 44 | ||
| 46 | 45 | import com.cloud.configuration.Config; | |
| 47 | 46 | import com.cloud.configuration.ConfigurationManager; | |
@@ -770,7 +769,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { | |||
| 770 | 769 | ||
| 771 | 770 | @Override | |
| 772 | 771 | @ActionEvent(eventType = EventTypes.EVENT_VPC_UPDATE, eventDescription = "updating vpc") | |
| 773 | - public Vpc updateVpc(long vpcId, String vpcName, String displayText) { | ||
| 772 | + public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId) { | ||
| 774 | 773 | CallContext.current().setEventDetails(" Id: " + vpcId); | |
| 775 | 774 | Account caller = CallContext.current().getCallingAccount(); | |
| 776 | 775 | ||
@@ -792,6 +791,10 @@ public Vpc updateVpc(long vpcId, String vpcName, String displayText) { | |||
| 792 | 791 | vpc.setDisplayText(displayText); | |
| 793 | 792 | } | |
| 794 | 793 | ||
| 794 | + if (customId != null) { | ||
| 795 | + vpc.setUuid(customId); | ||
| 796 | + } | ||
| 797 | + | ||
| 795 | 798 | if (_vpcDao.update(vpcId, vpc)) { | |
| 796 | 799 | s_logger.debug("Updated VPC id=" + vpcId); | |
| 797 | 800 | return _vpcDao.findById(vpcId); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments