fog-maestrodev 1.18.0.20131209091424 → 1.18.0.20131218202447
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +22 -0
- data/LICENSE.md +20 -0
- data/README.md +29 -42
- data/fog.gemspec +3 -3
- data/lib/fog/aws/compute.rb +1 -0
- data/lib/fog/aws/models/compute/subnet.rb +4 -0
- data/lib/fog/aws/models/compute/vpc.rb +5 -0
- data/lib/fog/aws/models/rds/server.rb +2 -0
- data/lib/fog/aws/models/storage/file.rb +2 -2
- data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +25 -0
- data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +60 -0
- data/lib/fog/aws/requests/compute/describe_subnets.rb +8 -0
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +8 -0
- data/lib/fog/cloudstack.rb +1 -1
- data/lib/fog/core/connection.rb +1 -2
- data/lib/fog/core/hmac.rb +3 -3
- data/lib/fog/core/mock.rb +2 -2
- data/lib/fog/core/wait_for.rb +1 -1
- data/lib/fog/core/{timeout.rb → wait_for_defaults.rb} +10 -0
- data/lib/fog/core.rb +1 -1
- data/lib/fog/google/compute.rb +19 -11
- data/lib/fog/google/examples/create.rb +12 -1
- data/lib/fog/google/examples/eric-fail.rb +13 -2
- data/lib/fog/google/examples/image_create.rb +0 -1
- data/lib/fog/google/examples/launch_micro_instance.rb +1 -2
- data/lib/fog/google/examples/metadata.rb +14 -2
- data/lib/fog/google/examples/network.rb +13 -2
- data/lib/fog/google/models/compute/disk.rb +10 -8
- data/lib/fog/google/models/compute/image.rb +8 -3
- data/lib/fog/google/models/compute/server.rb +19 -4
- data/lib/fog/google/models/compute/servers.rb +25 -9
- data/lib/fog/google/requests/compute/insert_disk.rb +6 -3
- data/lib/fog/google/requests/compute/insert_image.rb +1 -5
- data/lib/fog/google/requests/compute/insert_server.rb +8 -21
- data/lib/fog/openstack/compute.rb +3 -0
- data/lib/fog/openstack/models/compute/host.rb +1 -0
- data/lib/fog/openstack/models/compute/security_group.rb +18 -4
- data/lib/fog/openstack/models/compute/security_group_rule.rb +32 -0
- data/lib/fog/openstack/models/compute/security_group_rules.rb +22 -0
- data/lib/fog/openstack/network.rb +33 -3
- data/lib/fog/openstack/requests/compute/create_security_group.rb +3 -3
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +12 -5
- data/lib/fog/openstack/requests/compute/delete_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +2 -0
- data/lib/fog/openstack/requests/compute/get_security_group.rb +14 -24
- data/lib/fog/openstack/requests/compute/get_security_group_rule.rb +38 -0
- data/lib/fog/openstack/requests/compute/list_hosts.rb +3 -3
- data/lib/fog/openstack/volume.rb +3 -1
- data/lib/fog/rackspace/docs/auto_scale.md +9 -9
- data/lib/fog/rackspace/docs/getting_started.md +1 -0
- data/lib/fog/rackspace/docs/queues.md +312 -0
- data/lib/fog/vcloud_director/README.md +2 -0
- data/lib/fog/vcloud_director/compute.rb +78 -8
- data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +91 -0
- data/lib/fog/vcloud_director/generators/compute/vapp.rb +30 -0
- data/lib/fog/vcloud_director/models/compute/vm_customization.rb +2 -0
- data/lib/fog/vcloud_director/parsers/compute/vm_customization.rb +2 -0
- data/lib/fog/vcloud_director/requests/compute/delete_network.rb +64 -0
- data/lib/fog/vcloud_director/requests/compute/get_execute_query.rb +433 -333
- data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +3 -1
- data/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb +83 -0
- data/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb +1 -0
- data/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb +37 -0
- data/lib/fog/vsphere/models/compute/server.rb +1 -1
- data/lib/fog/xenserver/compute.rb +35 -0
- data/lib/fog/xenserver/models/compute/blob.rb +22 -0
- data/lib/fog/xenserver/models/compute/blobs.rb +25 -0
- data/lib/fog/xenserver/models/compute/bond.rb +23 -0
- data/lib/fog/xenserver/models/compute/bonds.rb +25 -0
- data/lib/fog/xenserver/models/compute/console.rb +3 -1
- data/lib/fog/xenserver/models/compute/crash_dump.rb +19 -0
- data/lib/fog/xenserver/models/compute/crash_dumps.rb +25 -0
- data/lib/fog/xenserver/models/compute/dr_task.rb +17 -0
- data/lib/fog/xenserver/models/compute/dr_tasks.rb +25 -0
- data/lib/fog/xenserver/models/compute/gpu_group.rb +22 -0
- data/lib/fog/xenserver/models/compute/gpu_groups.rb +25 -0
- data/lib/fog/xenserver/models/compute/guest_metrics.rb +2 -1
- data/lib/fog/xenserver/models/compute/host.rb +41 -8
- data/lib/fog/xenserver/models/compute/host_cpu.rb +2 -1
- data/lib/fog/xenserver/models/compute/host_crash_dump.rb +20 -0
- data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +25 -0
- data/lib/fog/xenserver/models/compute/host_metrics.rb +1 -1
- data/lib/fog/xenserver/models/compute/host_patch.rb +25 -0
- data/lib/fog/xenserver/models/compute/host_patchs.rb +25 -0
- data/lib/fog/xenserver/models/compute/network.rb +7 -6
- data/lib/fog/xenserver/models/compute/pbd.rb +3 -1
- data/lib/fog/xenserver/models/compute/pci.rb +22 -0
- data/lib/fog/xenserver/models/compute/pcis.rb +25 -0
- data/lib/fog/xenserver/models/compute/pgpu.rb +20 -0
- data/lib/fog/xenserver/models/compute/pgpus.rb +25 -0
- data/lib/fog/xenserver/models/compute/pif.rb +19 -8
- data/lib/fog/xenserver/models/compute/pif_metrics.rb +28 -0
- data/lib/fog/xenserver/models/compute/pifs_metrics.rb +25 -0
- data/lib/fog/xenserver/models/compute/pool.rb +18 -1
- data/lib/fog/xenserver/models/compute/pool_patch.rb +24 -0
- data/lib/fog/xenserver/models/compute/pool_patchs.rb +25 -0
- data/lib/fog/xenserver/models/compute/role.rb +19 -0
- data/lib/fog/xenserver/models/compute/roles.rb +25 -0
- data/lib/fog/xenserver/models/compute/server.rb +59 -26
- data/lib/fog/xenserver/models/compute/server_appliance.rb +21 -0
- data/lib/fog/xenserver/models/compute/server_appliances.rb +25 -0
- data/lib/fog/xenserver/models/compute/storage_manager.rb +28 -0
- data/lib/fog/xenserver/models/compute/storage_managers.rb +25 -0
- data/lib/fog/xenserver/models/compute/storage_repository.rb +4 -1
- data/lib/fog/xenserver/models/compute/tunnel.rb +20 -0
- data/lib/fog/xenserver/models/compute/tunnels.rb +25 -0
- data/lib/fog/xenserver/models/compute/vbd.rb +3 -2
- data/lib/fog/xenserver/models/compute/vbd_metrics.rb +1 -1
- data/lib/fog/xenserver/models/compute/vdi.rb +4 -1
- data/lib/fog/xenserver/models/compute/vif.rb +11 -2
- data/lib/fog/xenserver/models/compute/vlan.rb +2 -1
- data/lib/fog/xenserver/models/compute/vmpp.rb +35 -0
- data/lib/fog/xenserver/models/compute/vmpps.rb +25 -0
- data/lib/fog/xenserver/models/compute/vtpm.rb +18 -0
- data/lib/fog/xenserver/models/compute/vtpms.rb +25 -0
- data/tests/aws/requests/compute/assign_private_ip_tests.rb +52 -0
- data/tests/google/models/compute/servers_tests.rb +12 -1
- data/tests/google/requests/compute/image_tests.rb +0 -1
- data/tests/helpers/mock_helper.rb +1 -1
- data/tests/openstack/models/compute/security_group_tests.rb +54 -0
- data/tests/openstack/requests/compute/security_group_tests.rb +22 -20
- data/tests/openstack/requests/network/network_tests.rb +8 -8
- data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +17 -8
- data/tests/vcloud_director/requests/compute/network_tests.rb +25 -1
- data/tests/vcloud_director/requests/compute/query_tests.rb +67 -2
- metadata +125 -132
- checksums.yaml +0 -15
@@ -0,0 +1,38 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class OpenStack
|
4
|
+
class Real
|
5
|
+
def get_security_group_rule(security_group_rule_id)
|
6
|
+
request(
|
7
|
+
:expects => [200],
|
8
|
+
:method => 'GET',
|
9
|
+
:path => "os-security-group-rules/#{security_group_rule_id}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_security_group_rule(security_group_rule_id)
|
16
|
+
security_group_rule = nil
|
17
|
+
self.data[:security_groups].detect{|id, sg| security_group_rule = sg["rules"].detect{ |sgr| sgr["id"].to_s == security_group_rule_id.to_s }}
|
18
|
+
response = Excon::Response.new
|
19
|
+
if security_group_rule
|
20
|
+
response.status = 200
|
21
|
+
response.headers = {
|
22
|
+
"X-Compute-Request-Id" => "req-63a90344-7c4d-42e2-936c-fd748bced1b3",
|
23
|
+
"Content-Type" => "application/json",
|
24
|
+
"Content-Length" => "167",
|
25
|
+
"Date" => Date.new
|
26
|
+
}
|
27
|
+
response.body = {
|
28
|
+
"security_group_rule" => security_group_rule
|
29
|
+
}
|
30
|
+
else
|
31
|
+
raise Fog::Compute::OpenStack::NotFound, "Security group rule #{security_group_rule_id} does not exist"
|
32
|
+
end
|
33
|
+
response
|
34
|
+
end
|
35
|
+
end # mock
|
36
|
+
end # openstack
|
37
|
+
end #compute
|
38
|
+
end #fog
|
@@ -14,12 +14,12 @@ module Fog
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class Mock
|
17
|
-
|
17
|
+
|
18
18
|
def list_hosts
|
19
19
|
response = Excon::Response.new
|
20
20
|
response.status = 200
|
21
21
|
response.body = { "hosts" => [
|
22
|
-
{"host_name" => "host.test.net", "service"=>"compute"}
|
22
|
+
{"host_name" => "host.test.net", "service"=>"compute", "zone" => "az1"}
|
23
23
|
]
|
24
24
|
}
|
25
25
|
response
|
@@ -29,4 +29,4 @@ module Fog
|
|
29
29
|
end # mock
|
30
30
|
end # openstack
|
31
31
|
end # compute
|
32
|
-
end # fog
|
32
|
+
end # fog
|
data/lib/fog/openstack/volume.rb
CHANGED
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
:openstack_service_type, :openstack_service_name, :openstack_tenant,
|
10
10
|
:openstack_api_key, :openstack_username,
|
11
11
|
:current_user, :current_tenant,
|
12
|
-
:openstack_endpoint_type
|
12
|
+
:openstack_endpoint_type, :openstack_region
|
13
13
|
|
14
14
|
model_path 'fog/openstack/models/volume'
|
15
15
|
|
@@ -125,6 +125,7 @@ module Fog
|
|
125
125
|
@openstack_must_reauthenticate = false
|
126
126
|
@openstack_service_type = options[:openstack_service_type] || ['volume']
|
127
127
|
@openstack_service_name = options[:openstack_service_name]
|
128
|
+
@openstack_region = options[:openstack_region]
|
128
129
|
|
129
130
|
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
|
130
131
|
@connection_options = options[:connection_options] || {}
|
@@ -188,6 +189,7 @@ module Fog
|
|
188
189
|
def authenticate
|
189
190
|
if !@openstack_management_url || @openstack_must_reauthenticate
|
190
191
|
options = {
|
192
|
+
:openstack_region => @openstack_region,
|
191
193
|
:openstack_tenant => @openstack_tenant,
|
192
194
|
:openstack_api_key => @openstack_api_key,
|
193
195
|
:openstack_username => @openstack_username,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#Auto Scale (AutoScale)
|
2
2
|
|
3
|
-
This document explains how to get started using
|
3
|
+
This document explains how to get started using Auto Scale with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
4
4
|
|
5
5
|
## Basic Concepts
|
6
6
|
|
@@ -15,7 +15,7 @@ Auto Scale functions by linking three services:
|
|
15
15
|
|
16
16
|
## Workflow
|
17
17
|
|
18
|
-
A scaling group is monitored by Rackspace Cloud Monitoring. When Monitoring triggers an alarm for high utilization within the Autoscaling group, a webhook is triggered. The webhook calls the
|
18
|
+
A scaling group is monitored by Rackspace Cloud Monitoring. When Monitoring triggers an alarm for high utilization within the Autoscaling group, a webhook is triggered. The webhook calls the Auto Scale service, which consults a policy in accordance with the webhook. The policy determines how many additional Cloud Servers should be added or removed in accordance with the alarm.
|
19
19
|
|
20
20
|
Alarms may trigger scaling up or scaling down. Scale-down events always remove the oldest server in the group.
|
21
21
|
|
@@ -43,7 +43,7 @@ If using Ruby 1.9.x execute:
|
|
43
43
|
|
44
44
|
## Create Service
|
45
45
|
|
46
|
-
Next, create a connection to
|
46
|
+
Next, create a connection to Auto Scale:
|
47
47
|
|
48
48
|
Using a US-based account:
|
49
49
|
|
@@ -68,7 +68,7 @@ To learn more about obtaining cloud credentials refer to the [Getting Started wi
|
|
68
68
|
|
69
69
|
By default `Fog::Rackspace::AutoScale` will authenticate against the US authentication endpoint. You can specify alternative authentication endpoints using the key `:rackspace_auth_url`. Please refer to [Alternate Authentication Endpoints](http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html) for a list of alternative Rackspace authentication endpoints.
|
70
70
|
|
71
|
-
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for
|
71
|
+
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for Auto Scale can be found by executing the following:
|
72
72
|
|
73
73
|
identity_service = Fog::Identity({
|
74
74
|
:provider => 'Rackspace', # Rackspace Fog provider
|
@@ -142,7 +142,7 @@ This returns:
|
|
142
142
|
|
143
143
|
#### Example Request
|
144
144
|
|
145
|
-
To request a list of
|
145
|
+
To request a list of Auto Scale groups:
|
146
146
|
|
147
147
|
response = service.list_groups
|
148
148
|
|
@@ -165,7 +165,7 @@ returns:
|
|
165
165
|
{"groups_links"=>[], "groups"=>[{"paused"=>false, "desiredCapacity"=>0, "links"=>[{"href"=>"https://ord.autoscale.api.rackspacecloud.com/v1.0/555/groups/b45e6107-26ca-4a93-869d-46bf20005df3/", "rel"=>"self"}], "active"=>[], "pendingCapacity"=>0, "activeCapacity"=>0, "id"=>"b45e6107-26ca-4a93-869d-46bf20005df3", "name"=>"fog-scailing-group"}]}
|
166
166
|
|
167
167
|
|
168
|
-
To learn more about
|
168
|
+
To learn more about Auto Scale request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Rackspace/AutoScale/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
|
169
169
|
|
170
170
|
### Model Layer
|
171
171
|
|
@@ -369,7 +369,7 @@ Available options on `group_config` include `:max_entities`, `:name`, `:cooldow
|
|
369
369
|
group_config.max_entities = 16
|
370
370
|
group_config.save
|
371
371
|
|
372
|
-
**Note**: If you pass any metadata values in this call, it must be the full set of metadata for the
|
372
|
+
**Note**: If you pass any metadata values in this call, it must be the full set of metadata for the scaling group, since the underlying API call **overwrites** any existing metadata.
|
373
373
|
|
374
374
|
### Deleting a Scaling Group
|
375
375
|
|
@@ -400,7 +400,7 @@ To retrieve the launch config:
|
|
400
400
|
|
401
401
|
launch_config = group.launch_config
|
402
402
|
|
403
|
-
The launch configuration contains two attributes `:type` and `:args`. The only launch type currently available for
|
403
|
+
The launch configuration contains two attributes `:type` and `:args`. The only launch type currently available for Auto Scale is `:launch_server`. The `args` attribute contains a hash with the launch server configuration options as follows:
|
404
404
|
|
405
405
|
{"server"=>{
|
406
406
|
"name"=>"autoscale_server",
|
@@ -436,7 +436,7 @@ To add a policy to a scaling group use the following:
|
|
436
436
|
Parameter | Required | Default | Notes
|
437
437
|
---- | ---- | ---- | ----
|
438
438
|
**:name** | yes | |
|
439
|
-
**:type** | yes | | This can be "webhook", "schedule" or "
|
439
|
+
**:type** | yes | | This can be "webhook", "schedule" or "cloud monitoring"
|
440
440
|
**:cooldown** | yes | | Period in seconds after a policy execution in which further events are ignored. This is separate from the overall cooldown for the scaling group.
|
441
441
|
**:change** | no | | Can be positive or negative, which makes this a scale-up or scale-down policy, respectively. If this value is specified you can not specify `:change_percent`.
|
442
442
|
**:change_percent** | no | | The percentage change to the autoscale group's number of units. If this value is specified you can not specify `:change`.
|
@@ -71,6 +71,7 @@ These services can be explored in further depth in the following documents:
|
|
71
71
|
* [Cloud Files™ (storage)](storage.md)
|
72
72
|
* [Cloud Block Storage (block_storage)](block_storage.md)
|
73
73
|
* [Auto Scale (auto_scale)](auto_scale.md)
|
74
|
+
* [Queues](queues.md)
|
74
75
|
|
75
76
|
**Note**: The compute service provides an interface to the First Geneneration Cloud Servers™ (compute). This service is deprecated. Users are encouraged to use Next Geneneration Cloud Servers™ (compute_v2).
|
76
77
|
|
@@ -0,0 +1,312 @@
|
|
1
|
+
#Cloud Queues (queues)
|
2
|
+
|
3
|
+
This document explains how to get started using queues with Fog. It assumes you have read the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
4
|
+
|
5
|
+
## Basic Concepts
|
6
|
+
|
7
|
+
Cloud Queues is an open source, scalable, and highly available message and notifications service, based on the OpenStack Marconi project. Users of this service can create and manage a producer-consumer or a publisher-subscriber model. Unlimited queues and messages give users the flexibility they need to create powerful web applications in the cloud.
|
8
|
+
|
9
|
+
It consists of a few basic components: queues, messages, claims, and statistics. In the producer-consumer model, users create queues in which producers, or servers, can post messages. Workers, or consumers, can then claim those messages and delete them after they complete the actions associated with the messages. A single claim can contain multiple messages, and administrators can query claims for status.
|
10
|
+
|
11
|
+
In the publisher-subscriber model, messages are posted to a queue as in the producer-consumer model, but messages are never claimed. Instead, subscribers, or watchers, send GET requests to pull all messages that have been posted since their last request. In this model, a message remains in the queue, unclaimed, until the message's time to live (TTL) has expired.
|
12
|
+
|
13
|
+
In both of these models, administrators can get queue statistics that display the most recent and oldest messages, the number of unclaimed messages, and more.
|
14
|
+
|
15
|
+
## Starting irb console
|
16
|
+
|
17
|
+
Start by executing the following command:
|
18
|
+
|
19
|
+
irb
|
20
|
+
|
21
|
+
Once `irb` has launched you need to require the Fog library as follows:
|
22
|
+
|
23
|
+
require 'fog'
|
24
|
+
|
25
|
+
## Create Service
|
26
|
+
|
27
|
+
Next, create a connection to queue service:
|
28
|
+
|
29
|
+
Using a US-based account:
|
30
|
+
|
31
|
+
service = Fog::Rackspace::Queues(
|
32
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
33
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
34
|
+
:rackspace_region => :ord, # Your desired region
|
35
|
+
:rackspace_queues_client_id => CLIENT_ID, # Your client ID
|
36
|
+
:connection_options => {} # Optional connection options
|
37
|
+
)
|
38
|
+
|
39
|
+
Using a UK-based account:
|
40
|
+
|
41
|
+
service = Fog::Rackspace::Queues(
|
42
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
43
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
44
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT,
|
45
|
+
:rackspace_region => :lon, # Your desired region
|
46
|
+
:rackspace_queues_client_id => CLIENT_ID', # Your client ID
|
47
|
+
:connection_options => {} # Optional connection options
|
48
|
+
)
|
49
|
+
|
50
|
+
To learn more about obtaining cloud credentials refer to the [Getting Started with Fog and the Rackspace Open Cloud](getting_started.md) document.
|
51
|
+
|
52
|
+
### Authentication Endpoint
|
53
|
+
|
54
|
+
By default `Fog::Rackspace::Queues` will authenticate against the US authentication endpoint. You can specify alternative authentication endpoints using the key `:rackspace_auth_url`. Please refer to [Alternate Authentication Endpoints](http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html) for a list of alternative Rackspace authentication endpoints.
|
55
|
+
|
56
|
+
### Regions
|
57
|
+
|
58
|
+
Alternative regions are specified using the key `:rackspace_region `. A list of regions available for cloud queues can be found by executing the following:
|
59
|
+
|
60
|
+
identity_service = Fog::Identity({
|
61
|
+
:provider => 'Rackspace', # Rackspace Fog provider
|
62
|
+
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
|
63
|
+
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
|
64
|
+
:rackspace_auth_url => Fog::Rackspace::UK_AUTH_ENDPOINT # Not specified for US Cloud
|
65
|
+
})
|
66
|
+
|
67
|
+
identity_service.service_catalog.display_service_regions :queues
|
68
|
+
|
69
|
+
### Private Cloud
|
70
|
+
|
71
|
+
Rackspace Private Cloud installations can skip specifying a region and directly specify their custom service endpoints using the key `:rackspace_queues_url`.
|
72
|
+
|
73
|
+
**Note**: A`Fog::Rackspace::Queues` instance is needed for the desired region.
|
74
|
+
|
75
|
+
### Client ID
|
76
|
+
|
77
|
+
The Rackspace Queue service requires that every client define a client id to help identify messages and claims specific to the client. This client id should take the form of a UUID and can be generated using fog as follows:
|
78
|
+
|
79
|
+
Fog::UUID.uuid
|
80
|
+
|
81
|
+
If the client id is omitted fog will generate one for you.
|
82
|
+
|
83
|
+
### Optional Connection Parameters
|
84
|
+
|
85
|
+
Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
|
86
|
+
|
87
|
+
<table>
|
88
|
+
<tr>
|
89
|
+
<th>Key</th>
|
90
|
+
<th>Description</th>
|
91
|
+
</tr>
|
92
|
+
<tr>
|
93
|
+
<td>:connect_timeout</td>
|
94
|
+
<td>Connection timeout (default: 60 seconds)</td>
|
95
|
+
</tr>
|
96
|
+
<tr>
|
97
|
+
<td>:read_timeout</td>
|
98
|
+
<td>Read timeout for connection (default: 60 seconds)</td> </tr>
|
99
|
+
<tr>
|
100
|
+
<td>:write_timeout</td>
|
101
|
+
<td>Write timeout for connection (default: 60 seconds)</td>
|
102
|
+
</tr>
|
103
|
+
<tr>
|
104
|
+
<td>:proxy</td>
|
105
|
+
<td>Proxy for HTTP and HTTPS connections</td>
|
106
|
+
</tr>
|
107
|
+
<tr>
|
108
|
+
<td>:ssl_ca_path</td>
|
109
|
+
<td>Path to SSL certificate authorities</td>
|
110
|
+
</tr>
|
111
|
+
<tr>
|
112
|
+
<td>:ssl_ca_file</td>
|
113
|
+
<td>SSL certificate authority file</td>
|
114
|
+
</tr>
|
115
|
+
<tr>
|
116
|
+
<td>:ssl_verify_peer</td>
|
117
|
+
<td>SSL verify peer (default: true)</td>
|
118
|
+
</tr>
|
119
|
+
</table>
|
120
|
+
|
121
|
+
|
122
|
+
## Fog Abstractions
|
123
|
+
|
124
|
+
Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel`-like interface.
|
125
|
+
|
126
|
+
### Request Layer
|
127
|
+
|
128
|
+
The request abstraction maps directly to the [Queue API](http://docs.rackspace.com/queues/api/v1.0/cq-devguide/content/overview.html). It provides the most efficient interface to the Rackspace Open Cloud.
|
129
|
+
|
130
|
+
To see a list of requests supported by the service:
|
131
|
+
|
132
|
+
service.requests
|
133
|
+
|
134
|
+
This returns:
|
135
|
+
|
136
|
+
:list_queues, :get_queue, :create_queue, :delete_queue, :get_queue_stats, :list_messages, :get_message, :create_message, :delete_message, :create_claim, :get_claim, :update_claim, :delete_claim
|
137
|
+
|
138
|
+
|
139
|
+
#### Example Request
|
140
|
+
|
141
|
+
To request a list of queues:
|
142
|
+
|
143
|
+
response = service.list_queues
|
144
|
+
|
145
|
+
This returns in the following `Excon::Response`:
|
146
|
+
|
147
|
+
#<Excon::Response:0x007feddda06e00 @data={:body=>{"queues"=>[{"href"=>"/v1/queues/demo-queue", "name"=>"demo-queue"}], "links"=>[{"href"=>"/v1/queues?marker=demo-queue", "rel"=>"next"}]}, :headers=>{"Content-Length"=>"119", "Content-Type"=>"application/json; charset=utf-8", "Content-Location"=>"/v1/queues", "X-Project-ID"=>"5551212"}, :status=>200, :remote_ip=>"10.10.0.1"}, @body="{\"queues\": [{\"href\": \"/v1/queues/demo-queue\", \"name\": \"demo-queue\"}], \"links\": [{\"href\": \"/v1/queues?marker=demo-queue\", \"rel\": \"next\"}]}", @headers={"Content-Length"=>"119", "Content-Type"=>"application/json; charset=utf-8", "Content-Location"=>"/v1/queues", "X-Project-ID"=>"5551212"}, @status=200, @remote_ip="10.10.0.1">
|
148
|
+
|
149
|
+
To view the status of the response:
|
150
|
+
|
151
|
+
response.status
|
152
|
+
|
153
|
+
**Note**: Fog is aware of valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.
|
154
|
+
|
155
|
+
To view response body:
|
156
|
+
|
157
|
+
response.body
|
158
|
+
|
159
|
+
This returns:
|
160
|
+
|
161
|
+
{"queues"=>[{"href"=>"/v1/queues/demo-queue", "name"=>"demo-queue"}], "links"=>[{"href"=>"/v1/queues?marker=demo-queue", "rel"=>"next"}]}
|
162
|
+
|
163
|
+
|
164
|
+
To learn more about queue request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Rackspace/Queues/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
|
165
|
+
|
166
|
+
### Model Layer
|
167
|
+
|
168
|
+
Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors.
|
169
|
+
|
170
|
+
Here is a summary of common model methods:
|
171
|
+
|
172
|
+
<table>
|
173
|
+
<tr>
|
174
|
+
<th>Method</th>
|
175
|
+
<th>Description</th>
|
176
|
+
</tr>
|
177
|
+
<tr>
|
178
|
+
<td>create</td>
|
179
|
+
<td>
|
180
|
+
Accepts hash of attributes and creates object.<br>
|
181
|
+
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
|
182
|
+
</td>
|
183
|
+
</tr>
|
184
|
+
<tr>
|
185
|
+
<td>save</td>
|
186
|
+
<td>Saves object.<br>
|
187
|
+
Note: not all objects support updating object.</td>
|
188
|
+
</tr>
|
189
|
+
<tr>
|
190
|
+
<td>persisted?</td>
|
191
|
+
<td>Returns true if the object has been persisted.</td>
|
192
|
+
</tr>
|
193
|
+
<tr>
|
194
|
+
<td>destroy</td>
|
195
|
+
<td>
|
196
|
+
Destroys object.<br>
|
197
|
+
Note: this is a non-blocking call and object deletion might not be instantaneous.
|
198
|
+
</td>
|
199
|
+
<tr>
|
200
|
+
<td>reload</td>
|
201
|
+
<td>Updates object with latest state from service.</td>
|
202
|
+
<tr>
|
203
|
+
<td>ready?</td>
|
204
|
+
<td>Returns true if object is in a ready state and able to perform actions. This method will raise an exception if object is in an error state.</td>
|
205
|
+
</tr>
|
206
|
+
<tr>
|
207
|
+
<td>attributes</td>
|
208
|
+
<td>Returns a hash containing the list of model attributes and values.</td>
|
209
|
+
</tr>
|
210
|
+
<td>identity</td>
|
211
|
+
<td>
|
212
|
+
Returns the identity of the object.<br>
|
213
|
+
Note: This might not always be equal to object.id.
|
214
|
+
</td>
|
215
|
+
</tr>
|
216
|
+
<tr>
|
217
|
+
<td>wait_for</td>
|
218
|
+
<td>This method periodically reloads model and then yields to specified block until block returns true or a timeout occurs.</td>
|
219
|
+
</tr>
|
220
|
+
</table>
|
221
|
+
|
222
|
+
The remainder of this document details the model abstraction.
|
223
|
+
|
224
|
+
## Create Queue
|
225
|
+
|
226
|
+
Queues require a unique name. If you try to create a queue with a name that already exists, fog will throw a `Fog::Rackspace::Queues::ServiceError` exception with a 204 status code.
|
227
|
+
|
228
|
+
To create a queue named demo-queue
|
229
|
+
|
230
|
+
begin
|
231
|
+
queue = service.queues.create :name => 'demo-queue'
|
232
|
+
rescue Fog::Rackspace::Queues::ServiceError => e
|
233
|
+
if e.status_code == 204
|
234
|
+
# duplicate queue exists
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
## Posting a Message to a Queue
|
239
|
+
|
240
|
+
Messages can be any type of data, as long as they do not exceed 256 KB in length. Typical message bodies range from simple values, to a chunk of XML, or a list of JSON values. Fog handles the JSON-encoding required to post the message.
|
241
|
+
|
242
|
+
You can post a message a message to your queue as follows:
|
243
|
+
|
244
|
+
queue.messages.create :body => 'The laces were out!', :ttl => 360
|
245
|
+
|
246
|
+
You must supply both a body and a value for `ttl`. The value of `ttl` must be between 60 and 1209600 seconds (one minute to 14 days).
|
247
|
+
|
248
|
+
## Listing Messages in a Queue
|
249
|
+
|
250
|
+
To list messages:
|
251
|
+
|
252
|
+
queue.messages
|
253
|
+
|
254
|
+
You can change the behavior by setting the follow attributes on the messages collection:
|
255
|
+
|
256
|
+
Parameter | Default | Effect
|
257
|
+
---- | ---- | ----
|
258
|
+
**echo** | `true` | When `true`, your own messages are included.
|
259
|
+
**include_claimed** | `false` | By default, only unclaimed messages are returned. Pass this as `true` to get all messages, claimed or not.
|
260
|
+
**marker** | `nil` | Used for pagination.
|
261
|
+
**limit** | `10` | The maximum number of messages to return. Note that you may receive fewer than the specified limit if there aren't that many available messages in the queue.
|
262
|
+
|
263
|
+
For example, to include claimed messages:
|
264
|
+
|
265
|
+
queue.messages.include_claimed = true
|
266
|
+
queue.messages
|
267
|
+
|
268
|
+
## Claiming Messages in a Queue
|
269
|
+
|
270
|
+
Claiming messages is how workers processing a queue mark messages as being handled by that worker, avoiding having two workers process the same message.
|
271
|
+
|
272
|
+
Messages can be claimed and processed as follows:
|
273
|
+
|
274
|
+
claims = queue.claims.create :ttl => 300, :grace => 100, :limit => 10
|
275
|
+
|
276
|
+
The parameters for this call are described in the following table:
|
277
|
+
|
278
|
+
Parameter | Default | Notes
|
279
|
+
---- | ---- | ----
|
280
|
+
**ttl** | | The ttl attribute specifies how long the server waits before releasing the claim. The ttl value must be between 60 and 43200 seconds (12 hours).
|
281
|
+
**grace** | | The grace attribute specifies the message grace period in seconds. The value of the grace period must be between 60 and 43200 seconds (12 hours). To deal with workers that have stopped responding (for up to 1209600 seconds or 14 days, including claim lifetime), the server extends the lifetime of claimed messages to be at least as long as the lifetime of the claim itself, plus the specified grace period. If a claimed message would normally live longer than the grace period, its expiration is not adjusted.
|
282
|
+
**limit** | 10 | The number of messages to claim. The maximum number of messages you may claim at once is 20.
|
283
|
+
|
284
|
+
If the claim is successful it will return a `Fog::Rackspace::Queues::Claims` object; if there are not any available messages it will return `false`.
|
285
|
+
|
286
|
+
To iterate through the claimed messages:
|
287
|
+
|
288
|
+
claim.messages.each do |message|
|
289
|
+
# process message here
|
290
|
+
message.destroy
|
291
|
+
end
|
292
|
+
|
293
|
+
**Note:** You will want to call the `destroy` method on the message after processing to insure it is not processed more than once.
|
294
|
+
|
295
|
+
## Renewing a Claim
|
296
|
+
|
297
|
+
Once a claim has been made, if the TTL and grace period expire, the claim is automatically released and the messages are made available for others to claim. If you have a long-running process and want to ensure that this does not happen in the middle of the process, you should update the claim with one or both of a TTL or grace period. Updating resets the age of the claim, restarting the TTL for the claim. To update a claim, call:
|
298
|
+
|
299
|
+
claim.ttl = 360
|
300
|
+
claim.grace = 360
|
301
|
+
claim.save
|
302
|
+
|
303
|
+
## Refreshing a Claim
|
304
|
+
|
305
|
+
If you have a `Fog::Rackspace::Queues::claims` object, keep in mind that it is not a live window into the status of the claim; rather, it is a snapshot of the claim at the time the object was created. To refresh it with the latest information, call its `reload` method. This refreshes all of its attributes with the most current status of the claim.
|
306
|
+
|
307
|
+
|
308
|
+
## Releasing a Claim
|
309
|
+
|
310
|
+
If you have a claim on several messages and must abandon processing of those messages for any reason, you should release the claim so that those messages can be processed by other workers as soon as possible, instead of waiting for the claim's TTL to expire. When you release a claim, the claimed messages are immediately made available in the queue for other workers to claim. To release a claim, call:
|
311
|
+
|
312
|
+
claim.destroy
|
@@ -386,6 +386,8 @@ vm.customization
|
|
386
386
|
change_sid=false,
|
387
387
|
join_domain_enabled=false,
|
388
388
|
use_org_settings=false,
|
389
|
+
admin_password_auto=false,
|
390
|
+
admin_password='',
|
389
391
|
admin_password_enabled=false,
|
390
392
|
reset_password_required=false,
|
391
393
|
virtual_machine_id="2ddeea36-ac71-470f-abc5-c6e3c2aca192",
|
@@ -84,6 +84,7 @@ module Fog
|
|
84
84
|
request :delete_logout
|
85
85
|
request :delete_media
|
86
86
|
request :delete_media_metadata_item_metadata
|
87
|
+
request :delete_network
|
87
88
|
request :delete_shadow_vm
|
88
89
|
request :delete_vapp
|
89
90
|
request :delete_vapp_metadata_item_metadata
|
@@ -202,6 +203,7 @@ module Fog
|
|
202
203
|
request :post_configure_edge_gateway_services
|
203
204
|
request :post_consolidate_vm_vapp
|
204
205
|
request :post_consolidate_vm_vapp_template
|
206
|
+
request :post_create_org_vdc_network
|
205
207
|
request :post_deploy_vapp
|
206
208
|
request :post_detach_disk
|
207
209
|
request :post_disable_nested_hv
|
@@ -244,6 +246,7 @@ module Fog
|
|
244
246
|
request :put_metadata_value # deprecated
|
245
247
|
request :put_network_connection_system_section_vapp
|
246
248
|
request :put_vapp_metadata_item_metadata
|
249
|
+
request :put_vapp_name_and_description
|
247
250
|
request :put_vapp_template_metadata_item_metadata
|
248
251
|
request :put_vm
|
249
252
|
request :put_vm_capabilities
|
@@ -468,9 +471,12 @@ module Fog
|
|
468
471
|
def data
|
469
472
|
@@data ||= Hash.new do |hash, key|
|
470
473
|
|
471
|
-
|
474
|
+
vdc1_uuid = uuid
|
475
|
+
vdc2_uuid = uuid
|
472
476
|
default_network_uuid = uuid
|
473
|
-
uplink_network_uuid
|
477
|
+
uplink_network_uuid = uuid
|
478
|
+
isolated_vdc1_network_uuid = uuid
|
479
|
+
isolated_vdc2_network_uuid = uuid
|
474
480
|
|
475
481
|
hash[key] = {
|
476
482
|
:catalogs => {
|
@@ -489,7 +495,7 @@ module Fog
|
|
489
495
|
uuid => {
|
490
496
|
:name => 'MockEdgeGateway',
|
491
497
|
:networks => [uplink_network_uuid, default_network_uuid],
|
492
|
-
:vdc =>
|
498
|
+
:vdc => vdc1_uuid,
|
493
499
|
:Configuration => {
|
494
500
|
:GatewayBackingConfig => "compact",
|
495
501
|
:GatewayInterfaces => {
|
@@ -507,9 +513,15 @@ module Fog
|
|
507
513
|
}
|
508
514
|
}
|
509
515
|
},
|
516
|
+
|
510
517
|
:medias => {},
|
518
|
+
|
511
519
|
:networks => {
|
520
|
+
|
512
521
|
default_network_uuid => {
|
522
|
+
:IsShared => true,
|
523
|
+
:vdc => vdc1_uuid,
|
524
|
+
:FenceMode => 'natRouted',
|
513
525
|
:ApplyRateLimit => "false",
|
514
526
|
:Description => 'Org Network for mocking',
|
515
527
|
:Dns1 => '8.8.8.8',
|
@@ -531,8 +543,61 @@ module Fog
|
|
531
543
|
},
|
532
544
|
:UseForDefaultRoute => "false"
|
533
545
|
},
|
546
|
+
|
547
|
+
isolated_vdc1_network_uuid => {
|
548
|
+
:IsShared => false,
|
549
|
+
:vdc => vdc1_uuid,
|
550
|
+
:ApplyRateLimit => "false",
|
551
|
+
:FenceMode => 'isolated',
|
552
|
+
:Description => 'Org Network for mocking',
|
553
|
+
:Dns1 => '8.8.8.8',
|
554
|
+
:Dns2 => '8.8.4.4',
|
555
|
+
:DnsSuffix => 'example.com',
|
556
|
+
:InterfaceType => "internal",
|
557
|
+
:IpRanges => [{
|
558
|
+
:StartAddress=>'10.1.0.100',
|
559
|
+
:EndAddress=>'10.1.0.200'
|
560
|
+
}],
|
561
|
+
:IsInherited => false,
|
562
|
+
:Netmask => '255.255.255.0',
|
563
|
+
:name => 'vDC1 backend network',
|
564
|
+
:SubnetParticipation => {
|
565
|
+
:Gateway => "192.168.1.0",
|
566
|
+
:Netmask => "255.255.0.0",
|
567
|
+
:IpAddress => "192.168.1.0"
|
568
|
+
},
|
569
|
+
:UseForDefaultRoute => "false"
|
570
|
+
},
|
571
|
+
|
572
|
+
isolated_vdc2_network_uuid => {
|
573
|
+
:IsShared => false,
|
574
|
+
:vdc => vdc2_uuid,
|
575
|
+
:ApplyRateLimit => "false",
|
576
|
+
:Description => 'Org Network for mocking',
|
577
|
+
:Dns1 => '8.8.8.8',
|
578
|
+
:Dns2 => '8.8.4.4',
|
579
|
+
:DnsSuffix => 'example.com',
|
580
|
+
:InterfaceType => "internal",
|
581
|
+
:IpRanges => [{
|
582
|
+
:StartAddress=>'10.2.0.100',
|
583
|
+
:EndAddress=>'10.2.0.200'
|
584
|
+
}],
|
585
|
+
:IsInherited => false,
|
586
|
+
:Netmask => '255.255.255.0',
|
587
|
+
:name => 'vDC2 backend network',
|
588
|
+
:SubnetParticipation => {
|
589
|
+
:Gateway => "192.168.1.0",
|
590
|
+
:Netmask => "255.255.0.0",
|
591
|
+
:IpAddress => "192.168.1.0"
|
592
|
+
},
|
593
|
+
:UseForDefaultRoute => "false"
|
594
|
+
},
|
595
|
+
|
534
596
|
uplink_network_uuid => {
|
597
|
+
:IsShared => false,
|
598
|
+
:vdc => vdc1_uuid,
|
535
599
|
:ApplyRateLimit => "false",
|
600
|
+
:FenceMode => 'bridged',
|
536
601
|
:Description => 'Uplink Network for mocking',
|
537
602
|
:Dns1 => '8.8.8.8',
|
538
603
|
:Dns2 => '8.8.4.4',
|
@@ -559,6 +624,7 @@ module Fog
|
|
559
624
|
},
|
560
625
|
:UseForDefaultRoute => "true"
|
561
626
|
}
|
627
|
+
|
562
628
|
},
|
563
629
|
:org => {
|
564
630
|
:description => 'Organization for mocking',
|
@@ -574,14 +640,18 @@ module Fog
|
|
574
640
|
:limit => 2 * 1024 * 1024,
|
575
641
|
:name => 'DefaultMockStorageClass',
|
576
642
|
:units => 'MB',
|
577
|
-
:vdc =>
|
643
|
+
:vdc => vdc1_uuid,
|
578
644
|
}
|
579
645
|
},
|
580
646
|
:vdcs => {
|
581
|
-
|
582
|
-
:description => '
|
583
|
-
:name => 'MockVDC'
|
584
|
-
}
|
647
|
+
vdc1_uuid => {
|
648
|
+
:description => 'vDC1 for mocking',
|
649
|
+
:name => 'MockVDC 1'
|
650
|
+
},
|
651
|
+
vdc2_uuid => {
|
652
|
+
:description => 'vDC2 for mocking',
|
653
|
+
:name => 'MockVDC 2'
|
654
|
+
},
|
585
655
|
}
|
586
656
|
}
|
587
657
|
end[@vcloud_director_username]
|