fog-rackspace 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +29 -3
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +126 -0
- data/LICENSE.md +20 -0
- data/README.md +3 -20
- data/Rakefile +6 -3
- data/circle.yml +3 -0
- data/fog-rackspace.gemspec +4 -0
- data/lib/fog/rackspace.rb +108 -20
- data/lib/fog/rackspace/auto_scale.rb +0 -1
- data/lib/fog/rackspace/block_storage.rb +1 -1
- data/lib/fog/rackspace/cdn.rb +1 -1
- data/lib/fog/rackspace/cdn_v2.rb +7 -5
- data/lib/fog/rackspace/compute.rb +1 -1
- data/lib/fog/rackspace/compute_v2.rb +1 -1
- data/lib/fog/rackspace/databases.rb +1 -1
- data/lib/fog/rackspace/dns.rb +1 -1
- data/lib/fog/rackspace/docs/orchestration.md +13 -13
- data/lib/fog/rackspace/errors.rb +90 -18
- data/lib/fog/rackspace/identity.rb +1 -1
- data/lib/fog/rackspace/load_balancers.rb +1 -1
- data/lib/fog/rackspace/mock_data.rb +0 -61
- data/lib/fog/rackspace/models/compute_v2/server.rb +5 -2
- data/lib/fog/rackspace/monitoring.rb +1 -1
- data/lib/fog/rackspace/networking.rb +1 -1
- data/lib/fog/rackspace/networking_v2.rb +1 -1
- data/lib/fog/rackspace/orchestration.rb +1 -1
- data/lib/fog/rackspace/queues.rb +1 -1
- data/lib/fog/rackspace/storage.rb +1 -1
- data/lib/fog/rackspace/version.rb +1 -1
- metadata +64 -5
- data/LICENSE.txt +0 -21
- data/lib/fog/rackspace/core.rb +0 -150
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 679ac91232ed639637f44c04cd87541d18adc22c
|
4
|
+
data.tar.gz: 86e30131e2a6d330f86fac75951a3dbea29859cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08441c3ca7c499e208f15b4078e501e60c6caf85fc89f9d04be4c4deb7926a15afd2969e92f8dc1d0d48770557d2f112f5e72f73fb509dd41769dcc28de06f4
|
7
|
+
data.tar.gz: e831ddf0f804120c1c71de733ffee91a05b513006208285f6787d022cb679ce93dc4f2b800f80a0dc0abbe30024032e8b867d16acba9fc4d25883e4972c8c7c1
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fog-rackspace
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
data/.travis.yml
CHANGED
@@ -1,4 +1,30 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
sudo: false
|
3
|
+
script: bundle exec rake test
|
4
|
+
matrix:
|
5
|
+
fast_finish: true
|
6
|
+
include:
|
7
|
+
- rvm: 1.8.7
|
8
|
+
gemfile: gemfiles/Gemfile-ruby-1.8.7
|
9
|
+
- rvm: 1.9.3
|
10
|
+
gemfile: Gemfile
|
11
|
+
- rvm: 2.0.0
|
12
|
+
gemfile: Gemfile
|
13
|
+
- rvm: 2.1.0
|
14
|
+
gemfile: Gemfile
|
15
|
+
- rvm: 2.1.1
|
16
|
+
gemfile: Gemfile
|
17
|
+
- rvm: 2.1.1
|
18
|
+
gemfile: gemfiles/Gemfile-edge
|
19
|
+
- rvm: 2.2.0
|
20
|
+
gemfile: Gemfile
|
21
|
+
- rvm: 2.2.0
|
22
|
+
gemfile: gemfiles/Gemfile-edge
|
23
|
+
- rvm: jruby-18mode
|
24
|
+
gemfile: gemfiles/Gemfile-ruby-1.8.7
|
25
|
+
- rvm: jruby-19mode
|
26
|
+
gemfile: Gemfile
|
27
|
+
- rvm: jruby-head
|
28
|
+
gemfile: Gemfile
|
29
|
+
allow_failures:
|
30
|
+
- rvm: jruby-head
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## Getting Involved
|
2
|
+
|
3
|
+
New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
|
4
|
+
|
5
|
+
### Coding
|
6
|
+
|
7
|
+
* Pick a task:
|
8
|
+
* Offer feedback on open [pull requests](https://github.com/fog/fog-rackspace/pulls).
|
9
|
+
* Review open [issues](https://github.com/fog/fog-rackspace/issues) for things to help on.
|
10
|
+
* [Create an issue](https://github.com/fog/fog-rackspace/issues/new) to start a discussion on additions or features.
|
11
|
+
* Fork the project, add your changes and tests to cover them in a topic branch.
|
12
|
+
* Commit your changes and rebase against `fog/fog-rackspace-rackspace` to ensure everything is up to date.
|
13
|
+
* [Submit a pull request](https://github.com/fog/fog-rackspace/compare/).
|
14
|
+
|
15
|
+
### Non-Coding
|
16
|
+
|
17
|
+
* Offer feedback on open [issues](https://github.com/fog/fog-rackspace/issues).
|
18
|
+
* Organize or volunteer at events.
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
359 Kyle Rames <kyle.rames@rackspace.com>
|
2
|
+
102 geemus <geemus@gmail.com>
|
3
|
+
67 Ash Wilson <ash.wilson@rackspace.com>
|
4
|
+
63 Wesley Beary <wbeary@engineyard.com>
|
5
|
+
32 Brian Hartsock <brian.hartsock@gmail.com>
|
6
|
+
26 Brad Gignac <brad.gignac@rackspace.com>
|
7
|
+
24 Brian Hartsock <brian.hartsock@rackspace.com>
|
8
|
+
23 Ryan Richard <ryanrichard07@gmail.com>
|
9
|
+
20 Evan Light <evan@tripledogdare.net>
|
10
|
+
17 Thomas Cate <tcate@workstation.rackspace>
|
11
|
+
17 Ash Wilson <smashwilson@gmail.com>
|
12
|
+
16 geemus (Wesley Beary) <wbeary@engineyard.com>
|
13
|
+
15 Paul Thornthwaite <tokengeek@gmail.com>
|
14
|
+
14 Bart Vercammen <bart.vercammen@portico.io>
|
15
|
+
14 Wesley Beary <geemus@gmail.com>
|
16
|
+
12 Brian D. Burns <iosctr@gmail.com>
|
17
|
+
8 Brad Gignac <bgignac@bradgignac.com>
|
18
|
+
8 Matt Darby <matt.darby@rackspace.com>
|
19
|
+
8 Daniel Reichert <Daniel.Reichert@rackspace.com>
|
20
|
+
8 kfafel <keith.fafel@gmail.com>
|
21
|
+
6 Tom Noonan II <thomas.noonan@rackspace.com>
|
22
|
+
6 H. Wade Minter <minter@teamsnap.com>
|
23
|
+
6 dJason <jasonwalp@yahoo.com>
|
24
|
+
6 jamiehannaford <jamie@limetree.org>
|
25
|
+
5 Julio Feijo <jfeijo@thoughtworks.com>
|
26
|
+
5 Paul Thornthwaite <paul@brightbox.co.uk>
|
27
|
+
5 Jamie H <jamie@limetree.org>
|
28
|
+
4 Jesse Scott <jesse.c.scott@gmail.com>
|
29
|
+
4 Matt Darby <darby@mittdarko.com>
|
30
|
+
4 Lance Ivy <lance@cainlevy.net>
|
31
|
+
4 Evan Smith <evans@n2uitive.com>
|
32
|
+
4 James Healy <jimmy@deefa.com>
|
33
|
+
4 Dusty Jones <dusty@trueability.com>
|
34
|
+
3 Eugene Howe <eugene@xtreme-computers.net>
|
35
|
+
3 Jay Faulkner <jay.faulkner@rackspace.com>
|
36
|
+
3 Josh Lane & Jason Hansen <jlane@engineyard.com>
|
37
|
+
3 Tony Ta <tonyta.tt@gmail.com>
|
38
|
+
3 Chris Wuest <chris@chriswuest.com>
|
39
|
+
3 Sammy Larbi <sam@codeodor.com>
|
40
|
+
3 Dejan Menges <dejan.menges@9cookies.com>
|
41
|
+
3 Oleg Vivtash <oleg@vivtash.net>
|
42
|
+
3 Juris Galang <jurisgalang@gmail.com>
|
43
|
+
3 Kyle Rames <kyle@rames.org>
|
44
|
+
2 Decklin Foster <decklin@red-bean.com>
|
45
|
+
2 Alex Dunn <adunn@Alexs-MacBook-Pro.local>
|
46
|
+
2 Andreas Gerauer <helle@fraggaz.de>
|
47
|
+
2 Ben Hundley <ben.hundley@gmail.com>
|
48
|
+
2 Benjamin Manns <benmanns@gmail.com>
|
49
|
+
2 Brendan Fosberry <brendan.fosberry@rackspace.com>
|
50
|
+
2 Chris McClimans <chris@hippiehacker.org>
|
51
|
+
2 Jason Faulkner <jay@jvf.cc>
|
52
|
+
2 Jeffrey C. Ollie <jeff@ocjtech.us>
|
53
|
+
2 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
|
54
|
+
2 Joshua Schairbaum <joshua.schairbaum@gmail.com>
|
55
|
+
2 Kieran Pilkington <kieran776@gmail.com>
|
56
|
+
2 Matthias Gröbner <m.groebner@me.com>
|
57
|
+
2 Max Lincoln <max@devopsy.com>
|
58
|
+
2 Mike Dillon <mike.dillon@synctree.com>
|
59
|
+
2 Wesley Beary <geemus+github@gmail.com>
|
60
|
+
2 Zachary Danger Campbell <zacharydangercampbell@gmail.com>
|
61
|
+
2 irdan <daniel.reichert@rackspace.com>
|
62
|
+
2 sashap <sasha@mythictechnologies.com>
|
63
|
+
1 James Belchamber <james@belchamber.com>
|
64
|
+
1 Kevin Menard <nirvdrum@gmail.com>
|
65
|
+
1 stephen charles baldwin <stephencharlesb@gmail.com>
|
66
|
+
1 Grégory Karékinian <greg@karekinian.com>
|
67
|
+
1 Geoff Pado <geoffpado@gmail.com>
|
68
|
+
1 Erik Michaels-Ober <sferik@gmail.com>
|
69
|
+
1 Luiz Ribeiro <luizfar@gmail.com>
|
70
|
+
1 Mark Turner <mark@amerine.net>
|
71
|
+
1 Marshall Yount <marshall@yountlabs.com>
|
72
|
+
1 Martin Smith <martin@mbs3.org>
|
73
|
+
1 Eric Hodel <drbrain@segment7.net>
|
74
|
+
1 Eric Hankins <ehankins@rednovalabs.com>
|
75
|
+
1 Andrew Langhorn <andrew.langhorn@digital.cabinet-office.gov.uk>
|
76
|
+
1 jimworm <jimworm@gmail.com>
|
77
|
+
1 Max Stepanov <dlgtho@gmail.com>
|
78
|
+
1 Michael Jackson <michael.jackson@rackspace.com>
|
79
|
+
1 kbockmanrs <kevin@rightscale.com>
|
80
|
+
1 Nathan Sutton <nate@zencoder.com>
|
81
|
+
1 Nik Wakelin <nik@codetocustomer.com>
|
82
|
+
1 Dmitry Gutov <dgutov@yandex.ru>
|
83
|
+
1 Pablo Porto <portovep@tcd.ie>
|
84
|
+
1 Paul <paul@propanestudio.com>
|
85
|
+
1 Alain De Carolis <adecarolis@schoology.com>
|
86
|
+
1 David Wittman <david@wittman.com>
|
87
|
+
1 Paul Vudmaska <Paul.Vudmaska@Rackspace.com>
|
88
|
+
1 Phil Kates <phil.kates@cloudkick.com>
|
89
|
+
1 Pierre Massat <pierre@dakis.com>
|
90
|
+
1 Rick Bradley <rick@rickbradley.com>
|
91
|
+
1 Ryan King <ryanking@gmail.com>
|
92
|
+
1 Dan Prince <dprince@redhat.com>
|
93
|
+
1 Sam Kottler <shk@redhat.com>
|
94
|
+
1 Sami Samhuri <sami@samhuri.net>
|
95
|
+
1 Christopher Snell <chris.snell@gmail.com>
|
96
|
+
1 Steve Agalloco <steve.agalloco@gmail.com>
|
97
|
+
1 Steve Smith <github@scsworld.co.uk>
|
98
|
+
1 Thom May <thom_may@external.mckinsey.com>
|
99
|
+
1 Christian Berendt <berendt@b1-systems.de>
|
100
|
+
1 Thomas Cate <thomascate@gmail.com>
|
101
|
+
1 Chris Wuest <chris.wuest@rackspace.com>
|
102
|
+
1 Chris Roberts <chrisroberts.code@gmail.com>
|
103
|
+
1 Tõnis Simo <anton.estum@gmail.com>
|
104
|
+
1 Alex Tambellini <atambellini@gmail.com>
|
105
|
+
1 Cezar Sa Espinola <cezar.sa@corp.globo.com>
|
106
|
+
1 Carlos Sanchez <csanchez@maestrodev.com>
|
107
|
+
1 William Lawson <lawson.bj@gmail.com>
|
108
|
+
1 Yann Hamon <Yann@trailburning.com>
|
109
|
+
1 Yauheni Kryudziuk <yauheni.kryudziuk@xing.com>
|
110
|
+
1 rebelagentm <rebelagentm@yahoo.com>
|
111
|
+
1 Caleb Tennis <caleb.tennis@gmail.com>
|
112
|
+
1 deepj <deepjungle.maca@gmail.com>
|
113
|
+
1 Ben Sandberg <ben@pdxfixit.com>
|
114
|
+
1 Andrew Taylor <andrew.taylor@sage.com>
|
115
|
+
1 gilles <gilles@peerpong.com>
|
116
|
+
1 Jon Crosby <jon@joncrosby.me>
|
117
|
+
1 Jon Holt <jonmholt@gmail.com>
|
118
|
+
1 Jonathon Scanes <me@jscanes.com>
|
119
|
+
1 Joonas Reynders <joonas.reynders@iki.fi>
|
120
|
+
1 heyryanw <ryanw@ryanws-MacBook-Pro.local>
|
121
|
+
1 Jim Salinas <jim.salinas@rackspace.com>
|
122
|
+
1 howete <thowe@hp.com>
|
123
|
+
1 Josué Lima <josuedsi@gmail.com>
|
124
|
+
1 James Herdman <james.herdman@me.com>
|
125
|
+
1 Justin Barry <justin.d.barry@gmail.com>
|
126
|
+
➜ fog git:(master)
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014-2015 [CONTRIBUTORS.md](https://github.com/fog/fog-rackspace/blob/master/CONTRIBUTORS.md)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Fog::Rackspace
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
[![Circle CI](https://circleci.com/gh/fog/fog-rackspace.svg?style=svg)](https://circleci.com/gh/fog/fog-rackspace)
|
4
|
+
[![Build Status](https://travis-ci.org/fog/fog-rackspace.svg?branch=master)](https://travis-ci.org/fog/fog-rackspace)
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -22,20 +21,4 @@ Or install it yourself as:
|
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
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).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fog-rackspace. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
24
|
+
See https://github.com/fog/fog for usage.
|
data/Rakefile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
2
|
|
4
|
-
|
3
|
+
task :default => :test
|
5
4
|
|
6
|
-
|
5
|
+
mock = ENV['FOG_MOCK'] || 'true'
|
6
|
+
task :test do
|
7
|
+
sh("export FOG_MOCK=#{mock} && bundle exec shindont")
|
8
|
+
sh("rspec")
|
9
|
+
end
|
data/circle.yml
ADDED
data/fog-rackspace.gemspec
CHANGED
@@ -22,7 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
23
23
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
24
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.4'
|
25
26
|
spec.add_development_dependency 'rubyzip', '~> 0.9.9'
|
27
|
+
spec.add_development_dependency 'pry', '~> 0.10.3'
|
28
|
+
spec.add_development_dependency 'vcr', '~> 3.0.1'
|
29
|
+
spec.add_development_dependency 'webmock', '~> 1.24.2'
|
26
30
|
spec.add_development_dependency "mime-types"
|
27
31
|
spec.add_development_dependency "mime-types-data"
|
28
32
|
|
data/lib/fog/rackspace.rb
CHANGED
@@ -1,25 +1,113 @@
|
|
1
|
-
require
|
1
|
+
require 'fog/rackspace/version'
|
2
|
+
require 'fog/core'
|
3
|
+
require 'fog/json'
|
4
|
+
|
5
|
+
require 'fog/rackspace/mock_data'
|
6
|
+
require 'fog/rackspace/service'
|
7
|
+
require 'fog/rackspace/errors'
|
8
|
+
|
2
9
|
|
3
10
|
module Fog
|
4
|
-
module
|
5
|
-
|
11
|
+
module CDN
|
12
|
+
autoload :Rackspace, File.expand_path('../rackspace/cdn', __FILE__)
|
6
13
|
end
|
7
|
-
end
|
8
14
|
|
15
|
+
module Compute
|
16
|
+
autoload :Rackspace, File.expand_path('../rackspace/compute', __FILE__)
|
17
|
+
autoload :RackspaceV2, File.expand_path('../rackspace/compute_v2', __FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
module DNS
|
21
|
+
autoload :Rackspace, File.expand_path('../rackspace/dns', __FILE__)
|
22
|
+
end
|
23
|
+
|
24
|
+
module Storage
|
25
|
+
autoload :Rackspace, File.expand_path('../rackspace/storage', __FILE__)
|
26
|
+
end
|
27
|
+
|
28
|
+
module Rackspace
|
29
|
+
extend Fog::Provider
|
30
|
+
|
31
|
+
US_AUTH_ENDPOINT = 'https://identity.api.rackspacecloud.com/v2.0' unless defined? US_AUTH_ENDPOINT
|
32
|
+
UK_AUTH_ENDPOINT = 'https://lon.identity.api.rackspacecloud.com/v2.0' unless defined? UK_AUTH_ENDPOINT
|
33
|
+
|
34
|
+
autoload :AutoScale, File.expand_path('../rackspace/auto_scale', __FILE__)
|
35
|
+
autoload :BlockStorage, File.expand_path('../rackspace/block_storage', __FILE__)
|
36
|
+
autoload :CDN, File.expand_path('../rackspace/cdn', __FILE__)
|
37
|
+
autoload :CDNV2, File.expand_path('../rackspace/cdn_v2', __FILE__)
|
38
|
+
autoload :Compute, File.expand_path('../rackspace/compute', __FILE__)
|
39
|
+
autoload :ComputeV2, File.expand_path('../rackspace/compute_v2', __FILE__)
|
40
|
+
autoload :Database, File.expand_path('../rackspace/databases', __FILE__)
|
41
|
+
autoload :DNS, File.expand_path('../rackspace/dns', __FILE__)
|
42
|
+
autoload :Identity, File.expand_path('../rackspace/identity', __FILE__)
|
43
|
+
autoload :LoadBalancers, File.expand_path('../rackspace/load_balancers', __FILE__)
|
44
|
+
autoload :Monitoring, File.expand_path('../rackspace/monitoring', __FILE__)
|
45
|
+
autoload :Queues, File.expand_path('../rackspace/queues', __FILE__)
|
46
|
+
autoload :Storage, File.expand_path('../rackspace/storage', __FILE__)
|
47
|
+
autoload :Networking, File.expand_path('../rackspace/networking', __FILE__)
|
48
|
+
autoload :Orchestration, File.expand_path('../rackspace/orchestration', __FILE__)
|
49
|
+
autoload :NetworkingV2, File.expand_path('../rackspace/networking_v2', __FILE__)
|
50
|
+
|
51
|
+
service(:auto_scale, 'AutoScale')
|
52
|
+
service(:block_storage, 'BlockStorage')
|
53
|
+
service(:cdn, 'CDN')
|
54
|
+
service(:cdn_v2, 'CDN v2')
|
55
|
+
service(:compute, 'Compute')
|
56
|
+
service(:compute_v2, 'Compute v2')
|
57
|
+
service(:dns, 'DNS')
|
58
|
+
service(:storage, 'Storage')
|
59
|
+
service(:load_balancers, 'LoadBalancers')
|
60
|
+
service(:identity, 'Identity')
|
61
|
+
service(:databases, 'Databases')
|
62
|
+
service(:monitoring, 'Monitoring')
|
63
|
+
service(:queues, 'Queues')
|
64
|
+
service(:networking, 'Networking')
|
65
|
+
service(:orchestration, 'Orchestration')
|
66
|
+
service(:networkingV2, 'NetworkingV2')
|
67
|
+
|
68
|
+
def self.authenticate(options, connection_options = {})
|
69
|
+
rackspace_auth_url = options[:rackspace_auth_url]
|
70
|
+
rackspace_auth_url ||= options[:rackspace_endpoint] == Fog::Compute::RackspaceV2::LON_ENDPOINT ? UK_AUTH_ENDPOINT : US_AUTH_ENDPOINT
|
71
|
+
url = rackspace_auth_url.match(/^https?:/) ? \
|
72
|
+
rackspace_auth_url : 'https://' + rackspace_auth_url
|
73
|
+
uri = URI.parse(url)
|
74
|
+
connection = Fog::Core::Connection.new(url, false, connection_options)
|
75
|
+
@rackspace_api_key = options[:rackspace_api_key]
|
76
|
+
@rackspace_username = options[:rackspace_username]
|
77
|
+
response = connection.request({
|
78
|
+
:expects => [200, 204],
|
79
|
+
:headers => {
|
80
|
+
'X-Auth-Key' => @rackspace_api_key,
|
81
|
+
'X-Auth-User' => @rackspace_username
|
82
|
+
},
|
83
|
+
:method => 'GET',
|
84
|
+
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v1.0'
|
85
|
+
})
|
86
|
+
response.headers.reject do |key, value|
|
87
|
+
!['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
|
88
|
+
end
|
89
|
+
end
|
9
90
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
91
|
+
def self.json_response?(response)
|
92
|
+
return false unless response && response.headers
|
93
|
+
response.get_header('Content-Type') =~ %r{application/json}i ? true : false
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.normalize_url(endpoint)
|
97
|
+
return nil unless endpoint
|
98
|
+
str = endpoint.chomp " "
|
99
|
+
str = str.chomp "/"
|
100
|
+
str.downcase
|
101
|
+
end
|
102
|
+
|
103
|
+
# CGI.escape, but without special treatment on spaces
|
104
|
+
def self.escape(str,extra_exclude_chars = '')
|
105
|
+
# '-' is a special character inside a regex class so it must be first or last.
|
106
|
+
# Add extra excludes before the final '-' so it always remains trailing, otherwise
|
107
|
+
# an unwanted range is created by mistake.
|
108
|
+
str.gsub(/([^a-zA-Z0-9_.#{extra_exclude_chars}-]+)/) do
|
109
|
+
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
data/lib/fog/rackspace/cdn.rb
CHANGED
data/lib/fog/rackspace/cdn_v2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Rackspace
|
@@ -34,6 +34,7 @@ module Fog
|
|
34
34
|
|
35
35
|
def initialize(options)
|
36
36
|
@rackspace_api_key = options[:rackspace_api_key]
|
37
|
+
@rackspace_region = options[:rackspace_region]
|
37
38
|
end
|
38
39
|
|
39
40
|
def request(params)
|
@@ -55,11 +56,12 @@ module Fog
|
|
55
56
|
|
56
57
|
class Real < Fog::Rackspace::Service
|
57
58
|
def initialize(options = {})
|
58
|
-
@rackspace_api_key
|
59
|
-
@rackspace_username
|
60
|
-
@rackspace_auth_url
|
59
|
+
@rackspace_api_key = options[:rackspace_api_key]
|
60
|
+
@rackspace_username = options[:rackspace_username]
|
61
|
+
@rackspace_auth_url = options[:rackspace_auth_url]
|
62
|
+
@rackspace_region = options[:rackspace_region]
|
63
|
+
@connection_options = options[:connection_options] || {}
|
61
64
|
@rackspace_must_reauthenticate = false
|
62
|
-
@connection_options = options[:connection_options] || {}
|
63
65
|
|
64
66
|
authenticate
|
65
67
|
|
data/lib/fog/rackspace/dns.rb
CHANGED
@@ -60,7 +60,7 @@ irb: service.stacks.new.save({
|
|
60
60
|
We get back a JSON blob filled with info about our new stack:
|
61
61
|
|
62
62
|
```ruby
|
63
|
-
===> {"id"=>"73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "links"=>[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
63
|
+
===> {"id"=>"73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "links"=>[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"self"}]}
|
64
64
|
```
|
65
65
|
|
66
66
|
Now that we have the `id` of our new stack, we can get a reference to it using the stack's `name` and `id`:
|
@@ -71,7 +71,7 @@ irb: stack = service.stacks.get("a_redis_stack", "73e0f38a-a9fb-4a4e-8196-2b6303
|
|
71
71
|
===> <Fog::Rackspace::Orchestration::Stack
|
72
72
|
id="73e0f38a-a9fb-4a4e-8196-2b63039ef31f",
|
73
73
|
description="This is a Heat template to deploy a standalone redis server on\nRackspace Cloud Servers\n",
|
74
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
74
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"self"}],
|
75
75
|
stack_status_reason="Stack CREATE started",
|
76
76
|
stack_name="a_redis_stack",
|
77
77
|
creation_time="2014-11-13T16:21:02Z",
|
@@ -88,7 +88,7 @@ irb: stack.events
|
|
88
88
|
id="7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e",
|
89
89
|
resource_name="redis_server_config",
|
90
90
|
event_time="2014-11-13T16:21:45Z",
|
91
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
91
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config/events/7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config", "rel"=>"resource"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"stack"}],
|
92
92
|
logical_resource_id="redis_server_config",
|
93
93
|
resource_status="CREATE_IN_PROGRESS",
|
94
94
|
resource_status_reason="state changed",
|
@@ -105,7 +105,7 @@ irb: stack.resources
|
|
105
105
|
id=nil,
|
106
106
|
resource_name="redis_server",
|
107
107
|
description=nil,
|
108
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
108
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"stack"}],
|
109
109
|
logical_resource_id="redis_server",
|
110
110
|
resource_status="CREATE_COMPLETE",
|
111
111
|
updated_time="2014-11-13T16:21:04Z",
|
@@ -133,7 +133,7 @@ irb: stacks = service.stacks.all(sort_key: "stack_name", sort_dir: "asc")
|
|
133
133
|
<Fog::Rackspace::Orchestration::Stack
|
134
134
|
id="73e0f38a-a9fb-4a4e-8196-2b63039ef31f",
|
135
135
|
description="This is a Heat template to deploy a standalone redis server on\nRackspace Cloud Servers\n",
|
136
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
136
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"self"}],
|
137
137
|
stack_status_reason="Stack CREATE started",
|
138
138
|
stack_name="a_redis_stack",
|
139
139
|
creation_time="2014-11-13T16:21:02Z",
|
@@ -155,7 +155,7 @@ You can abandon a stack -- essentially, it will delete the stack, but keep the r
|
|
155
155
|
|
156
156
|
```ruby
|
157
157
|
irb: stack.abandon
|
158
|
-
===> #<Excon::Response:0x00000104d6b870 @data={:body=>{"status"=>"IN_PROGRESS", "name"=>"a_redis_stack", "stack_user_project_id"=>"
|
158
|
+
===> #<Excon::Response:0x00000104d6b870 @data={:body=>{"status"=>"IN_PROGRESS", "name"=>"a_redis_stack", "stack_user_project_id"=>"TENANT_ID", "environment"=>{"parameters"=>{}, "resource_registry"=>{"resources"=>{}}}, "template"=>{"parameter_groups"=>[{"parameters"=>["flavor", "image"], "label"=>"Server Settings"}, {"parameters"=>["redis_port"], "label"=>"Redis Settings"}, {"parameters"=>["redis_version", "redis_hostname", "kitchen", "chef_version"], "label"=>"rax-dev-params"}], "heat_template_version"=>"2013-05-23", "description"=>"This is a Heat te
|
159
159
|
```
|
160
160
|
|
161
161
|
You can preview a stack:
|
@@ -168,7 +168,7 @@ irb: service.stacks.preview({
|
|
168
168
|
===> <Fog::Rackspace::Orchestration::Stack
|
169
169
|
id="None",
|
170
170
|
description="This is a Heat template to deploy a standalone redis server on\nRackspace Cloud Servers\n",
|
171
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
171
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_template/None", "rel"=>"self"}],
|
172
172
|
stack_status_reason=nil,
|
173
173
|
stack_name="a_redis_template",
|
174
174
|
creation_time="2014-11-13T16:33:50Z",
|
@@ -208,7 +208,7 @@ irb: event = stack.events.first
|
|
208
208
|
id="7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e",
|
209
209
|
resource_name="redis_server_config",
|
210
210
|
event_time="2014-11-13T16:21:45Z",
|
211
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
211
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config/events/7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config", "rel"=>"resource"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"stack"}],
|
212
212
|
logical_resource_id="redis_server_config",
|
213
213
|
resource_status="CREATE_IN_PROGRESS",
|
214
214
|
resource_status_reason="state changed",
|
@@ -238,7 +238,7 @@ irb: event = service.events.get(stack, resource, event_id)
|
|
238
238
|
id="7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e",
|
239
239
|
resource_name="redis_server_config",
|
240
240
|
event_time="2014-11-13T16:21:45Z",
|
241
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
241
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config/events/7b1830a3-5d7b-43b2-bc1b-cffbb25c8b3e", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config", "rel"=>"resource"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"stack"}],
|
242
242
|
logical_resource_id="redis_server_config",
|
243
243
|
resource_status="CREATE_IN_PROGRESS",
|
244
244
|
resource_status_reason="state changed",
|
@@ -253,7 +253,7 @@ irb: event.stack
|
|
253
253
|
===> <Fog::Rackspace::Orchestration::Stack
|
254
254
|
id="73e0f38a-a9fb-4a4e-8196-2b63039ef31f",
|
255
255
|
description="This is a Heat template to deploy a standalone redis server on\nRackspace Cloud Servers\n",
|
256
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
256
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"self"}],
|
257
257
|
stack_status_reason="Stack CREATE completed successfully",
|
258
258
|
stack_name="a_redis_stack",
|
259
259
|
creation_time="2014-11-13T16:21:02Z",
|
@@ -282,7 +282,7 @@ irb: resource = event.resource
|
|
282
282
|
id=nil,
|
283
283
|
resource_name="redis_server_config",
|
284
284
|
description="",
|
285
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
285
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f/resources/redis_server_config", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"stack"}],
|
286
286
|
logical_resource_id="redis_server_config",
|
287
287
|
resource_status="CREATE_COMPLETE",
|
288
288
|
updated_time="2014-11-13T16:21:45Z",
|
@@ -304,7 +304,7 @@ irb: service.resources.all(stack, {nested_depth: 1})
|
|
304
304
|
id=nil,
|
305
305
|
resource_name="redis_server",
|
306
306
|
description=nil,
|
307
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
307
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/ee648a3b-14a3-4df8-aa58-620a9d67e3e5/resources/redis_server", "rel"=>"self"}, {"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/ee648a3b-14a3-4df8-aa58-620a9d67e3e5", "rel"=>"stack"}],
|
308
308
|
logical_resource_id="redis_server",
|
309
309
|
resource_status="CREATE_COMPLETE",
|
310
310
|
updated_time="2014-11-13T16:32:30Z",
|
@@ -322,7 +322,7 @@ irb: resource.stack
|
|
322
322
|
===> <Fog::Rackspace::Orchestration::Stack
|
323
323
|
id="73e0f38a-a9fb-4a4e-8196-2b63039ef31f",
|
324
324
|
description="This is a Heat template to deploy a standalone redis server on\nRackspace Cloud Servers\n",
|
325
|
-
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/
|
325
|
+
links=[{"href"=>"https://iad.orchestration.api.rackspacecloud.com/v1/TENANT_ID/stacks/a_redis_stack/73e0f38a-a9fb-4a4e-8196-2b63039ef31f", "rel"=>"self"}],
|
326
326
|
stack_status_reason="Stack CREATE completed successfully",
|
327
327
|
stack_name="a_redis_stack",
|
328
328
|
creation_time="2014-11-13T16:21:02Z",
|
data/lib/fog/rackspace/errors.rb
CHANGED
@@ -3,30 +3,102 @@ module Fog
|
|
3
3
|
module Errors
|
4
4
|
def self.included(mod)
|
5
5
|
mod.class_eval <<-'EOS', __FILE__, __LINE__
|
6
|
-
|
7
|
-
|
6
|
+
class NotFound < Fog::Service::NotFound
|
7
|
+
attr_reader :region, :status_code, :transaction_id
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
def to_s
|
10
|
+
status = status_code ? "HTTP #{status_code}" : "HTTP <Unknown>"
|
11
|
+
message = region ? "resource not found in #{region} region" : super
|
12
|
+
"[#{status} | #{transaction_id}] #{message}"
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
def self.slurp(error, service=nil)
|
16
|
+
exception = NotFound.new
|
17
|
+
exception.instance_variable_set(:@region, service.region) if service && service.respond_to?(:region)
|
18
|
+
exception.instance_variable_set(:@status_code, error.response.status) rescue nil
|
19
|
+
exception.set_transaction_id(error, service)
|
20
|
+
exception
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_transaction_id(error, service)
|
24
|
+
return unless service && service.respond_to?(:request_id_header) && error.response
|
25
|
+
@transaction_id = error.response.headers[service.request_id_header]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
EOS
|
30
|
+
end
|
31
|
+
|
32
|
+
class ServiceError < Fog::Errors::Error
|
33
|
+
attr_reader :response_data, :status_code, :transaction_id
|
34
|
+
|
35
|
+
def to_s
|
36
|
+
status = status_code ? "HTTP #{status_code}" : "HTTP <Unknown>"
|
37
|
+
"[#{status} | #{transaction_id}] #{super}"
|
38
|
+
end
|
22
39
|
|
23
|
-
|
24
|
-
|
25
|
-
|
40
|
+
def self.slurp(error, service=nil)
|
41
|
+
data = nil
|
42
|
+
message = nil
|
43
|
+
status_code = nil
|
44
|
+
|
45
|
+
if error.response
|
46
|
+
status_code = error.response.status
|
47
|
+
unless error.response.body.empty?
|
48
|
+
begin
|
49
|
+
data = Fog::JSON.decode(error.response.body)
|
50
|
+
message = extract_message(data)
|
51
|
+
rescue => e
|
52
|
+
Fog::Logger.warning("Received exception '#{e}' while decoding>> #{error.response.body}")
|
53
|
+
message = error.response.body
|
54
|
+
data = error.response.body
|
55
|
+
end
|
26
56
|
end
|
57
|
+
end
|
58
|
+
|
59
|
+
new_error = super(error, message)
|
60
|
+
new_error.instance_variable_set(:@response_data, data)
|
61
|
+
new_error.instance_variable_set(:@status_code, status_code)
|
62
|
+
new_error.set_transaction_id(error, service)
|
63
|
+
new_error
|
64
|
+
end
|
27
65
|
|
66
|
+
def set_transaction_id(error, service)
|
67
|
+
return unless service && service.respond_to?(:request_id_header) && error.response
|
68
|
+
@transaction_id = error.response.headers[service.request_id_header]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.extract_message(data)
|
72
|
+
if data.is_a?(Hash)
|
73
|
+
message = data.values.first['message'] if data.values.first.is_a?(Hash)
|
74
|
+
message ||= data['message']
|
28
75
|
end
|
29
|
-
|
76
|
+
message || data.inspect
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class InternalServerError < ServiceError; end
|
81
|
+
class Conflict < ServiceError; end
|
82
|
+
class ServiceUnavailable < ServiceError; end
|
83
|
+
class MethodNotAllowed < ServiceError; end
|
84
|
+
class BadRequest < ServiceError
|
85
|
+
attr_reader :validation_errors
|
86
|
+
|
87
|
+
def to_s
|
88
|
+
"#{super} - #{validation_errors}"
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.slurp(error, service=nil)
|
92
|
+
new_error = super(error)
|
93
|
+
unless new_error.response_data.nil? or new_error.response_data['badRequest'].nil?
|
94
|
+
new_error.instance_variable_set(:@validation_errors, new_error.response_data['badRequest']['validationErrors'])
|
95
|
+
end
|
96
|
+
|
97
|
+
status_code = error.response ? error.response.status : nil
|
98
|
+
new_error.instance_variable_set(:@status_code, status_code)
|
99
|
+
new_error.set_transaction_id(error, service)
|
100
|
+
new_error
|
101
|
+
end
|
30
102
|
end
|
31
103
|
end
|
32
104
|
end
|
@@ -112,67 +112,6 @@ module Fog
|
|
112
112
|
"extra_specs" => {}
|
113
113
|
}
|
114
114
|
|
115
|
-
#AutoScale
|
116
|
-
launch_config = {
|
117
|
-
"args" => {
|
118
|
-
"loadBalancers" => [
|
119
|
-
{
|
120
|
-
"port" => 8080,
|
121
|
-
"loadBalancerId" => 9099
|
122
|
-
}
|
123
|
-
],
|
124
|
-
"server" => {
|
125
|
-
"name" => "autoscale_server",
|
126
|
-
"imageRef" => "0d589460-f177-4b0f-81c1-8ab8903ac7d8",
|
127
|
-
"flavorRef" => "2",
|
128
|
-
"OS-DCF =>diskConfig" => "AUTO",
|
129
|
-
"metadata" => {
|
130
|
-
"build_config" => "core",
|
131
|
-
"meta_key_1" => "meta_value_1",
|
132
|
-
"meta_key_2" => "meta_value_2"
|
133
|
-
},
|
134
|
-
"networks" => [
|
135
|
-
{
|
136
|
-
"uuid" => "11111111-1111-1111-1111-111111111111"
|
137
|
-
},
|
138
|
-
{
|
139
|
-
"uuid" => "00000000-0000-0000-0000-000000000000"
|
140
|
-
}
|
141
|
-
],
|
142
|
-
"personality" => [
|
143
|
-
{
|
144
|
-
"path" => "/root/.csivh",
|
145
|
-
"contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4="
|
146
|
-
}
|
147
|
-
]
|
148
|
-
}
|
149
|
-
},
|
150
|
-
"type" => "launch_server"
|
151
|
-
}
|
152
|
-
|
153
|
-
group_config = {
|
154
|
-
"max_entities" => 10,
|
155
|
-
"cooldown" => 360,
|
156
|
-
"name" => "testscalinggroup198547",
|
157
|
-
"min_entities" => 0,
|
158
|
-
"metadata" => {
|
159
|
-
"gc_meta_key_2" => "gc_meta_value_2",
|
160
|
-
"gc_meta_key_1" => "gc_meta_value_1"
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
policy = {
|
165
|
-
"cooldown" => 0,
|
166
|
-
"type" => "webhook",
|
167
|
-
"name" => "scale up by 1",
|
168
|
-
"change" => 1
|
169
|
-
}
|
170
|
-
|
171
|
-
webhook = {
|
172
|
-
"name" => "webhook name",
|
173
|
-
"metadata" => {'foo' => 'bar'}
|
174
|
-
}
|
175
|
-
|
176
115
|
mock_data = {
|
177
116
|
#Compute V2
|
178
117
|
:flavors => Hash.new { |h,k| h[k] = flavor unless [NOT_FOUND_ID, '0'].include?(k) },
|
@@ -271,8 +271,11 @@ module Fog
|
|
271
271
|
modified_options[:boot_image_id] ||= attributes[:boot_image_id]
|
272
272
|
modified_options[:boot_volume_size] ||= attributes[:boot_volume_size]
|
273
273
|
|
274
|
-
if modified_options[:networks]
|
275
|
-
|
274
|
+
if mn = modified_options[:networks]
|
275
|
+
# If we've already processed it into the correct form don't process again.
|
276
|
+
unless mn.first.is_a?(Hash)
|
277
|
+
modified_options[:networks].map! { |id| { :uuid => id } }
|
278
|
+
end
|
276
279
|
end
|
277
280
|
|
278
281
|
data = service.create_server(name, image_id, flavor_id, 1, 1, modified_options)
|
data/lib/fog/rackspace/queues.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Darby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rubyzip
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,48 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: 0.9.9
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.24.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.24.2
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: mime-types
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,14 +215,19 @@ extra_rdoc_files: []
|
|
159
215
|
files:
|
160
216
|
- ".gitignore"
|
161
217
|
- ".rspec"
|
218
|
+
- ".ruby-gemset"
|
219
|
+
- ".ruby-version"
|
162
220
|
- ".travis.yml"
|
163
221
|
- CODE_OF_CONDUCT.md
|
222
|
+
- CONTRIBUTING.md
|
223
|
+
- CONTRIBUTORS.md
|
164
224
|
- Gemfile
|
165
|
-
- LICENSE.
|
225
|
+
- LICENSE.md
|
166
226
|
- README.md
|
167
227
|
- Rakefile
|
168
228
|
- bin/console
|
169
229
|
- bin/setup
|
230
|
+
- circle.yml
|
170
231
|
- fog-rackspace.gemspec
|
171
232
|
- lib/fog/rackspace.rb
|
172
233
|
- lib/fog/rackspace/auto_scale.rb
|
@@ -175,7 +236,6 @@ files:
|
|
175
236
|
- lib/fog/rackspace/cdn_v2.rb
|
176
237
|
- lib/fog/rackspace/compute.rb
|
177
238
|
- lib/fog/rackspace/compute_v2.rb
|
178
|
-
- lib/fog/rackspace/core.rb
|
179
239
|
- lib/fog/rackspace/databases.rb
|
180
240
|
- lib/fog/rackspace/dns.rb
|
181
241
|
- lib/fog/rackspace/docs/auto_scale.md
|
@@ -891,4 +951,3 @@ signing_key:
|
|
891
951
|
specification_version: 4
|
892
952
|
summary: Rackspace support for Fog
|
893
953
|
test_files: []
|
894
|
-
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Matt Darby
|
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/lib/fog/rackspace/core.rb
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'fog/core'
|
2
|
-
require 'fog/json'
|
3
|
-
require 'fog/rackspace/mock_data'
|
4
|
-
require 'fog/rackspace/service'
|
5
|
-
require 'fog/rackspace/errors'
|
6
|
-
|
7
|
-
module Fog
|
8
|
-
module Rackspace
|
9
|
-
extend Fog::Provider
|
10
|
-
|
11
|
-
US_AUTH_ENDPOINT = 'https://identity.api.rackspacecloud.com/v2.0' unless defined? US_AUTH_ENDPOINT
|
12
|
-
UK_AUTH_ENDPOINT = 'https://lon.identity.api.rackspacecloud.com/v2.0' unless defined? UK_AUTH_ENDPOINT
|
13
|
-
|
14
|
-
module Errors
|
15
|
-
class ServiceError < Fog::Errors::Error
|
16
|
-
attr_reader :response_data, :status_code, :transaction_id
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
status = status_code ? "HTTP #{status_code}" : "HTTP <Unknown>"
|
20
|
-
"[#{status} | #{transaction_id}] #{super}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.slurp(error, service=nil)
|
24
|
-
data = nil
|
25
|
-
message = nil
|
26
|
-
status_code = nil
|
27
|
-
|
28
|
-
if error.response
|
29
|
-
status_code = error.response.status
|
30
|
-
unless error.response.body.empty?
|
31
|
-
begin
|
32
|
-
data = Fog::JSON.decode(error.response.body)
|
33
|
-
message = extract_message(data)
|
34
|
-
rescue => e
|
35
|
-
Fog::Logger.warning("Received exception '#{e}' while decoding>> #{error.response.body}")
|
36
|
-
message = error.response.body
|
37
|
-
data = error.response.body
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
new_error = super(error, message)
|
43
|
-
new_error.instance_variable_set(:@response_data, data)
|
44
|
-
new_error.instance_variable_set(:@status_code, status_code)
|
45
|
-
new_error.set_transaction_id(error, service)
|
46
|
-
new_error
|
47
|
-
end
|
48
|
-
|
49
|
-
def set_transaction_id(error, service)
|
50
|
-
return unless service && service.respond_to?(:request_id_header) && error.response
|
51
|
-
@transaction_id = error.response.headers[service.request_id_header]
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.extract_message(data)
|
55
|
-
if data.is_a?(Hash)
|
56
|
-
message = data.values.first['message'] if data.values.first.is_a?(Hash)
|
57
|
-
message ||= data['message']
|
58
|
-
end
|
59
|
-
message || data.inspect
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class InternalServerError < ServiceError; end
|
64
|
-
class Conflict < ServiceError; end
|
65
|
-
class ServiceUnavailable < ServiceError; end
|
66
|
-
class MethodNotAllowed < ServiceError; end
|
67
|
-
class BadRequest < ServiceError
|
68
|
-
attr_reader :validation_errors
|
69
|
-
|
70
|
-
def to_s
|
71
|
-
"#{super} - #{validation_errors}"
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.slurp(error, service=nil)
|
75
|
-
new_error = super(error)
|
76
|
-
unless new_error.response_data.nil? or new_error.response_data['badRequest'].nil?
|
77
|
-
new_error.instance_variable_set(:@validation_errors, new_error.response_data['badRequest']['validationErrors'])
|
78
|
-
end
|
79
|
-
|
80
|
-
status_code = error.response ? error.response.status : nil
|
81
|
-
new_error.instance_variable_set(:@status_code, status_code)
|
82
|
-
new_error.set_transaction_id(error, service)
|
83
|
-
new_error
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
service(:auto_scale, 'AutoScale')
|
89
|
-
service(:block_storage, 'BlockStorage')
|
90
|
-
service(:cdn, 'CDN')
|
91
|
-
service(:cdn_v2, 'CDN v2')
|
92
|
-
service(:compute, 'Compute')
|
93
|
-
service(:compute_v2, 'Compute v2')
|
94
|
-
service(:dns, 'DNS')
|
95
|
-
service(:storage, 'Storage')
|
96
|
-
service(:load_balancers, 'LoadBalancers')
|
97
|
-
service(:identity, 'Identity')
|
98
|
-
service(:databases, 'Databases')
|
99
|
-
service(:monitoring, 'Monitoring')
|
100
|
-
service(:queues, 'Queues')
|
101
|
-
service(:networking, 'Networking')
|
102
|
-
service(:orchestration, 'Orchestration')
|
103
|
-
service(:networkingV2, 'NetworkingV2')
|
104
|
-
|
105
|
-
def self.authenticate(options, connection_options = {})
|
106
|
-
rackspace_auth_url = options[:rackspace_auth_url]
|
107
|
-
rackspace_auth_url ||= options[:rackspace_endpoint] == Fog::Compute::RackspaceV2::LON_ENDPOINT ? UK_AUTH_ENDPOINT : US_AUTH_ENDPOINT
|
108
|
-
url = rackspace_auth_url.match(/^https?:/) ? \
|
109
|
-
rackspace_auth_url : 'https://' + rackspace_auth_url
|
110
|
-
uri = URI.parse(url)
|
111
|
-
connection = Fog::Core::Connection.new(url, false, connection_options)
|
112
|
-
@rackspace_api_key = options[:rackspace_api_key]
|
113
|
-
@rackspace_username = options[:rackspace_username]
|
114
|
-
response = connection.request({
|
115
|
-
:expects => [200, 204],
|
116
|
-
:headers => {
|
117
|
-
'X-Auth-Key' => @rackspace_api_key,
|
118
|
-
'X-Auth-User' => @rackspace_username
|
119
|
-
},
|
120
|
-
:method => 'GET',
|
121
|
-
:path => (uri.path and not uri.path.empty?) ? uri.path : 'v1.0'
|
122
|
-
})
|
123
|
-
response.headers.reject do |key, value|
|
124
|
-
!['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def self.json_response?(response)
|
129
|
-
return false unless response && response.headers
|
130
|
-
response.get_header('Content-Type') =~ %r{application/json}i ? true : false
|
131
|
-
end
|
132
|
-
|
133
|
-
def self.normalize_url(endpoint)
|
134
|
-
return nil unless endpoint
|
135
|
-
str = endpoint.chomp " "
|
136
|
-
str = str.chomp "/"
|
137
|
-
str.downcase
|
138
|
-
end
|
139
|
-
|
140
|
-
# CGI.escape, but without special treatment on spaces
|
141
|
-
def self.escape(str,extra_exclude_chars = '')
|
142
|
-
# '-' is a special character inside a regex class so it must be first or last.
|
143
|
-
# Add extra excludes before the final '-' so it always remains trailing, otherwise
|
144
|
-
# an unwanted range is created by mistake.
|
145
|
-
str.gsub(/([^a-zA-Z0-9_.#{extra_exclude_chars}-]+)/) do
|
146
|
-
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|