External UUID control support for NetworkACLList/LoadBalancer/ApplicationLoadBalancer
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9641e1db Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9641e1db Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9641e1db Branch: refs/heads/rbac Commit: 9641e1dbeeb7c50f7759c563d35b77dd4537fd34 Parents: 3cfa5fb Author: Alena Prokharchyk <alena.prokharc...@citrix.com> Authored: Tue Feb 4 22:29:58 2014 -0800 Committer: Alena Prokharchyk <alena.prokharc...@citrix.com> Committed: Wed Feb 5 10:36:21 2014 -0800 ---------------------------------------------------------------------- api/src/com/cloud/event/EventTypes.java | 1 + .../cloud/network/vpc/NetworkACLService.java | 2 + .../UpdateApplicationLoadBalancerCmd.java | 95 ++++++++++++++++++++ .../loadbalancer/UpdateLoadBalancerRuleCmd.java | 13 ++- .../user/network/UpdateNetworkACLListCmd.java | 91 +++++++++++++++++++ .../lb/ApplicationLoadBalancerService.java | 2 + client/tomcatconf/commands.properties.in | 2 + .../src/com/cloud/network/vpc/NetworkACLVO.java | 3 + .../lb/LoadBalancingRulesManagerImpl.java | 5 ++ .../network/vpc/NetworkACLServiceImpl.java | 18 ++++ .../com/cloud/server/ManagementServerImpl.java | 4 + .../lb/ApplicationLoadBalancerManagerImpl.java | 23 ++++- 12 files changed, 253 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/com/cloud/event/EventTypes.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index fdbc21f..51f8f1b 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -365,6 +365,7 @@ public class EventTypes { public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE"; public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE"; public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE"; + public static final String EVENT_NETWORK_ACL_UPDATE = "NETWORK.ACL.UPDATE"; public static final String EVENT_NETWORK_ACL_ITEM_CREATE = "NETWORK.ACL.ITEM.CREATE"; public static final String EVENT_NETWORK_ACL_ITEM_UPDATE = "NETWORK.ACL.ITEM.UPDATE"; public static final String EVENT_NETWORK_ACL_ITEM_DELETE = "NETWORK.ACL.ITEM.DELETE"; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/com/cloud/network/vpc/NetworkACLService.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/network/vpc/NetworkACLService.java b/api/src/com/cloud/network/vpc/NetworkACLService.java index dff718d..29ae4ea 100644 --- a/api/src/com/cloud/network/vpc/NetworkACLService.java +++ b/api/src/com/cloud/network/vpc/NetworkACLService.java @@ -130,4 +130,6 @@ public interface NetworkACLService { */ boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException; + NetworkACL updateNetworkACL(Long id, String customId); + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java new file mode 100644 index 0000000..5f89692 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.loadbalancer; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; +import org.apache.log4j.Logger; + +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; + +@APICommand(name = "updateLoadBalancer", description = "Updates a Load Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = "4.4.0") +public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { + public static final Logger s_logger = Logger.getLogger(UpdateApplicationLoadBalancerCmd.class.getName()); + + private static final String s_name = "updateloadbalancerresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer") + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + @Override + public String getCommandName() { + return s_name; + } + + public Long getId() { + return id; + } + + @Override + public long getEntityOwnerId() { + ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId()); + if (lb != null) { + return lb.getAccountId(); + } else { + throw new InvalidParameterValueException("Can't find load balancer by id specified"); + } + } + + @Override + public String getEventType() { + return EventTypes.EVENT_LOAD_BALANCER_UPDATE; + } + + @Override + public String getEventDescription() { + return "updating load balancer: " + getId(); + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override + public void execute() { + CallContext.current().setEventDetails("Load balancer Id: " + getId()); + ApplicationLoadBalancerRule rule = _appLbService.deleteApplicationLoadBalancer(getId(), this.getCustomId()); + ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId())); + setResponseObject(lbResponse); + lbResponse.setResponseName(getCommandName()); + } + + @Override + public void checkUuid() { + if (this.getCustomId() != null) { + _uuidMgr.checkUuid(this.getCustomId(), ApplicationLoadBalancerRule.class); + } + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java index d68167d..f408756 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -34,7 +34,7 @@ import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; @APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class) -public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { +public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd { public static final Logger s_logger = Logger.getLogger(UpdateLoadBalancerRuleCmd.class.getName()); private static final String s_name = "updateloadbalancerruleresponse"; @@ -132,4 +132,11 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { } return lb.getNetworkId(); } + + @Override + public void checkUuid() { + if (this.getCustomId() != null) { + _uuidMgr.checkUuid(this.getCustomId(), LoadBalancer.class); + } + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java new file mode 100644 index 0000000..333090c --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.network; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.NetworkACLResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.vpc.NetworkACL; +import com.cloud.user.Account; + +@APICommand(name = "updateNetworkACLList", description = "Updates Network ACL list", responseObject = SuccessResponse.class, since = "4.4") +public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { + public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLListCmd.class.getName()); + private static final String s_name = "updatenetworkacllistresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") + private Long id; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override + public String getCommandName() { + return s_name; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NETWORK_ACL_UPDATE; + } + + @Override + public String getEventDescription() { + return ("Updating network acl list id=" + id); + } + + @Override + public long getEntityOwnerId() { + Account caller = CallContext.current().getCallingAccount(); + return caller.getAccountId(); + } + + @Override + public void execute() throws ResourceUnavailableException { + NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId()); + NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl); + setResponseObject(aclResponse); + aclResponse.setResponseName(getCommandName()); + } + + @Override + public void checkUuid() { + if (this.getCustomId() != null) { + _uuidMgr.checkUuid(this.getCustomId(), NetworkACL.class); + } + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java index 4908918..02bc2fd 100644 --- a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java +++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java @@ -39,4 +39,6 @@ public interface ApplicationLoadBalancerService { ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId); + ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId); + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/client/tomcatconf/commands.properties.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 27ed6cf..2992eea 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -471,6 +471,7 @@ createNetworkACLList=15 deleteNetworkACLList=15 replaceNetworkACLList=15 listNetworkACLLists=15 +updateNetworkACLList=15 #### Static route commands @@ -653,6 +654,7 @@ removedeleteUcsManager=1 createLoadBalancer=15 listLoadBalancers=15 deleteLoadBalancer=15 +updateLoadBalancer=15 #Internal Load Balancer Element commands configureInternalLoadBalancerElement=7 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java b/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java index 2f813c8..a0b77c7 100644 --- a/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java +++ b/engine/schema/src/com/cloud/network/vpc/NetworkACLVO.java @@ -82,4 +82,7 @@ public class NetworkACLVO implements NetworkACL { return name; } + public void setUuid(String uuid) { + this.uuid = uuid; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index cdd3435..ba54191 100755 --- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -1888,6 +1888,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements String algorithm = cmd.getAlgorithm(); LoadBalancerVO lb = _lbDao.findById(lbRuleId); LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId); + String customId = cmd.getCustomId(); if (lb == null) { throw new InvalidParameterValueException("Unable to find lb rule by id=" + lbRuleId); @@ -1908,6 +1909,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements lb.setAlgorithm(algorithm); } + if (customId != null) { + lb.setUuid(customId); + } + boolean success = _lbDao.update(lbRuleId, lb); // If algorithm is changed, have to reapply the lb config http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java index a9d2b1d..ec43883 100644 --- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java +++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java @@ -33,6 +33,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; +import com.cloud.event.ActionEvent; +import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network; @@ -637,4 +639,20 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID); } + @Override + @ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_UPDATE, eventDescription = "updating network acl", async = true) + public NetworkACL updateNetworkACL(Long id, String customId) { + NetworkACLVO acl = _networkACLDao.findById(id); + Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId()); + Account caller = CallContext.current().getCallingAccount(); + _accountMgr.checkAccess(caller, null, true, vpc); + + if (customId != null) { + acl.setUuid(customId); + } + + _networkACLDao.update(id, acl); + return _networkACLDao.findById(id); + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index ec40411..ad4e760 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -294,6 +294,7 @@ import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRules import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd; import org.apache.cloudstack.api.command.user.loadbalancer.RemoveCertFromLoadBalancerCmd; import org.apache.cloudstack.api.command.user.loadbalancer.RemoveFromLoadBalancerRuleCmd; +import org.apache.cloudstack.api.command.user.loadbalancer.UpdateApplicationLoadBalancerCmd; import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd; import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd; import org.apache.cloudstack.api.command.user.nat.CreateIpForwardingRuleCmd; @@ -314,6 +315,7 @@ import org.apache.cloudstack.api.command.user.network.ListNetworksCmd; import org.apache.cloudstack.api.command.user.network.ReplaceNetworkACLListCmd; import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; import org.apache.cloudstack.api.command.user.network.UpdateNetworkACLItemCmd; +import org.apache.cloudstack.api.command.user.network.UpdateNetworkACLListCmd; import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd; import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd; import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; @@ -2853,6 +2855,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe cmdList.add(GetVMUserDataCmd.class); cmdList.add(UpdateEgressFirewallRuleCmd.class); cmdList.add(UpdateFirewallRuleCmd.class); + cmdList.add(UpdateNetworkACLListCmd.class); + cmdList.add(UpdateApplicationLoadBalancerCmd.class); return cmdList; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9641e1db/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java index 9c93b46..61ad8f9 100644 --- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java +++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java @@ -24,15 +24,14 @@ import java.util.Map; import javax.ejb.Local; import javax.inject.Inject; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO; import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; @@ -525,4 +524,22 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A s_logger.debug("No network rule conflicts detected for " + newLbRule + " against " + (lbRules.size() - 1) + " existing rules"); } } + + @Override + @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_UPDATE, eventDescription = "updating load balancer", async = true) + public ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId) { + Account caller = CallContext.current().getCallingAccount(); + ApplicationLoadBalancerRuleVO rule = _lbDao.findById(id); + + if (rule == null) { + throw new InvalidParameterValueException("Unable to find load balancer " + id); + } + _accountMgr.checkAccess(caller, null, true, rule); + if (customId != null) { + rule.setUuid(customId); + } + _lbDao.update(id, rule); + + return _lbDao.findById(id); + } }