profitbricks-sdk-ruby 1.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/guide.md +18 -5
- data/docs/reference.md +5 -5
- data/lib/profitbricks/profitbricks.rb +4 -7
- data/lib/profitbricks/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/resource_helper.rb +4 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ded40a3bb0dee26ff94bb75c2b0968bf27c57970
|
4
|
+
data.tar.gz: d5eae2c53e57474a58cbda96aa0a50091aaebf1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb02363620776975baa7e900223a1933751c98201712fb18d72d827a5e7eee208133685cd72ece20b234f919f1a56ff8cca2738e4ddc42e2e82e1ff6c3bbf37
|
7
|
+
data.tar.gz: 951573541547d713c0bb306d025a9e56808846018360165b2ff45c1145df937332ac36f06212dbb2c21dd5fecb68b5666f7288178964590ff5d14316f497a746
|
data/docs/guide.md
CHANGED
@@ -115,7 +115,13 @@ The data center can also be retrieved and removed by the UUID.
|
|
115
115
|
|
116
116
|
The following example shows you how to create a new server in the virtual data center created above:
|
117
117
|
|
118
|
-
server = datacenter.create_server(
|
118
|
+
server = datacenter.create_server(
|
119
|
+
name: 'server1',
|
120
|
+
description: 'My New Server',
|
121
|
+
cores: 4,
|
122
|
+
cpuFamily: 'INTEL_XEON',
|
123
|
+
ram: 4096
|
124
|
+
)
|
119
125
|
server.wait_for { ready? }
|
120
126
|
|
121
127
|
One of the unique features of the ProfitBricks platform when compared with the other providers is that it allows you to define your own settings for cores, memory, and disk size without being tied to a particular size.
|
@@ -124,13 +130,20 @@ One of the unique features of the ProfitBricks platform when compared with the o
|
|
124
130
|
|
125
131
|
A composite server is a server instance that has volumes and NICs already attached. The following example will demonstrate how a composite server can be built with a single request, but the volume, NICs, and included firewall rule will be defined separately for readability.
|
126
132
|
|
127
|
-
volumes = [ { name: 'OS', size: 10, image: '4dc4585c-505a-11e5-bfc6-52540066fee9', bus: 'VIRTIO', imagePassword: 'secretpassword' } ]
|
133
|
+
volumes = [ { name: 'OS', size: 10, type: 'SSD', image: '4dc4585c-505a-11e5-bfc6-52540066fee9', bus: 'VIRTIO', imagePassword: 'secretpassword' } ]
|
128
134
|
fwrules = [ { name: 'SSH', protocol: 'TCP', portRangeStart: 22, portRangeEnd: 22 } ]
|
129
135
|
nics = [ { name: 'public', lan: 1, firewallrules: fwrules }, { name: 'private', lan: 2 } ]
|
130
136
|
|
131
137
|
The composite server can now be created.
|
132
138
|
|
133
|
-
server = datacenter.create_server(
|
139
|
+
server = datacenter.create_server(
|
140
|
+
name: 'Composite Server',
|
141
|
+
cores: 1,
|
142
|
+
cpuFamily: 'AMD_OPTERON',
|
143
|
+
ram: 1024,
|
144
|
+
volumes: volumes,
|
145
|
+
nics: nics
|
146
|
+
)
|
134
147
|
server.wait_for { ready? }
|
135
148
|
|
136
149
|
## How To: List Available Disk and ISO Images
|
@@ -139,7 +152,7 @@ A list of disk and ISO images are available from ProfitBricks for immediate use.
|
|
139
152
|
|
140
153
|
Image.list
|
141
154
|
|
142
|
-
image = Image.list.find { |image| image.name =~ /CentOS-6/ && image.type ==
|
155
|
+
image = Image.list.find { |image| image.name =~ /CentOS-6/ && image.type == 'HDD' && image.region == 'us/las' }
|
143
156
|
|
144
157
|
Make sure the image you retrieve is in the same location as the virtual data center.
|
145
158
|
|
@@ -154,7 +167,7 @@ ProfitBricks allows for the creation of multiple storage volumes that can be att
|
|
154
167
|
Several public images allow support for SSH authentication. This allows a list of SSH publics keys to supplied when creating a new volume.
|
155
168
|
|
156
169
|
ssh_key = 'ssh-rsa AAAAB3NzaC1yc2E...'
|
157
|
-
volume = datacenter.create_volume(name: 'Boot Volume', size: 40, image: image.id, type: '
|
170
|
+
volume = datacenter.create_volume(name: 'Boot Volume', size: 40, image: image.id, type: 'SSD', sshKeys: [ ssh_key ])
|
158
171
|
|
159
172
|
The corresonding SSH private key can then be used when logging into a server with that boot volume.
|
160
173
|
|
data/docs/reference.md
CHANGED
@@ -68,15 +68,15 @@ Retrieve a server within a datacenter:
|
|
68
68
|
Create a server:
|
69
69
|
|
70
70
|
datacenter = Datacenter.get(datacenter_id)
|
71
|
-
server = datacenter.create_server(name: "server1", cores: 2, ram: 4096)
|
71
|
+
server = datacenter.create_server(name: "server1", cores: 2, cpuFamily: "INTEL_XEON", ram: 4096)
|
72
72
|
|
73
73
|
Create a composite server:
|
74
74
|
|
75
|
-
volumes = [ { name: "server2-os", size: 10, image: "4dc4585c-505a-11e5-bfc6-52540066fee9", bus: "VIRTIO", imagePassword: "secretpassword" }, { name: "server2-data", size: 5, bus: "VIRTIO", licenceType: "UNKNOWN" } ]
|
75
|
+
volumes = [ { name: "server2-os", size: 10, type: "HDD", image: "4dc4585c-505a-11e5-bfc6-52540066fee9", bus: "VIRTIO", imagePassword: "secretpassword" }, { name: "server2-data", size: 5, type: "SSD" bus: "VIRTIO", licenceType: "UNKNOWN" } ]
|
76
76
|
fwrules = [ { name: "SSH", protocol: "TCP", portRangeStart: 22, portRangeEnd: 22 } ]
|
77
77
|
nics = [ { name: "public", lan: 1, firewallrules: fwrules }, { name: "private", lan: 2 } ]
|
78
78
|
|
79
|
-
server = datacenter.create_server(name: "server2", cores: 1, ram: 1024, volumes: volumes, nics: nics)
|
79
|
+
server = datacenter.create_server(name: "server2", cores: 1, ram: 1024, cpuFamily: "AMD_OPTERON", volumes: volumes, nics: nics)
|
80
80
|
|
81
81
|
Update a server:
|
82
82
|
|
@@ -244,11 +244,11 @@ Retrieve a loadbalancer:
|
|
244
244
|
|
245
245
|
Create a loadbalancer:
|
246
246
|
|
247
|
-
lb = datacenter.create_loadbalancer(name:
|
247
|
+
lb = datacenter.create_loadbalancer(name: "lb1", ...)
|
248
248
|
|
249
249
|
Update a loadbalancer:
|
250
250
|
|
251
|
-
lb.update(name:
|
251
|
+
lb.update(name: "lb1_rename")
|
252
252
|
|
253
253
|
Remove a loadbalancer:
|
254
254
|
|
@@ -8,13 +8,13 @@ module ProfitBricks
|
|
8
8
|
ProfitBricks::Config.debug = false
|
9
9
|
ProfitBricks::Config.protocol = 'https'
|
10
10
|
ProfitBricks::Config.port = '443'
|
11
|
-
ProfitBricks::Config.path_prefix = '/
|
11
|
+
ProfitBricks::Config.path_prefix = 'cloudapi/v3'
|
12
12
|
yield ProfitBricks::Config
|
13
13
|
|
14
14
|
if ProfitBricks::Config.host
|
15
15
|
url = construct_url
|
16
16
|
else
|
17
|
-
url = ProfitBricks::Config.url || 'https://api.profitbricks.com/
|
17
|
+
url = ProfitBricks::Config.url || 'https://api.profitbricks.com/cloudapi/v3'
|
18
18
|
end
|
19
19
|
|
20
20
|
params = {
|
@@ -88,6 +88,7 @@ module ProfitBricks
|
|
88
88
|
|
89
89
|
def self.add_headers(params)
|
90
90
|
params[:headers] ||= {}
|
91
|
+
params[:headers]["User-Agent"] ||= "profitbricks-ruby-sdk/#{ProfitBricks::VERSION}"
|
91
92
|
params[:headers].merge!(ProfitBricks::Config.headers) if ProfitBricks::Config.headers
|
92
93
|
unless params[:headers].key?('Content-Type')
|
93
94
|
params[:headers]['Content-Type'] = content_type(params[:method])
|
@@ -96,11 +97,7 @@ module ProfitBricks
|
|
96
97
|
end
|
97
98
|
|
98
99
|
def self.content_type(method)
|
99
|
-
|
100
|
-
'application/vnd.profitbricks.partial-properties+json'
|
101
|
-
else
|
102
|
-
'application/vnd.profitbricks.resource+json'
|
103
|
-
end
|
100
|
+
'application/json'
|
104
101
|
end
|
105
102
|
|
106
103
|
def self.prepend_path_prefix(params)
|
data/lib/profitbricks/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ RSpec.configure do |config|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
ProfitBricks.configure do |config|
|
12
|
-
config.url = 'https://api.profitbricks.com/
|
12
|
+
config.url = 'https://api.profitbricks.com/cloudapi/v3/'
|
13
13
|
config.username = ENV['PROFITBRICKS_USERNAME']
|
14
14
|
config.password = ENV['PROFITBRICKS_PASSWORD']
|
15
15
|
config.debug = false
|
@@ -18,7 +18,8 @@ module Helpers
|
|
18
18
|
name: 'my boot volume for server 1',
|
19
19
|
size: 5,
|
20
20
|
type: 'HDD',
|
21
|
-
licenceType: 'UNKNOWN'
|
21
|
+
licenceType: 'UNKNOWN',
|
22
|
+
availabilityZone: 'AUTO'
|
22
23
|
},
|
23
24
|
|
24
25
|
snapshot: {
|
@@ -30,7 +31,8 @@ module Helpers
|
|
30
31
|
name: 'nic1',
|
31
32
|
dhcp: true,
|
32
33
|
lan: 1,
|
33
|
-
firewallActive: true
|
34
|
+
firewallActive: true,
|
35
|
+
nat: false
|
34
36
|
},
|
35
37
|
|
36
38
|
fwrule: {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: profitbricks-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Devenport
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.0.14
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Official ProfitBricks SDK for Ruby
|
@@ -170,4 +170,3 @@ test_files:
|
|
170
170
|
- spec/spec_helper.rb
|
171
171
|
- spec/support/resource_helper.rb
|
172
172
|
- spec/volume_spec.rb
|
173
|
-
has_rdoc:
|