Permalink
Browse files

Merge branch 'atmos' into services-r6

Conflicts:
	base/lib/base/gateway.rb

Change-Id: I54d3f2b7f83590f48ee9ff3a55ea0437f315b131
  • Loading branch information...
2 parents ff646df + 0270662 commit de4073e351c22922abe9b2bab82340bcf581e472 figo committed Nov 13, 2011
Showing with 1,021 additions and 1 deletion.
  1. +22 −0 atmos/Gemfile
  2. +129 −0 atmos/Gemfile.lock
  3. +39 −0 atmos/Rakefile
  4. +32 −0 atmos/bin/atmos_gateway
  5. +29 −0 atmos/config/atmos_gateway.yml
  6. +17 −0 atmos/lib/atmos_service/atmos_error.rb
  7. +143 −0 atmos/lib/atmos_service/atmos_helper.rb
  8. +12 −0 atmos/lib/atmos_service/common.rb
  9. +154 −0 atmos/lib/atmos_service/provisioner.rb
  10. +41 −0 atmos/spec/Rakefile
  11. +194 −0 atmos/spec/atmos_gateway_spec.rb
  12. +115 −0 atmos/spec/atmos_rest_client.rb
  13. +88 −0 atmos/spec/spec_helper.rb
  14. BIN atmos/vendor/cache/addressable-2.2.4.gem
  15. BIN atmos/vendor/cache/bcrypt-ruby-2.1.4.gem
  16. BIN atmos/vendor/cache/builder-3.0.0.gem
  17. BIN atmos/vendor/cache/ci_reporter-1.6.4.gem
  18. BIN atmos/vendor/cache/daemons-1.1.2.gem
  19. BIN atmos/vendor/cache/data_objects-0.10.3.gem
  20. BIN atmos/vendor/cache/datamapper-1.1.0.gem
  21. BIN atmos/vendor/cache/diff-lcs-1.1.2.gem
  22. BIN atmos/vendor/cache/dm-aggregates-1.1.0.gem
  23. BIN atmos/vendor/cache/dm-constraints-1.1.0.gem
  24. BIN atmos/vendor/cache/dm-core-1.1.0.gem
  25. BIN atmos/vendor/cache/dm-do-adapter-1.1.0.gem
  26. BIN atmos/vendor/cache/dm-migrations-1.1.0.gem
  27. BIN atmos/vendor/cache/dm-serializer-1.1.0.gem
  28. BIN atmos/vendor/cache/dm-sqlite-adapter-1.1.0.gem
  29. BIN atmos/vendor/cache/dm-timestamps-1.1.0.gem
  30. BIN atmos/vendor/cache/dm-transactions-1.1.0.gem
  31. BIN atmos/vendor/cache/dm-types-1.1.0.gem
  32. BIN atmos/vendor/cache/dm-validations-1.1.0.gem
  33. BIN atmos/vendor/cache/do_sqlite3-0.10.3.gem
  34. BIN atmos/vendor/cache/em-http-request-0.3.0.gem
  35. BIN atmos/vendor/cache/escape_utils-0.2.3.gem
  36. BIN atmos/vendor/cache/eventmachine-0.12.10.gem
  37. BIN atmos/vendor/cache/fastercsv-1.5.4.gem
  38. BIN atmos/vendor/cache/json-1.4.6.gem
  39. BIN atmos/vendor/cache/json_pure-1.5.1.gem
  40. BIN atmos/vendor/cache/little-plugger-1.1.2.gem
  41. BIN atmos/vendor/cache/logging-1.5.0.gem
  42. BIN atmos/vendor/cache/nats-0.4.10.gem
  43. BIN atmos/vendor/cache/posix-spawn-0.3.6.gem
  44. BIN atmos/vendor/cache/rack-1.2.2.gem
  45. BIN atmos/vendor/cache/rake-0.8.7.gem
  46. BIN atmos/vendor/cache/rcov-0.9.9.gem
  47. BIN atmos/vendor/cache/rspec-2.5.0.gem
  48. BIN atmos/vendor/cache/rspec-core-2.5.1.gem
  49. BIN atmos/vendor/cache/rspec-expectations-2.5.0.gem
  50. BIN atmos/vendor/cache/rspec-mocks-2.5.0.gem
  51. BIN atmos/vendor/cache/ruby-hmac-0.4.0.gem
  52. BIN atmos/vendor/cache/sinatra-1.2.1.gem
  53. BIN atmos/vendor/cache/stringex-1.2.1.gem
  54. BIN atmos/vendor/cache/thin-1.2.11.gem
  55. BIN atmos/vendor/cache/tilt-1.2.2.gem
  56. BIN atmos/vendor/cache/uuidtools-2.1.2.gem
  57. BIN atmos/vendor/cache/vcap_logging-0.1.3.gem
  58. BIN atmos/vendor/cache/xml-simple-1.0.15.gem
  59. BIN atmos/vendor/cache/yajl-ruby-0.8.3.gem
  60. +6 −1 base/lib/base/gateway.rb
