exoscale 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exoscale.gemspec +26 -0
- data/lib/exoscale.rb +8 -0
- data/lib/exoscale/compute.rb +377 -0
- data/lib/exoscale/version.rb +3 -0
- metadata +99 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 9f6a24078529505e8667be68f0766004862f4186
|
|
4
|
+
data.tar.gz: 705b30102c4003e94ef8b8fb79be081fcd48f7a0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8ae7c0d5fbfb34636ab27d41d18725421324d049845ef97acdd22e27dd951c3d107e3c13bc381ae514114679319350989c41493eaf1a7c5852f85825ccf7b880
|
|
7
|
+
data.tar.gz: 58877b8912cdf22004c79edaa2b2da551450088612e21a7d71f47786f76ff2abae6fde2d9d9bf2c6929411d3a92724afa245c9c24a70e14a38661eac64e98f01
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
|
4
|
+
|
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
|
6
|
+
|
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
|
8
|
+
|
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
|
10
|
+
|
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
|
12
|
+
|
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Nicolas Brechet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Ruby Exoscale
|
|
2
|
+
|
|
3
|
+
Simple Ruby gem to access Exoscale's API
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'exoscale'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install exoscale
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
All methods are described on [Exoscale's documentation](https://community.exoscale.ch/api/). As this is a Ruby gem, all methods are snake_cased.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Compute
|
|
27
|
+
```
|
|
28
|
+
require 'exoscale'
|
|
29
|
+
exo = Exoscale::Compute.new(ENV['EXO_API_KEY'], ENV['EXO_API_SECRET_KEY'])
|
|
30
|
+
puts exo.list_zones
|
|
31
|
+
puts exo.list_virtual_machines
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### DNS
|
|
37
|
+
|
|
38
|
+
To do...
|
|
39
|
+
|
|
40
|
+
### Apps
|
|
41
|
+
|
|
42
|
+
To do...
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
47
|
+
|
|
48
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nicolasbrechet/ruby-exoscale. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
59
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "exoscale"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exoscale.gemspec
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'exoscale/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "exoscale"
|
|
8
|
+
spec.version = Exoscale::VERSION
|
|
9
|
+
spec.authors = ["Nicolas Brechet"]
|
|
10
|
+
spec.email = ["nicolasbrechet@me.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Use Exoscale services through Ruby}
|
|
13
|
+
spec.description = %q{Simple Ruby gem to access Exoscale API}
|
|
14
|
+
spec.homepage = "https://github.com/nicolasbrechet/ruby-exoscale"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
spec.bindir = "exe"
|
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
24
|
+
spec.add_development_dependency 'minitest', '~> 0'
|
|
25
|
+
|
|
26
|
+
end
|
data/lib/exoscale.rb
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
require "base64"
|
|
2
|
+
require "cgi"
|
|
3
|
+
require "uri"
|
|
4
|
+
require "openssl"
|
|
5
|
+
require 'net/https'
|
|
6
|
+
require 'json'
|
|
7
|
+
|
|
8
|
+
module Exoscale
|
|
9
|
+
|
|
10
|
+
class Compute
|
|
11
|
+
attr_accessor :api_key, :api_secret, :api_endpoint
|
|
12
|
+
|
|
13
|
+
@@digest = OpenSSL::Digest.new('sha1')
|
|
14
|
+
|
|
15
|
+
def initialize(api_key, api_secret)
|
|
16
|
+
# Use something like: e = Exoscale::Compute.new(ENV['EXO_API_KEY'], ENV['EXO_SECRET_KEY'])
|
|
17
|
+
@api_key = api_key
|
|
18
|
+
@api_secret = api_secret
|
|
19
|
+
@api_endpoint = COMPUTE_ENDPOINT
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def escape(string)
|
|
23
|
+
string = CGI::escape(string)
|
|
24
|
+
string = string.gsub("+","%20")
|
|
25
|
+
string
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def generate_url(paramHash)
|
|
29
|
+
params = {'apiKey' => @api_key, 'response' => 'json'}
|
|
30
|
+
params.merge!(paramHash)
|
|
31
|
+
|
|
32
|
+
param_array = []
|
|
33
|
+
|
|
34
|
+
params.sort.each do |key, value|
|
|
35
|
+
value = self.escape(value.to_s)
|
|
36
|
+
param_array << key.to_s + '=' + value.gsub('+', '%20').gsub(' ', '%20')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
data = param_array.join('&')
|
|
40
|
+
|
|
41
|
+
signature = Base64.encode64(OpenSSL::HMAC.digest(@@digest,@api_secret,data.downcase)).strip
|
|
42
|
+
signature = self.escape(signature)
|
|
43
|
+
request_url = "#{@api_endpoint}?#{data}&signature=#{signature}"
|
|
44
|
+
request_url
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def execute_request(url)
|
|
48
|
+
uri = URI.parse( url )
|
|
49
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
50
|
+
http.use_ssl = true
|
|
51
|
+
|
|
52
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
|
53
|
+
|
|
54
|
+
response = http.request(request)
|
|
55
|
+
return JSON.parse(response.body)
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#### VIRTUAL MACHINES
|
|
60
|
+
def deploy_virtual_machine(service_offering_id, template_id, zone_id, paramHash = {})
|
|
61
|
+
# GET /deployVirtualMachine
|
|
62
|
+
# Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.
|
|
63
|
+
|
|
64
|
+
params = {'command' => 'deployVirtualMachine', 'serviceOfferingId' => service_offering_id, 'templateId' => template_id, 'zoneId' => zone_id}
|
|
65
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
66
|
+
|
|
67
|
+
execute_request(generate_url( params ))
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def destroy_virtual_machine(id)
|
|
71
|
+
# GET /destroyVirtualMachine
|
|
72
|
+
# Destroys a virtual machine. Once destroyed, only the administrator can recover it.
|
|
73
|
+
|
|
74
|
+
params = {'command' => 'destroyVirtualMachine', 'id' => id}
|
|
75
|
+
execute_request(generate_url( params ))
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def reboot_virtual_machine(id)
|
|
79
|
+
# GET /rebootVirtualMachine
|
|
80
|
+
# Reboots a virtual machine.
|
|
81
|
+
|
|
82
|
+
params = {'command' => 'rebootVirtualMachine', 'id' => id}
|
|
83
|
+
execute_request(generate_url( params ))
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def start_virtual_machine(id)
|
|
87
|
+
# GET /startVirtualMachine
|
|
88
|
+
# Starts a virtual machine.
|
|
89
|
+
|
|
90
|
+
params = {'command' => 'startVirtualMachine', 'id' => id}
|
|
91
|
+
execute_request(generate_url( params ))
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def stop_virtual_machine(id)
|
|
95
|
+
# GET /stopVirtualMachine
|
|
96
|
+
# Stops a virtual machine.
|
|
97
|
+
|
|
98
|
+
params = {'command' => 'stopVirtualMachine', 'id' => id}
|
|
99
|
+
execute_request(generate_url( params ))
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def reset_password_for_virtual_machine(id)
|
|
103
|
+
# GET /resetPasswordForVirtualMachine
|
|
104
|
+
# Resets the password for virtual machine.
|
|
105
|
+
# The virtual machine must be in a “Stopped” state and the template
|
|
106
|
+
# must already support this feature for this command to take effect. [async]
|
|
107
|
+
|
|
108
|
+
params = {'command' => 'resetPasswordForVirtualMachine', 'id' => id}
|
|
109
|
+
execute_request(generate_url( params ))
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def change_service_for_virtual_machine(id, service_offering_id)
|
|
113
|
+
# GET /changeServiceForVirtualMachine
|
|
114
|
+
# Changes the service offering for a virtual machine.
|
|
115
|
+
# The virtual machine must be in a “Stopped” state for this command to take effect.
|
|
116
|
+
|
|
117
|
+
params = {'command' => 'changeServiceForVirtualMachine', 'id' => id, 'serviceOfferingId' => service_offering_id}
|
|
118
|
+
execute_request(generate_url( params ))
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def update_virtual_machine(id, paramHash = {})
|
|
122
|
+
# GET /updateVirtualMachine
|
|
123
|
+
# Updates properties of a virtual machine.
|
|
124
|
+
# The VM has to be stopped and restarted for the new properties to take effect.
|
|
125
|
+
# UpdateVirtualMachine does not first check whether the VM is stopped.
|
|
126
|
+
# Therefore, stop the VM manually before issuing this call.
|
|
127
|
+
|
|
128
|
+
params = {'command' => 'updateVirtualMachine', 'id' => id}
|
|
129
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
130
|
+
|
|
131
|
+
execute_request(generate_url( params ))
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def list_virtual_machines(paramHash = {})
|
|
135
|
+
# GET /listVirtualMachines
|
|
136
|
+
# List the virtual machines owned by the account
|
|
137
|
+
|
|
138
|
+
params = {'command' => 'listVirtualMachines'}
|
|
139
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
140
|
+
|
|
141
|
+
execute_request(generate_url( params ))
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def get_vm_password(id)
|
|
145
|
+
# GET /getVMPassword
|
|
146
|
+
#Returns an encrypted password for the VM
|
|
147
|
+
|
|
148
|
+
params = {'command' => 'getVMPassword', 'id' => id}
|
|
149
|
+
execute_request(generate_url( params ))
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
#### SECURITY GROUPS
|
|
153
|
+
def create_security_group(name, paramHash = {})
|
|
154
|
+
# GET /createSecurityGroup
|
|
155
|
+
# Creates a security group
|
|
156
|
+
|
|
157
|
+
params = {'command' => 'createSecurityGroup', 'name' => name}
|
|
158
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
159
|
+
|
|
160
|
+
execute_request(generate_url( params ))
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def delete_security_group(paramHash = {})
|
|
164
|
+
# GET /deleteSecurityGroup
|
|
165
|
+
# Deletes security group
|
|
166
|
+
|
|
167
|
+
params = {'command' => 'deleteSecurityGroup'}
|
|
168
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
169
|
+
|
|
170
|
+
execute_request(generate_url( params ))
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def authorize_security_group_ingress
|
|
174
|
+
# GET /authorizeSecurityGroupIngress
|
|
175
|
+
# Authorizes a particular ingress rule for this security group
|
|
176
|
+
|
|
177
|
+
params = {'command' => 'authorizeSecurityGroupIngress'}
|
|
178
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
179
|
+
|
|
180
|
+
execute_request(generate_url( params ))
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def revoke_security_group_ingress(id)
|
|
184
|
+
# GET /revokeSecurityGroupIngress
|
|
185
|
+
# Deletes a particular ingress rule for this security group
|
|
186
|
+
|
|
187
|
+
params = {'command' => 'revokeSecurityGroupIngress', 'id' => id}
|
|
188
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
189
|
+
|
|
190
|
+
execute_request(generate_url( params ))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def authorize_security_group_egress
|
|
194
|
+
# GET /authorizeSecurityGroupEgress
|
|
195
|
+
# Authorizes a particular egress rule for this security group
|
|
196
|
+
|
|
197
|
+
params = {'command' => 'authorizeSecurityGroupEgress'}
|
|
198
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
199
|
+
|
|
200
|
+
execute_request(generate_url( params ))
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def revoke_security_group_egress(id)
|
|
204
|
+
# GET /revokeSecurityGroupEgress
|
|
205
|
+
# Deletes a particular egress rule for this security group
|
|
206
|
+
|
|
207
|
+
params = {'command' => 'revokeSecurityGroupEgress', 'id' => id}
|
|
208
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
209
|
+
|
|
210
|
+
execute_request(generate_url( params ))
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def list_security_groups(paramHash = {})
|
|
214
|
+
# GET /listSecurityGroups
|
|
215
|
+
# Lists security groups
|
|
216
|
+
|
|
217
|
+
params = {'command' => 'listSecurityGroups'}
|
|
218
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
219
|
+
|
|
220
|
+
execute_request(generate_url( params ))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
#### TEMPLATES
|
|
224
|
+
def list_templates(template_filter, paramHash = {})
|
|
225
|
+
# GET /listTemplates
|
|
226
|
+
# List all public, private, and privileged templates.
|
|
227
|
+
|
|
228
|
+
params = {'command' => 'listTemplates', 'templateFilter' => template_filter}
|
|
229
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
230
|
+
|
|
231
|
+
execute_request(generate_url( params ))
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
#### SSH Keypairs
|
|
235
|
+
def create_ssh_key_pair(name, paramHash = {})
|
|
236
|
+
# GET /createSSHKeyPair
|
|
237
|
+
# Create a new keypair and returns the private key
|
|
238
|
+
|
|
239
|
+
params = {'command' => 'createSSHKeyPair', 'name' => name}
|
|
240
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
241
|
+
|
|
242
|
+
execute_request(generate_url( params ))
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def delete_ssh_key_pair(name, paramHash = {})
|
|
246
|
+
# GET /deleteSSHKeyPair
|
|
247
|
+
# Deletes a keypair by name
|
|
248
|
+
|
|
249
|
+
params = {'command' => 'deleteSSHKeyPair', 'name' => name}
|
|
250
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
251
|
+
|
|
252
|
+
execute_request(generate_url( params ))
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def list_ssh_key_pair(paramHash = {})
|
|
256
|
+
# GET /listSSHKeyPairs
|
|
257
|
+
# List registered keypairs
|
|
258
|
+
|
|
259
|
+
params = {'command' => 'listSSHKeyPairs'}
|
|
260
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
261
|
+
|
|
262
|
+
execute_request(generate_url( params ))
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def register_ssh_key_pair(name, public_key, paramHash = {})
|
|
266
|
+
# GET /registerSSHKeyPair
|
|
267
|
+
# Register a public key in a keypair under a certain name
|
|
268
|
+
|
|
269
|
+
params = {'command' => 'registerSSHKeyPair', 'name' => name, 'publicKey' => public_key}
|
|
270
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
271
|
+
|
|
272
|
+
execute_request(generate_url( params ))
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
#### TAGS
|
|
276
|
+
def create_tag(resource_ids, resource_type, tags, paramHash = {})
|
|
277
|
+
# GET /createTags
|
|
278
|
+
# Creates resource tag(s)
|
|
279
|
+
|
|
280
|
+
params = {'command' => 'createTags', 'resourceIds' => resource_ids, 'resourceType' => resource_type, 'tags' => tags}
|
|
281
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
282
|
+
|
|
283
|
+
execute_request(generate_url( params ))
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def delete_tag(resource_ids, resource_type, paramHash = {})
|
|
287
|
+
# GET /deleteTags
|
|
288
|
+
# Deletes resource tag(s)
|
|
289
|
+
|
|
290
|
+
params = {'command' => 'deleteTags', 'resourceIds' => resource_ids, 'resourceType' => resource_type }
|
|
291
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
292
|
+
|
|
293
|
+
execute_request(generate_url( params ))
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def list_tags(paramHash = {})
|
|
297
|
+
# GET /listTags
|
|
298
|
+
# List resource tag(s)
|
|
299
|
+
|
|
300
|
+
params = {'command' => 'listTags'}
|
|
301
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
302
|
+
|
|
303
|
+
execute_request(generate_url( params ))
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
#### ACCOUNT
|
|
307
|
+
def list_accounts(paramHash = {})
|
|
308
|
+
# GET /listAccounts
|
|
309
|
+
# Lists accounts and provides detailed account information for listed accounts
|
|
310
|
+
|
|
311
|
+
params = {'command' => 'listAccounts'}
|
|
312
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
313
|
+
|
|
314
|
+
execute_request(generate_url( params ))
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
#### EVENTS
|
|
318
|
+
def listEvents(paramHash = {})
|
|
319
|
+
# GET /listEvents
|
|
320
|
+
# A command to list events
|
|
321
|
+
|
|
322
|
+
params = {'command' => 'listEvents'}
|
|
323
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
324
|
+
|
|
325
|
+
execute_request(generate_url( params ))
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def listEventTypes
|
|
329
|
+
# GET /listEventTypes
|
|
330
|
+
# List Event Types
|
|
331
|
+
|
|
332
|
+
params = {'command' => 'listEventTypes'}
|
|
333
|
+
execute_request(generate_url( params ))
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
#### JOBS
|
|
337
|
+
def query_async_job_result(job_id)
|
|
338
|
+
# GET /queryAsyncJobResult
|
|
339
|
+
# Retrieves the current status of asynchronous job.
|
|
340
|
+
|
|
341
|
+
params = {'command' => 'queryAsyncJobResult', 'jobId' => job_id}
|
|
342
|
+
execute_request(generate_url( params ))
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def list_async_jobs(paramHash = {})
|
|
346
|
+
# GET /listAsyncJobs
|
|
347
|
+
# Lists all pending asynchronous jobs for the account.
|
|
348
|
+
|
|
349
|
+
params = {'command' => 'listAsyncJobs'}
|
|
350
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
351
|
+
|
|
352
|
+
execute_request(generate_url( params ))
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
#### CLOUD
|
|
356
|
+
def list_zones(paramHash = {})
|
|
357
|
+
# GET /listZones
|
|
358
|
+
# Lists zones
|
|
359
|
+
|
|
360
|
+
params = {'command' => 'listZones'}
|
|
361
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
362
|
+
|
|
363
|
+
execute_request(generate_url( params ))
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def list_service_offerings(paramHash = {})
|
|
367
|
+
# GET /listServiceOfferings
|
|
368
|
+
# Lists all available service offerings.
|
|
369
|
+
|
|
370
|
+
params = {'command' => 'listServiceOfferings'}
|
|
371
|
+
params.merge!(paramHash) unless paramHash.nil?
|
|
372
|
+
|
|
373
|
+
execute_request(generate_url( params ))
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
end
|
|
377
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: exoscale
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nicolas Brechet
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: minitest
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: Simple Ruby gem to access Exoscale API
|
|
56
|
+
email:
|
|
57
|
+
- nicolasbrechet@me.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- ".travis.yml"
|
|
64
|
+
- CODE_OF_CONDUCT.md
|
|
65
|
+
- Gemfile
|
|
66
|
+
- LICENSE.txt
|
|
67
|
+
- README.md
|
|
68
|
+
- Rakefile
|
|
69
|
+
- bin/console
|
|
70
|
+
- bin/setup
|
|
71
|
+
- exoscale.gemspec
|
|
72
|
+
- lib/exoscale.rb
|
|
73
|
+
- lib/exoscale/compute.rb
|
|
74
|
+
- lib/exoscale/version.rb
|
|
75
|
+
homepage: https://github.com/nicolasbrechet/ruby-exoscale
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata: {}
|
|
79
|
+
post_install_message:
|
|
80
|
+
rdoc_options: []
|
|
81
|
+
require_paths:
|
|
82
|
+
- lib
|
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '0'
|
|
93
|
+
requirements: []
|
|
94
|
+
rubyforge_project:
|
|
95
|
+
rubygems_version: 2.4.5.1
|
|
96
|
+
signing_key:
|
|
97
|
+
specification_version: 4
|
|
98
|
+
summary: Use Exoscale services through Ruby
|
|
99
|
+
test_files: []
|