#Cloud Load Balancers Access Rules
This document describes the access rules for cloud load balancers.
Using a US-based account:
service = Fog::Rackspace::LoadBalancers.new({ :rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username :rackspace_api_key => RACKSPACE_API, # Your Rackspace API key :rackspace_region => :ord, # Defaults to :dfw :connection_options => {} # Optional })
Using a UK-based account:
service = Fog::Rackspace::LoadBalancers.new({
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT,
:rackspace_region => :lon,
:connection_options => {} # Optional
})
To learn more about obtaining cloud credentials refer to the Getting Started with Fog and the Rackspace Open Cloud document.
To list access rules for a load balancer lb execute the following:
lb.access_rules
This returns a collection of Fog::Rackspace::LoadBalancers::AccessRule models:
<Fog::Rackspace::LoadBalancers::AccessRules
[
<Fog::Rackspace::LoadBalancers::AccessRule
id=39011,
address="10.10.0.15",
type="ALLOW"
>,
<Fog::Rackspace::LoadBalancers::AccessRule
id=39013,
address="10.10.1.0/24",
type="ALLOW"
>
]>
Cloud Load balancers will allow to you to create ALLOW or DENY rules by IP Address or by CIDR.
To allow 10.10.1.1 you would execute the following:
lb.access_rules.create :address => 10.10.1.1, :type => "ALLOW"
To deny IP range 172.156.1.0 - 172.156.1.255 you would execute the following:
lb.access_rules.create :address => '172.156.1.0/24', :type => "DENY"
Note: ALLOW and DENY must be in all capitals or the service will raise a Fog::Rackspace::LoadBalancers::BadRequest exception.
To delete a specific role you can execute the following:
rule.destroy
To remove all rules from the load balancer execute the following:
service.delete_all_access_rules(lb.id)
Markdown confuses me.
Why, for example, isn't the example for the U.S. wrapped in a nice grey border?
Under "Using a US-based account:" you have a regular old paragraph.
Under "Using a UK-based account:" you have a nice "code block".
I took a stare at the markdown, and it looks the SAME. Arrgh!
EDIT: there IS a difference - the first para isn't indented a full tabstop. Hope this helps!
-pbr.