weizhouapache commented on code in PR #9470: URL: https://github.com/apache/cloudstack/pull/9470#discussion_r1701951047
########## api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/CreateRoutingFirewallRuleCmd.java: ########## @@ -0,0 +1,270 @@ +// 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.routing; + +import java.util.ArrayList; +import java.util.List; + +import com.cloud.exception.NetworkRuleConflictException; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.FirewallResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang3.StringUtils; + +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.network.rules.FirewallRule; +import com.cloud.user.Account; +import com.cloud.utils.net.NetUtils; + +@APICommand(name = "createRoutingFirewallRule", Review Comment: @shwstppr actually at the beginning, I created an API to support both IPv4 routing firewall rules and Ipv6 firewall rules. But at the end, I decided to create 2 separated APIs due to - the description of the APIs are different (ipv4, and ipv6) - some checks on the parameters are different (also ipv4 vs ipv6) - the backend process are different (ipv4 processed by routedIpv4Manager, ipv6 processed by ipv6Service) - the existing APIs for ipv6 firewall rules contain `Ipv6FirewallRule` in their API names, we have to create new APIs (with different API name) for Ipv4 firewall rules anyway. these 2 APIs ar edifferent from the traditional API `createFirewallRule` - the firewall rules are associated to a public ip, while ipv4/ipv6 routing firewall rules are associated to a network - the firewall rules support only ingress rules, but ipv4/ipv6 routing firewall rules support both ingress and egress rules. - the firewall rules do not support destination cidrs, but ipv4/ipv6 routing firewall rules support. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
