org.dasein.cloud.services.firewall
Class FirewallRule

java.lang.Object
  extended by org.dasein.cloud.services.firewall.FirewallRule
All Implemented Interfaces:
Serializable

public class FirewallRule
extends Object
implements Serializable

Describes a specific firewall rule allowing access through the target firewall.

Author:
George Reese @ enStratus (http://www.enstratus.com)
See Also:
Serialized Form

Constructor Summary
FirewallRule()
          Constructs an empty firewall rule for marshalling purposes.
FirewallRule(String firewallId, String cidr, Protocol protocol, int startPort, int endPort)
          Constructs a firewall rule with the specified rule state.
 
Method Summary
 String getCidr()
          The source IP address or range of addresses in CIDR format.
 Direction getDirection()
           
 int getEndPort()
           
 String getFirewallId()
           
 Permission getPermission()
           
 Protocol getProtocol()
           
 String getProviderRuleId()
           
static String getRuleId(String providerFirewallId, String cidr, Direction direction, Protocol protocol, int startPort, int endPort)
           
 int getStartPort()
           
 void setCidr(String cidr)
          Used only for marshalling and not to be used programatically.
 void setDirection(Direction direction)
           
 void setEndPort(int endPort)
          Used only for marshalling and not to be used programatically.
 void setFirewallId(String firewallId)
          Used only for marshalling and not to be used programatically.
 void setPermission(Permission permission)
           
 void setProtocol(Protocol protocol)
          Used only for marshalling and not to be used programatically.
 void setProviderRuleId(String providerRuleId)
           
 void setStartPort(int startPort)
          Used only for marshalling and not to be used programatically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirewallRule

public FirewallRule()
Constructs an empty firewall rule for marshalling purposes.


FirewallRule

public FirewallRule(String firewallId,
                    String cidr,
                    Protocol protocol,
                    int startPort,
                    int endPort)
Constructs a firewall rule with the specified rule state.

Parameters:
firewallId - the unique ID of the firewall to which this rule belongs
cidr - the CIDR naming the source for this rule
protocol - the protocol supporting this rule
startPort - the start port for the access behind this rule
endPort - the end port for the access behind this rule
Method Detail

getRuleId

public static String getRuleId(String providerFirewallId,
                               String cidr,
                               Direction direction,
                               Protocol protocol,
                               int startPort,
                               int endPort)

getCidr

public String getCidr()
The source IP address or range of addresses in CIDR format. IP addresses matching this CIDR have positive access to any server protected by this firewall to the port range specified over the protocol specified.

Returns:
the source CIDR for this rule

getEndPort

public int getEndPort()
Returns:
the last port in the range of ports allowed by this rule

getFirewallId

public String getFirewallId()
Returns:
the unique provider ID for the firewall behind this rule

getProtocol

public Protocol getProtocol()
Returns:
the network protocol to allow through to the target ports

getStartPort

public int getStartPort()
Returns:
the first port in the range of ports allowed by this rule

setCidr

public void setCidr(String cidr)
Used only for marshalling and not to be used programatically.

Parameters:
cidr - the source CIDR for the rule being marshalled

setEndPort

public void setEndPort(int endPort)
Used only for marshalling and not to be used programatically.

Parameters:
endPort - the end port for the rule being marshalled

setFirewallId

public void setFirewallId(String firewallId)
Used only for marshalling and not to be used programatically.

Parameters:
firewallId - the unique provider ID for the firewall for the rule being marshalled

setProtocol

public void setProtocol(Protocol protocol)
Used only for marshalling and not to be used programatically.

Parameters:
protocol - the protocol for the rule being marshalled

setStartPort

public void setStartPort(int startPort)
Used only for marshalling and not to be used programatically.

Parameters:
startPort - the start port for the rule being marshalled

setDirection

public void setDirection(Direction direction)

getDirection

public Direction getDirection()

setPermission

public void setPermission(Permission permission)

getPermission

public Permission getPermission()

setProviderRuleId

public void setProviderRuleId(String providerRuleId)

getProviderRuleId

public String getProviderRuleId()