View
@@ -0,0 +1,22 @@
+source :rubygems
+
+gem "eventmachine"
+gem "em-http-request"
+gem "ruby-hmac"
+gem "uuidtools"
+gem "datamapper", ">= 0.10.2"
+gem "do_sqlite3"
+gem "dm-sqlite-adapter"
+gem "sinatra"
+gem "thin"
+gem "xml-simple"
+
+gem 'vcap_common', :path => '../../common'
+gem 'vcap_logging', '>=0.1.3', :require => ['vcap/logging']
+
+group :test do
+ gem "rake"
+ gem "rspec"
+ gem "rcov"
+ gem "ci_reporter"
+end
View
@@ -0,0 +1,129 @@
+PATH
+ remote: ../../common
+ specs:
+ vcap_common (0.99)
+ eventmachine (~> 0.12.10)
+ logging (>= 1.5.0)
+ nats
+ posix-spawn
+ thin
+ yajl-ruby
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.4)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ ci_reporter (1.6.4)
+ builder (>= 2.1.2)
+ daemons (1.1.2)
+ data_objects (0.10.3)
+ addressable (~> 2.1)
+ datamapper (1.1.0)
+ dm-aggregates (= 1.1.0)
+ dm-constraints (= 1.1.0)
+ dm-core (= 1.1.0)
+ dm-migrations (= 1.1.0)
+ dm-serializer (= 1.1.0)
+ dm-timestamps (= 1.1.0)
+ dm-transactions (= 1.1.0)
+ dm-types (= 1.1.0)
+ dm-validations (= 1.1.0)
+ diff-lcs (1.1.2)
+ dm-aggregates (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-constraints (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-core (1.1.0)
+ addressable (~> 2.2.4)
+ dm-do-adapter (1.1.0)
+ data_objects (~> 0.10.2)
+ dm-core (~> 1.1.0)
+ dm-migrations (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-serializer (1.1.0)
+ dm-core (~> 1.1.0)
+ fastercsv (~> 1.5.4)
+ json (~> 1.4.6)
+ dm-sqlite-adapter (1.1.0)
+ dm-do-adapter (~> 1.1.0)
+ do_sqlite3 (~> 0.10.2)
+ dm-timestamps (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-transactions (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-types (1.1.0)
+ bcrypt-ruby (~> 2.1.4)
+ dm-core (~> 1.1.0)
+ fastercsv (~> 1.5.4)
+ json (~> 1.4.6)
+ stringex (~> 1.2.0)
+ uuidtools (~> 2.1.2)
+ dm-validations (1.1.0)
+ dm-core (~> 1.1.0)
+ do_sqlite3 (0.10.3)
+ data_objects (= 0.10.3)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ escape_utils (0.2.3)
+ eventmachine (0.12.10)
+ fastercsv (1.5.4)
+ json (1.4.6)
+ json_pure (1.5.1)
+ little-plugger (1.1.2)
+ logging (1.5.0)
+ little-plugger (>= 1.1.2)
+ nats (0.4.10)
+ daemons (>= 1.1.0)
+ eventmachine (>= 0.12.10)
+ json_pure (>= 1.5.1)
+ posix-spawn (0.3.6)
+ rack (1.2.2)
+ rake (0.8.7)
+ rcov (0.9.9)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ ruby-hmac (0.4.0)
+ sinatra (1.2.1)
+ rack (~> 1.1)
+ tilt (< 2.0, >= 1.2.2)
+ stringex (1.2.1)
+ thin (1.2.11)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.2.2)
+ uuidtools (2.1.2)
+ vcap_logging (0.1.3)
+ xml-simple (1.0.15)
+ yajl-ruby (0.8.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ ci_reporter
+ datamapper (>= 0.10.2)
+ dm-sqlite-adapter
+ do_sqlite3
+ em-http-request
+ eventmachine
+ rake
+ rcov
+ rspec
+ ruby-hmac
+ sinatra
+ thin
+ uuidtools
+ vcap_common!
+ vcap_logging (>= 0.1.3)
+ xml-simple
View
@@ -0,0 +1,39 @@
+require 'rake'
+
+desc "Run specs"
+task "spec" => ["bundler:install:test", "test:spec"]
+
+desc "Run specs using RCov"
+task "spec:rcov" => ["bundler:install:test", "test:spec:rcov"]
+
+namespace "bundler" do
+ desc "Install gems"
+ task "install" do
+ sh("bundle install")
+ end
+
+ desc "Install gems for test"
+ task "install:test" do
+ sh("bundle install --without development production")
+ end
+
+ desc "Install gems for production"
+ task "install:production" do
+ sh("bundle install --without development test")
+ end
+
+ desc "Install gems for development"
+ task "install:development" do
+ sh("bundle install --without test production")
+ end
+end
+
+namespace "test" do
+ task "spec" do |t|
+ sh("cd spec && ../../base/bin/nats-util start && rake spec && ../../base/bin/nats-util stop")
+ end
+
+ task "spec:rcov" do |t|
+ sh("cd spec && rake spec:rcov")
+ end
+end
View
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+#
+# Copyright (c) 2009-2011 VMware, Inc.
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'base', 'lib')
+require 'base/gateway'
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'atmos_service/provisioner'
+require 'atmos_service/atmos_helper'
+
+class VCAP::Services::Atmos::Gateway < VCAP::Services::Base::Gateway
+
+ def provisioner_class
+ VCAP::Services::Atmos::Provisioner
+ end
+
+ def default_config_file
+ File.join(File.dirname(__FILE__), '..', 'config', 'atmos_gateway.yml')
+ end
+
+ def additional_options
+ {:atmos => @config[:atmos]}
+ end
+end
+
+VCAP::Services::Atmos::Gateway.new.start
+
+
@@ -0,0 +1,29 @@
+---
+#cloud_controller_uri: api.vcap.me
+service:
+ name: atmos
+ version: "1.4"
+ description: 'Atmos object store'
+ plans: ['free']
+ tags: ['atmos', 'atmos-1.4', 'object store']
+ip_route: localhost
+#proxy:
+# host: proxy
+# port: 8080
+# keepalive: true
+index: 0
+token: "0xdeadbeef"
+mbus: nats://localhost:4222
+logging:
+ level: debug
+pid: /var/vcap/sys/run/atmos_service.pid
+
+# atmos configuration
+# Not configured by default as it would require revealing
+# credentials to a non-local resource.
+atmos:
+ host: "127.0.0.1"
+ port: "443"
+ tenant: "tenant"
+ tenantadmin: "admin"
+ tenantpasswd: "password"
@@ -0,0 +1,17 @@
+# Copyright (c) 2009-2011 VMware, Inc.
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'base', 'lib')
+
+require "base/service_error"
+
+module VCAP
+ module Services
+ module Atmos
+ class AtmosError < VCAP::Services::Base::Error::ServiceError
+ ATMOS_BACKEND_ERROR_CREATE_SUBTENAT = [31801, HTTP_INTERNAL, 'Atmos create subtenant error. Atmos error code: %s.']
+ ATMOS_BACKEND_ERROR_DELETE_SUBTENAT = [31802, HTTP_INTERNAL, 'Atmos delete subtenant error. Atmos error code: %s.']
+ ATMOS_BACKEND_ERROR_CREATE_USER = [31803, HTTP_INTERNAL, 'Atmos create user error. Atmos error code: %s.']
+ ATMOS_BACKEND_ERROR_DELETE_USER = [31804, HTTP_INTERNAL, 'Atmos delete user error. Atmos error code: %s.']
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit de4073e

Please sign in to comment.