@Override public void execute() throws ResourceUnavailableException { if (getNetworkId() == null && getPrivateGatewayId() == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network ID and private gateway can't be null at the same time"); } if (getNetworkId() != null && getPrivateGatewayId() != null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network ID and private gateway can't be passed at the same time"); } CallContext.current().setEventDetails("Network ACL ID: " + aclId); boolean result = false; if (getPrivateGatewayId() != null) { result = _networkACLService.replaceNetworkACLonPrivateGw(aclId, privateGatewayId); } else { result = _networkACLService.replaceNetworkACL(aclId, networkId); } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to replace network ACL"); } } }
@Override public void execute() throws ResourceUnavailableException { validateAPICall(); CallContext.current().setEventDetails("Network ACL ID: " + aclId); boolean result = false; if (getPrivateGatewayId() != null) { result = _networkACLService.replaceNetworkACLonPrivateGw(aclId, privateGatewayId); } else if (getNetworkId() != null) { result = _networkACLService.replaceNetworkACL(aclId, networkId); } else if (getPublicIpId() != null) { result = _networkACLService.replacePublicIpACL(aclId, publicIpId); } if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to replace network ACL"); } }