mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
79 lines
3.3 KiB
Java
79 lines
3.3 KiB
Java
/**
|
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
*
|
|
* This software is licensed under the GNU General Public License v3 or later.
|
|
*
|
|
* It is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
package com.cloud.network.rules;
|
|
|
|
import java.util.List;
|
|
|
|
import com.cloud.exception.NetworkRuleConflictException;
|
|
import com.cloud.exception.ResourceUnavailableException;
|
|
import com.cloud.network.IpAddress;
|
|
import com.cloud.user.Account;
|
|
import com.cloud.uservm.UserVm;
|
|
|
|
|
|
/**
|
|
* Rules Manager manages the network rules created for different networks.
|
|
*/
|
|
public interface RulesManager extends RulesService {
|
|
|
|
boolean applyPortForwardingRules(long ipAddressId, boolean continueOnError, Account caller);
|
|
|
|
boolean applyStaticNatRules(long sourceIpId, boolean continueOnError, Account caller);
|
|
|
|
boolean applyPortForwardingRulesForNetwork(long networkId, boolean continueOnError, Account caller);
|
|
|
|
boolean applyStaticNatRulesForNetwork(long networkId, boolean continueOnError, Account caller);
|
|
|
|
void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller);
|
|
void checkRuleAndUserVm(FirewallRule rule, UserVm userVm, Account caller);
|
|
|
|
boolean revokeAllPFAndStaticNatRulesForIp(long ipId, long userId, Account caller) throws ResourceUnavailableException;
|
|
|
|
boolean revokeAllPFStaticNatRulesForNetwork(long networkId, long userId, Account caller) throws ResourceUnavailableException;
|
|
|
|
List<? extends FirewallRule> listFirewallRulesByIp(long ipAddressId);
|
|
|
|
/**
|
|
* Returns a list of port forwarding rules that are ready for application
|
|
* to the network elements for this ip.
|
|
* @param ip
|
|
* @return List of PortForwardingRule
|
|
*/
|
|
List<? extends PortForwardingRule> listPortForwardingRulesForApplication(long ipId);
|
|
|
|
List<? extends PortForwardingRule> gatherPortForwardingRulesForApplication(List<? extends IpAddress> addrs);
|
|
|
|
boolean revokePortForwardingRulesForVm(long vmId);
|
|
|
|
boolean revokeStaticNatRulesForVm(long vmId);
|
|
|
|
FirewallRule[] reservePorts(IpAddress ip, String protocol, FirewallRule.Purpose purpose, boolean openFirewall, Account caller, int... ports) throws NetworkRuleConflictException;
|
|
boolean releasePorts(long ipId, String protocol, FirewallRule.Purpose purpose, int... ports);
|
|
|
|
List<PortForwardingRuleVO> listByNetworkId(long networkId);
|
|
|
|
boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke);
|
|
|
|
boolean applyStaticNatsForNetwork(long networkId, boolean continueOnError, Account caller);
|
|
|
|
boolean enableElasticIpAndStaticNatForVm(UserVm vm, boolean stopOnError);
|
|
|
|
boolean disableStaticNat(long ipAddressId, Account caller, long callerUserId) throws ResourceUnavailableException;
|
|
|
|
}
|