fog-maestrodev 1.18.0.20131121075022 → 1.18.0.20131122203507

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +8 -8
  2. data/fog.gemspec +2 -2
  3. data/lib/fog/aws/models/auto_scaling/configuration.rb +1 -0
  4. data/lib/fog/aws/models/compute/flavors.rb +10 -0
  5. data/lib/fog/aws/models/glacier/vault.rb +1 -1
  6. data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +3 -0
  7. data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +1 -0
  8. data/lib/fog/aws/requests/dns/get_change.rb +1 -1
  9. data/lib/fog/aws/storage.rb +2 -1
  10. data/lib/fog/core/errors.rb +3 -3
  11. data/lib/fog/dreamhost/dns.rb +2 -4
  12. data/lib/fog/google/compute.rb +72 -62
  13. data/lib/fog/google/models/compute/zones.rb +1 -1
  14. data/lib/fog/google/requests/compute/delete_disk.rb +19 -2
  15. data/lib/fog/google/requests/compute/delete_server.rb +3 -3
  16. data/lib/fog/google/requests/compute/get_disk.rb +26 -2
  17. data/lib/fog/google/requests/compute/get_image.rb +3 -3
  18. data/lib/fog/google/requests/compute/get_server.rb +1 -0
  19. data/lib/fog/google/requests/compute/insert_disk.rb +37 -2
  20. data/lib/fog/google/requests/compute/insert_firewall.rb +2 -1
  21. data/lib/fog/google/requests/compute/insert_image.rb +1 -1
  22. data/lib/fog/google/requests/compute/insert_server.rb +31 -22
  23. data/lib/fog/google/requests/compute/list_disks.rb +8 -2
  24. data/lib/fog/google/requests/compute/list_images.rb +2 -2
  25. data/lib/fog/google/requests/compute/list_machine_types.rb +2 -2
  26. data/lib/fog/google/requests/compute/list_servers.rb +2 -2
  27. data/lib/fog/google/requests/compute/list_zone_operations.rb +1 -1
  28. data/lib/fog/google/requests/compute/list_zones.rb +1 -1
  29. data/lib/fog/hp.rb +1 -1
  30. data/lib/fog/hp/README.md +57 -0
  31. data/lib/fog/hp/articles/auth_caching.md +23 -0
  32. data/lib/fog/hp/docs/connect.md +152 -0
  33. data/lib/fog/hp/docs/install.md +133 -0
  34. data/lib/fog/hp/examples/block_storage.md +296 -0
  35. data/lib/fog/hp/examples/block_storage_v2.md +446 -0
  36. data/lib/fog/hp/examples/cdn.md +54 -0
  37. data/lib/fog/hp/examples/compute.md +794 -0
  38. data/lib/fog/hp/examples/compute_v2.md +848 -0
  39. data/lib/fog/hp/examples/getting_started_examples.md +30 -0
  40. data/lib/fog/hp/examples/networking.md +472 -0
  41. data/lib/fog/hp/examples/object_storage.md +387 -0
  42. data/lib/fog/json.rb +6 -3
  43. data/lib/fog/openstack/identity.rb +2 -3
  44. data/lib/fog/openstack/image.rb +1 -4
  45. data/lib/fog/openstack/metering.rb +1 -4
  46. data/lib/fog/openstack/network.rb +1 -3
  47. data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
  48. data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
  49. data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -1
  50. data/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +1 -1
  51. data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
  52. data/lib/fog/openstack/requests/compute/create_key_pair.rb +1 -1
  53. data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
  54. data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
  55. data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
  56. data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
  57. data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
  58. data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
  59. data/lib/fog/openstack/requests/compute/update_quota.rb +1 -1
  60. data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +1 -1
  61. data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
  62. data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
  63. data/lib/fog/openstack/requests/identity/update_user.rb +1 -1
  64. data/lib/fog/openstack/requests/image/update_image_members.rb +1 -1
  65. data/lib/fog/openstack/requests/orchestration/create_stack.rb +2 -2
  66. data/lib/fog/openstack/requests/orchestration/update_stack.rb +1 -1
  67. data/lib/fog/openstack/requests/volume/create_volume.rb +1 -1
  68. data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +1 -1
  69. data/lib/fog/openstack/volume.rb +1 -4
  70. data/lib/fog/rackspace/compute_v2.rb +1 -0
  71. data/lib/fog/rackspace/examples/queues/claim_messages.rb +60 -0
  72. data/lib/fog/rackspace/examples/queues/create_queue.rb +45 -0
  73. data/lib/fog/rackspace/examples/queues/delete_message.rb +72 -0
  74. data/lib/fog/rackspace/examples/queues/delete_queue.rb +53 -0
  75. data/lib/fog/rackspace/examples/queues/list_messages.rb +64 -0
  76. data/lib/fog/rackspace/examples/queues/post_message.rb +59 -0
  77. data/lib/fog/rackspace/models/queues/claim.rb +2 -0
  78. data/lib/fog/rackspace/models/queues/message.rb +5 -5
  79. data/lib/fog/rackspace/models/queues/queue.rb +1 -1
  80. data/lib/fog/rackspace/service.rb +1 -1
  81. data/lib/fog/riakcs.rb +2 -2
  82. data/lib/fog/riakcs/provisioning.rb +1 -3
  83. data/lib/fog/riakcs/requests/provisioning/create_user.rb +2 -2
  84. data/lib/fog/riakcs/requests/provisioning/get_user.rb +1 -1
  85. data/lib/fog/riakcs/requests/provisioning/list_users.rb +1 -1
  86. data/lib/fog/riakcs/requests/usage/get_usage.rb +1 -1
  87. data/lib/fog/riakcs/usage.rb +0 -2
  88. data/lib/fog/vsphere/compute.rb +1 -0
  89. data/lib/fog/vsphere/models/compute/datastore.rb +1 -0
  90. data/lib/fog/vsphere/requests/compute/list_datastores.rb +9 -8
  91. data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +19 -0
  92. data/lib/tasks/changelog_task.rb +0 -1
  93. data/tests/google/models/compute/disk_tests.rb +5 -0
  94. data/tests/google/models/compute/disks_tests.rb +5 -0
  95. data/tests/google/models/compute/server_tests.rb +3 -0
  96. data/tests/google/models/compute/servers_tests.rb +5 -0
  97. data/tests/google/requests/compute/disk_tests.rb +2 -1
  98. data/tests/google/requests/compute/firewall_tests.rb +1 -0
  99. data/tests/google/requests/compute/image_tests.rb +3 -0
  100. data/tests/google/requests/compute/network_tests.rb +1 -0
  101. data/tests/google/requests/compute/operation_tests.rb +1 -0
  102. data/tests/google/requests/compute/server_tests.rb +2 -3
  103. data/tests/google/requests/compute/zone_tests.rb +1 -6
  104. data/tests/helpers/mock_helper.rb +3 -4
  105. data/tests/rackspace/models/queues/message_tests.rb +16 -0
  106. data/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb +21 -0
  107. metadata +29 -3
  108. data/lib/fog/hp/README_HP.rdoc +0 -61
