org.dasein.cloud.services.firewall
Interface FirewallServices


public interface FirewallServices

Operations on whatever concept the underlying cloud uses to regulate network traffic into a server or group of servers.

Author:
George Reese @ enStratus (http://www.enstratus.com)

Method Summary
 void authorize(String firewallId, String cidr, Protocol protocol, int beginPort, int endPort)
          Provides positive authorization for the specified firewall rule.
 String create(String name, String description)
          Creates a new firewall with the specified name.
 void delete(String firewallId)
          Deletes the specified firewall from the system.
 Firewall getFirewall(String firewallId)
          Provides the full firewall data for the specified firewall.
 String getProviderTermForFirewall(Locale locale)
          Provides the firewall terminology for the concept of a firewall.
 Collection<FirewallRule> getRules(String firewallId)
          Provides the affirmative rules supported by the named firewall.
 Collection<Firewall> list()
          Lists all firewalls in the current provider context.
 void revoke(String firewallId, String cidr, Protocol protocol, int beginPort, int endPort)
          Revokes the specified access from the named firewall.
 

Method Detail

authorize

void authorize(String firewallId,
               String cidr,
               Protocol protocol,
               int beginPort,
               int endPort)
               throws CloudException,
                      InternalException
Provides positive authorization for the specified firewall rule. Any call to this method should result in an override of any previous revocations.

Parameters:
firewallId - the unique, cloud-specific ID for the firewall being targeted by the new rule
cidr - the source CIDR (http://en.wikipedia.org/wiki/CIDR) for the allowed traffic
protocol - the protocol (tcp/udp/icmp) supported by this rule
beginPort - the beginning of the port range to be allowed, inclusive
endPort - the end of the port range to be allowed, inclusive
Throws:
CloudException - an error occurred with the cloud provider establishing the rule
InternalException - an error occurred locally trying to establish the rule

create

String create(String name,
              String description)
              throws InternalException,
                     CloudException
Creates a new firewall with the specified name.

Parameters:
name - the user-friendly name for the new firewall
description - a description of the purpose of the firewall
Returns:
the unique ID for the newly created firewall
Throws:
CloudException - an error occurred with the cloud provider while performing the operation
InternalException - an error occurred locally independent of any events in the cloud

delete

void delete(String firewallId)
            throws InternalException,
                   CloudException
Deletes the specified firewall from the system.

Parameters:
firewallId - the unique ID of the firewall to be deleted
Throws:
InternalException - an error occurred locally independent of any events in the cloud
CloudException - an error occurred with the cloud provider while performing the operation

getFirewall

Firewall getFirewall(String firewallId)
                     throws InternalException,
                            CloudException
Provides the full firewall data for the specified firewall.

Parameters:
firewallId - the unique ID of the desired firewall
Returns:
the firewall state for the specified firewall instance
Throws:
InternalException - an error occurred locally independent of any events in the cloud
CloudException - an error occurred with the cloud provider while performing the operation

getProviderTermForFirewall

String getProviderTermForFirewall(Locale locale)
Provides the firewall terminology for the concept of a firewall. For example, AWS calls a firewall a "security group".

Parameters:
locale - the locale for which you should translate the firewall term
Returns:
the translated term for firewall with the target cloud provider

getRules

Collection<FirewallRule> getRules(String firewallId)
                                  throws InternalException,
                                         CloudException
Provides the affirmative rules supported by the named firewall.

Parameters:
firewallId - the unique ID of the firewall being queried
Returns:
all rules supported by the target firewall
Throws:
InternalException - an error occurred locally independent of any events in the cloud
CloudException - an error occurred with the cloud provider while performing the operation

list

Collection<Firewall> list()
                          throws InternalException,
                                 CloudException
Lists all firewalls in the current provider context.

Returns:
a list of all firewalls in the current provider context
Throws:
InternalException - an error occurred locally independent of any events in the cloud
CloudException - an error occurred with the cloud provider while performing the operation

revoke

void revoke(String firewallId,
            String cidr,
            Protocol protocol,
            int beginPort,
            int endPort)
            throws CloudException,
                   InternalException
Revokes the specified access from the named firewall.

Parameters:
firewallId - the firewall from which the rule is being revoked
cidr - the source CIDR (http://en.wikipedia.org/wiki/CIDR) for the rule being removed
protocol - the protocol (tcp/icmp/udp) of the rule being removed
beginPort - the initial port of the rule being removed
endPort - the end port of the rule being removed
Throws:
InternalException - an error occurred locally independent of any events in the cloud
CloudException - an error occurred with the cloud provider while performing the operation