profitbricks-sdk-ruby 3.0.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d905ba6dacae8a6ec1f163b24436212d45c3438
4
- data.tar.gz: 196780e401e82940e7439c6d9b3d3084191c97ad
3
+ metadata.gz: e9b5e253c0c361c2b42b17a0fd3eb4e9f018738c
4
+ data.tar.gz: aed6f9ed4fd83b4d299e76de3189966013009e79
5
5
  SHA512:
6
- metadata.gz: 23f82b287e452f82c8f77453a9a6f4839cec9f3226957c3c0a4e548547dcecc24221cfc3cec27c277ea3acaed717a0707d77035a317c14c8a2f5b4c9691b5d06
7
- data.tar.gz: 6eb60e665ca0b8455cd2f5fb9793a446602e1377fa3204a6a1f2fcc998dcf8ea20fb575838a550fd05bf57cc9e8fed9eab8dce0e2fd00837488338008dcbc74e
6
+ metadata.gz: 0fb3bffc928f8124885563d674e12b7dc7b07ec305d869ae33190ae15a2f329f5732e2d27be78a0560eed568c375187406ffa44034832de8a1c32dd962453c70
7
+ data.tar.gz: 5c64da12b69e10e5d467beacb5dd6a750dddb8993b2aec8d9741625d60606c84f8d47298a64564f8654f2a2c4aa96a533daf4b451a38881e17eabf898927dee0
data/README.md CHANGED
@@ -1,44 +1,2124 @@
1
- # ProfitBricks
2
-
3
- ProfitBricks SDK for Ruby
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'profitbricks-sdk-ruby'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install profitbricks-sdk-ruby
18
-
19
- ## Documentation and Support
20
-
21
- * A guide and reference documentation can be found in the repo docs/ directory.
22
- * [ProfitBricks SDK for Ruby](https://devops.profitbricks.com/libraries/ruby/) guide.
23
- * [ProfitBricks REST API](https://devops.profitbricks.com/api/rest/) documentation.
24
- * Ask a question or discuss at [ProfitBricks DevOps Central](https://devops.profitbricks.com/community).
25
- * Report an [issue here](https://github.com/profitbricks/profitbricks-sdk-ruby/issues).
26
-
27
- ## Testing
28
-
29
- Please note that the unit tests will create and destroy live resources under
30
- the account specified and you will be responsible for any charges incurred.
31
- Proceed with caution.
32
-
33
- Add the ProfitBricks API credentials to the `spec/spec_helper.rb` file and
34
- run the following command.
35
-
36
- $ rspec spec
37
-
38
- ## Contributing
39
-
40
- 1. Fork it ( https://github.com/[my-github-username]/profitbricks-sdk-ruby/fork )
41
- 2. Create your feature branch (`git checkout -b my-new-feature`)
42
- 3. Commit your changes (`git commit -am 'Add some feature'`)
43
- 4. Push to the branch (`git push origin my-new-feature`)
44
- 5. Create a new Pull Request
1
+ # SDK for Ruby
2
+
3
+ Version: **profitbricks-sdk-ruby v4.0.0**
4
+
5
+ ## Table of Contents
6
+
7
+ * [Description](#description)
8
+ * [Getting Started](#getting-started)
9
+ * [Installation](#installation)
10
+ * [Authenticating](#authenticating)
11
+ * [Reference](#reference)
12
+ * [Data Centers](#data-centers)
13
+ * [List Data Centers](#list-data-centers)
14
+ * [Retrieve a Data Center](#retrieve-a-data-center)
15
+ * [Create a Data Center](#create-a-data-center)
16
+ * [Update a Data Center](#update-a-data-center)
17
+ * [Delete a Data Center](#delete-a-data-center)
18
+ * [Locations](#locations)
19
+ * [List Locations](#list-locations)
20
+ * [Get a Location](#get-a-location)
21
+ * [Servers](#servers)
22
+ * [List Servers](#list-servers)
23
+ * [Retrieve a Server](#retrieve-a-server)
24
+ * [Create a Server](#create-a-server)
25
+ * [Update a Server](#update-a-server)
26
+ * [Delete a Server](#delete-a-server)
27
+ * [List Attached Volumes](#list-attached-volumes)
28
+ * [Attach a Volume](#attach-a-volume)
29
+ * [Retrieve an Attached Volume](#retrieve-an-attached-volume)
30
+ * [Detach a Volume](#detach-a-volume)
31
+ * [List Attached CD-ROMs](#list-attached-cd-roms)
32
+ * [Attach a CD-ROM](#attach-a-cd-rom)
33
+ * [Retrieve an Attached CD-ROM](#retrieve-an-attached-cd-rom)
34
+ * [Detach a CD-ROM](#detach-a-cd-rom)
35
+ * [Reboot a Server](#reboot-a-server)
36
+ * [Start a Server](#start-a-server)
37
+ * [Stop a Server](#stop-a-server)
38
+ * [Images](#images)
39
+ * [List Images](#list-images)
40
+ * [Get an Image](#get-an-image)
41
+ * [Update an Image](#update-an-image)
42
+ * [Delete an Image](#delete-an-image)
43
+ * [Volumes](#volumes)
44
+ * [List Volumes](#list-volumes)
45
+ * [Get a Volume](#get-a-volume)
46
+ * [Create a Volume](#create-a-volume)
47
+ * [Update a Volume](#update-a-volume)
48
+ * [Delete a Volume](#delete-a-volume)
49
+ * [Create a Volume Snapshot](#create-a-volume-snapshot)
50
+ * [Restore a Volume Snapshot](#restore-a-volume-snapshot)
51
+ * [Snapshots](#snapshots)
52
+ * [List Snapshots](#list-snapshots)
53
+ * [Get a Snapshot](#get-a-snapshot)
54
+ * [Update a Snapshot](#update-a-snapshot)
55
+ * [Delete a Snapshot](#delete-a-snapshot)
56
+ * [IP Blocks](#ip-blocks)
57
+ * [List IP Blocks](#list-ip-blocks)
58
+ * [Get an IP Block](#get-an-ip-block)
59
+ * [Create an IP Block](#create-an-ip-block)
60
+ * [Delete an IP Block](#delete-an-ip-block)
61
+ * [LANs](#lans)
62
+ * [List LANs](#list-lans)
63
+ * [Create a LAN](#create-a-lan)
64
+ * [Get a LAN](#get-a-lan)
65
+ * [Update a LAN](#update-a-lan)
66
+ * [Delete a LAN](#delete-a-lan)
67
+ * [Network Interfaces (NICs)](#network-interfaces)
68
+ * [List NICs](#list-nics)
69
+ * [Get a NIC](#get-a-nic)
70
+ * [Create a NIC](#create-a-nic)
71
+ * [Update a NIC](#update-a-nic)
72
+ * [Delete a NIC](#delete-a-nic)
73
+ * [Firewall Rules](#firewall-rules)
74
+ * [List Firewall Rules](#list-firewall-rules)
75
+ * [Get a Firewall Rule](#get-a-firewall-rule)
76
+ * [Create a Firewall Rule](#create-a-firewall-rule)
77
+ * [Update a Firewall Rule](#update-a-firewall-rule)
78
+ * [Delete a Firewall Rule](#delete-a-firewall-rule)
79
+ * [Load Balancers](#load-balancers)
80
+ * [List Load Balancers](#list-load-balancers)
81
+ * [Get a Load Balancer](#get-a-load-balancer)
82
+ * [Create a Load Balancer](#create-a-load-balancer)
83
+ * [Update a Load Balancer](#update-a-load-balancer)
84
+ * [List Load Balanced NICs](#list-load-balanced-nics)
85
+ * [Get a Load Balanced NIC](#get-a-load-balanced-nic)
86
+ * [Associate NIC to a Load Balancer](#associate-nic-to-a-load-balancer)
87
+ * [Remove a NIC Association](#remove-a-nic-association)
88
+ * [User Management](#user-management)
89
+ * [List Groups](#list-groups)
90
+ * [Get a Group](#get-a-group)
91
+ * [Create a Group](#create-a-group)
92
+ * [Update a Group](#update-a-group)
93
+ * [Delete a Group](#delete-a-group)
94
+ * [List Shares](#list-shares)
95
+ * [Get a Share](#get-a-share)
96
+ * [Add a Share](#add-a-share)
97
+ * [Update a Share](#update-a-share)
98
+ * [Delete a Share](#delete-a-share)
99
+ * [List Users](#list-users)
100
+ * [Get a User](#get-a-user)
101
+ * [Create a User](#create-a-user)
102
+ * [Update a User](#update-a-user)
103
+ * [Delete a User](#delete-a-user)
104
+ * [List Users in a Group](#list-users-in-a-group)
105
+ * [Add User to Group](#add-user-to-group)
106
+ * [Remove User from a Group](#remove-user-from-a-group)
107
+ * [List Resources](#list-resources)
108
+ * [Get a Resource](#get-a-resource)
109
+ * [Contract Resources](#contract-resources)
110
+ * [List Contract Resources](#list-contract-resources)
111
+ * [Requests](#requests)
112
+ * [List Requests](#list-requests)
113
+ * [Get a Request](#get-a-request)
114
+ * [Get a Request Status](#get-a-request-status)
115
+ * [Support](#support)
116
+ * [Testing](#testing)
117
+ * [Contributing](#contributing)
118
+
119
+
120
+
121
+ ## Description
122
+
123
+ This Ruby library is a wrapper for the ProfitBricks REST API. All API operations are performed over SSL and authenticated using your ProfitBricks portal credentials. The API can be accessed within an instance running in ProfitBricks or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.
124
+
125
+ This guide will show you how to programmatically perform common management tasks using the ProfitBricks SDK for Ruby.
126
+
127
+ ## Getting Started
128
+
129
+ * ProfitBricks account
130
+
131
+ Before you begin you will need to have [signed-up](https://www.profitbricks.com/signup) for a ProfitBricks account. The credentials you setup during sign-up will be used to authenticate against the API.
132
+
133
+
134
+
135
+
136
+ ## Installation
137
+
138
+ The official ProfitBricks Ruby library is available from the ProfitBricks GitHub account found [here](https://github.com/profitbricks/profitbricks-sdk-ruby). You can download the latest stable version by cloning the repository and then adding the project to your solution.
139
+
140
+ Once the SDK is downloaded:
141
+
142
+ Add this line to your application's Gemfile:
143
+
144
+ gem 'profitbricks-sdk-ruby'
145
+
146
+ And then execute:
147
+
148
+ $ bundle
149
+
150
+ Or install it yourself as:
151
+
152
+ $ gem install profitbricks-sdk-ruby
153
+
154
+ ### Authenticating
155
+
156
+ Connecting to ProfitBricks is handled by first setting up your authentication credentials.
157
+
158
+ To setup your credentials you will have to provide configure and provide your username and password
159
+
160
+ ProfitBricks.configure do |config|
161
+ config.url = 'https://api.profitbricks.com/cloudapi/v4/'
162
+ config.username = ENV['PROFITBRICKS_USERNAME']
163
+ config.password = ENV['PROFITBRICKS_PASSWORD']
164
+ config.debug = false
165
+ config.timeout = 300
166
+ config.interval = 5
167
+ config.depth=5
168
+ end
169
+
170
+
171
+ You can choose to read them from the environment variables like in the example above, or just provide the strting value for *username* and *password*.
172
+
173
+ ## Reference
174
+
175
+ This section provides details on all the available operations and the parameters they accept. Brief code snippets demonstrating usage are also included.
176
+
177
+ ### Data Centers
178
+
179
+ Virtual data centers (VDCs) are the foundation of the ProfitBricks platform. VDCs act as logical containers for all other objects you will be creating, e.g., servers. You can provision as many VDCs as you want. VDCs have their own private network and are logically segmented from each other to create isolation.
180
+
181
+
182
+ #### List Data Centers
183
+
184
+ This operation will list all currently provisioned VDCs that your account credentials provide access to.
185
+
186
+ The optional `depth` parameter can be set from the `ProfitBricks.configure` and it defines the level, one being the least and five being the most, of information returned with the response.
187
+
188
+ ```
189
+ datacenters = ProfitBricks::Datacenter.list
190
+ ```
191
+
192
+ ---
193
+
194
+ #### Retrieve a Data Center
195
+
196
+ Use this to retrieve details about a specific VDC.
197
+
198
+ The following table describes the request arguments:
199
+
200
+ | Name| Required | Type | Description |
201
+ |---|:-:|---|---|
202
+ | datacenter_id | **yes** | string | The ID of the VDC. |
203
+
204
+ ```
205
+ datacenter = ProfitBricks::Datacenter.get(datacenter_id)
206
+ ```
207
+
208
+ ---
209
+
210
+ #### Create a Data Center
211
+
212
+ Use this operation to create a new VDC. You can create a "simple" VDC by supplying just the required *name* and *location* parameters. This operation also has the capability of provisioning a "complex" VDC by supplying additional parameters for servers, volumes, LANs, and/or load balancers.
213
+
214
+ The following table describes the request arguments:
215
+
216
+ | Name| Required | Type | Description |
217
+ |---|:-:|---|---|
218
+ | name | **yes** | string | The name of the data center. |
219
+ | location | **yes** | string | The physical ProfitBricks location where the VDC will be created. |
220
+ | description | no | string | A description for the data center, e.g. staging, production. |
221
+ | servers | no | collection | Details about creating one or more servers. See [create a server](#create-a-server). |
222
+ | volumes | no | collection | Details about creating one or more volumes. See [create a volume](#create-a-volume). |
223
+ | lans | no | collection | Details about creating one or more LANs. See [create a lan](#create-a-lan). |
224
+ | loadbalancers | no | collection | Details about creating one or more load balancers. See [create a load balancer](#create-a-load- balancer). |
225
+
226
+ The following table outlines the locations currently supported:
227
+
228
+ | Value| Country | City |
229
+ |---|---|---|
230
+ | us/las | United States | Las Vegas |
231
+ | us/ewr | United States | Newark |
232
+ | de/fra | Germany | Frankfurt |
233
+ | de/fkb | Germany | Karlsruhe |
234
+
235
+ **NOTES**:
236
+ - The value for `name` cannot contain the following characters: (@, /, , |, ‘’, ‘).
237
+ - You cannot change the virtual data center `location` once it has been provisioned.
238
+
239
+ ```
240
+ datacenter = ProfitBricks::Datacenter.create(
241
+ name: 'Ruby SDK Composite Datacenter',
242
+ description: 'SDK Composite test environment',
243
+ location: 'de/fkb',
244
+ servers: [
245
+ {
246
+ name: 'New Composite Server',
247
+ ram: 1024,
248
+ cores: 1,
249
+ volumes: [
250
+ {
251
+ name: 'composite-boot',
252
+ size: 5,
253
+ type: 'HDD',
254
+ licenceType: 'UNKNOWN'
255
+ }
256
+ ]
257
+ }
258
+ ]
259
+ )
260
+
261
+ ```
262
+
263
+ ---
264
+
265
+ #### Update a Data Center
266
+
267
+ After retrieving a data center, either by getting it by id, or as a create response object, you can change its properties by calling the the `update` method. Some parameters may not be changed using either of the update methods.
268
+
269
+ The following table describes the available request arguments:
270
+
271
+ | Name| Required | Type | Description |
272
+ |---|:-:|---|---|
273
+ | datacenter_id | **yes** | string | The ID of the VDC. |
274
+ | name | no | string | The new name of the VDC. |
275
+ | description | no | string | The new description of the VDC. |
276
+
277
+ ```
278
+ datacenter.update(name: 'datacenter1', description: 'Ruby SDK test environment')
279
+ ```
280
+
281
+ ---
282
+
283
+ #### Delete a Data Center
284
+
285
+ This will remove all objects within the virtual data center AND remove the virtual data center object itself.
286
+
287
+ **NOTE**: This is a highly destructive operation which should be used with extreme caution!
288
+
289
+ The following table describes the available request arguments:
290
+
291
+ | Name| Required | Type | Description |
292
+ |---|:-:|---|---|
293
+ | datacenter_id | **yes** | string | The ID of the VDC that you want to delete. |
294
+
295
+ ```
296
+ datacenter.delete;
297
+ ```
298
+
299
+ ---
300
+
301
+ ### Locations
302
+
303
+ Locations are the physical ProfitBricks data centers where you can provision your VDCs.
304
+
305
+
306
+ #### List Locations
307
+
308
+ This operation will return the list of currently available locations.
309
+
310
+ The optional `depth` parameter can be set from the `ProfitBricks.configure` and it defines the level, one being the least and five being the most, of information returned with the response.
311
+
312
+ ```
313
+ locations = ProfitBricks::Location.list
314
+ ```
315
+
316
+ ---
317
+
318
+ #### Get a Location
319
+
320
+ Retrieves the attributes of a specific location.
321
+
322
+ The following table describes the request arguments:
323
+
324
+ | Name| Required | Type | Description |
325
+ |---|:-:|---|---|
326
+ | location_id | **yes** | string | The ID consisting of country/city. |
327
+
328
+ ```
329
+ location = ProfitBricks::Location.get(location_id)
330
+ ```
331
+
332
+ ---
333
+
334
+ ### Servers
335
+
336
+
337
+ #### List Servers
338
+
339
+ You can retrieve a list of all the servers provisioned inside a specific VDC.
340
+
341
+
342
+ The following table describes the request arguments:
343
+
344
+ | Name| Required | Type | Description |
345
+ |---|:-:|---|---|
346
+ | datacenter_id | **yes** | string | The ID of the VDC. |
347
+
348
+ ```
349
+ servers = ProfitBricks::Server.list(datacenter_id)
350
+ ```
351
+
352
+ ---
353
+
354
+ #### Retrieve a Server
355
+
356
+ Returns information about a specific server such as its configuration, provisioning status, etc.
357
+
358
+ The following table describes the request arguments:
359
+
360
+ | Name| Required | Type | Description |
361
+ |---|:-:|---|---|
362
+ | datacenter_id | **yes** | string | The ID of the VDC. |
363
+ | server_id | **yes** | string | The ID of the server. |
364
+
365
+ ```
366
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
367
+ ```
368
+
369
+ ---
370
+
371
+ #### Create a Server
372
+
373
+ Creates a server within an existing VDC. You can configure additional properties such as specifying a boot volume and connecting the server to a LAN.
374
+
375
+ The following table describes the request arguments:
376
+
377
+ | Name| Required | Type | Description |
378
+ |---|:-:|---|---|
379
+ | datacenter_id | **yes** | string | The ID of the VDC. |
380
+ | name | **yes** | string | The name of the server. |
381
+ | cores | **yes** | int | The total number of cores for the server. |
382
+ | ram | **yes** | int | The amount of memory for the server in MB, e.g. 2048. Size must be specified in multiples of 256 MB with a minimum of 256 MB; however, if you set `ram_hot_plug` to *True* then you must use a minimum of 1024 MB. |
383
+ | availabilityZone | no | string | The availability zone in which the server should exist. |
384
+ | cpuFamily | no | string | Sets the CPU type. "AMD_OPTERON" or "INTEL_XEON". Defaults to "AMD_OPTERON". |
385
+ | bootVolume | no | object | Reference to a volume used for booting. If not *null* then `bootCdrom` has to be *null*. |
386
+ | bootCdrom | no | object | Reference to a CD-ROM used for booting. If not *null* then `bootVolume` has to be *null*. |
387
+ | volumes | no | object | A collection of volume objects that you want to create and attach to the server.|
388
+ | nics | no | object | A collection of NICs you wish to create at the time the server is provisioned. |
389
+
390
+ The following table outlines the server availability zones currently supported:
391
+
392
+ | Availability Zone | Comment |
393
+ |---|---|
394
+ | AUTO | Automatically Selected Zone |
395
+ | ZONE_1 | Fire Zone 1 |
396
+ | ZONE_2 | Fire Zone 2 |
397
+
398
+ ```
399
+ server = ProfitBricks::Server.create(
400
+ datacenter_id,
401
+ name: 'New Composite Server',
402
+ ram: 1024,
403
+ cores: 1,
404
+ volumes: [
405
+ {
406
+ name: 'composite-boot',
407
+ size: 5,
408
+ type: 'HDD',
409
+ licenceType: 'UNKNOWN'
410
+ }
411
+ ],
412
+ nics: [
413
+ {
414
+ name: 'nic1',
415
+ dhcp: 'true',
416
+ lan: 1,
417
+ firewallrules: [
418
+ {
419
+ name: 'SSH',
420
+ protocol: 'TCP',
421
+ portRangeStart: 22,
422
+ portRangeEnd: 22,
423
+ }
424
+ ]
425
+ }
426
+ ])
427
+ ```
428
+
429
+ ---
430
+
431
+ #### Update a Server
432
+
433
+ Perform updates to the attributes of a server.
434
+
435
+ The following table describes the request arguments:
436
+
437
+ | Name| Required | Type | Description |
438
+ |---|:-:|---|---|
439
+ | datacenter_id | **yes** | string | The ID of the VDC. |
440
+ | server_id | **yes** | string | The ID of the server. |
441
+ | name | no | string | The name of the server. |
442
+ | cores | no | int | The number of cores for the server. |
443
+ | ram | no | int | The amount of memory in the server. |
444
+ | availabilityZone | no | string | The new availability zone for the server. |
445
+ | cpuFamily | no | string | Sets the CPU type. "AMD_OPTERON" or "INTEL_XEON". Defaults to "AMD_OPTERON". |
446
+ | bootVolume | no | object | Reference to a volume used for booting. If not *null* then `bootCdrom` has to be *null* |
447
+ | bootCdrom | no | object | Reference to a CD-ROM used for booting. If not *null* then `bootVolume` has to be *null*. |
448
+
449
+ After retrieving a server, either by getting it by id, or as a create response object, you can change its properties and call the `update` method:
450
+
451
+ ```
452
+ server = server.update(
453
+ name: 'New Server - Updated',
454
+ cores: 2
455
+ )
456
+ ```
457
+
458
+ ---
459
+
460
+ #### Delete a Server
461
+
462
+ This will remove a server from a data center. **NOTE**: This will not automatically remove the storage volume(s) attached to a server. A separate operation is required to delete a storage volume.
463
+
464
+ The following table describes the request arguments:
465
+
466
+ | Name| Required | Type | Description |
467
+ |---|:-:|---|---|
468
+ | datacenter_id | **yes** | string | The ID of the VDC. |
469
+ | server_id | **yes** | string | The ID of the server. |
470
+
471
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `delete` method directly:
472
+
473
+ ```
474
+ server.delete
475
+ ```
476
+
477
+ ---
478
+
479
+ #### List Attached Volumes
480
+
481
+ Retrieves a list of volumes attached to the server.
482
+
483
+ The following table describes the request arguments:
484
+
485
+ | Name| Required | Type | Description |
486
+ |---|:-:|---|---|
487
+ | datacenter_id | **yes** | string | The ID of the VDC. |
488
+ | server_id | **yes** | string | The ID of the server. |
489
+
490
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `list_volumes` method directly on the server instance:
491
+
492
+ ```
493
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
494
+ volumes = server.list_volumes
495
+ ```
496
+
497
+ ---
498
+
499
+ #### Attach a Volume
500
+
501
+ This will attach a pre-existing storage volume to the server.
502
+
503
+ The following table describes the request arguments:
504
+
505
+ | Name| Required | Type | Description |
506
+ |---|:-:|---|---|
507
+ | datacenter_id | **yes** | string | The ID of the VDC. |
508
+ | server_id | **yes** | string | The ID of the server. |
509
+ | volume_id | **yes** | string | The ID of a storage volume. |
510
+
511
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `attach_volume` method directly.
512
+
513
+ ```
514
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
515
+ volume = server.attach_volume(volume_id)
516
+ ```
517
+
518
+ ---
519
+
520
+ #### Retrieve an Attached Volume
521
+
522
+ This will retrieve the properties of an attached volume.
523
+
524
+ The following table describes the request arguments:
525
+
526
+ | Name| Required | Type | Description |
527
+ |---|:-:|---|---|
528
+ | datacenter_id | **yes** | string | The ID of the VDC. |
529
+ | server_id | **yes** | string | The ID of the server. |
530
+ | volume_id | **yes** | string | The ID of the attached volume. |
531
+
532
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `get_volume` method directly.
533
+
534
+ ```
535
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
536
+ volume = server.get_volume(volume_id)
537
+ ```
538
+
539
+ ---
540
+
541
+ #### Detach a Volume
542
+
543
+ This will detach the volume from the server. Depending on the volume `hot_unplug` settings, this may result in the server being rebooted.
544
+
545
+ This will NOT delete the volume from your virtual data center. You will need to make a separate request to delete a volume.
546
+
547
+ The following table describes the request arguments:
548
+
549
+ | Name| Required | Type | Description |
550
+ |---|:-:|---|---|
551
+ | datacenter_id | **yes** | string | The ID of the VDC. |
552
+ | server_id | **yes** | string | The ID of the server. |
553
+ | volume_id | **yes** | string | The ID of the attached volume. |
554
+
555
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `detach_volume` method directly.
556
+
557
+ ```
558
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
559
+ volume = server.detach_volume(volume_id)
560
+ ```
561
+
562
+ ---
563
+
564
+ #### List Attached CD-ROMs
565
+
566
+ Retrieves a list of CD-ROMs attached to a server.
567
+
568
+ The following table describes the request arguments:
569
+
570
+ | Name| Required | Type | Description |
571
+ |---|:-:|---|---|
572
+ | datacenter_id | **yes** | string | The ID of the VDC. |
573
+ | server_id | **yes** | string | The ID of the server. |
574
+
575
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `list_cdroms` method directly.
576
+
577
+ ```
578
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
579
+ cdroms = server.list_cdroms
580
+ ```
581
+
582
+ ---
583
+
584
+ #### Attach a CD-ROM
585
+
586
+ You can attach a CD-ROM to an existing server.
587
+
588
+ The following table describes the request arguments:
589
+
590
+ | Name| Required | Type | Description |
591
+ |---|:-:|---|---|
592
+ | datacenter_id | **yes** | string | The ID of the VDC. |
593
+ | server_id | **yes** | string | The ID of the server. |
594
+ | cdrom_image_id | **yes** | string | The ID of a CD-ROM. |
595
+
596
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `attach_cdrom` method directly.
597
+
598
+ ```
599
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
600
+ image = server.attach_cdrom(cdrom_image_id)
601
+ ```
602
+
603
+ ---
604
+
605
+ #### Retrieve an Attached CD-ROM
606
+
607
+ You can retrieve a specific CD-ROM attached to the server.
608
+
609
+ The following table describes the request arguments:
610
+
611
+ | Name| Required | Type | Description |
612
+ |---|:-:|---|---|
613
+ | datacenter_id | **yes** | string | The ID of the VDC. |
614
+ | server_id | **yes** | string | The ID of the server. |
615
+ | cdrom_image_id | **yes** | string | The ID of the attached CD-ROM. |
616
+
617
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `get_cdrom` method directly.
618
+
619
+ ```
620
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
621
+ cdrom = server.get_cdrom(image.id)
622
+ ```
623
+
624
+ ---
625
+
626
+ #### Detach a CD-ROM
627
+
628
+ This will detach a CD-ROM from the server.
629
+
630
+ The following table describes the request arguments:
631
+
632
+ | Name| Required | Type | Description |
633
+ |---|:-:|---|---|
634
+ | datacenter_id | **yes** | string | The ID of the VDC. |
635
+ | server_id | **yes** | string | The ID of the server. |
636
+ | cdrom_image_id | **yes** | string | The ID of the attached CD-ROM. |
637
+
638
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `detach_cdrom` method directly.
639
+
640
+ ```
641
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
642
+ server.detach_cdrom(cdrom_image_id)
643
+ ```
644
+
645
+ ---
646
+
647
+ #### Reboot a Server
648
+
649
+ This will force a hard reboot of the server. Do not use this method if you want to gracefully reboot the machine. This is the equivalent of powering off the machine and turning it back on.
650
+
651
+ The following table describes the request arguments:
652
+
653
+ | Name| Required | Type | Description |
654
+ |---|:-:|---|---|
655
+ | datacenter_id | **yes** | string | The ID of the VDC. |
656
+ | server_id | **yes** | string | The ID of the server. |
657
+
658
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `reboot` method directly.
659
+
660
+ ```
661
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
662
+ server.reboot
663
+ ```
664
+
665
+ ---
666
+
667
+ #### Start a Server
668
+
669
+ This will start a server. If the server's public IP was deallocated then a new IP will be assigned.
670
+
671
+ The following table describes the request arguments:
672
+
673
+ | Name| Required | Type | Description |
674
+ |---|:-:|---|---|
675
+ | datacenter_id | **yes** | string | The ID of the VDC. |
676
+ | server_id | **yes** | string | The ID of the server. |
677
+
678
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `start` method directly.
679
+
680
+ ```
681
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
682
+ server.start
683
+ ```
684
+
685
+ ---
686
+
687
+ #### Stop a Server
688
+
689
+ This will stop a server. The machine will be forcefully powered off, billing will cease, and the public IP, if one is allocated, will be deallocated.
690
+
691
+ The following table describes the request arguments:
692
+
693
+ | Name| Required | Type | Description |
694
+ |---|:-:|---|---|
695
+ | datacenter_id | **yes** | string | The ID of the VDC. |
696
+ | server_id | **yes** | string | The ID of the server. |
697
+
698
+ After retrieving a server, either by getting it by id, or as a create response object, you can call the `stop` method directly.
699
+
700
+ ```
701
+ server = ProfitBricks::Server.get(datacenter_id, server_id)
702
+ server.stop
703
+ ```
704
+
705
+ ---
706
+
707
+ ### Images
708
+
709
+
710
+ #### List Images
711
+
712
+ Retrieve a list of images.
713
+
714
+ The optional `depth` parameter can be set from the `ProfitBricks.configure` and it defines the level, one being the least and five being the most, of information returned with the response.
715
+
716
+ ```
717
+ images = ProfitBricks::Image.list
718
+ ```
719
+
720
+ ---
721
+
722
+ #### Get an Image
723
+
724
+ Retrieves the attributes of a specific image.
725
+
726
+ The following table describes the request arguments:
727
+
728
+ | Name| Required | Type | Description |
729
+ |---|:-:|---|---|
730
+ | image_id | **yes** | string | The ID of the image. |
731
+
732
+ ```
733
+ ProfitBricks::Image.get(image_id)
734
+ ```
735
+
736
+ ---
737
+
738
+ ### Volumes
739
+
740
+
741
+ #### List Volumes
742
+
743
+ Retrieve a list of volumes within the virtual data center. If you want to retrieve a list of volumes attached to a server please see the [List Attached Volumes](#list-attached-volumes) entry in the Server section for details.
744
+
745
+ The following table describes the request arguments:
746
+
747
+ | Name| Required | Type | Description |
748
+ |---|:-:|---|---|
749
+ | datacenter_id | **yes** | string | The ID of the VDC. |
750
+
751
+ ```
752
+ volumes = ProfitBricks::Volume.list(datacenter_id)
753
+ ```
754
+
755
+ ---
756
+
757
+ #### Get a Volume
758
+
759
+ Retrieves the attributes of a given volume.
760
+
761
+ The following table describes the request arguments:
762
+
763
+ | Name| Required | Type | Description |
764
+ |---|:-:|---|---|
765
+ | datacenter_id | **yes** | string | The ID of the VDC. |
766
+ | volume_id | **yes** | string | The ID of the volume. |
767
+
768
+ ```
769
+ volumes = ProfitBricks::Volume.get(datacenter_id,volume_id)
770
+ ```
771
+
772
+ ---
773
+
774
+ #### Create a Volume
775
+
776
+ Creates a volume within the virtual data center. This will NOT attach the volume to a server. Please see the [Attach a Volume](#attach-a-volume) entry in the Server section for details on how to attach storage volumes.
777
+
778
+ The following table describes the request arguments:
779
+
780
+ | Name| Required | Type | Description |
781
+ |---|:-:|---|---|
782
+ | datacenter_id | **yes** | string | The ID of the VDC. |
783
+ | name | no | string | The name of the volume. |
784
+ | size | **yes** | int | The size of the volume in GB. |
785
+ | bus | no | string | The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. |
786
+ | image | **yes** | string | The image or snapshot ID. |
787
+ | type | **yes** | string | The volume type, HDD or SSD. |
788
+ | licenceType | **yes** | string | The licence type of the volume. Options: LINUX, WINDOWS, WINDOWS2016, UNKNOWN, OTHER |
789
+ | imagePassword | **yes** | string | One-time password is set on the Image for the appropriate root or administrative account. This field may only be set in creation requests. When reading, it always returns *null*. The password has to contain 8-50 characters. Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789] |
790
+ | sshKeys | **yes** | string | SSH keys to allow access to the volume via SSH. |
791
+ | availabilityZone | no | string | The storage availability zone assigned to the volume. Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes. Leave blank or set to AUTO when provisioning SSD volumes. |
792
+
793
+ The following table outlines the various licence types you can define:
794
+
795
+ | Licence Type | Comment |
796
+ |---|---|
797
+ | WINDOWS2016 | Use this for the Microsoft Windows Server 2016 operating system. |
798
+ | WINDOWS | Use this for the Microsoft Windows Server 2008 and 2012 operating systems. |
799
+ | LINUX |Use this for Linux distributions such as CentOS, Ubuntu, Debian, etc. |
800
+ | OTHER | Use this for any volumes that do not match one of the other licence types. |
801
+ | UNKNOWN | This value may be inherited when you've uploaded an image and haven't set the license type. Use one of the options above instead. |
802
+
803
+ The following table outlines the storage availability zones currently supported:
804
+
805
+ | Availability Zone | Comment |
806
+ |---|---|
807
+ | AUTO | Automatically Selected Zone |
808
+ | ZONE_1 | Fire Zone 1 |
809
+ | ZONE_2 | Fire Zone 2 |
810
+ | ZONE_3 | Fire Zone 3 |
811
+
812
+ * You will need to provide either the `image` or the `licenceType` parameters. `licenceType` is required, but if `image` is supplied, it is already set and cannot be changed. Similarly either the `imagePassword` or `sshKeys` parameters need to be supplied when creating a volume. We recommend setting a valid value for `imagePassword` even when using `sshKeys` so that it is possible to authenticate using the remote console feature of the DCD.
813
+
814
+ ```
815
+ volume = ProfitBricks::Volume.create(
816
+ datacenter_id, name: 'my boot volume for server 1',
817
+ size: 5,
818
+ type: 'HDD',
819
+ licenceType: 'UNKNOWN',
820
+ availabilityZone: 'AUTO')
821
+ ```
822
+
823
+ ---
824
+
825
+ #### Update a Volume
826
+
827
+ You can update -- in full or partially -- various attributes on the volume; however, some restrictions are in place:
828
+
829
+ You can increase the size of an existing storage volume. You cannot reduce the size of an existing storage volume. The volume size will be increased without requiring a reboot if the relevant hot plug settings have been set to *true*. The additional capacity is not added automatically added to any partition, therefore you will need to handle that inside the OS afterwards. Once you have increased the volume size you cannot decrease the volume size.
830
+
831
+ Since an existing volume is being modified, none of the request parameters are specifically required as long as the changes being made satisfy the requirements for creating a volume.
832
+
833
+ The following table describes the request arguments:
834
+
835
+ | Name| Required | Type | Description |
836
+ |---|:-:|---|---|
837
+ | datacenter_id | **yes** | string | The ID of the VDC. |
838
+ | volume_id | **yes** | string | The ID of the volume. |
839
+ | name | no | string | The name of the volume. |
840
+ | size | no | int | The size of the volume in GB. Only increase when updating. |
841
+ | bus | no | string | The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. |
842
+ | image | no | string | The image or snapshot ID. |
843
+ | type | no | string | The volume type, HDD or SSD. |
844
+ | licenceType | no | string | The licence type of the volume. Options: LINUX, WINDOWS, WINDOWS2016, UNKNOWN, OTHER |
845
+ | availabilityZone | no | string | The storage availability zone assigned to the volume. Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes. Leave blank or set to AUTO when provisioning SSD volumes. |
846
+
847
+ After retrieving a volume, either by getting it by id, or as a create response object, you can change its properties and call the `update` method:
848
+
849
+ ```
850
+ volume = volume.update(
851
+ name: 'Resized storage to 15 GB',
852
+ size: 15
853
+ )
854
+ ```
855
+
856
+ ---
857
+
858
+ #### Delete a Volume
859
+
860
+ Deletes the specified volume. This will result in the volume being removed from your data center. Use this with caution.
861
+
862
+ The following table describes the request arguments:
863
+
864
+ | Name| Required | Type | Description |
865
+ |---|:-:|---|---|
866
+ | datacenter_id | **yes** | string | The ID of the VDC. |
867
+ | volume_id | **yes** | string | The ID of the volume. |
868
+
869
+ After retrieving a volume, either by getting it by id, or as a create response object, you can call the `delete` method directly.
870
+
871
+ ```
872
+ volumes = ProfitBricks::Volume.get(datacenter_id,volume_id)
873
+ volume.delete
874
+ ```
875
+
876
+ ---
877
+
878
+ #### Create a Volume Snapshot
879
+
880
+ Creates a snapshot of a volume within the virtual data center. You can use a snapshot to create a new storage volume or to restore a storage volume.
881
+
882
+ The following table describes the request arguments:
883
+
884
+ | Name| Required | Type | Description |
885
+ |---|:-:|---|---|
886
+ | datacenter_id | **yes** | string | The ID of the VDC. |
887
+ | volume_id | **yes** | string | The ID of the volume. |
888
+ | name | no | string | The name of the snapshot. |
889
+ | description | no | string | The description of the snapshot. |
890
+
891
+ After retrieving a volume, either by getting it by id, or as a create response object, you can call the `create_snapshot` method directly.
892
+
893
+ ```
894
+ volume = ProfitBricks::Volume.get(datacenter_id,volume_id)
895
+ snapshot = volume.create_snapshot(
896
+ name: 'Snapshot of storage X on 12.12.12 12:12:12 - updated',
897
+ description: 'description of a snapshot - updated')
898
+ ```
899
+
900
+ ---
901
+
902
+ #### Restore a Volume Snapshot
903
+
904
+ This will restore a snapshot onto a volume. A snapshot is created as just another image that can be used to create new volumes or to restore an existing volume.
905
+
906
+ The following table describes the request arguments:
907
+
908
+ | Name| Required | Type | Description |
909
+ |---|:-:|---|---|
910
+ | datacenter_id | **yes** | string | The ID of the VDC. |
911
+ | snapshot_id | **yes** | string | The ID of the snapshot. |
912
+
913
+ After retrieving a volume, either by getting it by id, or as a create response object, you can call the `restore_snapshot` method directly.
914
+
915
+ ```
916
+ volume = ProfitBricks::Volume.get(datacenter_id,volume_id)
917
+ volume.restore_snapshot(snapshot_id)
918
+ ```
919
+
920
+ ---
921
+
922
+ ### Snapshots
923
+
924
+
925
+ #### List Snapshots
926
+
927
+ You can retrieve a list of all available snapshots.
928
+
929
+ The optional `depth` parameter can be set from the `ProfitBricks.configure` and it defines the level, one being the least and five being the most, of information returned with the response.
930
+
931
+ ```
932
+ snapshots = ProfitBricks::Snapshot.list
933
+ ```
934
+
935
+ ---
936
+
937
+ #### Get a Snapshot
938
+
939
+ Retrieves the attributes of a specific snapshot.
940
+
941
+ The following table describes the request arguments:
942
+
943
+ | Name| Required | Type | Description |
944
+ |---|:-:|---|---|
945
+ | snapshot_id | **yes** | string | The ID of the snapshot. |
946
+
947
+ ```
948
+ snapshot = ProfitBricks::Snapshot.get(snapshot_id)
949
+ ```
950
+
951
+ ---
952
+
953
+ #### Update a Snapshot
954
+
955
+ Perform updates to attributes of a snapshot.
956
+
957
+ The following table describes the request arguments:
958
+
959
+ | Name| Required | Type | Description |
960
+ |---|:-:|---|---|
961
+ | snapshot_id | **yes** | string | The ID of the snapshot. |
962
+ | name | no | string | The name of the snapshot. |
963
+ | description | no | string | The description of the snapshot. |
964
+ | licenceType | no | string | The snapshot's licence type: LINUX, WINDOWS, WINDOWS2016, or OTHER. |
965
+ | cpuHotPlug | no | bool | This volume is capable of CPU hot plug (no reboot required) |
966
+ | cpuHotUnplug | no | bool | This volume is capable of CPU hot unplug (no reboot required) |
967
+ | ramHotPlug | no | bool | This volume is capable of memory hot plug (no reboot required) |
968
+ | ramHotUnplug | no | bool | This volume is capable of memory hot unplug (no reboot required) |
969
+ | nicHotPlug | no | bool | This volume is capable of NIC hot plug (no reboot required) |
970
+ | nicHotUnplug | no | bool | This volume is capable of NIC hot unplug (no reboot required) |
971
+ | discVirtioHotPlug | no | bool | This volume is capable of VirtIO drive hot plug (no reboot required) |
972
+ | discVirtioHotUnplug | no | bool | This volume is capable of VirtIO drive hot unplug (no reboot required) |
973
+ | discScsiHotPlug | no | bool | This volume is capable of SCSI drive hot plug (no reboot required) |
974
+ | discScsiHotUnplug | no | bool | This volume is capable of SCSI drive hot unplug (no reboot required) |
975
+
976
+ After retrieving a snapshot, either by getting it by id, or as a create response object, you can change its properties and call the `update` method:
977
+
978
+ ```
979
+ snapshot = ProfitBricks::Snapshot.get(snapshot_id)
980
+ snapshot = snapshot.update(name: 'New name')
981
+ ```
982
+
983
+ ---
984
+
985
+ #### Delete a Snapshot
986
+
987
+ Deletes the specified snapshot.
988
+
989
+ The following table describes the request arguments:
990
+
991
+ | Name| Required | Type | Description |
992
+ |---|:-:|---|---|
993
+ | snapshot_id | **yes** | string | The ID of the snapshot. |
994
+
995
+ After retrieving a snapshot, either by getting it by id, or as a create response object, you can call the `delete` method directly.
996
+
997
+ ```
998
+ snapshot = ProfitBricks::Snapshot.get(snapshot_id)
999
+ snapshot.delete
1000
+ ```
1001
+
1002
+ ---
1003
+
1004
+ ### IP Blocks
1005
+
1006
+ The IP block operations assist with managing reserved /static public IP addresses.
1007
+
1008
+
1009
+ #### List IP Blocks
1010
+
1011
+ Retrieve a list of available IP blocks.
1012
+
1013
+ ```
1014
+ ipblocks = ProfitBricks::IPBlock.list
1015
+ ```
1016
+
1017
+ #### Get an IP Block
1018
+
1019
+ Retrieves the attributes of a specific IP block.
1020
+
1021
+ The following table describes the request arguments:
1022
+
1023
+ | Name| Required | Type | Description |
1024
+ |---|:-:|---|---|
1025
+ | ipblock_id | **yes** | string | The ID of the IP block. |
1026
+
1027
+ ```
1028
+ ipblock = ProfitBricks::IPBlock.get(ipblock_id)
1029
+ ```
1030
+
1031
+ ---
1032
+
1033
+ #### Create an IP Block
1034
+
1035
+ Creates an IP block. IP blocks are attached to a location, so you must specify a valid `location` along with a `size` parameter indicating the number of IP addresses you want to reserve in the IP block. Servers or other resources using an IP address from an IP block must be in the same `location`.
1036
+
1037
+ The following table describes the request arguments:
1038
+
1039
+ | Name| Required | Type | Description |
1040
+ |---|:-:|---|---|
1041
+ | location | **yes** | string | This must be one of the locations: us/las, us/ewr, de/fra, de/fkb. |
1042
+ | size | **yes** | int | The size of the IP block you want. |
1043
+ | name | no | string | A descriptive name for the IP block |
1044
+
1045
+ The following table outlines the locations currently supported:
1046
+
1047
+ | Value| Country | City |
1048
+ |---|---|---|
1049
+ | us/las | United States | Las Vegas |
1050
+ | us/ewr | United States | Newark |
1051
+ | de/fra | Germany | Frankfurt |
1052
+ | de/fkb | Germany | Karlsruhe |
1053
+
1054
+ To create an IP block, establish the parameters and then call `reserve`.
1055
+
1056
+ ```
1057
+ ipblock = ProfitBricks::IPBlock.reserve
1058
+ (
1059
+ location: "de/fra",
1060
+ size: 1
1061
+ )
1062
+ ```
1063
+
1064
+ ---
1065
+
1066
+ #### Delete an IP Block
1067
+
1068
+ Deletes the specified IP Block.
1069
+
1070
+ The following table describes the request arguments:
1071
+
1072
+ | Name| Required | Type | Description |
1073
+ |---|:-:|---|---|
1074
+ | ipblock_id | **yes** | string | The ID of the IP block. |
1075
+
1076
+ After retrieving an IP block, either by getting it by id, or as a create response object, you can call the `release` method directly.
1077
+
1078
+ ```
1079
+ ipblock = ProfitBricks::IPBlock.get(ipblock_id)
1080
+ ipblock.release
1081
+ ```
1082
+
1083
+ ---
1084
+
1085
+ ### LANs
1086
+
1087
+ #### List LANs
1088
+
1089
+ Retrieve a list of LANs within the virtual data center.
1090
+
1091
+ The following table describes the request arguments:
1092
+
1093
+ | Name| Required | Type | Description |
1094
+ |---|:-:|---|---|
1095
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1096
+
1097
+ ```
1098
+ lans = ProfitBricks::LAN.list(datacenter_id)
1099
+ ```
1100
+
1101
+ ---
1102
+
1103
+ #### Create a LAN
1104
+
1105
+ Creates a LAN within a virtual data center.
1106
+
1107
+ The following table describes the request arguments:
1108
+
1109
+ | Name| Required | Type | Description |
1110
+ |---|:-:|---|---|
1111
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1112
+ | name | no | string | The name of your LAN. |
1113
+ | public | **Yes** | bool | Boolean indicating if the LAN faces the public Internet or not. |
1114
+ | nics | no | object | A collection of NICs associated with the LAN. |
1115
+
1116
+ ```
1117
+ lan = ProfitBricks::LAN.create(datacenter_id, name: 'public Lan 4',
1118
+ public: 'true')
1119
+ ```
1120
+
1121
+ ---
1122
+
1123
+ #### Get a LAN
1124
+
1125
+ Retrieves the attributes of a given LAN.
1126
+
1127
+ The following table describes the request arguments:
1128
+
1129
+ | Name| Required | Type | Description |
1130
+ |---|:-:|---|---|
1131
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1132
+ | lan_id | **yes** | int | The ID of the LAN. |
1133
+
1134
+ ```
1135
+ lan = ProfitBricks::LAN.get(datacenter_id, lan_id)
1136
+ ```
1137
+
1138
+ ---
1139
+
1140
+ #### Update a LAN
1141
+
1142
+ Perform updates to attributes of a LAN.
1143
+
1144
+ The following table describes the request arguments:
1145
+
1146
+ | Name| Required | Type | Description |
1147
+ |---|:-:|---|---|
1148
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1149
+ | lan_id | **yes** | int | The ID of the LAN. |
1150
+ | name | no | string | A descriptive name for the LAN. |
1151
+ | public | no | bool | Boolean indicating if the LAN faces the public Internet or not. |
1152
+
1153
+ After retrieving a LAN, either by getting it by id, or as a create response object, you can change its properties and call the `update` method:
1154
+
1155
+ ```
1156
+ lan = lan.update(public: false)
1157
+ ```
1158
+
1159
+ ---
1160
+
1161
+ #### Delete a LAN
1162
+
1163
+ Deletes the specified LAN.
1164
+
1165
+ The following table describes the request arguments:
1166
+
1167
+ | Name| Required | Type | Description |
1168
+ |---|:-:|---|---|
1169
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1170
+ | lan_id | **yes** | string | The ID of the LAN. |
1171
+
1172
+ After retrieving a LAN, either by getting it by id, or as a create response object, you can call the `delete` method directly.
1173
+
1174
+ ```
1175
+ lan = ProfitBricks::LAN.get(datacenter_id, lan_id)
1176
+ lan.delete
1177
+ ```
1178
+
1179
+ ---
1180
+
1181
+ ### Network Interfaces
1182
+
1183
+
1184
+ #### List NICs
1185
+
1186
+ Retrieve a list of LANs within the virtual data center.
1187
+
1188
+ The following table describes the request arguments:
1189
+
1190
+ | Name| Required | Type | Description |
1191
+ |---|:-:|---|---|
1192
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1193
+ | server_id | **yes** | string | The ID of the server. |
1194
+
1195
+ ```
1196
+ nics = ProfitBricks::NIC.list(datacenter_id, server_id)
1197
+ ```
1198
+
1199
+ ---
1200
+
1201
+ #### Get a NIC
1202
+
1203
+ Retrieves the attributes of a given NIC.
1204
+
1205
+ The following table describes the request arguments:
1206
+
1207
+ | Name| Required | Type | Description |
1208
+ |---|:-:|---|---|
1209
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1210
+ | server_id | **yes** | string | The ID of the server. |
1211
+ | nic_id | **yes** | string | The ID of the NIC. |
1212
+
1213
+ ```
1214
+ nic = ProfitBricks::NIC.get(datacenter_id, server_id, nic_id)
1215
+ ```
1216
+
1217
+ ---
1218
+
1219
+ #### Create a NIC
1220
+
1221
+ Adds a NIC to the target server.
1222
+
1223
+ The following table describes the request arguments:
1224
+
1225
+ | Name| Required | Type | Description |
1226
+ |---|:-:|---|---|
1227
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1228
+ | server_id | **yes** | string| The ID of the server. |
1229
+ | name | no | string | The name of the NIC. |
1230
+ | ips | no | string collection | IPs assigned to the NIC. This can be a collection. |
1231
+ | dhcp | no | bool | Set to FALSE if you wish to disable DHCP on the NIC. Default: TRUE. |
1232
+ | lan | **yes** | int | The LAN ID the NIC will sit on. If the LAN ID does not exist it will be created. |
1233
+ | nat | no | bool | Indicates the private IP address has outbound access to the public internet. |
1234
+ | firewallActive | no | bool | Once you add a firewall rule this will reflect a true value. |
1235
+ | firewallRules | no | object| A list of firewall rules associated to the NIC represented as a collection. |
1236
+
1237
+ ```
1238
+ nic = ProfitBricks::NIC.create
1239
+ (
1240
+ datacenter_id, server_id, name: 'nic1',
1241
+ dhcp: true,
1242
+ lan: 1,
1243
+ firewallActive: true,
1244
+ nat: false)
1245
+ ```
1246
+
1247
+ ---
1248
+
1249
+ #### Update a NIC
1250
+
1251
+ You can update -- in full or partially -- various attributes on the NIC; however, some restrictions are in place:
1252
+
1253
+ The primary address of a NIC connected to a load balancer can only be changed by changing the IP of the load balancer. You can also add additional reserved, public IPs to the NIC.
1254
+
1255
+ The user can specify and assign private IPs manually. Valid IP addresses for private networks are 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16.
1256
+
1257
+ The following table describes the request arguments:
1258
+
1259
+ | Name| Required | Type | Description |
1260
+ |---|:-:|---|---|
1261
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1262
+ | server_id | **yes** | string| The ID of the server. |
1263
+ | nic_id | **yes** | string| The ID of the NIC. |
1264
+ | name | no | string | The name of the NIC. |
1265
+ | ips | no | string collection | IPs assigned to the NIC represented as a collection. |
1266
+ | dhcp | no | bool | Boolean value that indicates if the NIC is using DHCP or not. |
1267
+ | lan | no | int | The LAN ID the NIC sits on. |
1268
+ | nat | no | bool | Indicates the private IP address has outbound access to the public internet. |
1269
+
1270
+ After retrieving a NIC, either by getting it by id, or as a create response object, you can call the `update` method directly.
1271
+
1272
+ ```
1273
+ nic = ProfitBricks::NIC.get(datacenter_id, server_id, nic_id)
1274
+ nic = nic.update(ips: ['10.1.1.1', '10.1.1.2'])
1275
+ ```
1276
+
1277
+ ---
1278
+
1279
+ #### Delete a NIC
1280
+
1281
+ Deletes the specified NIC.
1282
+
1283
+ The following table describes the request arguments:
1284
+
1285
+ | Name| Required | Type | Description |
1286
+ |---|:-:|---|---|
1287
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1288
+ | server_id | **yes** | string| The ID of the server. |
1289
+ | nic_id | **yes** | string| The ID of the NIC. |
1290
+
1291
+ After retrieving a NIC, either by getting it by id, or as a create response object, you can call the `Delete` method directly.
1292
+
1293
+ ```
1294
+ nic = ProfitBricks::NIC.get(datacenter_id, server_id, nic_id)
1295
+ nic.delete
1296
+ ```
1297
+
1298
+ ---
1299
+
1300
+ ### Firewall Rules
1301
+
1302
+ #### List Firewall Rules
1303
+
1304
+ Retrieves a list of firewall rules associated with a particular NIC.
1305
+
1306
+ The following table describes the request arguments:
1307
+
1308
+ | Name| Required | Type | Description |
1309
+ |---|:-:|---|---|
1310
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1311
+ | server_id | **yes** | string | The ID of the server. |
1312
+ | nic_id | **yes** | string | The ID of the NIC. |
1313
+
1314
+ ```
1315
+ fwrules = ProfitBricks::Firewall.list(datacenter_id, server_id, nic_id)
1316
+ ```
1317
+
1318
+ ---
1319
+
1320
+ #### Get a Firewall Rule
1321
+
1322
+ Retrieves the attributes of a given firewall rule.
1323
+
1324
+ The following table describes the request arguments:
1325
+
1326
+ | Name| Required | Type | Description |
1327
+ |---|:-:|---|---|
1328
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1329
+ | server_id | **yes** | string | The ID of the server. |
1330
+ | nic_id | **yes** | string | The ID of the NIC. |
1331
+ | firewall_rule_id | **yes** | string | The ID of the firewall rule. |
1332
+
1333
+ ```
1334
+ fwrule = ProfitBricks::Firewall.get(datacenter_id, server_id, nic_id, firewall_rule_id)
1335
+ ```
1336
+
1337
+ ---
1338
+
1339
+ #### Create a Firewall Rule
1340
+
1341
+ This will add a firewall rule to the NIC.
1342
+
1343
+ The following table describes the request arguments:
1344
+
1345
+ | Name| Required | Type | Description |
1346
+ |---|:-:|---|---|
1347
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1348
+ | server_id | **yes** | string | The ID of the server. |
1349
+ | nic_id | **yes** | string | The ID of the NIC. |
1350
+ | name | no | string | The name of the firewall rule. |
1351
+ | protocol | **yes** | string | The protocol for the rule: TCP, UDP, ICMP, ANY. |
1352
+ | sourceMac | no | string | Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. A *null* value allows all source MAC address. |
1353
+ | sourceIp | no | string | Only traffic originating from the respective IPv4 address is allowed. A *null* value allows all source IPs. |
1354
+ | targetIp | no | string | In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. A *null* value allows all target IPs. |
1355
+ | portRangeStart | no | string | Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave `portRangeStart` and `portRangeEnd` value as *null* to allow all ports. |
1356
+ | portRangeEnd | no | string | Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave `portRangeStart` and `portRangeEnd` value as *null* to allow all ports. |
1357
+ | icmpType | no | string | Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. A *null* value allows all types. |
1358
+ | icmpCode | no | string | Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. A *null* value allows all codes. |
1359
+
1360
+ ```
1361
+ fwrule = ProfitBricks::Firewall.create(
1362
+ datacenter_id, server_id, nic_id, name: 'SSH',
1363
+ protocol: 'TCP',
1364
+ sourceMac: '01:23:45:67:89:00',
1365
+ sourceIp: nil,
1366
+ targetIp: nil,
1367
+ portRangeStart: 22,
1368
+ portRangeEnd: 22,
1369
+ icmpType: nil,
1370
+ icmpCode: nil)
1371
+ ```
1372
+
1373
+ ---
1374
+
1375
+ #### Update a Firewall Rule
1376
+
1377
+ Perform updates to attributes of a firewall rule.
1378
+
1379
+ The following table describes the request arguments:
1380
+
1381
+ | Name| Required | Type | Description |
1382
+ |---|:-:|---|---|
1383
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1384
+ | server_id | **yes** | string | The ID of the server. |
1385
+ | nic_id | **yes** | string | The ID of the NIC. |
1386
+ | firewall_rule_id | **yes** | string | The ID of the firewall rule. |
1387
+ | name | no | string | The name of the firewall rule. |
1388
+ | sourceMac | no | string | Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. A *null* value allows all source MAC address. |
1389
+ | sourceIp | no | string | Only traffic originating from the respective IPv4 address is allowed. A *null* value allows all source IPs. |
1390
+ | targetIp | no | string | In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. A *null* value allows all target IPs. |
1391
+ | portRangeStart | no | string | Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave `portRangeStart` and `portRangeEnd` value as *null* to allow all ports. |
1392
+ | portRangeEnd | no | string | Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave `portRangeStart` and `portRangeEnd` value as *null* to allow all ports. |
1393
+ | IcmpType | no | string | Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. A *null* value allows all types. |
1394
+ | IcmpCode | no | string | Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. A *null* value allows all codes. |
1395
+
1396
+ After retrieving a firewall rule, either by getting it by id, or as a create response object, you can change its properties and call the `update` method:
1397
+
1398
+ ```
1399
+ fwrule = ProfitBricks::Firewall.get(datacenter_id, server_id, nic_id, firewall_rule_id)
1400
+ fwrule = fwrule.update(
1401
+ sourceMac: '01:98:22:22:44:22',
1402
+ targetIp: '123.100.101.102'
1403
+ )
1404
+ ```
1405
+
1406
+ ---
1407
+
1408
+ #### Delete a Firewall Rule
1409
+
1410
+ Removes the specific firewall rule.
1411
+
1412
+ | Name| Required | Type | Description |
1413
+ |---|:-:|---|---|
1414
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1415
+ | server_id | **yes** | string | The ID of the server. |
1416
+ | nic_id | **yes** | string | The ID of the NIC. |
1417
+ | firewall_rule_id | **yes** | string | The ID of the firewall rule. |
1418
+
1419
+ After retrieving a firewall rule, either by getting it by id, or as a create response object, you can call the `delete` method directly.
1420
+
1421
+ ```
1422
+ fwrule = ProfitBricks::Firewall.get(datacenter_id, server_id, nic_id, firewall_rule_id)
1423
+ fwrule.delete
1424
+ ```
1425
+
1426
+ ---
1427
+
1428
+
1429
+
1430
+ ### Load Balancers
1431
+
1432
+ #### List Load Balancers
1433
+
1434
+ Retrieve a list of load balancers within the data center.
1435
+
1436
+ The following table describes the request arguments:
1437
+
1438
+ | Name| Required | Type | Description |
1439
+ |---|:-:|---|---|
1440
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1441
+
1442
+ ```
1443
+ loadbalancers = ProfitBricks::Loadbalancer.list(datacenter_id)
1444
+ ```
1445
+
1446
+ ---
1447
+
1448
+ #### Get a Load Balancer
1449
+
1450
+ Retrieves the attributes of a given load balancer.
1451
+
1452
+ The following table describes the request arguments:
1453
+
1454
+ | Name| Required | Type | Description |
1455
+ |---|:-:|---|---|
1456
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1457
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1458
+
1459
+ ```
1460
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1461
+ ```
1462
+
1463
+ ---
1464
+
1465
+ #### Create a Load Balancer
1466
+
1467
+ Creates a load balancer within the virtual data center. Load balancers can be used for public or private IP traffic.
1468
+
1469
+ The following table describes the request arguments:
1470
+
1471
+ | Name| Required | Type | Description |
1472
+ |---|:-:|---|---|
1473
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1474
+ | name | **yes** | string | The name of the load balancer. |
1475
+ | ip | no | string | IPv4 address of the load balancer. All attached NICs will inherit this IP. |
1476
+ | dhcp | no | bool | Indicates if the load balancer will reserve an IP using DHCP. |
1477
+ | balancedNics | no | string collection | List of NICs taking part in load-balancing. All balanced NICs inherit the IP of the load balancer. |
1478
+
1479
+ ```
1480
+ loadbalancer = ProfitBricks::Loadbalancer.create(
1481
+ datacenter_id, name: 'My LB',
1482
+ # ip: '10.2.2.3',
1483
+ dhcp: 'true')
1484
+ ```
1485
+
1486
+ ---
1487
+
1488
+ #### Update a Load Balancer
1489
+
1490
+ Perform updates to attributes of a load balancer.
1491
+
1492
+ The following table describes the request arguments:
1493
+
1494
+ | Name| Required | Type | Description |
1495
+ |---|:-:|---|---|
1496
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1497
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1498
+ | name | no | string | The name of the load balancer. |
1499
+ | ip | no | string | The IP of the load balancer. |
1500
+ | dhcp | no | bool | Indicates if the load balancer will reserve an IP using DHCP. |
1501
+
1502
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can change it's properties and call the `update` method:
1503
+
1504
+ ```
1505
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1506
+ loadbalancer = loadbalancer.update(
1507
+ ip: '10.1.1.2'
1508
+ )
1509
+ ```
1510
+
1511
+ ---
1512
+
1513
+ #### Delete a Load Balancer
1514
+
1515
+ Deletes the specified load balancer.
1516
+
1517
+ The following table describes the request arguments:
1518
+
1519
+ | Name| Required | Type | Description |
1520
+ |---|:-:|---|---|
1521
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1522
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1523
+
1524
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can call the `delete` method directly.
1525
+
1526
+ ```
1527
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1528
+ loadbalancer.delete
1529
+ ```
1530
+
1531
+ ---
1532
+
1533
+ #### List Load Balanced NICs
1534
+
1535
+ This will retrieve a list of NICs associated with the load balancer.
1536
+
1537
+ The following table describes the request arguments:
1538
+
1539
+ | Name| Required | Type | Description |
1540
+ |---|:-:|---|---|
1541
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1542
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1543
+
1544
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can call the `list_balanced_nics` method directly.
1545
+
1546
+ ```
1547
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1548
+ balanced_nics = loadbalancer.list_balanced_nics
1549
+ ```
1550
+
1551
+ ---
1552
+
1553
+ #### Get a Load Balanced NIC
1554
+
1555
+ Retrieves the attributes of a given load balanced NIC.
1556
+
1557
+ The following table describes the request arguments:
1558
+
1559
+ | Name| Required | Type | Description |
1560
+ |---|:-:|---|---|
1561
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1562
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1563
+ | nic_id | **yes** | string | The ID of the NIC. |
1564
+
1565
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can call the `get_balanced_nic` method directly.
1566
+
1567
+ ```
1568
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1569
+ nic = ProfitBricks::NIC.get(datacenter_id, server_id, nic_id)
1570
+ balanced_nic = loadbalancer.get_balanced_nic(nic_id)
1571
+ ```
1572
+
1573
+ ---
1574
+
1575
+ #### Associate NIC to a Load Balancer
1576
+
1577
+ This will associate a NIC to a load balancer, enabling the NIC to participate in load-balancing.
1578
+
1579
+ The following table describes the request arguments:
1580
+
1581
+ | Name| Required | Type | Description |
1582
+ |---|:-:|---|---|
1583
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1584
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1585
+ | nic_id | **yes** | string | The ID of the NIC. |
1586
+
1587
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can call the `associate_balanced_nic` method directly.
1588
+
1589
+ ```
1590
+ loadbalancer = ProfitBricks::Loadbalancer.get(datacenter_id, loadbalancer_id)
1591
+ nic = ProfitBricks::NIC.get(datacenter_id, server_id, nic_id)
1592
+ balanced_nic = loadbalancer.associate_balanced_nic(nic.id)
1593
+ ```
1594
+
1595
+ ---
1596
+
1597
+ #### Remove a NIC Association
1598
+
1599
+ Removes the association of a NIC with a load balancer.
1600
+
1601
+ The following table describes the request arguments:
1602
+
1603
+ | Name| Required | Type | Description |
1604
+ |---|:-:|---|---|
1605
+ | datacenter_id | **yes** | string | The ID of the VDC. |
1606
+ | loadbalancer_id | **yes** | string | The ID of the load balancer. |
1607
+ | nic_id | **yes** | string | The ID of the NIC. |
1608
+
1609
+ After retrieving a load balancer, either by getting it by id, or as a create response object, you can call the `remove_balanced_nic` method directly.
1610
+
1611
+ ```
1612
+ loadbalancer.remove_balanced_nic(nic.id)
1613
+ ```
1614
+
1615
+ ---
1616
+
1617
+ ### User Management
1618
+
1619
+ #### List Groups
1620
+
1621
+ Retrieves a list of all groups.
1622
+
1623
+ | Name | Required | Type | Description |
1624
+ |---|:-:|---|---|
1625
+ | options | no| string | The options of the resource. |
1626
+
1627
+
1628
+ The following table describes the options arguments:
1629
+
1630
+ | Name | Required | Type | Description |
1631
+ |---|:-:|---|---|
1632
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1633
+
1634
+ groups = ProfitBricks::Group.list()
1635
+
1636
+ ---
1637
+
1638
+ #### Get a Group
1639
+
1640
+ Retrieves the attributes of a given group.
1641
+
1642
+ The following table describes the request arguments:
1643
+
1644
+ | Name | Required | Type | Description |
1645
+ |---|:-:|---|---|
1646
+ | group_id | **yes** | string | The ID of the group. |
1647
+ | options | no | string | The options of the resource. |
1648
+
1649
+
1650
+ The following table describes the options arguments:
1651
+
1652
+ | Name | Required | Type | Description |
1653
+ |---|:-:|---|---|
1654
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1655
+
1656
+ response = ProfitBricks::Group.get(group_id)
1657
+
1658
+ ---
1659
+
1660
+ #### Create a Group
1661
+
1662
+ Creates a new group and set group privileges.
1663
+
1664
+ The following table describes the request arguments:
1665
+
1666
+ | Name | Required | Type | Description |
1667
+ |---|:-:|---|---|
1668
+ | name | **yes** | string | The ID of the group. |
1669
+ | create_datacenter | no | bool | Indicates if the group is allowed to create virtual data centers. |
1670
+ | create_snapshot | no | bool | Indicates if the group is allowed to create snapshots. |
1671
+ | reserve_ip | no | bool | Indicates if the group is allowed to reserve IP addresses. |
1672
+ | access_activity_log | no | bool | Indicates if the group is allowed to access activity log. |
1673
+
1674
+ group = {
1675
+ name: 'my group',
1676
+ create_datacenter: 'true',
1677
+ create_snapshot: 'true',
1678
+ reserve_ip: 'true',
1679
+ access_activity_log: 'true'
1680
+ }
1681
+
1682
+ response = ProfitBricks::Group.create(group)
1683
+
1684
+ ---
1685
+
1686
+ #### Update a Group
1687
+
1688
+ Updates a group's name or privileges.
1689
+
1690
+ The following table describes the request arguments:
1691
+
1692
+ | Name | Required | Type | Description |
1693
+ |---|:-:|---|---|
1694
+ | group_id | **yes** | string | The ID of the group. |
1695
+ | name | **yes** | string | The ID of the group. |
1696
+ | create_datacenter | no | bool | Indicates if the group is allowed to create virtual data centers. |
1697
+ | create_snapshot | no | bool | Indicates if the group is allowed to create snapshots. |
1698
+ | reserve_ip | no | bool | Indicates if the group is allowed to reserve IP addresses. |
1699
+ | access_activity_log | no | bool | Indicates if the group is allowed to access activity log. |
1700
+
1701
+ group = ProfitBricks::Group.get(group_id)
1702
+ group = group.update(
1703
+ name: 'my group RENAME',
1704
+ create_datacenter: false
1705
+ )
1706
+
1707
+ ---
1708
+
1709
+ #### Delete a Group
1710
+
1711
+ Deletes the specified group.
1712
+
1713
+ The following table describes the request arguments:
1714
+
1715
+ | Name | Required | Type | Description |
1716
+ |---|:-:|---|---|
1717
+ | group_id | **yes** | string | The ID of the group. |
1718
+ group = ProfitBricks::Group.get(group_id)
1719
+ response = group.delete
1720
+
1721
+ ---
1722
+
1723
+ #### List Shares
1724
+
1725
+ Retrieves a list of all shares though a group.
1726
+
1727
+ | Name | Required | Type | Description |
1728
+ |---|:-:|---|---|
1729
+ | group_id | **yes** | string | The ID of the group. |
1730
+ | options | no | string | The options of the resource. |
1731
+
1732
+ The following table describes the options arguments:
1733
+
1734
+ | Name | Required | Type | Description |
1735
+ |---|:-:|---|---|
1736
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1737
+
1738
+ response = ProfitBricks::Share.list(group_id)
1739
+
1740
+ ---
1741
+
1742
+ #### Get a Share
1743
+
1744
+ Retrieves a specific resource share available to a group.
1745
+
1746
+ The following table describes the request arguments:
1747
+
1748
+ | Name | Required | Type | Description |
1749
+ |---|:-:|---|---|
1750
+ | group_id | **yes** | string | The ID of the group. |
1751
+ | resource_id | **yes** | string | The ID of the resource. |
1752
+ | options | no | string | The options of the resource. |
1753
+
1754
+
1755
+ The following table describes the options arguments:
1756
+
1757
+ | Name | Required | Type | Description |
1758
+ |---|:-:|---|---|
1759
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1760
+
1761
+ response = ProfitBricks::Share.get(
1762
+ group_id,
1763
+ resource_id)
1764
+
1765
+ ---
1766
+
1767
+ #### Add a Share
1768
+
1769
+ Shares a resource through a group.
1770
+
1771
+ The following table describes the request arguments:
1772
+
1773
+ | Name | Required | Type | Description |
1774
+ |---|:-:|---|---|
1775
+ | group_id | **yes** | string | The ID of the group. |
1776
+ | resource_id | **yes** | string | The ID of the resource. |
1777
+ | edit_privilege | no | string | Indicates that the group has permission to edit privileges on the resource. |
1778
+ | share_privilege | no | string | Indicates that the group has permission to share the resource. |
1779
+
1780
+ share = {
1781
+ edit_privilege: 'true',
1782
+ share_privilege: 'true',
1783
+ resource_id = datacenter_id
1784
+ }
1785
+ response = ProfitBricks::Share.create(group_id,share)
1786
+
1787
+ ---
1788
+
1789
+ #### Update a Share
1790
+
1791
+ Updates the permissions of a group for a resource share.
1792
+
1793
+ The following table describes the request arguments:
1794
+
1795
+ | Name | Required | Type | Description |
1796
+ |---|:-:|---|---|
1797
+ | group_id | **yes** | string | The ID of the group. |
1798
+ | resource_id | **yes** | string | The ID of the resource. |
1799
+ | options | no | string | The options of the resource. |
1800
+
1801
+
1802
+ The following table describes the options arguments:
1803
+
1804
+ | Name | Required | Type | Description |
1805
+ |---|:-:|---|---|
1806
+ | edit_privilege | no | string | Indicates that the group has permission to edit privileges on the resource. |
1807
+ | share_privilege | no | string | Indicates that the group has permission to share the resource. |
1808
+
1809
+ share = ProfitBricks::Share.update(group_id,datacenter_id,{
1810
+ edit_privilege: false
1811
+ })
1812
+
1813
+ ---
1814
+
1815
+ #### Delete a Share
1816
+
1817
+ Removes a resource share from a group.
1818
+
1819
+ | Name | Required | Type | Description |
1820
+ |---|:-:|---|---|
1821
+ | group_id | **yes** | string | The ID of the group. |
1822
+ | resource_id | **yes** | string | The ID of the resource. |
1823
+
1824
+ ProfitBricks::Share.delete(group_id,datacenter_id)
1825
+
1826
+ ---
1827
+
1828
+ #### List Users
1829
+
1830
+ Retrieves a list of all users.
1831
+
1832
+ | Name | Required | Type | Description |
1833
+ |---|:-:|---|---|
1834
+ | options | no | string | The options of the resource. |
1835
+
1836
+
1837
+ The following table describes the options arguments:
1838
+
1839
+ | Name | Required | Type | Description |
1840
+ |---|:-:|---|---|
1841
+ | group_id | no | string | The ID of the group. |
1842
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1843
+
1844
+ response = ProfitBricks::User.list()
1845
+
1846
+ ---
1847
+
1848
+ #### Get a User
1849
+
1850
+ Retrieves a single user.
1851
+
1852
+ | Name | Required | Type | Description |
1853
+ |---|:-:|---|---|
1854
+ | user_id | **yes** | string | The ID of the user. |
1855
+ | options | no | string | The options of the resource. |
1856
+
1857
+
1858
+ The following table describes the options arguments:
1859
+
1860
+ | Name | Required | Type | Description |
1861
+ |---|:-:|---|---|
1862
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1863
+
1864
+ response = ProfitBricks::User.get(user_id)
1865
+
1866
+ ---
1867
+
1868
+ #### Create a User
1869
+
1870
+ Creates a new user.
1871
+
1872
+ The following table describes the request arguments:
1873
+
1874
+ | Name | Required | Type | Description |
1875
+ |---|:-:|---|---|
1876
+ | firstname | **yes** | string | A name for the user. |
1877
+ | lastname | **yes** | bool | A name for the user. |
1878
+ | email | **yes** | bool | An e-mail address for the user. |
1879
+ | password | **yes** | bool | A password for the user. |
1880
+ | administrator | no | bool | Assigns the user have administrative rights. |
1881
+ | force_sec_auth | no | bool | Indicates if secure (two-factor) authentication should be forced for the user. |
1882
+
1883
+ user = {
1884
+ firstname: 'John',
1885
+ lastname: 'Doe',
1886
+ email: 'no-reply@example.com',
1887
+ password: 'secretpassword123',
1888
+ administrator: 'administrator',
1889
+ force_sec_auth: false
1890
+ }
1891
+
1892
+ response = ProfitBricks::User.create(user)
1893
+
1894
+ ---
1895
+
1896
+ #### Update a User
1897
+
1898
+ Updates an existing user.
1899
+
1900
+ The following table describes the request arguments:
1901
+
1902
+ | Name | Required | Type | Description |
1903
+ |---|:-:|---|---|
1904
+ | user_id | **yes** | string | The ID of the user. |
1905
+ | firstname | **yes** | string | A name for the user. |
1906
+ | lastname | **yes** | bool | A name for the user. |
1907
+ | email | **yes** | bool | An e-mail address for the user. |
1908
+ | administrator | **yes** | bool | Assigns the user have administrative rights. |
1909
+ | force_sec_auth | **yes** | bool | Indicates if secure (two-factor) authentication should be forced for the user. |
1910
+
1911
+ user = ProfitBricks::User.get(user_id)
1912
+ response = user.update(
1913
+ administrator: false,
1914
+ firstname: 'John',
1915
+ lastname: 'Doe',
1916
+ email: 'no-reply@example.com',
1917
+ force_sec_auth: false
1918
+ )
1919
+
1920
+ ---
1921
+
1922
+ #### Delete a User
1923
+
1924
+ Removes a user.
1925
+
1926
+ | Name | Required | Type | Description |
1927
+ |---|:-:|---|---|
1928
+ | user_id | **yes** | string | The ID of the user. |
1929
+
1930
+ user = ProfitBricks::User.get(user_id)
1931
+ response = user.delete
1932
+
1933
+ ---
1934
+
1935
+ #### List Users in a Group
1936
+
1937
+ Retrieves a list of all users that are members of a particular group.
1938
+
1939
+ | Name | Required | Type | Description |
1940
+ |---|:-:|---|---|
1941
+ | options | no | string | The options of the resource. |
1942
+
1943
+
1944
+ The following table describes the options arguments:
1945
+
1946
+ | Name | Required | Type | Description |
1947
+ |---|:-:|---|---|
1948
+ | group_id | no| string | The ID of the group. |
1949
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
1950
+
1951
+ response = ProfitBricks::User.list(group_id: 'UUID')
1952
+
1953
+ ---
1954
+
1955
+ #### Add User to Group
1956
+
1957
+ Adds an existing user to a group.
1958
+
1959
+ The following table describes the request arguments:
1960
+
1961
+ | Name | Required | Type | Description |
1962
+ |---|:-:|---|---|
1963
+ | group_id | **yes** | string | The ID of the group. |
1964
+ | user_id | **yes** | string | The ID of the user. |
1965
+
1966
+ response = user = ProfitBricks::User.add_to_group(group_id,user_id)
1967
+
1968
+ ---
1969
+
1970
+ #### Remove User from a Group
1971
+
1972
+ Removes a user from a group.
1973
+
1974
+ | Name | Required | Type | Description |
1975
+ |---|:-:|---|---|
1976
+ | group_id | **yes** | string | The ID of the group. |
1977
+ | user_id | **yes** | string | The ID of the user. |
1978
+
1979
+ response = ProfitBricks::User.remove_from_group(group_id,user_id)
1980
+
1981
+ ---
1982
+
1983
+ #### List Resources
1984
+
1985
+ Retrieves a list of all resources. Alternatively, Retrieves all resources of a particular type.
1986
+
1987
+ The following table describes the request arguments:
1988
+
1989
+ | Name | Required | Type | Description |
1990
+ |---|:-:|---|---|
1991
+ | resource_type | no | string | The resource type: `datacenter`, `image`, `snapshot` or `ipblock`. |
1992
+ | options | no | string | The options of the resource. |
1993
+
1994
+
1995
+ The following table describes the options arguments:
1996
+
1997
+ | Name | Required | Type | Description |
1998
+ |---|:-:|---|---|
1999
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
2000
+
2001
+ response = ProfitBricks::Resource.list
2002
+
2003
+ response = ProfitBricks::Resource.list_by_type('datacenter')
2004
+
2005
+ ---
2006
+
2007
+ #### Get a Resource
2008
+
2009
+ Retrieves a single resource of a particular type.
2010
+
2011
+ The following table describes the request arguments:
2012
+
2013
+ | Name | Required | Type | Description |
2014
+ |---|:-:|---|---|
2015
+ | resource_type | **yes** | string | The resource type: `datacenter`, `image`, `snapshot` or `ipblock`. |
2016
+ | resource_id | **yes** | string | The ID of the resource. |
2017
+ | options | no | string | The options of the resource. |
2018
+
2019
+
2020
+ The following table describes the options arguments:
2021
+
2022
+ | Name | Required | Type | Description |
2023
+ |---|:-:|---|---|
2024
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
2025
+
2026
+ response = ProfitBricks::Resource.get('datacenter', datacenter_id)
2027
+
2028
+ ---
2029
+
2030
+ ### Contract Resources
2031
+
2032
+ #### List Contract Resources
2033
+
2034
+ Retrieves information about the resource limits for a particular contract and the current resource usage.
2035
+
2036
+ | Name | Required | Type | Description |
2037
+ |---|:-:|---|---|
2038
+ | options | no | string | The options of the resource. |
2039
+
2040
+
2041
+ The following table describes the options arguments:
2042
+
2043
+ | Name | Required | Type | Description |
2044
+ |---|:-:|---|---|
2045
+ | depth | no | int | An integer value of 0 - 5 that affects the amount of detail returned. |
2046
+
2047
+ response = ProfitBricks::Contract.get
2048
+
2049
+ ---
2050
+
2051
+ ### Requests
2052
+
2053
+ Each call to the ProfitBricks Cloud API is assigned a request ID. These operations can be used to get information about the requests that have been submitted and their current status.
2054
+
2055
+
2056
+ #### List Requests
2057
+
2058
+ Retrieve a list of requests.
2059
+
2060
+ ```
2061
+ requests = ProfitBricks::Request.list
2062
+ ```
2063
+
2064
+ ---
2065
+
2066
+ #### Get a Request
2067
+
2068
+ Retrieves the attributes of a specific request.
2069
+
2070
+ The following table describes the request arguments:
2071
+
2072
+ | Name| Required | Type | Description |
2073
+ |---|:-:|---|---|
2074
+ | request_id | **yes** | string | The ID of the request. |
2075
+
2076
+ ```
2077
+ request = ProfitBricks::Request.get(request_id)
2078
+ ```
2079
+
2080
+ ---
2081
+
2082
+ #### Get a Request Status
2083
+
2084
+ Retrieves the status of a request.
2085
+
2086
+ The following table describes the request arguments:
2087
+
2088
+ | Name| Required | Type | Description |
2089
+ |---|:-:|---|---|
2090
+ | request_id | **yes** | string | The ID of the request. |
2091
+
2092
+ ```
2093
+ request = ProfitBricks::Request.get(request_id)
2094
+ status = request.status
2095
+ ```
2096
+
2097
+ ---
2098
+
2099
+ ## Support
2100
+
2101
+ * A guide and reference documentation can be found in the repo docs/ directory.
2102
+ * [ProfitBricks SDK for Ruby](https://devops.profitbricks.com/libraries/ruby/) guide.
2103
+ * [ProfitBricks REST API](https://devops.profitbricks.com/api/rest/) documentation.
2104
+ * Ask a question or discuss at [ProfitBricks DevOps Central](https://devops.profitbricks.com/community).
2105
+ * Report an [issue here](https://github.com/profitbricks/profitbricks-sdk-ruby/issues).
2106
+
2107
+ ## Testing
2108
+
2109
+ Please note that the unit tests will create and destroy live resources under
2110
+ the account specified and you will be responsible for any charges incurred.
2111
+ Proceed with caution.
2112
+
2113
+ Add the ProfitBricks API credentials to the `spec/spec_helper.rb` file and
2114
+ run the following command.
2115
+
2116
+ $ rspec spec
2117
+
2118
+ ## Contributing
2119
+
2120
+ 1. Fork it ( https://github.com/[my-github-username]/profitbricks-sdk-ruby/fork )
2121
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
2122
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
2123
+ 4. Push to the branch (`git push origin my-new-feature`)
2124
+ 5. Create a new Pull Request