@@ -0,0 +1,23 @@
1
+ #Using Authentication Caching for HP Cloud Services#
2
+
3
+ Your application can run up to 40% faster if you cache the authentication information. The authentication token is typically valid for a day or more and if you save it in a safe place, you can reuse it. If you pass the authentication information to Fog, it does not have to reauthenticate.
4
+
5
+ For example if you save your credentials:
6
+
7
+ @storage = Fog::Storage.new(options)
8
+ @credentials = @storage.credentials
9
+
10
+ The next time you go to create a storage connection, pass in the credentials:
11
+
12
+ options[:credentials] = @credentials
13
+ @storage = Fog::Storage.new(options)
14
+ @credentials = @storage.credentials
15
+
16
+ It is best to always update your cached credentials. If they expire, they are automatically updated. When you create the new connection with the credentials, you should still pass in your normal authentication information in the options.
17
+
18
+ The contents of the credentials should be treated like a set of data. The contents of this object are likely to change in the future.
19
+
20
+ The same credentials may be used to create connections for Compute, Object Storage, CDN, Block Storage, and other services.
21
+
22
+ ---------
23
+ [Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
@@ -0,0 +1,152 @@
1
+ # Connecting to HP Cloud Services using Ruby Fog Bindings
2
+
3
+ The HP Cloud uses OpenStack as the platform and you can connect and set up your HP Cloud using Ruby Fog. To begin, connect using the following instructions:
4
+
5
+ * [Initial Connection](#initial-connection)
6
+ * [Availability Zones](#availability-zones)
7
+ * [Optional Parameters](#optional-parameters)
8
+
9
+ ## Initial Connection
10
+
11
+ To connect to the HP Cloud, follow these steps:
12
+
13
+ 1. Enter IRB
14
+
15
+ irb
16
+
17
+ 2. Require the Fog library and Rubygems:
18
+
19
+ require 'rubygems'
20
+ require 'fog'
21
+
22
+ **Note**: If the `require 'rubygems'` command returns a value of `false`, enter IRB with the following command:
23
+
24
+ irb -r 'rubygems'
25
+
26
+ 3. Establish a connection to the desired HP Cloud service
27
+
28
+ conn = Fog::<SERVICE-NAME>.new(
29
+ :provider => "HP",
30
+ :hp_access_key => "<your_ACCESS_KEY>",
31
+ :hp_secret_key => "<your_SECRET_KEY>",
32
+ :hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
33
+ :hp_tenant_id => "<your_TENANT_ID>",
34
+ :hp_avl_zone => "<your_AVAILABILITY_ZONE>",
35
+ <other optional parameters>
36
+ )
37
+
38
+ Where `SERVICE-NAME` can be [Compute](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/compute.md), [Storage](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/object_storage.md), [CDN](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/cdn.md) or other services. Please surf on over to the [Block Storage](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/block-storage.md) for the details on how to connect to that service.
39
+
40
+ **Note**: You must use the `:hp_access_key` parameter rather than the now-deprecated `:hp_account_id` parameter you might have used in previous versions of the HP Cloud Services Extensions to Ruby Fog.
41
+
42
+ You can find the values the access key, secret key, and other values by clicking the [`API Keys`](https://console.hpcloud.com/account/api_keys) button in the [Console Dashboard](https://console.hpcloud.com/dashboard).
43
+
44
+
45
+ ## Availability Zones
46
+
47
+ You cannot specify an availability zone if you have not activated it. To activate an availability zone, go to the [Management Console dashboard](https://console.hpcloud.com/) and click the `**Activate`** button. You are required to set an availability zone to establish a connection; there is no default availability zone value.
48
+
49
+ The current usable availability zones for the compute service:
50
+
51
+ * `az-1.region-a.geo-1`
52
+ * `az-2.region-a.geo-1`
53
+ * `az-3.region-a.geo-1`
54
+
55
+ The current usable availability zones for the storage service:
56
+
57
+ * `region-a.geo-1`
58
+ * `region-b.geo-1`
59
+
60
+ The current usable availability zones for the CDN:
61
+
62
+ * `region-a.geo-1`
63
+ * `region-b.geo-1`
64
+
65
+ The current usable availability zones for the block storage service:
66
+
67
+ * `az-1.region-a.geo-1`
68
+ * `az-2.region-a.geo-1`
69
+ * `az-3.region-a.geo-1`
70
+
71
+ ## Optional Parameters
72
+
73
+ This section describes the optional parameters that you can use when connecting to any of the HP Cloud services. The examples below show the Compute service, but these optional parameters work with all of the HP Cloud services.
74
+
75
+ The `user_agent` parameter allows you to specify a string to pass as a `user_agent` header for the connection. You can use this to track the caller of the operations. You can set the `user_agent` parameter as follows:
76
+
77
+ conn = Fog::Compute.new(
78
+ ...
79
+ ...
80
+ :user_agent => "MyApp/x.x.x")
81
+
82
+ This inserts a `user_agent` string such as `hpfog/x.x.x (MyApp/x.x.x)` into the header.
83
+
84
+ In addition to the `user_agent` parameter, there are several additional parameters you can set using the `connection_options` parameter. These options are provided by the Excon library and allow you to modify the underlying connection to a service. These options are [Instrumentation](#Instrumentation), [Timeouts](#Timeouts), [Proxy](#Proxy), and [HTTPS/SSL](#HTTPS).
85
+
86
+ ### Instrumentation
87
+
88
+ Use this parameter for debugging purposes. When you use the default instrumentor `Excon::StandardInstrumentor`, all events are output to `stderr`. You can also designate your own instrumentor. You can set the default instrumentor as follows:
89
+
90
+ conn = Fog::Compute.new(
91
+ ...
92
+ ...
93
+ :connection_options => {:instrumentor => Excon::StandardInstrumentor})
94
+
95
+ For convenience of debugging HTTP requests, we have created a custom instrumentor `Excon::SimpleHttpInstrumentor`. This instrumentor shows the HTTP calls in afashion which is similar to a `curl` output. You can set the custom `SimpleHttpInstrumentor` as follows:
96
+
97
+ conn = Fog::Compute.new(
98
+ ...
99
+ ...
100
+ :connection_options => {:instrumentor => Excon::SimpleHttpInstrumentor, :instrumentor_name => 'SimpleHttp'})
101
+
102
+ ### Timeouts
103
+
104
+ Use this parameter to set different timeout values. You can set the timeouts parameter as follows:
105
+
106
+ conn = Fog::Compute.new(
107
+ ...
108
+ ...
109
+ :connection_options => {
110
+ :connect_timeout => <time_in_secs>,
111
+ :read_timeout => <time_in_secs>,
112
+ :write_timeout => <time_in_secs>})
113
+
114
+ ### Proxy
115
+
116
+ Use this parameter to specify a proxy URL for both HTTP and HTTPS connections. You can set the proxy parameter as follows:
117
+
118
+ conn = Fog::Compute.new(
119
+ ...
120
+ ...
121
+ :connection_options => {:proxy => 'http://myproxyurl:4444'})
122
+
123
+ ### HTTPS/SSL
124
+
125
+ By default, peer certificates are verified when you use secure socket layer (SSL) for HTTPS. Sometimes this does not work due to configurations in different operating systems, causing connection errors. To help avoid this, you can set HTTPS/SSL parameters. To set the path to the certificates:
126
+
127
+ conn = Fog::Compute.new(
128
+ ...
129
+ ...
130
+ :connection_options => {:ssl_ca_path => "/path/to/certs"})
131
+
132
+ To set the path to a certificate file:
133
+
134
+ conn = Fog::Compute.new(
135
+ ...
136
+ ...
137
+ :connection_options => {:ssl_ca_file => "/path/to/certificate_file"})
138
+
139
+ To set turn off peer verification:
140
+
141
+ conn = Fog::Compute.new(
142
+ ...
143
+ ...
144
+ :connection_options => {:ssl_verify_peer => false})
145
+
146
+ **Note**: This makes your connection less secure.
147
+
148
+ For further information on these options, please see [the Excon documentation](http://github.com/geemus/excon).
149
+
150
+
151
+ ---------
152
+ [Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
@@ -0,0 +1,133 @@
1
+ # Installing Ruby Fog Bindings for HP Cloud Services
2
+
3
+ Before you can begin working with the Ruby Fog bindings, you have to install them (of course!). This page provides you with the installation information for the following operating systems:
4
+
5
+ * [Ubuntu Installation](#ubuntu-installation)
6
+ * [Mac OSX Installation](#mac-osx-installation)
7
+ * [CentOS Installation](#centos-installation)
8
+ * [Uninstalling](#uninstalling)
9
+
10
+ To install and use HP Cloud Ruby bindings for Fog, please install the [latest release](http://fog.io) of Fog.
11
+
12
+
13
+ ## Ubuntu Installation
14
+
15
+ If you plan on using the Ruby Fog binding on Ubuntu, we recommend you use Ubuntu versions 12.04 or 12.10. The Ruby Fog bindings may work on other versions, but are not supported.
16
+
17
+ To install the Ruby Fog bindings on the Ubuntu operating system, follow these steps while logged in as the root user:
18
+
19
+ 1. Install Ruby and Ruby-dev:
20
+
21
+ apt-get install ruby1.8 ruby-dev
22
+
23
+ 2. Install RubyGems:
24
+
25
+ apt-get install rubygems
26
+
27
+ 3. Install the dependent libraries:
28
+
29
+ apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1 sgml-base xml-core
30
+
31
+ 4. Install the RDoc Ruby source documenation generator package:
32
+
33
+ gem install rdoc
34
+
35
+ 5. Install the Fog gem:
36
+
37
+ gem install fog
38
+
39
+
40
+ See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
41
+
42
+ ## MacOS X Installation
43
+
44
+ Some Ruby packages require C/C++ compiler support. On the MacOS, if you haven't already installed XCode, we recommend that you install it to provide the needed C/C++ compiler for your system.
45
+
46
+ To install the Ruby Fog bindings on MacOS X, follow these steps while logged in as the root user:
47
+
48
+ 1. Download and install Xcode. You can [download the most recent version of XCode through the Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12). If you want to install an earlier version of Xcode, go to the [Apple Developer](https://developer.apple.com/downloads/index.action) site and search for "Xcode". In the results list, select the version of Xcode that you want and install it. (Note that you need to be signed up as an "Apple Developer" to access the download. Sign-up is free.)
49
+
50
+ 2. To make your installation process easier we recommend that you install [Homebrew](http://wiki.github.com/mxcl/homebrew/installation). Follow the instructions on the Homebrew page to install the package. After you have downloaded Homebrew, the CLI command to install it is:
51
+
52
+ homebrew install - ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
53
+
54
+ 3. Add the Homebrew path to your $PATH environment variable. You can either do this via the CLI command line:
55
+
56
+ export PATH=:/usr/local/sbin:$PATH
57
+
58
+ (The default Homebrew installation location is the `/usr/local/sbin` directory.) Or you can add the Homebrew path (`/usr/local/sbin`) to your $PATH environment variable in your local `.profile` file.
59
+
60
+ 4. Install RVM on your system:
61
+
62
+ curl -L get.rvm.io | bash -s stable
63
+
64
+ **Note**: You can also install RVM using [Jewelry Box](https://unfiniti.com/software/mac/jewelrybox), a RVM graphical user interface (GUI) for Mac OSX.
65
+
66
+ 5. Install the packages required by RVM; the following command lists the required packages:
67
+
68
+ source ~/.rvm/scripts/rvm
69
+ rvm requirements # install required packages
70
+
71
+ 6. Install the required packages listed in Step 5:
72
+
73
+ brew install <packages>
74
+
75
+ Where `<packages>` are the packages that you need to install.
76
+
77
+ 7. Install the `libksba` library:
78
+
79
+ brew install libksba
80
+
81
+ 8. Install Ruby:
82
+
83
+ rvm user all
84
+ rvm install ruby-1.9.2 --with-gcc=clang
85
+
86
+ 9. Use the Ruby version and make it the default:
87
+
88
+ rvm use 1.9.2 --default
89
+
90
+ 10. Install the Fog gem:
91
+
92
+ gem install fog
93
+
94
+
95
+ See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
96
+
97
+ ## CentOS Installation
98
+
99
+ If you plan on using the Ruby Fog binding on CentOS, we recommend you use CentOS versions 6.2 or 6.3. The Ruby Fog bindings may work on other versions, but are not supported.
100
+
101
+ To install the Ruby Fog bindings on CentOS, follow these steps while logged in as the root user:
102
+
103
+ 1. Install Ruby and Ruby Dev:
104
+
105
+ yum install -y ruby ruby-devel
106
+
107
+ 2. Install Rubygems:
108
+
109
+ yum install -y rubygems
110
+
111
+ 3. Install the dependent libraries:
112
+
113
+ yum install -y gcc make libxml2 libxml2-devel libxslt libxslt-devel
114
+
115
+ 4. Install RDoc Ruby source documentation generator package:
116
+
117
+ gem install rdoc
118
+
119
+ 5. Install the Fog gem:
120
+
121
+ gem install fog
122
+
123
+
124
+ See the [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md) page for details on how to connect.
125
+
126
+ ## Uninstalling
127
+
128
+ Its recommended that you uninstall a previous version prior to upgrading. To uninstall, execute the followin command while logged in as the root user:
129
+
130
+ gem uninstall fog
131
+
132
+ ---------
133
+ [Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)
@@ -0,0 +1,296 @@
1
+ #Examples for working with HP Cloud Block Storage Service v12.12
2
+
3
+ HP Cloud block storage provides support for volumes and snapshots. A volume can store boot images, user data or both. They provide customers with persistent and flexible permanent storage. You can think of it as list of USB devices, that can be plugged in anywhere at will. Volumes can be attached to server instances and mounted.
4
+
5
+ Snapshots are saved volume images at specific moments in time. You can take a snapshot of a volume and then use that snapshot to create a new volume.
6
+
7
+ The block storage provider has two abstractions: a model layer and a request layer. Both layers are detailed below. The following code snippets can be executed from within a Ruby console (IRB):
8
+
9
+ irb
10
+
11
+ This page discusses the following tasks:
12
+
13
+ * [Connecting to the Service](#connecting-to-the-service)
14
+
15
+ **Model Layer Examples**
16
+
17
+ * [Model Volume Operations](#model-volume-operations)
18
+ * [Model Snapshot Operations](#model-snapshot-operations)
19
+
20
+ **Request Layer Examples**
21
+
22
+ * [Request Volume Operations](#request-volume-operations)
23
+ * [Request Snapshot Operations](#request-snapshot-operations)
24
+
25
+ ## Connecting to the Service
26
+
27
+ To connect to the HP Cloud Block Storage Service, follow these steps:
28
+
29
+ 1. Enter IRB
30
+
31
+ irb
32
+
33
+ 2. Require the Fog library
34
+
35
+ require 'fog'
36
+
37
+ 3. Establish a connection to the HP Cloud BlockStorage service
38
+
39
+ conn = Fog::HP::BlockStorage.new(
40
+ :hp_access_key => "<your_ACCESS_KEY>",
41
+ :hp_secret_key => "<your_SECRET_KEY>",
42
+ :hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
43
+ :hp_tenant_id => "<your_TENANT_ID>",
44
+ :hp_avl_zone => "<your_AVAILABILITY_ZONE>",
45
+ <other optional parameters>
46
+ )
47
+
48
+ **Note**: You must use the `:hp_access_key` parameter rather than the now-deprecated `:hp_account_id` parameter you might have used in previous Ruby Fog versions.
49
+
50
+ You can find the values the access key, secret key, and other values by clicking the [`API Keys`](https://console.hpcloud.com/account/api_keys) button in the [Console Dashboard](https://console.hpcloud.com/dashboard).
51
+
52
+ ## Model Volume Operations
53
+
54
+ This section discusses the volume operations you can perform using the model abstraction.
55
+
56
+ 1. List all available volumes for an account
57
+
58
+ volumes = conn.volumes
59
+ volumes.size # returns no. of volumes
60
+ # display volumes in a tabular format
61
+ volumes.table([:id, :name, :status, :created_at])
62
+
63
+ 2. Obtain the details of a particular volume
64
+
65
+ volume = conn.volumes.get(volume_id)
66
+ volume.name # returns name of the volume
67
+ volume.created_at # returns the date the volume was created
68
+ volume.status # returns the state of the volume e.g. available, in-use
69
+
70
+ 3. List all available bootable volumes for an account
71
+
72
+ bootable_volumes = conn.bootable_volumes
73
+ bootable_volumes.size # returns no. of bootable volumes
74
+ # display bootable volumes in a tabular format
75
+ bootable_volumes.table([:id, :name, :state, :created_at])
76
+
77
+ 4. Obtain the details of a particular bootable volume
78
+
79
+ volume = conn.bootable_volumes.get(volume_id)
80
+ volume.name # returns name of the bootable volume
81
+ volume.created_at # returns the date the bootable volume was created
82
+ volume.status # returns the state of the bootable volume e.g. available, in-use
83
+
84
+ 5. Create a new volume
85
+
86
+ new_volume = conn.volumes.create(
87
+ :name => "TestVolume",
88
+ :description => "My Test Volume",
89
+ :size => 1)
90
+ new_volume.id # returns the id of the volume
91
+ new_volume.name # => "TestVolume"
92
+ new_volume.status # returns the status of the volume e.g. creating, available
93
+
94
+ 6. Create a new volume from an existing snapshot
95
+
96
+ new_volume = conn.volumes.create(
97
+ :name => "TestVolume",
98
+ :description => "My Test Volume",
99
+ :snapshot_id => 1,
100
+ :size => 1)
101
+ new_volume.id # returns the id of the volume
102
+ new_volume.snapshot_id # returns the snapshot_id of the volume
103
+ new_volume.name # => "TestVolume"
104
+ new_volume.status # returns the status of the volume e.g. creating, available
105
+ **Note**: The size of the volume you create from a snapshot is the same as that of the snapshot. The `:size` parameter has no effect in this case.
106
+
107
+ 7. Create a new bootable volume from an suitable single-part image
108
+
109
+ new_volume = conn.bootable_volumes.create(
110
+ :name => "BootVolume",
111
+ :description => "My Boot Volume",
112
+ :image_id => 11111,
113
+ :size => 10)
114
+ new_volume.id # returns the id of the volume
115
+ **Note**: You can use a bootable volume to create a persistent server instance.
116
+
117
+ 8. Attach an existing volume to an existing server
118
+
119
+ volume = conn.volumes.get(volume_id)
120
+ volume.attach(server_id, device)
121
+ # => true
122
+ **Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`).
123
+
124
+ 9. Detach an existing volume
125
+
126
+ volume = conn.volumes.get(volume_id)
127
+ volume.detach
128
+ # => true
129
+
130
+ 10. Delete an existing volume
131
+
132
+ volume = conn.volumes.get(volume_id)
133
+ volume.destroy
134
+ # => true
135
+
136
+ ## Model Snapshot Operations
137
+
138
+ This section discusses the snapshot operations you can perform using the model abstraction.
139
+
140
+ 1. List all available snapshots for an account
141
+
142
+ snapshots = conn.snapshots
143
+ snapshots.size # returns no. of snapshots
144
+ # display snapshots in a tabular format
145
+ conn.snapshots.table([:id, :name, :state, :created_at])
146
+
147
+ 2. Obtain the details of a particular snapshot
148
+
149
+ snapshot = conn.snapshots.get(snapshot_id)
150
+ snapshot.name # returns name of the volume
151
+ snapshot.created_at # returns the date the volume was created
152
+ snapshot.status # returns the state of the volume e.g. available
153
+
154
+ 3. Create a new snapshot
155
+
156
+ new_snapshot = conn.snapshots.create(
157
+ :name => "TestVolume",
158
+ :description => "My Test Volume",
159
+ :volume_id => 1)
160
+ new_snapshot.id # returns the id of the volume
161
+ new_snapshot.name # => "TestVolume"
162
+ new_snapshot.volume_id # => 1
163
+ new_snapshot.status # returns the status of the volume e.g. creating, available
164
+
165
+ 4. Delete an existing snapshot
166
+
167
+ snapshot = conn.snapshots.get(snapshot_id)
168
+ snapshot.destroy
169
+ # => true
170
+
171
+ ## Request Volume Operations
172
+
173
+ This section discusses the volume operations you can perform using the request abstraction.
174
+
175
+ 1. List all available volumes for an account
176
+
177
+ response = conn.list_volumes
178
+ response.body['volumes'] # returns an array of volume hashes
179
+ response.headers # returns the headers
180
+ response.body['volumes'][0]['displayName'] # returns the name of the volume
181
+
182
+ 2. Obtain the details of a particular volume
183
+
184
+ response = conn.get_volume_details(volume_id)
185
+ volume = response.body['volume']
186
+ volume['displayName'] # returns the name of the volume
187
+ volume['size'] # returns the size of the volume
188
+ volume['status'] # returns the status of the volume e.g. available, in-use
189
+
190
+ 3. List all available bootable volumes for an account
191
+
192
+ response = conn.list_bootable_volumes
193
+ response.body['volumes'] # returns an array of bootable volume hashes
194
+ response.headers # returns the headers
195
+ response.body['volumes'][0]['displayName'] # returns the name of the bootable volume
196
+
197
+ 4. Obtain the details of a particular bootable volume
198
+
199
+ response = conn.get_bootable_volume_details(volume_id)
200
+ volume = response.body['volume']
201
+ volume['displayName'] # returns the name of the bootable volume
202
+ volume['size'] # returns the size of the bootable volume
203
+ volume['status'] # returns the status of the bootable volume e.g. available, in-use
204
+
205
+ 5. Create a new volume
206
+
207
+ response = conn.create_volume("demo-vol", "demo-vol-desc", 1)
208
+ volume = response.body['volume']
209
+ volume['id'] # returns the id of the new volume
210
+ volume['displayName'] # => "demo-vol"
211
+ volume['size'] # => 1
212
+ volume['status'] # returns the status of the volume e.g. creating, available
213
+
214
+ 6. Create a new volume from an existing snapshot
215
+
216
+ response = conn.create_volume("demo-vol", "demo-vol-desc", 1, {'snapshot_id' => 1})
217
+ volume = response.body['volume']
218
+ volume['id'] # returns the id of the new volume
219
+ volume['displayName'] # => "demo-vol"
220
+ volume['size'] # => 1
221
+ volume['snapshot_id'] # => 1
222
+ volume['status'] # returns the status of the volume e.g. creating, available
223
+ **Note**: The size of the volume you create from a snapshot is the same as that of the snapshot. The third parameter (the size) has no effect in this case.
224
+
225
+ 7. Create a new bootable volume from an suitable single-part image
226
+
227
+ new_volume = conn.create_volume("TestBootVol",
228
+ "My Test Boot Volume",
229
+ 10,
230
+ {"imageRef" => "1111111"}
231
+ )
232
+ new_volume.id # returns the id of the volume
233
+ **Note**: You can use a bootable volume to create a persistent server instance.
234
+
235
+ 8. Attach an existing volume to an existing server
236
+
237
+ response = conn.compute.attach_volume(server_id, volume_id, device)
238
+ volume_attachment = response.body['volumeAttachment']
239
+ volume_attachment['id'] # returns the id of the volume
240
+ volume_attachment['volumeId'] # returns the id of the volume
241
+ **Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`)
242
+
243
+ 9. List volumes attached to a server
244
+
245
+ response = conn.compute.list_server_volumes(server_id)
246
+ volume_attachments = response.body['volumeAttachments']
247
+ volume_attachment[0]['id'] # returns the id of the volume
248
+ volume_attachment[0]['volumeId'] # returns the id of the volume
249
+ volume_attachment[0]['device'] # returns the device of the volume
250
+
251
+ 10. Detach an existing volume
252
+
253
+ conn.detach_volume(server_id, volume_id)
254
+
255
+ 11. Delete an existing volume
256
+
257
+ conn.delete_volume(volume_id)
258
+
259
+ ## Request Snapshot Operations
260
+
261
+ This section discusses the snapshot operations you can perform using the request abstraction.
262
+
263
+ 1. List all available snapshots for an account
264
+
265
+ response = conn.list_snapshots
266
+ response.body['snapshots'] # returns an array of snapshot hashes
267
+ response.headers # returns the headers
268
+ response.body['snapshots'][0]['displayName'] # returns the name of the snapshot
269
+ response.body['snapshots'][0]['size'] # returns the size of the snapshot
270
+ response.body['snapshots'][0]['volumeId'] # returns the volume id of the snapshot
271
+
272
+ 2. Obtain the details of a particular snapshot
273
+
274
+ response = conn.get_snapshot_details(snapshot_id)
275
+ snapshot = response.body['snapshot']
276
+ snapshot['displayName'] # returns the name of the snapshot
277
+ snapshot['size'] # returns the size of the snapshot
278
+ snapshot['volumeId'] # returns the volume id of the snapshot
279
+ snapshot['status'] # returns the status of the snapshot e.g. available, in-use
280
+
281
+ 3. Create a new snapshot
282
+
283
+ response = conn.create_snapshot("demo-snap", "demo-snap-desc", 1)
284
+ snapshot = response.body['snapshot']
285
+ snapshot['id'] # returns the id of the new volume
286
+ snapshot['displayName'] # => "demo-vol"
287
+ snapshot['size'] # => 1
288
+ snapshot['volumeId'] # returns the volume id of the snapshot
289
+ snapshot['status'] # returns the status of the snapshot e.g. creating, available
290
+
291
+ 4. Delete an existing snapshot
292
+
293
+ conn.delete_snapshot(snapshot_id)
294
+
295
+ ---------
296
+ [Documentation Home](https://github.com/fog/fog/blob/master/lib/fog/hp/README.md) | [Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/getting_started_examples.md)