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.
- checksums.yaml +8 -8
- data/fog.gemspec +2 -2
- data/lib/fog/aws/models/auto_scaling/configuration.rb +1 -0
- data/lib/fog/aws/models/compute/flavors.rb +10 -0
- data/lib/fog/aws/models/glacier/vault.rb +1 -1
- data/lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb +3 -0
- data/lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb +1 -0
- data/lib/fog/aws/requests/dns/get_change.rb +1 -1
- data/lib/fog/aws/storage.rb +2 -1
- data/lib/fog/core/errors.rb +3 -3
- data/lib/fog/dreamhost/dns.rb +2 -4
- data/lib/fog/google/compute.rb +72 -62
- data/lib/fog/google/models/compute/zones.rb +1 -1
- data/lib/fog/google/requests/compute/delete_disk.rb +19 -2
- data/lib/fog/google/requests/compute/delete_server.rb +3 -3
- data/lib/fog/google/requests/compute/get_disk.rb +26 -2
- data/lib/fog/google/requests/compute/get_image.rb +3 -3
- data/lib/fog/google/requests/compute/get_server.rb +1 -0
- data/lib/fog/google/requests/compute/insert_disk.rb +37 -2
- data/lib/fog/google/requests/compute/insert_firewall.rb +2 -1
- data/lib/fog/google/requests/compute/insert_image.rb +1 -1
- data/lib/fog/google/requests/compute/insert_server.rb +31 -22
- data/lib/fog/google/requests/compute/list_disks.rb +8 -2
- data/lib/fog/google/requests/compute/list_images.rb +2 -2
- data/lib/fog/google/requests/compute/list_machine_types.rb +2 -2
- data/lib/fog/google/requests/compute/list_servers.rb +2 -2
- data/lib/fog/google/requests/compute/list_zone_operations.rb +1 -1
- data/lib/fog/google/requests/compute/list_zones.rb +1 -1
- data/lib/fog/hp.rb +1 -1
- data/lib/fog/hp/README.md +57 -0
- data/lib/fog/hp/articles/auth_caching.md +23 -0
- data/lib/fog/hp/docs/connect.md +152 -0
- data/lib/fog/hp/docs/install.md +133 -0
- data/lib/fog/hp/examples/block_storage.md +296 -0
- data/lib/fog/hp/examples/block_storage_v2.md +446 -0
- data/lib/fog/hp/examples/cdn.md +54 -0
- data/lib/fog/hp/examples/compute.md +794 -0
- data/lib/fog/hp/examples/compute_v2.md +848 -0
- data/lib/fog/hp/examples/getting_started_examples.md +30 -0
- data/lib/fog/hp/examples/networking.md +472 -0
- data/lib/fog/hp/examples/object_storage.md +387 -0
- data/lib/fog/json.rb +6 -3
- data/lib/fog/openstack/identity.rb +2 -3
- data/lib/fog/openstack/image.rb +1 -4
- data/lib/fog/openstack/metering.rb +1 -4
- data/lib/fog/openstack/network.rb +1 -3
- data/lib/fog/openstack/requests/compute/add_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/allocate_address.rb +1 -1
- data/lib/fog/openstack/requests/compute/attach_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_key_pair.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/requests/compute/list_tenants.rb +1 -1
- data/lib/fog/openstack/requests/compute/remove_flavor_access.rb +1 -1
- data/lib/fog/openstack/requests/compute/update_quota.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_ec2_credential.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_role.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_user.rb +1 -1
- data/lib/fog/openstack/requests/identity/update_user.rb +1 -1
- data/lib/fog/openstack/requests/image/update_image_members.rb +1 -1
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +2 -2
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +1 -1
- data/lib/fog/openstack/requests/volume/create_volume.rb +1 -1
- data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +1 -1
- data/lib/fog/openstack/volume.rb +1 -4
- data/lib/fog/rackspace/compute_v2.rb +1 -0
- data/lib/fog/rackspace/examples/queues/claim_messages.rb +60 -0
- data/lib/fog/rackspace/examples/queues/create_queue.rb +45 -0
- data/lib/fog/rackspace/examples/queues/delete_message.rb +72 -0
- data/lib/fog/rackspace/examples/queues/delete_queue.rb +53 -0
- data/lib/fog/rackspace/examples/queues/list_messages.rb +64 -0
- data/lib/fog/rackspace/examples/queues/post_message.rb +59 -0
- data/lib/fog/rackspace/models/queues/claim.rb +2 -0
- data/lib/fog/rackspace/models/queues/message.rb +5 -5
- data/lib/fog/rackspace/models/queues/queue.rb +1 -1
- data/lib/fog/rackspace/service.rb +1 -1
- data/lib/fog/riakcs.rb +2 -2
- data/lib/fog/riakcs/provisioning.rb +1 -3
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +2 -2
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +1 -1
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +1 -1
- data/lib/fog/riakcs/requests/usage/get_usage.rb +1 -1
- data/lib/fog/riakcs/usage.rb +0 -2
- data/lib/fog/vsphere/compute.rb +1 -0
- data/lib/fog/vsphere/models/compute/datastore.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +9 -8
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +19 -0
- data/lib/tasks/changelog_task.rb +0 -1
- data/tests/google/models/compute/disk_tests.rb +5 -0
- data/tests/google/models/compute/disks_tests.rb +5 -0
- data/tests/google/models/compute/server_tests.rb +3 -0
- data/tests/google/models/compute/servers_tests.rb +5 -0
- data/tests/google/requests/compute/disk_tests.rb +2 -1
- data/tests/google/requests/compute/firewall_tests.rb +1 -0
- data/tests/google/requests/compute/image_tests.rb +3 -0
- data/tests/google/requests/compute/network_tests.rb +1 -0
- data/tests/google/requests/compute/operation_tests.rb +1 -0
- data/tests/google/requests/compute/server_tests.rb +2 -3
- data/tests/google/requests/compute/zone_tests.rb +1 -6
- data/tests/helpers/mock_helper.rb +3 -4
- data/tests/rackspace/models/queues/message_tests.rb +16 -0
- data/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb +21 -0
- metadata +29 -3
- data/lib/fog/hp/README_HP.rdoc +0 -61
@@ -0,0 +1,30 @@
|
|
1
|
+
#Ruby Fog Bindings Examples for use with HP Cloud Services
|
2
|
+
|
3
|
+
This section includes code examples for working with Ruby Fog bindings and HP Cloud. HP Cloud recently updated their service to version 13.5, so make sure you use the HP Cloud Compute 13.5 examples, HP Cloud Block Storage 13.5, and the HP Cloud Networking examples only with the the latest version. The CDN and object storage examples work in both 12.12 and 13.5.
|
4
|
+
|
5
|
+
Choose what you want to work with:
|
6
|
+
|
7
|
+
##Version 12.12 Extensions to Ruby Fog Bindings
|
8
|
+
|
9
|
+
These examples currently supports HP Cloud Compute, HP Cloud Object Storage, HP Cloud CDN, and HP Cloud Block Storage. Support for other services will be added as they become available.
|
10
|
+
|
11
|
+
* [Installation Instructions](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/install.md)
|
12
|
+
* [Connecting to the Service](https://github.com/fog/fog/blob/master/lib/fog/hp/docs/connect.md)
|
13
|
+
* [Compute Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/compute.md)
|
14
|
+
* [Object Storage Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/object_storage.md)
|
15
|
+
* [CDN Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/cdn.md)
|
16
|
+
* [Block Storage Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/block_storage.md)
|
17
|
+
|
18
|
+
##Version 13.5 Extensions to Ruby Fog Bindings
|
19
|
+
|
20
|
+
For the release of HP Cloud v13.5, the HP Cloud extensions added support for
|
21
|
+
HP Cloud Networking and HP Cloud Compute V2 and HP Cloud Block Storage V2 examples. All other examples above are compatible with v13.5.
|
22
|
+
|
23
|
+
* [Compute v2 Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/compute_v2.md)
|
24
|
+
* [Block Storage v2 Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/block_storage_v2.md)
|
25
|
+
* [Networking Examples](https://github.com/fog/fog/blob/master/lib/fog/hp/examples/networking.md)
|
26
|
+
* Load Balancer Examples (coming soon)
|
27
|
+
* DNS Examples (coming soon)
|
28
|
+
|
29
|
+
---------
|
30
|
+
[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,472 @@
|
|
1
|
+
#Examples for working with HP Cloud Networking Service
|
2
|
+
The HP Cloud provides networking support using two abstractions: a model layer and a request layer. Both layers are detailed below.
|
3
|
+
|
4
|
+
**Note:** The networking functionality works with HP Cloud version 13.5 but is not available in version 12.12.
|
5
|
+
|
6
|
+
The code samples on this page can be executed from within a Ruby console (IRB):
|
7
|
+
|
8
|
+
irb
|
9
|
+
|
10
|
+
This page discusses the following topics:
|
11
|
+
|
12
|
+
* [Connecting to the Service](#connecting-to-the-service)
|
13
|
+
|
14
|
+
**Model Layer Examples**
|
15
|
+
|
16
|
+
* [Model Network Operations](#model-network-operations)
|
17
|
+
* [Model Subnet Operations](#model-subnet-operations)
|
18
|
+
* [Model Port Operations](#model-port-operations)
|
19
|
+
* [Model Router Operations](#model-router-operations)
|
20
|
+
* [Model Security Group Operations](#model-security-group-operations)
|
21
|
+
* [Model Security Group Rules](#model-security-group-rules-operations)
|
22
|
+
* [Model Floating IPs](#model-floating-ips-operations)
|
23
|
+
|
24
|
+
**Request Layer Examples**
|
25
|
+
|
26
|
+
* [Request Network Operations](#request-network-operations)
|
27
|
+
* [Request Subnet Operations](#request-subnet-operations)
|
28
|
+
* [Request Port Operations](#request-port-operations)
|
29
|
+
* [Request Router Operations](#request-router-operations)
|
30
|
+
* [Request Security Group Operations](#request-security-group-operations)
|
31
|
+
* [Request Security Group Rules Operations](#request-security-group-rules-operations)
|
32
|
+
* [Request Floating IPs Operations](#request-floating-ips-operations)
|
33
|
+
|
34
|
+
## Connecting to the Service
|
35
|
+
|
36
|
+
To connect to the HP Cloud Networking Service, follow these steps:
|
37
|
+
|
38
|
+
1. Enter IRB
|
39
|
+
|
40
|
+
irb
|
41
|
+
|
42
|
+
2. Require the Fog library
|
43
|
+
|
44
|
+
require 'fog'
|
45
|
+
|
46
|
+
3. Establish a connection to the HP Cloud Networking service
|
47
|
+
|
48
|
+
conn = Fog::HP::Networking.new(
|
49
|
+
:hp_access_key => "<your_ACCESS_KEY>",
|
50
|
+
:hp_secret_key => "<your_SECRET_KEY>",
|
51
|
+
:hp_auth_uri => "<IDENTITY_ENDPOINT_URL>",
|
52
|
+
:hp_tenant_id => "<your_TENANT_ID>",
|
53
|
+
:hp_avl_zone => "<your_AVAILABILITY_ZONE>",
|
54
|
+
<other optional parameters>
|
55
|
+
)
|
56
|
+
|
57
|
+
**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.
|
58
|
+
|
59
|
+
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).
|
60
|
+
|
61
|
+
## Model Network Operations
|
62
|
+
|
63
|
+
1. List networks:
|
64
|
+
|
65
|
+
conn.networks
|
66
|
+
|
67
|
+
2. List network using a filter:
|
68
|
+
|
69
|
+
conn.networks.all({"router:external"=>true})
|
70
|
+
|
71
|
+
3. Obtain a network by ID:
|
72
|
+
|
73
|
+
conn.networks.get("<network_id>")
|
74
|
+
|
75
|
+
4. Create a network:
|
76
|
+
|
77
|
+
conn.networks.create(:name => "My Slick Network")
|
78
|
+
|
79
|
+
5. Delete a network:
|
80
|
+
|
81
|
+
conn.networks.get("<network_id>").destroy
|
82
|
+
|
83
|
+
## Model Subnet Operations
|
84
|
+
|
85
|
+
1. List subnets:
|
86
|
+
|
87
|
+
conn.subnets
|
88
|
+
|
89
|
+
2. List subnets using a filter:
|
90
|
+
|
91
|
+
conn.subnets.all({:gateway_ip => "12.0.0.1"})
|
92
|
+
|
93
|
+
3. Create a subnet:
|
94
|
+
|
95
|
+
conn.subnets.create(
|
96
|
+
:network_id => "<network_id>",
|
97
|
+
:cidr => "12.0.3.0/24",
|
98
|
+
:ip_version => 4,
|
99
|
+
:name => "My Subnet Model 1"
|
100
|
+
)
|
101
|
+
|
102
|
+
4. Obtain a subnet by ID:
|
103
|
+
|
104
|
+
conn.subnets.get("<subnet_id>")
|
105
|
+
|
106
|
+
5. Assign a DNS server to a subnet:
|
107
|
+
|
108
|
+
subnet = conn.subnets.get("<subnet_id>")
|
109
|
+
subnet.dns_nameservers = ["dns_ip"]
|
110
|
+
subnet.save
|
111
|
+
|
112
|
+
6. Delete a subnet:
|
113
|
+
|
114
|
+
conn.subnets.get("<subnet_id>").destroy
|
115
|
+
|
116
|
+
## Model Port Operations
|
117
|
+
|
118
|
+
1. List ports:
|
119
|
+
|
120
|
+
conn.ports
|
121
|
+
|
122
|
+
2. List ports using a filter:
|
123
|
+
|
124
|
+
conn.ports.all({:mac_address => "<mac_address>"})
|
125
|
+
|
126
|
+
|
127
|
+
3. Obtain a port by ID:
|
128
|
+
|
129
|
+
conn.ports.get("<port_id>")
|
130
|
+
|
131
|
+
4. Create a port:
|
132
|
+
|
133
|
+
conn.ports.create(
|
134
|
+
:name => "Port Model 1",
|
135
|
+
:network_id => "<network_id>"
|
136
|
+
)
|
137
|
+
|
138
|
+
5. Delete a port:
|
139
|
+
|
140
|
+
conn.ports.get("<port_id>").destroy
|
141
|
+
|
142
|
+
## Model Router Operations
|
143
|
+
|
144
|
+
1. List routers:
|
145
|
+
|
146
|
+
conn.routers
|
147
|
+
|
148
|
+
2. List routers using a filter:
|
149
|
+
|
150
|
+
conn.routers.all({:name => "Router 1"})
|
151
|
+
|
152
|
+
3. Obtain a router by ID:
|
153
|
+
|
154
|
+
router = conn.routers.get("<router_id>")
|
155
|
+
|
156
|
+
4. Create a router:
|
157
|
+
|
158
|
+
router = conn.routers.create(
|
159
|
+
:name => "Router Model 1",
|
160
|
+
:admin_state_up => true
|
161
|
+
)
|
162
|
+
|
163
|
+
5. Add a router interface using a subnet:
|
164
|
+
|
165
|
+
router.add_interface("<subnet_id>", nil)
|
166
|
+
conn.ports # If you look at the ports, note that a new port is auto. created, the device_id is assigned to the router id, and the device_owner is updated
|
167
|
+
|
168
|
+
6. Remove a router interface using a subnet:
|
169
|
+
|
170
|
+
router.remove_interface("<subnet_id>", nil)
|
171
|
+
# Removing the interface also deletes the auto-created port
|
172
|
+
|
173
|
+
7. Add a router interface using a port:
|
174
|
+
|
175
|
+
# Add a router interface using the port you created
|
176
|
+
network = router.add_interface(nil, "<port_id>")
|
177
|
+
|
178
|
+
# Port is updated with device_id and device_owner
|
179
|
+
conn.ports.get("<port_id>")
|
180
|
+
|
181
|
+
8. Remove a router interface using a port:
|
182
|
+
|
183
|
+
router.remove_interface(nil, "<port_id>")
|
184
|
+
# after removing the interface, the associated port is deleted
|
185
|
+
|
186
|
+
9. Delete a router:
|
187
|
+
|
188
|
+
conn.routers.get("<router_id>").destroy
|
189
|
+
|
190
|
+
## Model Security Group Operations
|
191
|
+
|
192
|
+
1. List security groups:
|
193
|
+
|
194
|
+
conn.security_groups
|
195
|
+
|
196
|
+
2. List security groups using a filter:
|
197
|
+
|
198
|
+
conn.security_groups.all({:name => "My Security Group"})
|
199
|
+
|
200
|
+
3. Obtain a security group by ID:
|
201
|
+
|
202
|
+
conn.security_groups.get("<SecurityGroup_id>")
|
203
|
+
|
204
|
+
4. Create a security group:
|
205
|
+
|
206
|
+
conn.security_groups.create(
|
207
|
+
:name => 'MySecurityGroup',
|
208
|
+
:description => 'my security group description'
|
209
|
+
)
|
210
|
+
**Note:** Two security group rules are created by default for every new security group that is created: one 'ingress' and one 'egress' rule.
|
211
|
+
|
212
|
+
5. Delete a security group:
|
213
|
+
|
214
|
+
conn.security_groups.get("<SecurityGroup_id>").destroy
|
215
|
+
|
216
|
+
## Model Security Group Rules Operations
|
217
|
+
|
218
|
+
1. List security group rules:
|
219
|
+
|
220
|
+
conn.security_group_rules
|
221
|
+
|
222
|
+
2. List security group rules using a filter:
|
223
|
+
|
224
|
+
conn.security_group_rules.all({:direction => "ingress"})
|
225
|
+
|
226
|
+
3. Obtain a security group by ID:
|
227
|
+
|
228
|
+
conn.security_group_rules.get("<SecurityGroupRule_id>")
|
229
|
+
|
230
|
+
4. Create a security group rule:
|
231
|
+
|
232
|
+
conn.security_group_rules.create(
|
233
|
+
:security_group_id => "<SecurityGroup_id>",
|
234
|
+
:direction => 'ingress',
|
235
|
+
:protocol => 'tcp',
|
236
|
+
:port_range_min => 22,
|
237
|
+
:port_range_max => 22,
|
238
|
+
:remote_ip_prefix => '0.0.0.0/0'
|
239
|
+
)
|
240
|
+
|
241
|
+
5. Delete a security group rule:
|
242
|
+
|
243
|
+
conn.security_group_rules.get("<SecurityGroupRule_id>").destroy
|
244
|
+
|
245
|
+
## Model Floating IPs Operations
|
246
|
+
|
247
|
+
1. List floating IPs:
|
248
|
+
|
249
|
+
conn.floating_ips
|
250
|
+
|
251
|
+
2. List floating IPs using a filter:
|
252
|
+
|
253
|
+
conn.floating_ips.all("fixed_ip_address" => "<ip address>")
|
254
|
+
|
255
|
+
3. Obtain a floating IP by ID:
|
256
|
+
|
257
|
+
conn.floating_ips.get("<FloatingIp_id>")
|
258
|
+
|
259
|
+
4. Create a floating IP:
|
260
|
+
|
261
|
+
conn.floating_ips.create(
|
262
|
+
:floating_network_id => "<network_id>"
|
263
|
+
)
|
264
|
+
|
265
|
+
5. Delete a floating IP:
|
266
|
+
|
267
|
+
conn.floating_ips.get("<FloatingIp_id>").destroy
|
268
|
+
|
269
|
+
|
270
|
+
## Request Network Operations
|
271
|
+
|
272
|
+
1. List networks:
|
273
|
+
|
274
|
+
conn.list_networks
|
275
|
+
|
276
|
+
2. List networks using a filter:
|
277
|
+
|
278
|
+
conn.list_networks({"router:external" => true})
|
279
|
+
|
280
|
+
3. Obtain a network by ID:
|
281
|
+
|
282
|
+
conn.get_network("<network_id>")
|
283
|
+
|
284
|
+
4. Create a network:
|
285
|
+
|
286
|
+
conn.create_network({:name => "Network 1"})
|
287
|
+
|
288
|
+
5. Update a network:
|
289
|
+
|
290
|
+
conn.update_network("<network_id>", {:name => "Network 1"})
|
291
|
+
|
292
|
+
6. Delete a network:
|
293
|
+
|
294
|
+
conn.delete_network("<network_id>")
|
295
|
+
|
296
|
+
## Request Subnet Operations
|
297
|
+
|
298
|
+
1. List subnets:
|
299
|
+
|
300
|
+
conn.list_subnets
|
301
|
+
|
302
|
+
2. List subnets using a filter:
|
303
|
+
|
304
|
+
conn.list_subnets({"name"=>"My Subnet"})
|
305
|
+
|
306
|
+
3. Create a subnet:
|
307
|
+
|
308
|
+
conn.create_subnet("<network_id>", "11.0.3.0/24", 4, {:name => "My Subnet"})
|
309
|
+
|
310
|
+
4. Obtain a subnet by ID:
|
311
|
+
|
312
|
+
conn.get_subnet("<subnet_id>")
|
313
|
+
|
314
|
+
5. Update a subnet:
|
315
|
+
|
316
|
+
conn.update_subnet("<subnet_id>", {:name => My Subnet Upd"})
|
317
|
+
|
318
|
+
6. Assign a DNS server to a subnet:
|
319
|
+
|
320
|
+
conn.update_subnet("<subnet_id>", {:dns_nameservers => ["15.185.9.24"]})
|
321
|
+
|
322
|
+
7. Delete a subnet:
|
323
|
+
|
324
|
+
conn.delete_subnet("<subnet_id>")
|
325
|
+
|
326
|
+
## Request Port Operations
|
327
|
+
|
328
|
+
1. List ports:
|
329
|
+
|
330
|
+
conn.list_ports
|
331
|
+
|
332
|
+
2. List ports using a filter:
|
333
|
+
|
334
|
+
conn.list_ports({"router_id" => "<router_id>"})
|
335
|
+
|
336
|
+
3. Obtain a port by ID:
|
337
|
+
|
338
|
+
conn.get_port("<port_id>")
|
339
|
+
|
340
|
+
4. Create a port:
|
341
|
+
|
342
|
+
conn.create_port("<network_id>", {:name => "myport"})
|
343
|
+
|
344
|
+
5. Update a port:
|
345
|
+
|
346
|
+
conn.update_port("<port_id>", {:name => "My Port Upd"})
|
347
|
+
|
348
|
+
6. Delete a port:
|
349
|
+
|
350
|
+
conn.delete_port("<port_id>")
|
351
|
+
|
352
|
+
## Request Router Operations
|
353
|
+
|
354
|
+
1. List routers:
|
355
|
+
|
356
|
+
conn.list_routers
|
357
|
+
|
358
|
+
2. List routers using a filter:
|
359
|
+
|
360
|
+
conn.list_routers({"name"=>"My Router"})
|
361
|
+
|
362
|
+
3. Obtain a router:
|
363
|
+
|
364
|
+
conn.get_router("<router_id>")
|
365
|
+
|
366
|
+
4. Create a router:
|
367
|
+
|
368
|
+
conn.create_router({:name => 'My Router'})
|
369
|
+
|
370
|
+
5. Update a router:
|
371
|
+
|
372
|
+
conn.update_router("<router_id>" {:name => 'My Router Updates'})
|
373
|
+
|
374
|
+
6. Add a router interface using a subnet:
|
375
|
+
|
376
|
+
conn.add_router_interface("<router_id>", "<subnet_id>")
|
377
|
+
|
378
|
+
7. Remove a router interface using a subnet:
|
379
|
+
|
380
|
+
conn.remove_router_interface("<router_id>", "<subnet_id>")
|
381
|
+
# Removes a port with no name using the subnet_id
|
382
|
+
|
383
|
+
8. Add a router interface using a port:
|
384
|
+
|
385
|
+
conn.add_router_interface("<router_id>", nil, "<port_id>")
|
386
|
+
|
387
|
+
**Note:** Updates the router_id and device_owner for this port.
|
388
|
+
|
389
|
+
9. Remove a router interface using a port:
|
390
|
+
|
391
|
+
conn.remove_router_interface("router_id", nil, "port_id")
|
392
|
+
|
393
|
+
10. Delete a router:
|
394
|
+
|
395
|
+
conn.delete_router("<router_id>")
|
396
|
+
|
397
|
+
## Request Security Group Operations
|
398
|
+
|
399
|
+
1. List security groups:
|
400
|
+
|
401
|
+
conn.list_security_groups
|
402
|
+
|
403
|
+
2. List security groups using a filter:
|
404
|
+
|
405
|
+
conn.list_security_groups({:name => "My Security Group"})
|
406
|
+
|
407
|
+
3. Obtain a security group by ID:
|
408
|
+
|
409
|
+
conn.get_security_group("<security_group_id>")
|
410
|
+
|
411
|
+
4. Create a security group:
|
412
|
+
|
413
|
+
conn.create_security_group(
|
414
|
+
:name => "My Security Group",
|
415
|
+
:description => "What my security group does."
|
416
|
+
)
|
417
|
+
|
418
|
+
5. Delete a security group:
|
419
|
+
|
420
|
+
conn.delete_security_group("<security_group_id>")
|
421
|
+
|
422
|
+
## Request Security Group Rules Operations
|
423
|
+
|
424
|
+
1. List security group rules:
|
425
|
+
|
426
|
+
conn.list_security_group_rules
|
427
|
+
|
428
|
+
2. List security group rules using a filter:
|
429
|
+
|
430
|
+
conn.list_security_group_rules({:direction => 'egress'})
|
431
|
+
|
432
|
+
3. Obtain a security group rule by ID:
|
433
|
+
|
434
|
+
conn.get_security_group_rule("<rule_id>")
|
435
|
+
|
436
|
+
4. Create a security group rule:
|
437
|
+
|
438
|
+
conn.create_security_group_rule("<security_group_id>", 'ingress',{
|
439
|
+
:remote_ip_prefix => ""0.0.0.0/0",
|
440
|
+
:protocol => "tcp",
|
441
|
+
:port_range_min => 22,
|
442
|
+
:port_range_max => 22
|
443
|
+
})
|
444
|
+
|
445
|
+
5. Delete a security group rule:
|
446
|
+
|
447
|
+
conn.delete_security_group_rule("<rule_id>")
|
448
|
+
|
449
|
+
## Request Floating IPs Operations
|
450
|
+
|
451
|
+
1. List floating IPs:
|
452
|
+
|
453
|
+
conn.list_floating_ips
|
454
|
+
|
455
|
+
2. List floating IPs using a filter:
|
456
|
+
|
457
|
+
conn.list_floating_ips("fixed_ip_address" => "11.0.3.5")
|
458
|
+
|
459
|
+
3. Obtain a floating IP by ID:
|
460
|
+
|
461
|
+
conn.get_floating_ip("<FloatingIp_id>")
|
462
|
+
|
463
|
+
4. Create a floating IP:
|
464
|
+
|
465
|
+
conn.create_floating_ip("<FloatingIp_id>")
|
466
|
+
|
467
|
+
5. Delete a floating IP:
|
468
|
+
|
469
|
+
conn.delete_floating_IP("<FloatingIp_id>")
|
470
|
+
|
471
|
+
---------
|
472
|
+
[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)
|