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,446 @@
1
+ #Examples for working with HP Cloud Block Storage Service v13.5
2
+
3
+ HP Cloud block storage provides support for volumes and snapshots. The latest HP Cloud deployment, version 13.5, takes advantage of more OpenStack functionality and the block storage service uses slightly different commands (often noted by *v2* in the commands) than the previous 12.12 version. Verify which version of HP Cloud you are working with.
4
+
5
+ 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.
6
+
7
+ 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.
8
+
9
+ The block storage provider has two abstractions: [a model layer](#ModelLayer) and [a request layer](#RequestLayer). Both layers are detailed below. The following code snippets can be executed from within a Ruby console (IRB):
10
+
11
+ irb
12
+
13
+ This page discusses the following tasks:
14
+
15
+ * [Connecting to the Service](#connecting-to-the-service)
16
+
17
+ **Model Layer Examples**
18
+
19
+ * [Model Volume Operations](#model-volume-operations)
20
+ * [Model Snapshot Operations](#model-snapshot-operations)
21
+ * [Model Volume Backup Operations](#model-volume-backup-operations)
22
+
23
+ **Request Layer Examples**
24
+
25
+ * [Request Volume Operations](#request-volume-operations)
26
+ * [Request Snapshot Operations](#request-snapshot-operations)
27
+ * [Volume Operations (Request Layer)](#request-volume-backup-operations)
28
+
29
+ ## Connecting to the Service
30
+
31
+ To connect to the HP Cloud Block Storage Service, follow these steps:
32
+
33
+ 1. Enter IRB
34
+
35
+ irb
36
+
37
+ 2. Require the Fog library
38
+
39
+ require 'fog'
40
+
41
+ 3. Establish a connection to the HP Cloud Block Storage service
42
+
43
+ conn = Fog::HP::BlockStorageV2.new(
44
+ :hp_access_key => "<your_ACCESS_KEY>",
45
+ :hp_secret_key => "<your_SECRET_KEY>",
46
+ :hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
47
+ :hp_tenant_id => "<your_TENANT_ID>",
48
+ :hp_avl_zone => "<your_AVAILABILITY_ZONE>",
49
+ <other optional parameters>
50
+ )
51
+
52
+ **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.
53
+
54
+ 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).
55
+
56
+ ## Model Volume Operations
57
+
58
+ This section discusses the volume operations you can perform using the model abstraction.
59
+
60
+ 1. List all available volumes for an account:
61
+
62
+ volumes = conn.volumes
63
+ volumes.size # returns no. of volumes
64
+ # display volumes in a tabular format
65
+ volumes.table([:id, :name, :status, :created_at])
66
+
67
+ 2. Obtain the details of a volume by the volume ID:
68
+
69
+ volume = conn.volumes.get("<volume_id>")
70
+ volume.name # returns name of the volume
71
+ volume.created_at # returns the date the volume was created
72
+ volume.status # returns the state of the volume e.g. available, in-use
73
+
74
+ 3. List volume details using a filter:
75
+
76
+ volume = conn.volumes.all(:status => 'error')
77
+
78
+ 4. Create a volume
79
+
80
+ new_volume = conn.volumes.create(
81
+ :name => "TestVolume",
82
+ :description => "My Test Volume",
83
+ :size => 1)
84
+ new_volume.id # returns the id of the volume
85
+ new_volume.name # => "TestVolume"
86
+ new_volume.status # returns the status of the volume e.g., creating, available
87
+
88
+ 5. Create a new bootable volume from an suitable single-part image
89
+
90
+ new_volume = conn.volumes.create(
91
+ :name => "BootVolume",
92
+ :description => "My Boot Volume",
93
+ :image_id => 11111,
94
+ :size => 10)
95
+ new_volume.id # returns the id of the volume
96
+ **Note**: You can use a bootable volume to create a persistent server instance.
97
+ **Note**: The size of the volume you create from an image is the same as that of the image. The `:size` parameter has no effect in this case.
98
+
99
+ 6. Create a volume from a volume snapshot:
100
+
101
+ new_volume = conn.volumes.create(
102
+ :name => 'VolumeFromSnapshot',
103
+ :snapshot_id => "<snapshot_id>")
104
+ **Note**: The size of the volume you create from a snapshot, is the same as that of the snapshot.
105
+
106
+ 7. Create a volume from another source volume:
107
+
108
+ new_volume = conn.volumes.create(
109
+ :name => 'VolumeClone',
110
+ :source_volid => "<source_volid>")
111
+ **Note**: The size of the volume you create from a source volume, is the same as that of the source volume.
112
+
113
+ 8. Attach a volume to a server:
114
+
115
+ # assuming we have a server
116
+ server.volume_attachments.create(
117
+ :server_id => server.id,
118
+ :volume_id => "<volume_id>",
119
+ :device => "/dev/sdf")
120
+ # => true
121
+ **Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`).
122
+
123
+ 9. List the attached volumes for a server:
124
+
125
+ # assuming we have a server
126
+ server.volume_attachments.all
127
+
128
+ 10. Detach a volume from a server:
129
+
130
+ # assuming we have a server
131
+ att_vol = server.volume_attachments.get("<volume_id>")
132
+ att_vol.destroy
133
+ # => true
134
+
135
+ 11. Update a volume:
136
+
137
+ volume = conn.volumes.get("<volume_id>")
138
+ vol.description = "from a source vol. in a diff. availability zone"
139
+ => "from a source vol. in a diff. availability zone"
140
+ vol.save
141
+ => true
142
+
143
+ 12. Delete a volume:
144
+
145
+ volume = conn.volumes.get("<volume_id>")
146
+ volume.destroy
147
+ # => true
148
+
149
+ ## Model Snapshot Operations
150
+
151
+ This section discusses the snapshot operations you can perform using the model abstraction.
152
+
153
+ 1. List all available snapshots for an account:
154
+
155
+ snapshot = conn.snapshots
156
+ snapshots.size # returns no. of snapshots
157
+ # display snapshots in a tabular format
158
+ conn.snapshots.table([:id, :name, :state, :created_at])
159
+
160
+ 2. List snapshots using a filter:
161
+
162
+ snapshot = conn.snapshots.all(:display_name => 'My Snapshot')
163
+ snapshot.name # returns name of the snapshot
164
+ snapshot.description # returns the description of the snapshot
165
+ snapshot.created_at # returns the date the snapshot was created
166
+ snapshot.status # returns the state of the snapshot e.g., available
167
+
168
+ 3. Obtain the details of a snapshot by the ID:
169
+
170
+ snapshot = conn.snapshots.get("<snapshot_id>")
171
+ snapshot.name # returns name of the volume
172
+ snapshot.description # returns the description of the snapshot
173
+ snapshot.status # returns the state of the snapshot e.g., available
174
+ snapshot.created_at # returns the date the snapshot was created
175
+ snapshot.volume_id # returns the volume ID
176
+
177
+ 4. Create a snapshot:
178
+
179
+ snapshot = conn.snapshots.create(
180
+ :volume_id => "<volume_id>",
181
+ :name => "TestSnapshot",
182
+ :description => "My Test Snapshot")
183
+
184
+ snapshot.id # returns the id of the volume
185
+ snapshot.name # => "TestVolume"
186
+ snapshot.description # returns the description of the snapshot
187
+ snapshot.status # returns the status of the volume e.g., creating, available
188
+ snapshot.created_at # returns the date the snapshot was created
189
+ snapshot.volume_id # => 1
190
+
191
+ 5. Update a snapshot
192
+
193
+ snapshot = conn.snapshots.get("<snapshot_id>")
194
+ snapshot.name = "Snapshot 1"
195
+ snapshot.save
196
+ => true
197
+
198
+ 6. Delete an existing snapshot
199
+
200
+ conn.snapshots.get("<snapshot_id>").destroy
201
+ => true
202
+
203
+ ## Model Volume Backup Operations
204
+
205
+ This section discusses the volume backup operations you can perform using the model abstraction.
206
+
207
+ 1. List available volume backups for an account:
208
+
209
+ conn.volume_backups
210
+
211
+ 2. List details of volume backups:
212
+
213
+ conn.volume_backups.all(:details => true)
214
+
215
+ 3. Obtain the details of a volume backup by ID:
216
+
217
+ volume = conn.volume_backups.get("<volume_backup_id>")
218
+
219
+ volume.name # returns the name of the volume backup
220
+ volume.status # provides the status of the volume backup e.g., available
221
+ volume.created_at # provides the date the backup was created
222
+ volume.volume_id # returns the id of the volume
223
+ volume.container # returns the container holding the backup
224
+
225
+ 4. Create a volume backup:
226
+
227
+ volume = conn.volume_backups.create(
228
+ :name => "My Volume Backup",
229
+ :volume_id => "<volume_id>")
230
+
231
+ 5. Restore from a volume backup into a new volume:
232
+
233
+ # restore into a new volume
234
+ backup = conn.volume_backups.get("<volume_backup_id>")
235
+ backup.restore
236
+ => true
237
+
238
+ 6. Restore from a volume backup into an existing volume:
239
+
240
+ # restore into an existing volume
241
+ backup = conn.volume_backups.get("<volume_backup_id>")
242
+ backup.restore("<existing_volume_id>")
243
+ => true
244
+
245
+ 7. Delete a volume backup:
246
+
247
+ backup = conn.volume_backups.get("<volume_backup_id>")
248
+ backup.destroy
249
+
250
+ ## Request Volume Operations
251
+
252
+ This section discusses the volume operations you can perform using the request abstraction.
253
+
254
+ 1. List all available volumes for an account:
255
+
256
+ response = conn.list_volumes
257
+ response.body['volumes'] # returns an array of volume hashes
258
+ response.headers # returns the headers
259
+ response.body['volumes'][0]['display_name'] # returns the name of the volume
260
+
261
+ 2. List available volumes using a filter:
262
+
263
+ conn.list_volumes(:limit => 2 )
264
+
265
+ 3. List volumes with details:
266
+
267
+ response = conn.list_volumes_detail
268
+ response.body['volumes'][0]['volume_image_metadata'] # returns volume image metadata
269
+
270
+ 4. List volumes with details using a filter:
271
+
272
+ response = conn.list_volumes_detail(:display_name => "Test Volume")
273
+ response.body['volumes'][0]['volume_image_metadata'] # returns volume image metadata
274
+
275
+ 5. Obtain the details of a volume by ID:
276
+
277
+ response = conn.get_volume_details("<volume_id>")
278
+ volume = response.body['volume']
279
+ volume['display_name'] # returns the name of the volume
280
+ volume['size'] # returns the size of the volume
281
+ volume['status'] # returns the status of the volume e.g. available, in-use
282
+
283
+ 6. Create a volume:
284
+
285
+ response = conn.create_volume('display_name' => 'Test Volume', 'size' => 10)
286
+ volume = response.body['volume']
287
+ volume['id'] # returns the id of the new volume
288
+ volume['display_name'] # => "demo-vol"
289
+ volume['size'] # => 10
290
+ volume['status'] # returns the status of the volume e.g. creating, available
291
+
292
+ 7. Create a new volume from an existing image:
293
+
294
+ conn.create_volume('display_name' => 'Test Volume 1',
295
+ 'display_description' => 'Test Volume from image',
296
+ 'size' => 10,
297
+ 'imageRef' => "<image_id>")
298
+
299
+ 8. Create a new volume from an existing snapshot:
300
+
301
+ response = conn.create_volume(
302
+ 'display_name' => 'Test Volume 2',
303
+ 'display_description' => 'New Volume from Snapshot',
304
+ 'snapshot_id' => "<snapshot_id>")
305
+ volume = response.body['volume']
306
+
307
+ volume['id'] # returns the id of the new volume
308
+ volume['display_name'] # => "Test Volume 2"
309
+ volume['size'] # => 1
310
+ volume['snapshot_id'] # => 1
311
+ volume['status'] # returns the status of the volume e.g. creating, available
312
+ **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.
313
+
314
+ 9. Create a new volume from an existing volume:
315
+
316
+ conn.create_volume(
317
+ 'display_name' => 'Test Volume 3',
318
+ 'display_description' => 'Test volume from another image',
319
+ 'source_volid' => "<source_volid>")
320
+
321
+ 10. Create a new bootable volume from an suitable single-part image:
322
+
323
+ conn.create_volume(
324
+ 'display_name' => "TestBootVol",
325
+ 'display_description' => "My Test Boot Volume",
326
+ 'size' => 10,
327
+ 'imageRef' => "<bootable_image_id>")
328
+ **Note**: You can use a bootable volume to create a persistent server instance.
329
+
330
+ 11. Attach an existing volume to an existing server:
331
+
332
+ response = conn.attach_volume("<server_id>", "<volume_id>", "/dev/sdf")
333
+ volume_attachment = response.body['volumeAttachment']
334
+ volume_attachment['id'] # returns the id of the volume
335
+ volume_attachment['volumeId'] # returns the id of the volume
336
+ volume_attachment['serverId'] # returns the id of the server
337
+ volume_attachment['device'] # returns the device of the volume
338
+ **Note**: The device parameter is the mount point on the server instance to which the volume is attached (for example, `/dev/sdf`)
339
+
340
+ 12. List volumes attached to a server:
341
+
342
+ response = conn.list_server_volumes("<server_id>")
343
+ volume_attachments = response.body['volumeAttachments']
344
+ volume_attachment[0]['id'] # returns the id of the volume
345
+ volume_attachment[0]['volumeId'] # returns the id of the volume
346
+ volume_attachment[0]['serverId'] # returns the id of the volume
347
+ volume_attachment[0]['device'] # returns the device of the volume
348
+
349
+ 13. Detach an existing volume from a server:
350
+
351
+ conn.detach_volume("<server_id>", "<volume_id>")
352
+
353
+ 14. Update a volume:
354
+
355
+ conn.update_volume("<volume_id>",
356
+ {'display_name' => 'Test Volume Update'})
357
+
358
+ 15. Delete an existing volume:
359
+
360
+ conn.delete_volume("<volume_id>")
361
+
362
+ ## Request Snapshot Operations
363
+
364
+ This section discusses the snapshot operations you can perform using the request abstraction.
365
+
366
+ 1. List all available snapshots for an account:
367
+
368
+ response = conn.list_snapshots
369
+ response.body['snapshots'] # returns an array of snapshot hashes
370
+ response.headers # returns the headers
371
+ response.body['snapshots'][0]['display_name'] # returns the name of the snapshot
372
+ response.body['snapshots'][0]['size'] # returns the size of the snapshot
373
+ response.body['snapshots'][0]['volume_id'] # returns the volume id of the snapshot
374
+
375
+ 2. List the details of all snapshots:
376
+
377
+ conn.list_snapshots_detail
378
+
379
+ 3. List the details of a snapshot using a filter:
380
+
381
+ conn.list_snapshots_detail(:limit => 2)
382
+
383
+ 4. Obtain the details of a snapshot by ID:
384
+
385
+ response = conn.get_snapshot_details("<snapshot_id>")
386
+ snapshot = response.body['snapshot']
387
+ snapshot['display_name'] # returns the name of the snapshot
388
+ snapshot['size'] # returns the size of the snapshot
389
+ snapshot['volume_id'] # returns the volume id of the snapshot
390
+ snapshot['status'] # returns the status of the snapshot e.g. available, in-use
391
+
392
+ 5. Create a new snapshot:
393
+
394
+ response = conn.create_snapshot("<volume_id>",
395
+ 'display_name' => 'Test Snapshot',
396
+ 'display_description' => 'Test Snapshot from Vol Test')
397
+ snapshot = response.body['snapshot']
398
+ snapshot['id'] # returns the id of the new volume
399
+ snapshot['display_name'] # => "demo-vol"
400
+ snapshot['size'] # => 1
401
+ snapshot['volume_id'] # returns the volume id of the snapshot
402
+ snapshot['status'] # returns the status of the snapshot e.g. creating, available
403
+
404
+ 6. Update a snapshot:
405
+
406
+ conn.update_snapshot("<snapshot_id>", 'display_name' => "Test Snapshot 1 Update")
407
+
408
+ 7. Delete a snapshot:
409
+
410
+ conn.delete_snapshot("<snapshot_id>")
411
+
412
+ ## Request Volume Backup Operations
413
+
414
+ This section discusses the volume backup operations you can perform using the request abstraction.
415
+
416
+ 1. List all available volume backups for an account:
417
+
418
+ conn.list_volume_backups
419
+
420
+ 2. List details of all available volume backups:
421
+
422
+ conn.list_volume_backups_detail
423
+
424
+ 3. Obtain the details of a volume backup by ID:
425
+
426
+ conn.get_volume_backup_details("<volume_backup_id>")
427
+
428
+ 4. Create a volume backup:
429
+
430
+ conn.create_volume_backup("<volume_id>")
431
+
432
+ 5. Restore into a new volume using a volume backup:
433
+
434
+ conn.restore_volume_backup("<volume_backup_id>")
435
+ # creates a new volume that is a clone of the volume the backup was created from
436
+
437
+ 6. Restore into an existing volume using a volume backup:
438
+
439
+ conn.restore_volume_backup("<volume_backup_id>", "<existing_volume_id>")
440
+
441
+ 7. Delete a volume backup:
442
+
443
+ conn.delete_volume_backup("<volume_backup_id>")
444
+
445
+ ---------
446
+ [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,54 @@
1
+ # Examples for working with HP Cloud CDN Service
2
+
3
+ The HP Cloud services provides CDN support via the request layer abstraction. In the request abstraction, you can CDN-enable a container, get a list of the CDN-enabled containers, list the metadata for a CDN-enabled container, update the metadata for a CDN-enabled container, and CDN-disable a container.
4
+
5
+ The examples on this page can be executed from within a Ruby console (IRB):
6
+
7
+ irb
8
+
9
+ * [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md)
10
+
11
+
12
+ ## CDN-Enabling an Existing Container
13
+
14
+ To CDN-enable an existing container:
15
+
16
+ conn.put_container("fog-rocks")
17
+
18
+ ## Listing CDN-Enabled Containers
19
+
20
+ To generate a list of CDN-enabled containers:
21
+
22
+ conn.get_containers
23
+
24
+ ## Listing the Metadata for a CDN-Enabled Container
25
+
26
+ To list the metadata (or header information) for a CDN-enabled container:
27
+
28
+ conn.head_container("fog-rocks")
29
+
30
+ ## Updating the Metadata for a CDN-Enabled Container
31
+
32
+ To update or modify the metadata for a CDN-enabled container, use the command
33
+
34
+ > conn.post_container("fog-rocks", {**option**})
35
+
36
+ Where _option_ can be any of the following:
37
+
38
+ * X-CDN-Enabled <Boolean> - cdn status for container
39
+ * X-CDN-URI <String> - cdn url for this container
40
+ * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 900 (15 min.) to 1577836800 (50 years)
41
+ * X-Log-Retention <Boolean>
42
+
43
+ So for example, if you want to modify the X-TTL metadata information so that the value becomes 3600, the command would be:
44
+
45
+ conn.post_container("fog-rocks", {'X-Ttl' => 3600 })
46
+
47
+ ## Disabling a CDN Container
48
+
49
+ To CDN-disable container:
50
+
51
+ conn.delete_container("fog-rocks")
52
+
53
+ ---------
54
+ [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)