fog-1.34.0/0000755000004100000410000000000012600047642012403 5ustar www-datawww-datafog-1.34.0/Rakefile0000644000004100000410000001316612600047641014056 0ustar www-datawww-datarequire 'bundler/setup' require 'rake/testtask' require 'date' require 'rubygems' require 'rubygems/package_task' require 'yard' require File.dirname(__FILE__) + '/lib/fog' require "tasks/changelog_task" Fog::Rake::ChangelogTask.new require "tasks/github_release_task" Fog::Rake::GithubReleaseTask.new ############################################################################# # # Helper functions # ############################################################################# def name @name ||= Dir['*.gemspec'].first.split('.').first end def version Fog::VERSION end def date Date.today.to_s end def rubyforge_project name end def gemspec_file "#{name}.gemspec" end def gem_file "#{name}-#{version}.gem" end def replace_header(head, header_name) head.sub!(/(\.#{header_name}\s*= \").*\"/) { "#{$1}#{send(header_name)}\""} end ############################################################################# # # Standard tasks # ############################################################################# GEM_NAME = "#{name}" task :default => :test task :travis => ['test', 'test:travis', 'test:openstack_specs'] Rake::TestTask.new do |t| t.pattern = File.join("spec", "**", "*_spec.rb") t.libs << "spec" end namespace :test do mock = ENV['FOG_MOCK'] || 'true' task :openstack_specs do sh("export FOG_MOCK=false && bundle exec rspec spec/fog/openstack/*_spec.rb") end task :travis => [:openstack_specs] do sh("export FOG_MOCK=#{mock} && bundle exec shindont") end task :vsphere do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/vsphere") end task :openvz do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz") end task :ovirt do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/ovirt") end task :openstack do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openstack") end task :rackspace do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/rackspace") end task :cloudstack do sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/cloudstack") end end desc 'Run mocked tests for a specific provider' task :mock, :provider do |t, args| if args.to_a.size != 1 fail 'USAGE: rake mock[]' end provider = args[:provider] sh("export FOG_MOCK=true && bundle exec shindont tests/#{provider}") end desc 'Run live tests against a specific provider' task :live, :provider do |t, args| if args.to_a.size != 1 fail 'USAGE: rake live[]' end provider = args[:provider] sh("export FOG_MOCK=false PROVIDER=#{provider} && bundle exec shindont tests/#{provider}") end task :nuke do Fog.providers.each do |provider| next if ['Vmfusion'].include?(provider) begin compute = Fog::Compute.new(:provider => provider) for server in compute.servers Fog::Formatador.display_line("[#{provider}] destroying server #{server.identity}") server.destroy rescue nil end rescue end begin dns = Fog::DNS.new(:provider => provider) for zone in dns.zones for record in zone.records record.destroy rescue nil end Fog::Formatador.display_line("[#{provider}] destroying zone #{zone.identity}") zone.destroy rescue nil end rescue end end end desc "Open an irb session preloaded with this library" task :console do sh "irb -rubygems -r ./lib/#{name}.rb" end ############################################################################# # # Packaging tasks # ############################################################################# task :release => ["release:prepare", "release:publish"] namespace :release do task :preflight do unless `git branch` =~ /^\* master$/ puts "You must be on the master branch to release!" exit! end if `git tag` =~ /^\* v#{version}$/ puts "Tag v#{version} already exists!" exit! end end task :prepare => :preflight do Rake::Task[:build].invoke sh "gem install pkg/#{name}-#{version}.gem" Rake::Task[:git_mark_release].invoke end task :publish do Rake::Task[:git_push_release].invoke Rake::Task[:gem_push].invoke end end task :git_mark_release do sh "git commit --allow-empty -a -m 'Release #{version}'" end task :git_push_release do sh "git push origin master" ::Rake::Task[:github_release].invoke end task :gem_push do sh "gem push pkg/#{name}-#{version}.gem" end desc "Build fog-#{version}.gem" task :build => :gemspec do sh "mkdir -p pkg" sh "gem build #{gemspec_file}" sh "mv #{gem_file} pkg" end task :gem => :build desc "Updates the gemspec and runs 'validate'" task :gemspec => :validate do # read spec file and split out manifest section spec = File.read(gemspec_file) # replace name version and date replace_header(spec, :name) replace_header(spec, :version) replace_header(spec, :date) #comment this out if your rubyforge_project has a different name replace_header(spec, :rubyforge_project) File.open(gemspec_file, 'w') { |io| io.write(spec) } puts "Updated #{gemspec_file}" end desc "Run before pushing out the code" task :validate do libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/tasks"] unless libfiles.empty? puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir." exit! end unless Dir['VERSION*'].empty? puts "A `VERSION` file at root level violates Gem best practices." exit! end end # Include Yard tasks for rake yard YARDOC_LOCATION = "doc" YARD::Rake::YardocTask.new do |t| t.files = ['lib/**/*.rb', "README"] t.options = ["--output-dir", YARDOC_LOCATION, "--title", "#{name} #{version}"] end fog-1.34.0/bin/0000755000004100000410000000000012600047641013152 5ustar www-datawww-datafog-1.34.0/bin/fog0000755000004100000410000000340712600047641013657 0ustar www-datawww-data#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog')) require 'optparse' require 'irb' require 'yaml' options = OptionParser.new do |opts| opts.banner = 'usage: fog [options] CREDENTIAL' opts.on('-C', '--credentials-path FILE', 'Path to the credentials file') do |file| Fog.credentials_path = file end opts.on_tail('-v', '--version', 'Prints the version') do puts Fog::VERSION exit end opts.on_tail('-h', '--help', 'Prints this message') do puts opts exit end end options.parse! Fog.credential = ARGV.first ? ARGV.first.to_sym : nil Fog.mock! if ENV['FOG_MOCK'] if Fog.credentials.empty? begin Fog::Errors.missing_credentials rescue Fog::Errors::LoadError => error abort error.message end end require 'fog/bin' providers = Fog.available_providers providers = if providers.length > 1 providers[0...-1].join(', ') << ' and ' << providers[-1] else providers.first end if ARGV.length > 1 result = instance_eval(ARGV[1..-1].join(' ')) puts(Fog::JSON.encode(result)) else ARGV.clear # Avoid passing args to IRB IRB.setup(nil) @irb = IRB::Irb.new(nil) IRB.conf[:MAIN_CONTEXT] = @irb.context IRB.conf[:PROMPT][:FOG] = IRB.conf[:PROMPT][:SIMPLE].dup IRB.conf[:PROMPT][:FOG][:RETURN] = "%s\n" @irb.context.prompt_mode = :FOG @irb.context.workspace = IRB::WorkSpace.new(binding) trap 'INT' do @irb.signal_handle end Fog::Formatador.display_line('Welcome to fog interactive!') Fog::Formatador.display_line(":#{Fog.credential} provides #{providers}") providers = Fog.providers # FIXME: hacks until we can `include Fog` in bin CDN = Fog::CDN Compute = Fog::Compute DNS = Fog::DNS Storage = Fog::Storage catch(:IRB_EXIT) { @irb.eval_input } end fog-1.34.0/Gemfile0000644000004100000410000000035612600047641013701 0ustar www-datawww-datasource "https://rubygems.org" group :development, :test do # This is here because gemspec doesn't support require: false gem "netrc", :require => false gem "octokit", :require => false gem 'rspec', :require => false end gemspec fog-1.34.0/tests/0000755000004100000410000000000012600047642013545 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/0000755000004100000410000000000012600047642016170 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/helper.rb0000644000004100000410000000263512600047642020002 0ustar www-datawww-data # Shortcut for Fog::Compute[:digitalocean] def service Fog::Compute[:digitalocean] end def fog_test_server_attributes # Hard coding numbers because requests from tests are sometimes failing. # TODO: Mock properly instead image = service.images.find { |i| i.name == 'Ubuntu 13.10 x64' } image_id = image.nil? ? 1505447 : image.id region = service.regions.find { |r| r.name == 'New York 1' } region_id = region.nil? ? 4 : region.id flavor = service.flavors.find { |r| r.name == '512MB' } flavor_id = flavor.nil? ? 66 : flavor.id { :image_id => image_id, :region_id => region_id, :flavor_id => flavor_id } end def fog_server_name "fog-server-test" end # Create a long lived server for the tests def fog_test_server server = service.servers.find { |s| s.name == fog_server_name } unless server server = service.servers.create({ :name => fog_server_name }.merge(fog_test_server_attributes)) server.wait_for { ready? } end server end # Destroy the long lived server def fog_test_server_destroy server = service.servers.find { |s| s.name == fog_server_name } server.destroy if server end at_exit do unless Fog.mocking? || Fog.credentials[:digitalocean_api_key].nil? server = service.servers.find { |s| s.name == fog_server_name } if server server.wait_for(120) do reload rescue nil; ready? end end fog_test_server_destroy end end fog-1.34.0/tests/digitalocean/requests/0000755000004100000410000000000012600047642020043 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/requests/compute/0000755000004100000410000000000012600047642021517 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/requests/compute/power_state_tests.rb0000644000004100000410000000106012600047642025617 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | power on/off/shutdown requests', ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] server = fog_test_server tests('success') do test('#power_off_server') do service.power_off_server(server.id).body['status'] == 'OK' end test('#power_on_server') do service.power_on_server(server.id).body['status'] == 'OK' end test('#shutdown_server') do service.shutdown_server(server.id).body['status'] == 'OK' end server.start end end fog-1.34.0/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb0000644000004100000410000000116512600047642026507 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | destroy_ssh_key request', ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] tests('success') do test('#destroy_ssh_key') do key = service.create_ssh_key 'fookey', 'fookey' service.destroy_ssh_key(key.body['ssh_key']['id']).body['status'] == 'OK' end end tests('failures') do test 'delete invalid key' do # DigitalOcean API returns 500 with this sometimes # so mark it as pending in real mode pending unless Fog.mocking? service.destroy_ssh_key('00000000000').body['status'] == 'ERROR' end end end fog-1.34.0/tests/digitalocean/requests/compute/list_servers_tests.rb0000644000004100000410000000130012600047642026004 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | list_servers request', ['digitalocean', 'compute']) do @server_format = { 'id' => Integer, 'name' => String, 'image_id' => Integer, 'size_id' => Integer, 'region_id' => Integer, 'backups_active' => Fog::Nullable::Boolean, 'ip_address' => Fog::Nullable::String, 'status' => String, 'created_at' => String } tests('success') do tests('#list_servers') do Fog::Compute[:digitalocean].list_servers.body['droplets'].each do |server| tests('format').data_matches_schema(@server_format) do server end end end end end fog-1.34.0/tests/digitalocean/requests/compute/power_cycle_server_tests.rb0000644000004100000410000000066112600047642027172 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | power_cycle_server request', ['digitalocean', 'compute']) do server = fog_test_server tests('success') do tests('#power_cycle_server') do test('returns 200') do service.power_cycle_server(server.id).status == 200 end test('state is off') do server.wait_for { server.state == 'off' } server.state == 'off' end end end end fog-1.34.0/tests/digitalocean/requests/compute/list_flavors_tests.rb0000644000004100000410000000101012600047642025765 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | list_flavors request', ['digitalocean', 'compute']) do # {"id":2,"name":"Amsterdam 1"} @flavor_format = { 'id' => Integer, 'name' => String, } tests('success') do tests('#list_flavor') do flavors = Fog::Compute[:digitalocean].list_flavors.body test 'returns a Hash' do flavors.is_a? Hash end tests('flavor').formats(@flavor_format, false) do flavors['sizes'].first end end end end fog-1.34.0/tests/digitalocean/requests/compute/list_regions_tests.rb0000644000004100000410000000101312600047642025762 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | list_regions request', ['digitalocean', 'compute']) do # {"id":2,"name":"Amsterdam 1"} @region_format = { 'id' => Integer, 'name' => String, } tests('success') do tests('#list_regions') do regions = Fog::Compute[:digitalocean].list_regions.body test 'returns a Hash' do regions.is_a? Hash end tests('region').formats(@region_format, false) do regions['regions'].first end end end end fog-1.34.0/tests/digitalocean/requests/compute/reboot_server_tests.rb0000644000004100000410000000042312600047642026145 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | reboot_server request', ['digitalocean', 'compute']) do server = fog_test_server tests('success') do tests('#reboot_server').succeeds do service.reboot_server(server.id).body['status'] == 'OK' end end end fog-1.34.0/tests/digitalocean/requests/compute/get_ssh_key_tests.rb0000644000004100000410000000112612600047642025572 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | get_ssh_keys request', ['digitalocean', 'compute']) do @ssh_key_format = { 'id' => Integer, 'name' => String, 'ssh_pub_key' => String, } service = Fog::Compute[:digitalocean] tests('success') do tests('#get_ssh_key') do key = service.create_ssh_key 'fookey', 'ssh-dss FOO' tests('format').data_matches_schema(@ssh_key_format) do service.get_ssh_key(key.body['ssh_key']['id']).body['ssh_key'] end service.destroy_ssh_key(key.body['ssh_key']['id']) end end end fog-1.34.0/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb0000644000004100000410000000103712600047642026152 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | list_ssh_keys request', ['digitalocean', 'compute']) do @ssh_key_format = { 'id' => Integer, 'name' => String } tests('success') do ssh_key = service.create_ssh_key 'fookey', 'ssh-dss FOO' tests('#list_ssh_keys') do service.list_ssh_keys.body['ssh_keys'].each do |key| tests('format').data_matches_schema(@ssh_key_format) do key end end end service.destroy_ssh_key(ssh_key.body['ssh_key']['id']) end end fog-1.34.0/tests/digitalocean/requests/compute/destroy_server_tests.rb0000644000004100000410000000053612600047642026351 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | destroy_server request', ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] server = fog_test_server tests('success') do test('#destroy_server') do service.destroy_server(server.id).body['status'] == 'OK' service.servers.get(server.id) == nil end end end fog-1.34.0/tests/digitalocean/requests/compute/list_images_tests.rb0000644000004100000410000000110112600047642025557 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | list_images request', ['digitalocean', 'compute']) do # {"id"=>1601, "name"=>"CentOS 5.8 x64", "distribution"=>"CentOS"} @image_format = { 'id' => Integer, 'name' => String, 'distribution' => String } tests('success') do tests('#list_images') do images = Fog::Compute[:digitalocean].list_images.body test 'returns a Hash' do images.is_a? Hash end tests('image').formats(@image_format, false) do images['images'].first end end end end fog-1.34.0/tests/digitalocean/requests/compute/create_server_tests.rb0000644000004100000410000000170312600047642026120 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitalocean', 'compute']) do @server_format = { 'id' => Integer, 'name' => String, 'image_id' => Integer, 'size_id' => Integer, 'event_id' => Integer } service = Fog::Compute[:digitalocean] tests('success') do tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do image = service.images.find { |i| i.name == 'Ubuntu 13.10 x64' } image_id = image.nil? ? 1505447 : image.id region = service.regions.find { |r| r.name == 'New York 1' } region_id = region.nil? ? 4 : region.id flavor = service.flavors.find { |r| r.name == '512MB' } flavor_id = flavor.nil? ? 66 : flavor.id data = Fog::Compute[:digitalocean].create_server( fog_server_name, flavor_id, image_id, region_id ) data.body end end end fog-1.34.0/tests/digitalocean/requests/compute/get_server_details_tests.rb0000644000004100000410000000052412600047642027141 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | get_server_details request', ['digitalocean', 'compute']) do tests('success') do test('#get_server_details') do server = fog_test_server body = Fog::Compute[:digitalocean].get_server_details(server.id).body body['droplet']['name'] == fog_server_name end end end fog-1.34.0/tests/digitalocean/requests/compute/create_ssh_key_tests.rb0000644000004100000410000000103012600047642026250 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | create_ssh_key request', ['digitalocean', 'compute']) do @key_format = { 'id' => Integer, 'name' => String, 'ssh_pub_key' => String } service = Fog::Compute[:digitalocean] tests('success') do tests('#create_ssh_key').formats({'status' => 'OK', 'ssh_key' => @key_format}) do @key = Fog::Compute[:digitalocean].create_ssh_key 'fookey', 'fookey' @key.body end end service.destroy_ssh_key @key.body['ssh_key']['id'] end fog-1.34.0/tests/digitalocean/models/0000755000004100000410000000000012600047642017453 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/models/compute/0000755000004100000410000000000012600047642021127 5ustar www-datawww-datafog-1.34.0/tests/digitalocean/models/compute/ssh_keys_tests.rb0000644000004100000410000000161612600047642024532 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | ssh_keys collection', ['digitalocean']) do service = Fog::Compute[:digitalocean] tests('The ssh_keys collection') do key = service.ssh_keys.create :name => 'fookey', :ssh_pub_key => 'fookey' [:all, :get].each do |method| test("should respond to #{method}") do service.ssh_keys.respond_to? method end end tests('should have Fog::Compute::DigitalOcean::SshKey inside') do service.ssh_keys.each do |s| test { s.kind_of? Fog::Compute::DigitalOcean::SshKey } end end tests('should be able to get a model') do test('by instance id') do retrieved_key = service.ssh_keys.get(key.id) test { retrieved_key.kind_of? Fog::Compute::DigitalOcean::SshKey } test { retrieved_key.name == key.name } end end key.destroy end end fog-1.34.0/tests/digitalocean/models/compute/flavor_tests.rb0000644000004100000410000000146112600047642024171 0ustar www-datawww-dataShindo.tests("Fog::Compute[:digitalocean] | flavor model", ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] flavor = service.flavors.first tests('The flavor model should') do tests('have the action') do test('reload') { flavor.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = flavor.attributes attributes = [ :id, :name, ] tests("The flavor model should respond to") do attributes.each do |attribute| test("#{attribute}") { flavor.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end end end fog-1.34.0/tests/digitalocean/models/compute/region_tests.rb0000644000004100000410000000146112600047642024163 0ustar www-datawww-dataShindo.tests("Fog::Compute[:digitalocean] | region model", ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] region = service.regions.first tests('The region model should') do tests('have the action') do test('reload') { region.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = region.attributes attributes = [ :id, :name, ] tests("The region model should respond to") do attributes.each do |attribute| test("#{attribute}") { region.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end end end fog-1.34.0/tests/digitalocean/models/compute/image_tests.rb0000644000004100000410000000147712600047642023771 0ustar www-datawww-dataShindo.tests("Fog::Compute[:digitalocean] | image model", ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] image = service.images.first tests('The image model should') do tests('have the action') do test('reload') { image.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = image.attributes attributes = [ :id, :name, :distribution ] tests("The image model should respond to") do attributes.each do |attribute| test("#{attribute}") { image.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end end end fog-1.34.0/tests/digitalocean/models/compute/server_tests.rb0000644000004100000410000000401112600047642024200 0ustar www-datawww-dataShindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'compute']) do server = fog_test_server tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ shutdown reboot power_cycle stop start }.each do |action| test(action) { server.respond_to? action } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :id, :name, :state, :backups_active, :public_ip_address, :private_ip_address, :flavor_id, :region_id, :image_id, :created_at, :ssh_keys= ] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end end test('#reboot') do pending if Fog.mocking? server.reboot server.wait_for { server.state == 'off' } server.state == 'off' end test('#power_cycle') do pending if Fog.mocking? server.wait_for { server.ready? } server.power_cycle server.wait_for { server.state == 'off' } server.state == 'off' end test('#stop') do server.stop server.wait_for { server.state == 'off' } server.state == 'off' end test('#start') do server.start server.wait_for { ready? } server.ready? end # DigitalOcean shutdown is unreliable # so disable it in real mode for now test('#shutdown') do pending unless Fog.mocking? server.start server.wait_for { server.ready? } server.shutdown server.wait_for { server.state == 'off' } server.state == 'off' end test('#update') do begin server.update rescue NotImplementedError => e true end end end # restore server state server.start server.wait_for { ready? } end fog-1.34.0/tests/digitalocean/models/compute/servers_tests.rb0000644000004100000410000000244112600047642024370 0ustar www-datawww-dataShindo.tests('Fog::Compute[:digitalocean] | servers collection', ['digitalocean']) do service = Fog::Compute[:digitalocean] options = { :name => "#{fog_server_name}-#{Time.now.to_i.to_s}" }.merge fog_test_server_attributes public_key_path = File.join(File.dirname(__FILE__), '../../fixtures/id_rsa.pub') private_key_path = File.join(File.dirname(__FILE__), '../../fixtures/id_rsa') # Collection tests are consistently timing out on Travis wasting people's time and resources pending if Fog.mocking? collection_tests(service.servers, options, true) do @instance.wait_for { ready? } end tests("#bootstrap with public/private_key_path").succeeds do pending if Fog.mocking? @server = service.servers.bootstrap({ :public_key_path => public_key_path, :private_key_path => private_key_path }.merge(options)) @server.destroy end tests("#bootstrap with public/private_key").succeeds do pending if Fog.mocking? @server = service.servers.bootstrap({ :public_key => File.read(public_key_path), :private_key => File.read(private_key_path) }.merge(options)) @server.destroy end tests("#bootstrap with no public/private keys") do raises(ArgumentError, 'raises ArgumentError') { service.servers.bootstrap(options) } end end fog-1.34.0/tests/digitalocean/models/compute/ssh_key_tests.rb0000644000004100000410000000166112600047642024347 0ustar www-datawww-dataShindo.tests("Fog::Compute[:digitalocean] | ssh_key model", ['digitalocean', 'compute']) do service = Fog::Compute[:digitalocean] tests('The ssh_key model should') do test('#save') do @key = service.ssh_keys.create :name => 'fookey', :ssh_pub_key => 'fookey' @key.is_a? Fog::Compute::DigitalOcean::SshKey end tests('have the action') do test('reload') { @key.respond_to? 'reload' } %w{ save destroy }.each do |action| test(action) { @key.respond_to? action } end end tests('have attributes') do attributes = [ :id, :name, :ssh_pub_key ] tests("The key model should respond to") do attributes.each do |attribute| test("#{attribute}") { @key.respond_to? attribute } end end end test('#destroy') do @key.destroy end end end fog-1.34.0/tests/cloudsigma/0000755000004100000410000000000012600047642015674 5ustar www-datawww-datafog-1.34.0/tests/cloudsigma/requests/0000755000004100000410000000000012600047642017547 5ustar www-datawww-datafog-1.34.0/tests/cloudsigma/requests/server_tests.rb0000644000004100000410000000454412600047642022633 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | server requests', ['cloudsigma']) do @server_format = { 'uuid' => String, 'status' => String, 'vnc_password' => String, 'name' => String, 'cpus_instead_of_cores' => Fog::Boolean, 'tags' => Array, 'mem' => Integer, 'enable_numa' => Fog::Boolean, 'smp' => Integer, 'hv_relaxed' => Fog::Boolean, 'hv_tsc' => Fog::Boolean, 'meta' => Fog::Nullable::Hash, 'owner' => Fog::Nullable::Hash, 'runtime' => Fog::Nullable::Hash, 'cpu' => Integer, 'resource_uri' => Fog::Nullable::String, 'drives' => Array, 'nics' => Array } @server_create_args = {:name => 'fogtest', :cpu => 2000, :mem => 512*1024**2, :vnc_password => 'myrandompass'} tests('success') do tests("#create_server(#@server_create_args)").formats(@server_format, false) do server_def = Fog::Compute[:cloudsigma].create_server(@server_create_args).body['objects'].first @server_uuid = server_def['uuid'] server_def end tests("#get_server(#@server_uuid)").formats(@server_format, false) do @resp_server = Fog::Compute[:cloudsigma].get_server(@server_uuid).body end tests("#update_server(#@server_uuid)").formats(@server_format, false) do @resp_server['cpu'] = 1000 @resp_server = Fog::Compute[:cloudsigma].update_server(@server_uuid, @resp_server).body @resp_server end tests("#start_server(#@server_uuid)").succeeds do response = Fog::Compute[:cloudsigma].start_server(@server_uuid) response.body['result'] == "success" end server = Fog::Compute[:cloudsigma].servers.get(@server_uuid) server.wait_for { status == 'running' } tests("#stop_server(#@server_uuid)").succeeds do response = Fog::Compute[:cloudsigma].stop_server(@server_uuid) response.body['result'] == "success" end server = Fog::Compute[:cloudsigma].servers.get(@server_uuid) server.wait_for { status == 'stopped' } tests("#delete_server(#@server_uuid)").succeeds do resp = Fog::Compute[:cloudsigma].delete_server(@server_uuid) resp.body.empty? && resp.status == 204 end end tests('failure') do tests("#get_server(#@server_uuid)|deleted|").raises(Fog::CloudSigma::Errors::NotFound) do Fog::Compute[:cloudsigma].get_server(@server_uuid).body end end end fog-1.34.0/tests/cloudsigma/requests/volumes_tests.rb0000644000004100000410000000312212600047642023006 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | volume requests', ['cloudsigma']) do @volume_format = { 'uuid' => String, 'size' => Integer, 'status' => String, 'name' => String, 'tags' => Array, 'meta' => Fog::Nullable::Hash, 'owner' => Fog::Nullable::Hash, 'resource_uri' => Fog::Nullable::String, 'licenses' => Array, 'jobs' => Array, 'affinities' => Array, 'mounted_on' => Array, 'media' => String, 'allow_multimount' => Fog::Boolean } @volume_create_args = {:name => 'fogtest', :size => 1024**3, :media => :cdrom} tests('success') do tests("#create_volume(#@volume_create_args)").formats(@volume_format, false) do @resp_volume = Fog::Compute[:cloudsigma].create_volume(@volume_create_args).body['objects'].first @volume_uuid = @resp_volume['uuid'] @resp_volume end volume = Fog::Compute[:cloudsigma].volumes.get(@volume_uuid) volume.wait_for { status == 'unmounted' } tests("#update_volume(#@volume_uuid)").formats(@volume_format, false) do @resp_volume['media'] = 'disk' @resp_volume = Fog::Compute[:cloudsigma].update_volume(@volume_uuid, @resp_volume).body @resp_volume end tests("#delete_volume(#@volume_uuid)").succeeds do resp = Fog::Compute[:cloudsigma].delete_volume(@volume_uuid) resp.body.empty? && resp.status == 204 end end tests('failure') do tests("#get_volume(#@server_uuid)|deleted|").raises(Fog::CloudSigma::Errors::NotFound) do Fog::Compute[:cloudsigma].get_volume(@volume_uuid).body end end end fog-1.34.0/tests/cloudsigma/models/0000755000004100000410000000000012600047642017157 5ustar www-datawww-datafog-1.34.0/tests/cloudsigma/models/server_tests.rb0000644000004100000410000000376312600047642022245 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | server model', ['cloudsigma']) do service = Fog::Compute[:cloudsigma] servers = Fog::Compute[:cloudsigma].servers server_create_args = {:name => 'fogtest', :cpu => 2000, :mem => 512*1024**2, :vnc_password => 'myrandompass'} model_tests(servers, server_create_args, true) do tests('start_stop').succeeds do @instance.start @instance.wait_for(timeout=60) { status == 'running' } @instance.stop @instance.wait_for(timeout=60) { status == 'stopped' } end tests('attach_dhcp_nic').succeeds do @instance.add_public_nic() @instance.save @instance.reload returns('dhcp') { @instance.nics.first.ip_v4_conf.conf } succeeds {/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/ === @instance.nics.first.mac} end tests('attach_vlan') do if Fog.mocking? # Do not buy subscription with real account service.subscriptions.create({:period=>"1 month", :amount=>1, :resource=>"vlan"}) vlan = service.vlans.first vlan.meta['name'] = 'fog-test' vlan.save end vlan = service.vlans.find {|vlan| vlan.meta['name'] == 'fog-test'} # Skip if there is no vlan marked for fog tests pending unless vlan @instance.add_private_nic(vlan) @instance.save @instance.reload returns(vlan.uuid) { @instance.nics.last.vlan['uuid'] || @instance.nics.last.vlan} succeeds {/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/ === @instance.nics.last.mac} end tests('attach_volume') do volume_create_args = {:name => 'fogservermodeltest', :size => 1000**3, :media => :cdrom} v = service.volumes.create(volume_create_args) volume_uuid = v.uuid @instance.mount_volume(v) @instance.save @instance.reload returns(volume_uuid) { @instance.volumes.first.volume } @instance.unmount_volume(v) @instance.save @instance.reload succeeds { @instance.volumes.empty? } v.delete end end end fog-1.34.0/tests/cloudsigma/models/volumes_tests.rb0000644000004100000410000000052212600047642022417 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | volumes collection', ['cloudsigma']) do volumes = Fog::Compute[:cloudsigma].volumes volume_create_args = {:name => 'fogtest', :size => 1024**3, :media => :cdrom} collection_tests(volumes, volume_create_args, true) do @instance.wait_for(timeout=60) { status == 'unmounted' } end end fog-1.34.0/tests/cloudsigma/models/servers_tests.rb0000644000004100000410000000064012600047642022417 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | servers collection', ['cloudsigma']) do # mark as pending, the collection_tests are not quite what in line with how CloudSigma servers operate pending servers = Fog::Compute[:cloudsigma].servers server_create_args = {:name => 'fogtest', :cpu => 2000, :mem => 512*1024**2, :vnc_password => 'myrandompass'} collection_tests(servers, server_create_args, true) end fog-1.34.0/tests/cloudsigma/models/volume_tests.rb0000644000004100000410000000120612600047642022234 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudsigma] | volume model', ['cloudsigma']) do volumes = Fog::Compute[:cloudsigma].volumes volume_create_args = {:name => 'fogmodeltest', :size => 1000**3, :media => :cdrom} model_tests(volumes, volume_create_args, true) do @instance.wait_for(timeout=60) { status == 'unmounted' } tests('#update').succeeds do @instance.media = 'disk' #@instance.size = 1024**3 # resizes disk @instance.save @instance.reload @instance.wait_for(timeout=60) { status == 'unmounted' } #returns(1024**3) { @instance.size } returns('disk') { @instance.media } end end end fog-1.34.0/tests/storage/0000755000004100000410000000000012600047642015211 5ustar www-datawww-datafog-1.34.0/tests/storage/helper.rb0000644000004100000410000000052512600047642017017 0ustar www-datawww-datadef storage_providers { :aws => { :mocked => true }, :hp => { :mocked => true }, :internetarchive => { :mocked => true }, :local => { :mocked => false }, :ninefold => { :mocked => false }, :rackspace => { :mocked => false } } end fog-1.34.0/tests/storage/models/0000755000004100000410000000000012600047642016474 5ustar www-datawww-datafog-1.34.0/tests/storage/models/directory_test.rb0000644000004100000410000000127112600047642022065 0ustar www-datawww-datafor provider, config in storage_providers Shindo.tests("Storage[:#{provider}] | directory", [provider.to_s]) do if !Fog.mocking? || config[:mocked] directory_attributes = { :key => 'fogdirectorytests' }.merge!(config[:directory_attributes] || {}) model_tests(Fog::Storage[provider].directories, directory_attributes, config[:mocked]) do tests("#public=(true)").succeeds do pending if Fog.mocking? && !config[:mocked] @instance.public=(true) end tests('responds_to(:public_url)') do pending if Fog.mocking? && !config[:mocked] responds_to(:public_url) end end end end end fog-1.34.0/tests/storage/models/file_tests.rb0000644000004100000410000000213612600047642021164 0ustar www-datawww-datafor provider, config in storage_providers Shindo.tests("Storage[:#{provider}] | file", [provider.to_s]) do if !Fog.mocking? || config[:mocked] file_attributes = { :key => 'fog_file_tests', :body => lorem_file, :public => true }.merge!(config[:file_attributes] || {}) directory_attributes = { :key => 'fogfilestests' }.merge!(config[:directory_attributes] || {}) @directory = Fog::Storage[provider].directories.create(directory_attributes) model_tests(@directory.files, file_attributes, config[:mocked]) do responds_to(:public_url) tests("#public=(true)").succeeds do pending if Fog.mocking? && !config[:mocked] || !Fog::Storage[provider].respond_to?(:public=) @instance.public=(true) end test("@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read") do pending if Fog.mocking? @instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read end end @directory.destroy end end end fog-1.34.0/tests/storage/models/files_tests.rb0000644000004100000410000000114412600047642021345 0ustar www-datawww-datafor provider, config in storage_providers Shindo.tests("Storage[:#{provider}] | files", [provider.to_s]) do if !Fog.mocking? || config[:mocked] file_attributes = { :key => 'fog_files_tests', :body => lorem_file }.merge!(config[:file_attributes] || {}) directory_attributes = { :key => 'fogfilestests' }.merge!(config[:directory_attributes] || {}) @directory = Fog::Storage[provider].directories.create(directory_attributes) collection_tests(@directory.files, file_attributes, config[:mocked]) @directory.destroy end end end fog-1.34.0/tests/storage/models/directories_tests.rb0000644000004100000410000000062112600047642022556 0ustar www-datawww-datafor provider, config in storage_providers Shindo.tests("Storage[:#{provider}] | directories", [provider.to_s]) do if !Fog.mocking? || config[:mocked] directory_attributes = { :key => 'fogdirectoriestests', }.merge!(config[:directory_attributes] || {}) collection_tests(Fog::Storage[provider].directories, directory_attributes, config[:mocked]) end end end fog-1.34.0/tests/helper.rb0000644000004100000410000000370212600047642015353 0ustar www-datawww-dataENV['FOG_RC'] = ENV['FOG_RC'] || File.expand_path('../.fog', __FILE__) ENV['FOG_CREDENTIAL'] = ENV['FOG_CREDENTIAL'] || 'default' require 'fog' require 'fog/bin' # for available_providers and registered_providers Excon.defaults.merge!(:debug_request => true, :debug_response => true) require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper')) # This overrides the default 600 seconds timeout during live test runs if Fog.mocking? FOG_TESTING_TIMEOUT = ENV['FOG_TEST_TIMEOUT'] || 2000 Fog.timeout = 2000 Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds" # These sets of tests do not behave nicely when running mocked tests Thread.current[:tags] << '-xenserver' Thread.current[:tags] << '-joyent' Thread.current[:tags] << '-dreamhost' else FOG_TESTING_TIMEOUT = Fog.timeout end def lorem_file File.open(File.dirname(__FILE__) + '/lorem.txt', 'r') end def array_differences(array_a, array_b) (array_a - array_b) | (array_b - array_a) end # check to see which credentials are available and add others to the skipped tags list all_providers = Fog.registered_providers.map {|provider| provider.downcase} # Manually remove these providers since they are local applications, not lacking credentials all_providers = all_providers - ["openvz"] available_providers = Fog.available_providers.map {|provider| provider.downcase} unavailable_providers = all_providers - available_providers if !ENV['PROVIDER'].nil? && unavailable_providers.include?(ENV['PROVIDER']) Fog::Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" + "[red]Check if .fog file has correct configuration (see '#{Fog.credentials_path}')[/]") exit(0) end for provider in unavailable_providers Fog::Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '#{Fog.credentials_path}' to run them)[/]") end fog-1.34.0/tests/zerigo/0000755000004100000410000000000012600047642015044 5ustar www-datawww-datafog-1.34.0/tests/zerigo/requests/0000755000004100000410000000000012600047642016717 5ustar www-datawww-datafog-1.34.0/tests/zerigo/requests/dns/0000755000004100000410000000000012600047642017503 5ustar www-datawww-datafog-1.34.0/tests/zerigo/requests/dns/dns_tests.rb0000644000004100000410000002745112600047642022047 0ustar www-datawww-dataShindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do # tests assume have a free acccount - ie need to limit # of zones to max of 3 MAX_ZONE_COUNT = 3 @domain = '' @org_zone_count = 0 @new_zones = [] @new_records =[] def generate_unique_domain( with_trailing_dot = false) #get time (with 1/100th of sec accuracy) #want unique domain name and if provider is fast, this can be called more than once per second time= (Time.now.to_f * 100).to_i domain = 'test-' + time.to_s + '.com' if with_trailing_dot domain+= '.' end domain end tests( 'success') do test('get current zone count') do pending if Fog.mocking? @org_zone_count= 0 response = Fog::DNS[:zerigo].count_zones() if response.status == 200 @org_zone_count = response.body['count'] end response.status == 200 end test('create zone - simple') do pending if Fog.mocking? options = { :nx_ttl => 1800 } domain = generate_unique_domain response = Fog::DNS[:zerigo].create_zone( domain, 3600, 'pri_sec', options) if response.status == 201 zone_id = response.body['id'] #worked so can now delete response = Fog::DNS[:zerigo].delete_zone( zone_id) end response.status == 200 end test('create zone - set zerigo as slave') do pending if Fog.mocking? options = { :active => 'N', :ns1=> '2.3.4.5' } domain= generate_unique_domain response = Fog::DNS[:zerigo].create_zone( domain, 14400, 'sec', options ) if response.status == 201 zone_id = response.body['id'] #worked so can now delete response = Fog::DNS[:zerigo].delete_zone( zone_id) end response.status == 200 end test('create zone - set zerigo as master') do pending if Fog.mocking? domain= generate_unique_domain options = { :active => 'N', :slave_nameservers=> "ns1.#{domain},ns2.#{domain}" } response = Fog::DNS[:zerigo].create_zone( domain, 14400, 'pri', options ) if response.status == 201 zone_id = response.body['id'] #worked so can now delete response = Fog::DNS[:zerigo].delete_zone( zone_id) end response.status == 200 end test('create zone - set all parameters') do pending if Fog.mocking? @domain = generate_unique_domain options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{@domain}", :notes => 'for client ABC', :tag_list=> 'sample-tag' } response = Fog::DNS[:zerigo].create_zone( @domain, 14400, 'pri', options ) if response.status == 201 @zone_id = response.body['id'] @new_zones << @zone_id end response.status == 201 end test("get zone #{@zone_id} for #{@domain}- check all parameters") do pending if Fog.mocking? result= false response = Fog::DNS[:zerigo].get_zone( @zone_id) if response.status == 200 zone = response.body if (zone['ns-type'] == 'pri') and (zone['tag-list'] == 'sample-tag') and (zone['default-ttl'] == 14400) and (zone['nx-ttl'] == 1800) and (zone['updated-at'].length > 0) and (zone['created-at'].length > 0) and (zone['domain'] == @domain) and (zone['notes'] == 'for client ABC') and (zone['id'] == @zone_id) result = true end result end end test("update zone #{@zone_id} - set notes & tags") do pending if Fog.mocking? options = { :notes => 'for client XYZ', :tag_list=> 'testing-tag' } response = Fog::DNS[:zerigo].update_zone( @zone_id, options ) response.status == 200 end test("get zone #{@zone_id} - check updated parameters") do pending if Fog.mocking? result= false response = Fog::DNS[:zerigo].get_zone( @zone_id) if response.status == 200 zone = response.body if (zone['tag-list'] == 'testing-tag') and (zone['notes'] == 'for client XYZ') result = true end result end end test("get zone stats for #{@zone_id}") do pending if Fog.mocking? result= false response = Fog::DNS[:zerigo].get_zone_stats( @zone_id) if response.status == 200 zone = response.body if (zone['domain'] == @domain) and (zone['id'] == @zone_id) and (zone['period-begin'].length > 0) and (zone['period-end'].length > 0) result= true end result end end test("list zones - make sure total count is #{@org_zone_count+1}") do pending if Fog.mocking? result= false response = Fog::DNS[:zerigo].list_zones() if response.status == 200 zones = response.body['zones'] if (@org_zone_count+1) == zones.count result= true; end end result end test('list zones with pagination') do pending if Fog.mocking? result = false # make enough zones to paginate number_zones_to_create = MAX_ZONE_COUNT-@org_zone_count-1 number_zones_to_create.times do |i| domain = generate_unique_domain options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{domain}", :notes => 'for client ABC', :tag_list=> "sample-tag-#{i}" } response = Fog::DNS[:zerigo].create_zone( domain, 14400, 'pri', options ) if response.status == 201 @new_zones << response.body['id'] else return false end end total_zone_count_response = Fog::DNS[:zerigo].list_zones() if total_zone_count_response.status == 200 if number_zones_to_create > 0 zones_we_should_see = @new_zones.dup total_zone_count = total_zone_count_response.headers['X-Query-Count'].to_i else zones_we_should_see = total_zone_count_response.body['zones'].map {|z| z['id']} total_zone_count = zones_we_should_see.count end total_zone_count.times do |i| # zerigo pages are 1-indexed, not 0-indexed response = Fog::DNS[:zerigo].list_zones(:per_page => 1, :page => i+1) zones = response.body['zones'] if 1 == zones.count zones_we_should_see.delete(zones.first['id']) end end if zones_we_should_see.empty? result = true end end result end test('create record - simple A record') do pending if Fog.mocking? host= 'www' options = { :hostname => host } response = Fog::DNS[:zerigo].create_host( @zone_id, 'A', '1.2.3.4', options) if response.status == 201 record_id = response.body['id'] @new_records << record_id end response.status == 201 end test('create record - CNAME record') do pending if Fog.mocking? host = 'mail' options = { :hostname => host } response = Fog::DNS[:zerigo].create_host( @zone_id, 'CNAME', @domain, options) if response.status == 201 record_id = response.body['id'] @new_records << record_id end response.status == 201 end test('create record - NS record') do pending if Fog.mocking? #note, when use create_host for a NS record, it needs to be a delation #rather than a NS record for the main domain (those NS records are setup #using the zone methods) sub_domain = 'subdomain' # that we want to delete DNS for ns_host = 'ns.' + @domain options = { :hostname => sub_domain} response = Fog::DNS[:zerigo].create_host( @zone_id, 'NS', ns_host, options) if response.status == 201 record_id = response.body['id'] @new_records << record_id end response.status == 201 end test('create record - MX record') do pending if Fog.mocking? mail_domain = 'mail.' + @domain options = { :hostname => @domain, :ttl => 3600, :priority => '3'} response = Fog::DNS[:zerigo].create_host( @zone_id, 'MX', mail_domain, options) if response.status == 201 @record_id = response.body['id'] @new_records << @record_id end response.status == 201 end test("get host #{@record_id}") do pending if Fog.mocking? result = false response = Fog::DNS[:zerigo].get_host( @record_id) if response.status == 200 host = response.body if (host['id'] == @record_id) and (host['host-type'] == 'MX') and (host['created-at'].length > 0) and (host['updated-at'].length > 0) result = true end end result end test("update host #{@record_id}") do pending if Fog.mocking? result = false options = { :priority => 7 } response = Fog::DNS[:zerigo].update_host( @record_id, options) if response.status == 200 response = Fog::DNS[:zerigo].get_host( @record_id) if response.status == 200 host= response.body if (host['priority'] == 7) result = true end end end result end test('count host records') do pending if Fog.mocking? host_count = 0 response = Fog::DNS[:zerigo].count_hosts( @zone_id) if response.status == 200 host_count = response.body['count'] end host_count == 4 end test("list host records") do pending if Fog.mocking? result = false response = Fog::DNS[:zerigo].list_hosts( @zone_id) if response.status == 200 hosts = response.body["hosts"] if (hosts.count == 4) hosts.each { |host| if (host["id"] > 0) and (host["fqdn"].length > 0) and (host["host-type"].length > 0) and (host["created-at"].length > 0) and (host["updated-at"].length > 0) result = true end } end end result end test("list host records with options") do pending if Fog.mocking? result = false response = Fog::DNS[:zerigo].list_hosts(@zone_id, {:per_page=>2, :page=>1}) if response.status == 200 hosts = response.body["hosts"] if (hosts.count == 2) hosts.each { |host| if (host["id"] > 0) and (host["fqdn"].length > 0) and (host["host-type"].length > 0) and (host["created-at"].length > 0) and (host["updated-at"].length > 0) result = true end } end end result end test("find host: mail.#{@domain}") do pending if Fog.mocking? result = false host = 'mail.' + @domain response = Fog::DNS[:zerigo].find_hosts( host) if response.status == 200 hosts = response.body['hosts'] host_count = hosts.count if (host_count == 1) result = true end end result end test("find host: mail.#{@domain} - method 2") do pending if Fog.mocking? result = false host = 'mail.' + @domain response = Fog::DNS[:zerigo].find_hosts( host, @zone_id) if response.status == 200 hosts = response.body['hosts'] host_count = hosts.count if (host_count == 1) result = true end end result end test("delete #{@new_records.count} records created") do pending if Fog.mocking? result= true @new_records.each { |record_id| response = Fog::DNS[:zerigo].delete_host( record_id) if response.status != 200 result= false; end } result end test("delete #{@new_zones.count} zones created") do pending if Fog.mocking? result= true @new_zones.each { |zone_id| response = Fog::DNS[:zerigo].delete_zone( zone_id) if response.status != 200 result= false; end } result end end tests( 'failure') do end end fog-1.34.0/tests/openstack/0000755000004100000410000000000012600047642015534 5ustar www-datawww-datafog-1.34.0/tests/openstack/authenticate_tests.rb0000644000004100000410000001523412600047642021766 0ustar www-datawww-dataShindo.tests('OpenStack | authenticate', ['openstack']) do begin @old_mock_value = Excon.defaults[:mock] Excon.defaults[:mock] = true Excon.stubs.clear expires = Time.now.utc + 600 token = Fog::Mock.random_numbers(8).to_s tenant_token = Fog::Mock.random_numbers(8).to_s body = { "access" => { "token" => { "expires" => expires.iso8601, "id" => token, "tenant" => { "enabled" => true, "description" => nil, "name" => "admin", "id" => tenant_token, } }, "serviceCatalog" => [{ "endpoints" => [{ "adminURL" => "http://example:8774/v2/#{tenant_token}", "region" => "RegionOne", "internalURL" => "http://example:8774/v2/#{tenant_token}", "id" => Fog::Mock.random_numbers(8).to_s, "publicURL" => "http://example:8774/v2/#{tenant_token}" }], "endpoints_links" => [], "type" => "compute", "name" => "nova" }, { "endpoints" => [{ "adminURL" => "http://example:9292", "region" => "RegionOne", "internalURL" => "http://example:9292", "id" => Fog::Mock.random_numbers(8).to_s, "publicURL" => "http://example:9292" }], "endpoints_links" => [], "type" => "image", "name" => "glance" }], "user" => { "username" => "admin", "roles_links" => [], "id" => Fog::Mock.random_numbers(8).to_s, "roles" => [ { "name" => "admin" }, { "name" => "KeystoneAdmin" }, { "name" => "KeystoneServiceAdmin" } ], "name" => "admin" }, "metadata" => { "is_admin" => 0, "roles" => [ Fog::Mock.random_numbers(8).to_s, Fog::Mock.random_numbers(8).to_s, Fog::Mock.random_numbers(8).to_s,]}}} tests("v2") do Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" }, { :status => 200, :body => Fog::JSON.encode(body) }) expected = { :user => body['access']['user'], :tenant => body['access']['token']['tenant'], :identity_public_endpoint => nil, :server_management_url => body['access']['serviceCatalog']. first['endpoints'].first['publicURL'], :token => token, :expires => expires.iso8601, :current_user_id => body['access']['user']['id'], :unscoped_token => token, } returns(expected) do Fog::OpenStack.authenticate_v2( :openstack_auth_uri => URI('http://example/v2.0/tokens'), :openstack_tenant => 'admin', :openstack_service_type => %w[compute]) end end tests("validate token") do Fog::Identity[:openstack].validate_token(token, tenant_token) Fog::Identity[:openstack].validate_token(token) end tests("check token") do Fog::Identity[:openstack].check_token(token, tenant_token) Fog::Identity[:openstack].check_token(token) end tests("v2 missing service") do Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" }, { :status => 200, :body => Fog::JSON.encode(body) }) raises(Fog::Errors::NotFound, 'Could not find service network. Have compute, image') do Fog::OpenStack.authenticate_v2( :openstack_auth_uri => URI('http://example/v2.0/tokens'), :openstack_tenant => 'admin', :openstack_service_type => %w[network]) end end tests("v2 missing storage service") do Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" }, { :status => 200, :body => Fog::JSON.encode(body) }) raises(NoMethodError, "undefined method `join' for \"object-store\":String") do Fog::OpenStack.authenticate_v2( :openstack_auth_uri => URI('http://example/v2.0/tokens'), :openstack_tenant => 'admin', :openstack_service_type => 'object-store') end raises(Fog::Errors::NotFound, "Could not find service object-store. Have compute, image") do Fog::OpenStack.authenticate_v2( :openstack_auth_uri => URI('http://example/v2.0/tokens'), :openstack_tenant => 'admin', :openstack_service_type => %w[object-store]) end end tests("v2 auth with two compute services") do body_clone = body.clone body_clone["access"]["serviceCatalog"] << { "endpoints" => [{ "adminURL" => "http://example2:8774/v2/#{tenant_token}", "region" => "RegionOne", "internalURL" => "http://example2:8774/v2/#{tenant_token}", "id" => Fog::Mock.random_numbers(8).to_s, "publicURL" => "http://example2:8774/v2/#{tenant_token}" }], "endpoints_links" => [], "type" => "compute", "name" => "nova2" } Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" }, { :status => 200, :body => Fog::JSON.encode(body_clone) }) returns("http://example2:8774/v2/#{tenant_token}") do Fog::OpenStack.authenticate_v2( :openstack_auth_uri => URI('http://example/v2.0/tokens'), :openstack_tenant => 'admin', :openstack_service_type => %w[compute], :openstack_service_name => 'nova2')[:server_management_url] end end tests("legacy v1 auth") do headers = { "X-Storage-Url" => "https://swift.myhost.com/v1/AUTH_tenant", "X-Auth-Token" => "AUTH_yui193bdc00c1c46c5858788yuio0e1e2p", "X-Trans-Id" => "iu99nm9999f9b999c9b999dad9cd999e99", "Content-Length" => "0", "Date" => "Wed, 07 Aug 2013 11:11:11 GMT" } Excon.stub({:method => 'GET', :path => "/auth/v1.0"}, {:status => 200, :body => "", :headers => headers}) returns("https://swift.myhost.com/v1/AUTH_tenant") do Fog::OpenStack.authenticate_v1( :openstack_auth_uri => URI('https://swift.myhost.com/auth/v1.0'), :openstack_username => 'tenant:dev', :openstack_api_key => 'secret_key', :openstack_service_type => %w[storage])[:server_management_url] end end ensure Excon.stubs.clear Excon.defaults[:mock] = @old_mock_value end end fog-1.34.0/tests/openstack/requests/0000755000004100000410000000000012600047642017407 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/orchestration/0000755000004100000410000000000012600047642022273 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/orchestration/stack_tests.rb0000644000004100000410000000401612600047642025150 0ustar www-datawww-dataShindo.tests('Fog::Orchestration[:openstack] | stack requests', ['openstack']) do @stack_format = { 'links' => Array, 'id' => String, 'stack_name' => String, 'description' => Fog::Nullable::String, 'stack_status' => String, 'stack_status_reason' => String, 'creation_time' => Time, 'updated_time' => Time } @stack_detailed_format = { "parent" => Fog::Nullable::String, "disable_rollback" => Fog::Boolean, "description" => String, "links" => Array, "stack_status_reason" => String, "stack_name" => String, "stack_user_project_id" => String, "stack_owner" => String, "creation_time" => Fog::Nullable::String, "capabilities" => Array, "notification_topics" => Array, "updated_time" => Fog::Nullable::String, "timeout_mins" => Fog::Nullable::String, "stack_status" => String, "parameters" => Hash, "id" => String, "outputs" => Array, "template_description" => String } @create_format = { 'id' => String, 'links' => Array, } tests('success') do tests('#create_stack("teststack")').formats(@create_format) do Fog::Orchestration[:openstack].create_stack("teststack").body end tests('#list_stack_data').formats({'stacks' => [@stack_format]}) do Fog::Orchestration[:openstack].list_stack_data.body end tests('#list_stack_data_Detailed').formats({'stacks' => [@stack_detailed_format]}) do Fog::Orchestration[:openstack].list_stack_data_detailed.body end tests('#update_stack("teststack")').formats({}) do Fog::Orchestration[:openstack].update_stack("teststack").body end tests('#delete_stack("teststack", "id")').formats({}) do Fog::Orchestration[:openstack].delete_stack("teststack", "id").body end end end fog-1.34.0/tests/openstack/requests/network/0000755000004100000410000000000012600047642021100 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/network/port_tests.rb0000644000004100000410000000450212600047642023634 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | port requests', ['openstack']) do @port_format = { 'id' => String, 'name' => String, 'network_id' => String, 'fixed_ips' => Array, 'mac_address' => String, 'status' => String, 'admin_state_up' => Fog::Boolean, 'device_owner' => String, 'device_id' => String, 'tenant_id' => String, 'security_groups' => Array, 'allowed_address_pairs' => Array } tests('success') do tests('#create_port').formats({'port' => @port_format}) do network_id = 'net_id' attributes = {:name => 'port_name', :fixed_ips => [], :mac_address => 'fa:16:3e:62:91:7f', :admin_state_up => true, :device_owner => 'device_owner', :device_id => 'device_id', :tenant_id => 'tenant_id' ,:security_groups => [], :allowed_address_pairs => [] } Fog::Network[:openstack].create_port(network_id, attributes).body end tests('#list_port').formats({'ports' => [@port_format]}) do Fog::Network[:openstack].list_ports.body end tests('#get_port').formats({'port' => @port_format}) do port_id = Fog::Network[:openstack].ports.all.first.id Fog::Network[:openstack].get_port(port_id).body end tests('#update_port').formats({'port' => @port_format}) do port_id = Fog::Network[:openstack].ports.all.first.id attributes = {:name => 'port_name', :fixed_ips => [], :admin_state_up => true, :device_owner => 'device_owner', :device_id => 'device_id'} Fog::Network[:openstack].update_port(port_id, attributes).body end tests('#delete_port').succeeds do port_id = Fog::Network[:openstack].ports.all.first.id Fog::Network[:openstack].delete_port(port_id) end end tests('failure') do tests('#get_port').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_port(0) end tests('#update_port').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_port(0, {}) end tests('#delete_port').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_port(0) end end end fog-1.34.0/tests/openstack/requests/network/lb_member_tests.rb0000644000004100000410000000403512600047642024575 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | lb_member requests', ['openstack']) do @lb_member_format = { 'id' => String, 'pool_id' => String, 'address' => String, 'protocol_port' => Integer, 'weight' => Integer, 'status' => String, 'admin_state_up' => Fog::Boolean, 'tenant_id' => String, } tests('success') do tests('#create_lb_member').formats({'member' => @lb_member_format}) do pool_id = 'pool_id' address = '10.0.0.1' protocol_port = 80 weight = 100 attributes = {:admin_state_up => true, :tenant_id => 'tenant_id'} Fog::Network[:openstack].create_lb_member(pool_id, address, protocol_port, weight, attributes).body end tests('#list_lb_members').formats({'members' => [@lb_member_format]}) do Fog::Network[:openstack].list_lb_members.body end tests('#get_lb_member').formats({'member' => @lb_member_format}) do lb_member_id = Fog::Network[:openstack].lb_members.all.first.id Fog::Network[:openstack].get_lb_member(lb_member_id).body end tests('#update_lb_member').formats({'member' => @lb_member_format}) do lb_member_id = Fog::Network[:openstack].lb_members.all.first.id attributes = {:pool_id => 'new_pool_id', :weight => 50, :admin_state_up => false} Fog::Network[:openstack].update_lb_member(lb_member_id, attributes).body end tests('#delete_lb_member').succeeds do lb_member_id = Fog::Network[:openstack].lb_members.all.first.id Fog::Network[:openstack].delete_lb_member(lb_member_id) end end tests('failure') do tests('#get_lb_member').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_lb_member(0) end tests('#update_lb_member').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_lb_member(0, {}) end tests('#delete_lb_member').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_lb_member(0) end end end fog-1.34.0/tests/openstack/requests/network/security_group_tests.rb0000644000004100000410000000277112600047642025741 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_group requests', ['openstack']) do @security_group_format = { "id" => String, "name" => String, "description" => String, "tenant_id" => String, "security_group_rules" => [Hash] } tests('success') do @sec_group_id = nil tests("#create_security_group('fog_security_group', 'tests group')").formats(@security_group_format) do attributes = {:name => "fog_security_group", :description => "tests group"} data = Fog::Network[:openstack].create_security_group(attributes).body["security_group"] @sec_group_id = data["id"] data end tests("#get_security_group('#{@sec_group_id}')").formats(@security_group_format) do Fog::Network[:openstack].get_security_group(@sec_group_id).body["security_group"] end tests("#list_security_groups").formats('security_groups' => [@security_group_format]) do Fog::Network[:openstack].list_security_groups.body end tests("#delete_security_group('#{@sec_group_id}')").succeeds do Fog::Network[:openstack].delete_security_group(@sec_group_id) end end tests('failure') do tests("#get_security_group(0)").raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_security_group(0) end tests("#delete_security_group(0)").raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_security_group(0) end end end fog-1.34.0/tests/openstack/requests/network/lb_pool_tests.rb0000644000004100000410000000553012600047642024300 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | lb_pool requests', ['openstack']) do @lb_pool_format = { 'id' => String, 'subnet_id' => String, 'protocol' => String, 'lb_method' => String, 'name' => String, 'description' => String, 'health_monitors' => Array, 'members' => Array, 'status' => String, 'admin_state_up' => Fog::Boolean, 'vip_id' => Fog::Nullable::String, 'tenant_id' => String, 'active_connections' => Fog::Nullable::Integer, 'bytes_in' => Fog::Nullable::Integer, 'bytes_out' => Fog::Nullable::Integer, 'total_connections' => Fog::Nullable::Integer } @lb_pool_stats_format = { 'active_connections' => Integer, 'bytes_in' => Integer, 'bytes_out' => Integer, 'total_connections' => Integer } tests('success') do tests('#create_lb_pool').formats({'pool' => @lb_pool_format}) do subnet_id = 'subnet_id' protocol = 'HTTP' lb_method = 'ROUND_ROBIN' attributes = {:name => 'test-pool', :description => 'Test Pool', :admin_state_up => true, :tenant_id => 'tenant_id'} Fog::Network[:openstack].create_lb_pool(subnet_id, protocol, lb_method, attributes).body end tests('#list_lb_pools').formats({'pools' => [@lb_pool_format]}) do Fog::Network[:openstack].list_lb_pools.body end tests('#get_lb_pool').formats({'pool' => @lb_pool_format}) do lb_pool_id = Fog::Network[:openstack].lb_pools.all.first.id Fog::Network[:openstack].get_lb_pool(lb_pool_id).body end tests('#get_lb_pool_stats').formats({'stats' => @lb_pool_stats_format}) do lb_pool_id = Fog::Network[:openstack].lb_pools.all.first.id Fog::Network[:openstack].get_lb_pool_stats(lb_pool_id).body end tests('#update_lb_pool').formats({'pool' => @lb_pool_format}) do lb_pool_id = Fog::Network[:openstack].lb_pools.all.first.id attributes = {:name => 'new-test-pool', :description => 'New Test Pool', :lb_method => 'LEAST_CONNECTIONS', :admin_state_up => false} Fog::Network[:openstack].update_lb_pool(lb_pool_id, attributes).body end tests('#delete_lb_pool').succeeds do lb_pool_id = Fog::Network[:openstack].lb_pools.all.first.id Fog::Network[:openstack].delete_lb_pool(lb_pool_id) end end tests('failure') do tests('#get_lb_pool').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_lb_pool(0) end tests('#update_lb_pool').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_lb_pool(0, {}) end tests('#delete_lb_pool').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_lb_pool(0) end end end fog-1.34.0/tests/openstack/requests/network/subnet_tests.rb0000644000004100000410000000444012600047642024151 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | subnet requests', ['openstack']) do @subnet_format = { 'id' => String, 'name' => String, 'network_id' => String, 'cidr' => String, 'ip_version' => Integer, 'gateway_ip' => String, 'allocation_pools' => Array, 'dns_nameservers' => Array, 'host_routes' => Array, 'enable_dhcp' => Fog::Boolean, 'tenant_id' => String, } tests('success') do tests('#create_subnet').formats({'subnet' => @subnet_format}) do network_id = 'net_id' cidr = '10.2.2.0/24' ip_version = 4 attributes = {:name => 'subnet_name', :gateway_ip => '10.2.2.1', :allocation_pools => [], :dns_nameservers => [], :host_routes => [], :enable_dhcp => true, :tenant_id => 'tenant_id'} Fog::Network[:openstack].create_subnet(network_id, cidr, ip_version, attributes).body end tests('#list_subnet').formats({'subnets' => [@subnet_format]}) do Fog::Network[:openstack].list_subnets.body end tests('#get_subnet').formats({'subnet' => @subnet_format}) do subnet_id = Fog::Network[:openstack].subnets.all.first.id Fog::Network[:openstack].get_subnet(subnet_id).body end tests('#update_subnet').formats({'subnet' => @subnet_format}) do subnet_id = Fog::Network[:openstack].subnets.all.first.id attributes = {:name => 'subnet_name', :gateway_ip => '10.2.2.1', :allocation_pools => [], :dns_nameservers => [], :host_routes => [], :enable_dhcp => true} Fog::Network[:openstack].update_subnet(subnet_id, attributes).body end tests('#delete_subnet').succeeds do subnet_id = Fog::Network[:openstack].subnets.all.first.id Fog::Network[:openstack].delete_subnet(subnet_id) end end tests('failure') do tests('#get_subnet').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_subnet(0) end tests('#update_subnet').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_subnet(0, {}) end tests('#delete_subnet').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_subnet(0) end end end fog-1.34.0/tests/openstack/requests/network/router_tests.rb0000644000004100000410000000451312600047642024172 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | router requests', ['openstack']) do @router_format = { :id => String, :name => String, :status => String, :admin_state_up => Fog::Boolean, :tenant_id => String, :external_gateway_info => Fog::Nullable::Hash, } tests('success') do tests('#create_router').formats({'router' => @router_format}) do attributes = { :admin_state_up => true, :tenant_id => 'tenant_id' } Fog::Network[:openstack].create_router('router_name', attributes).body end tests('#list_routers').formats({'routers' => [@router_format]}) do Fog::Network[:openstack].list_routers.body end tests('#get_router').formats({'router' => @router_format}) do router_id = Fog::Network[:openstack].routers.all.first.id Fog::Network[:openstack].get_router(router_id).body end tests('#update_router').formats({'router' => @router_format}) do router_id = Fog::Network[:openstack].routers.all.first.id attributes = { :name => 'net_name', :external_gateway_info => { :network_id => 'net_id' }, :status => 'ACTIVE', :admin_state_up => true } Fog::Network[:openstack].update_router(router_id, attributes).body end tests('#update_router_with_network').formats({'router' => @router_format}) do router_id = Fog::Network[:openstack].routers.all.first.id net = Fog::Network[:openstack].networks.first attributes = { :name => 'net_name', :external_gateway_info => net, :status => 'ACTIVE', :admin_state_up => true } Fog::Network[:openstack].update_router(router_id, attributes).body end tests('#delete_router').succeeds do router_id = Fog::Network[:openstack].routers.all.last.id Fog::Network[:openstack].delete_router(router_id) end end tests('failure') do tests('#get_router').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_router(0) end tests('#update_router').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_router(0, {}) end tests('#delete_router').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_router(0) end end end fog-1.34.0/tests/openstack/requests/network/network_tests.rb0000644000004100000410000000667712600047642024360 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do @network_format = { 'id' => String, 'name' => String, 'subnets' => Array, 'shared' => Fog::Boolean, 'status' => String, 'admin_state_up' => Fog::Boolean, 'tenant_id' => String, } @network_format_extensions = { 'router:external' => Fog::Boolean, 'provider:network_type' => String, 'provider:physical_network' => Fog::Nullable::String, 'provider:segmentation_id' => Integer } tests('success') do tests('#create_network').formats({'network' => @network_format}) do attributes = { :name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id' } Fog::Network[:openstack].create_network(attributes).body end tests('#create_network+provider extensions').formats( {'network' => @network_format.merge(@network_format_extensions)} ) do attributes = { :name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id', :router_external => true, # local, gre, vlan. Depends on the provider. # May rise an exception if the network_type isn't valid: # QuantumError: "Invalid input for operation: provider:physical_network" :provider_network_type => 'gre', :provider_segmentation_id => 22, } Fog::Network[:openstack].create_network(attributes).body end tests('#list_networks').formats({'networks' => [@network_format]}) do Fog::Network[:openstack].list_networks.body end tests('#get_network').formats({'network' => @network_format}) do network_id = Fog::Network[:openstack].networks.all.first.id Fog::Network[:openstack].get_network(network_id).body end tests('#update_network').formats({'network' => @network_format}) do network_id = Fog::Network[:openstack].networks.all.first.id attributes = {:name => 'net_name', :shared => false, :admin_state_up => true} Fog::Network[:openstack].update_network(network_id, attributes).body end tests('#delete_network').succeeds do network_id = Fog::Network[:openstack].networks.all.first.id Fog::Network[:openstack].delete_network(network_id) end end tests('failure') do tests('#create_network+provider extensions').raises( Excon::Errors::BadRequest ) do pending if Fog.mocking? attributes = { :name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id', :router_external => true, # QuantumError: "Invalid input for operation: provider:physical_network" :provider_network_type => 'foobar', :provider_segmentation_id => 22, } Fog::Network[:openstack].create_network(attributes) end tests('#get_network').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_network(0) end tests('#update_network').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_network(0, {}) end tests('#delete_network').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_network(0) end end # Cleaning up the mess Fog::Network[:openstack].networks.each do |n| Fog::Network[:openstack].delete_network(n.id) end end fog-1.34.0/tests/openstack/requests/network/quota_tests.rb0000644000004100000410000000343312600047642024003 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | quota requests', ['openstack']) do @tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id'] @quota_format = { 'subnet' => Fog::Nullable::Integer, 'router' => Fog::Nullable::Integer, 'port' => Fog::Nullable::Integer, 'network' => Fog::Nullable::Integer, 'floatingip' => Fog::Nullable::Integer } @quotas_format = [{ 'subnet' => Fog::Nullable::Integer, 'router' => Fog::Nullable::Integer, 'port' => Fog::Nullable::Integer, 'network' => Fog::Nullable::Integer, 'floatingip' => Fog::Nullable::Integer, 'tenant_id' => Fog::Nullable::String }] tests('success') do tests('#get_quotas').formats({ 'quotas' => @quotas_format }) do Fog::Network[:openstack].get_quotas.body end tests('#get_quota').formats(@quota_format) do @quota = Fog::Network[:openstack].get_quota(@tenant_id).body['quota'] end tests('#update_quota') do new_values = @quota.merge({ 'volumes' => @quota['subnet']/2, 'snapshots' => @quota['router']/2 }) succeeds do Fog::Network[:openstack].update_quota(@tenant_id, new_values.clone) end returns(new_values, 'returns new values') do Fog::Network[:openstack].get_quota(@tenant_id).body['quota'] end # set quota back to old values succeeds do Fog::Network[:openstack].update_quota(@tenant_id, @quota.clone) end # ensure old values are restored returns(@quota, 'old values restored') do Fog::Network[:openstack].get_quota(@tenant_id).body['quota'] end end tests('#delete_quota') do succeeds do Fog::Network[:openstack].delete_quota(@tenant_id) end end end end fog-1.34.0/tests/openstack/requests/network/security_group_rule_tests.rb0000644000004100000410000000444112600047642026764 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_grouprule requests', ['openstack']) do @security_group_rule_format = { "id" => String, "remote_group_id" => Fog::Nullable::String, "direction" => String, "remote_ip_prefix" => Fog::Nullable::String, "protocol" => Fog::Nullable::String, "ethertype" => String, "port_range_max" => Fog::Nullable::Integer, "port_range_min" => Fog::Nullable::Integer, "security_group_id" => String, "tenant_id" => String } tests('success') do attributes = {:name => "my_security_group", :description => "tests group"} data = Fog::Network[:openstack].create_security_group(attributes).body["security_group"] @sec_group_id = data["id"] @sec_group_rule_id = nil tests("#create_security_group_rule(#{@sec_group_id}, 'ingress', attributes)").formats(@security_group_rule_format) do attributes = { :remote_ip_prefix => "0.0.0.0/0", :protocol => "tcp", :port_range_min => 22, :port_range_max => 22 } data = Fog::Network[:openstack].create_security_group_rule(@sec_group_id, 'ingress', attributes).body["security_group_rule"] @sec_group_rule_id = data["id"] data end tests("#get_security_group_rule('#{@sec_group_rule_id}')").formats(@security_group_rule_format) do Fog::Network[:openstack].get_security_group_rule(@sec_group_rule_id).body["security_group_rule"] end tests("#list_security_group_rules").formats("security_group_rules" => [@security_group_rule_format]) do Fog::Network[:openstack].list_security_group_rules.body end tests("#delete_security_group_rule('#{@sec_group_rule_id}')").succeeds do Fog::Network[:openstack].delete_security_group_rule(@sec_group_rule_id) end end tests('failure') do tests('#get_security_group_rule(0)').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_security_group_rule(0) end tests('#delete_security_group_rule(0)').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_security_group_rule(0) end end Fog::Network[:openstack].delete_security_group(@sec_group_id) end fog-1.34.0/tests/openstack/requests/network/lb_health_monitor_tests.rb0000644000004100000410000000725612600047642026352 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | lb_health_monitor requests', ['openstack']) do @lb_health_monitor_format = { 'id' => String, 'type' => String, 'delay' => Integer, 'timeout' => Integer, 'max_retries' => Integer, 'http_method' => String, 'url_path' => String, 'expected_codes' => String, 'status' => String, 'admin_state_up' => Fog::Boolean, 'tenant_id' => String, } tests('success') do before do @lb_pool = Fog::Network[:openstack].lb_pools.create(:subnet_id => 'subnet_id', :protocol => 'HTTP', :lb_method => 'ROUND_ROBIN') end after do @lb_pool.destroy end tests('#create_lb_health_monitor').formats({'health_monitor' => @lb_health_monitor_format}) do type = 'PING' delay = 1 timeout = 5 max_retries = 10 attributes = {:http_method => 'GET', :url_path => '/', :expected_codes => '200, 201', :admin_state_up => true, :tenant_id => 'tenant_id'} Fog::Network[:openstack].create_lb_health_monitor(type, delay, timeout, max_retries, attributes).body end tests('#list_lb_health_monitors').formats({'health_monitors' => [@lb_health_monitor_format]}) do Fog::Network[:openstack].list_lb_health_monitors.body end tests('#get_lb_health_monitor').formats({'health_monitor' => @lb_health_monitor_format}) do lb_health_monitor_id = Fog::Network[:openstack].lb_health_monitors.all.first.id Fog::Network[:openstack].get_lb_health_monitor(lb_health_monitor_id).body end tests('#update_lb_health_monitor').formats({'health_monitor' => @lb_health_monitor_format}) do lb_health_monitor_id = Fog::Network[:openstack].lb_health_monitors.all.first.id attributes = {:delay => 5, :timeout => 10, :max_retries => 20, :http_method => 'POST', :url_path => '/varz', :expected_codes => '200', :admin_state_up => false} Fog::Network[:openstack].update_lb_health_monitor(lb_health_monitor_id, attributes).body end tests('#associate_lb_health_monitor').succeeds do lb_health_monitor_id = Fog::Network[:openstack].lb_health_monitors.all.first.id Fog::Network[:openstack].associate_lb_health_monitor(@lb_pool.id, lb_health_monitor_id) end tests('#disassociate_lb_health_monitor').succeeds do lb_health_monitor_id = Fog::Network[:openstack].lb_health_monitors.all.first.id Fog::Network[:openstack].disassociate_lb_health_monitor(@lb_pool.id, lb_health_monitor_id) end tests('#delete_lb_health_monitor').succeeds do lb_health_monitor_id = Fog::Network[:openstack].lb_health_monitors.all.first.id Fog::Network[:openstack].delete_lb_health_monitor(lb_health_monitor_id) end end tests('failure') do tests('#get_lb_health_monitor').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_lb_health_monitor(0) end tests('#update_lb_health_monitor').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_lb_health_monitor(0, {}) end tests('#associate_lb_health_monitor').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].associate_lb_health_monitor(0, 0) end tests('#disassociate_lb_health_monitor').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].disassociate_lb_health_monitor(0, 0) end tests('#delete_lb_health_monitor').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_lb_health_monitor(0) end end end fog-1.34.0/tests/openstack/requests/network/lb_vip_tests.rb0000644000004100000410000000512512600047642024125 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | lb_vip requests', ['openstack']) do @lb_vip_format = { 'id' => String, 'subnet_id' => String, 'pool_id' => String, 'protocol' => String, 'protocol_port' => Integer, 'name' => String, 'description' => String, 'address' => String, 'port_id' => String, 'session_persistence' => Hash, 'connection_limit' => Integer, 'status' => String, 'admin_state_up' => Fog::Boolean, 'tenant_id' => String, } tests('success') do tests('#create_lb_vip').formats({'vip' => @lb_vip_format}) do subnet_id = 'subnet_id' pool_id = 'pool_id' protocol = 'HTTP' protocol_port = 80 attributes = {:name => 'test-vip', :description => 'Test VIP', :address => '10.0.0.1', :connection_limit => 10, :session_persistence => { "cookie_name" => "COOKIE_NAME", "type" => "APP_COOKIE" }, :admin_state_up => true, :tenant_id => 'tenant_id'} Fog::Network[:openstack].create_lb_vip(subnet_id, pool_id, protocol, protocol_port, attributes).body end tests('#list_lb_vips').formats({'vips' => [@lb_vip_format]}) do Fog::Network[:openstack].list_lb_vips.body end tests('#get_lb_vip').formats({'vip' => @lb_vip_format}) do lb_vip_id = Fog::Network[:openstack].lb_vips.all.first.id Fog::Network[:openstack].get_lb_vip(lb_vip_id).body end tests('#update_lb_vip').formats({'vip' => @lb_vip_format}) do lb_vip_id = Fog::Network[:openstack].lb_vips.all.first.id attributes = {:pool_id => 'new_pool_id', :name => 'new-test-vip', :description => 'New Test VIP', :connection_limit => 5, :session_persistence => { "type" => "HTTP_COOKIE" }, :admin_state_up => false} Fog::Network[:openstack].update_lb_vip(lb_vip_id, attributes).body end tests('#delete_lb_vip').succeeds do lb_vip_id = Fog::Network[:openstack].lb_vips.all.first.id Fog::Network[:openstack].delete_lb_vip(lb_vip_id) end end tests('failure') do tests('#get_lb_vip').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].get_lb_vip(0) end tests('#update_lb_vip').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].update_lb_vip(0, {}) end tests('#delete_lb_vip').raises(Fog::Network::OpenStack::NotFound) do Fog::Network[:openstack].delete_lb_vip(0) end end end fog-1.34.0/tests/openstack/requests/storage/0000755000004100000410000000000012600047642021053 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/storage/object_tests.rb0000644000004100000410000001653512600047642024102 0ustar www-datawww-dataShindo.tests('Fog::Storage[:openstack] | object requests', ["openstack"]) do unless Fog.mocking? @directory = Fog::Storage[:openstack].directories.create(:key => 'fogobjecttests') end module OpenStackStorageHelpers def override_path(path) @path = path end end tests('success') do tests("#put_object('fogobjecttests', 'fog_object')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].put_object('fogobjecttests', 'fog_object', lorem_file) end tests("#get_object('fogobjectests', 'fog_object')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].get_object('fogobjecttests', 'fog_object').body == lorem_file.read end tests("#get_object('fogobjecttests', 'fog_object', &block)").succeeds do pending if Fog.mocking? data = '' Fog::Storage[:openstack].get_object('fogobjecttests', 'fog_object') do |chunk, remaining_bytes, total_bytes| data << chunk end data == lorem_file.read end tests("#public_url('fogobjectests', 'fog_object')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].directories.first.files.first.public_url end tests("#public_url('fogobjectests')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].directories.first.public_url end tests("#head_object('fogobjectests', 'fog_object')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].head_object('fogobjecttests', 'fog_object') end tests("#delete_object('fogobjecttests', 'fog_object')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].delete_object('fogobjecttests', 'fog_object') end def test_temp_url(url_s, time, desired_scheme) object_url = URI.parse(url_s) query_params = URI.decode_www_form(object_url.query) tests("the link is #{desired_scheme}").returns(desired_scheme) { object_url.scheme } tests('the container and object are present in the path').returns(true) do (object_url.path =~ /\/#{@directory.identity}\/fog_object/) != nil end tests('a temp_url_sig is present').returns(true) do query_params.any? { |p| p[0] == 'temp_url_sig' } end tests('temp_url_expires matches the expiration').returns(true) do query_params.any? { |p| p == ['temp_url_expires', time.to_i.to_s] } end end tests("#get_object_http_url('directory.identity', 'fog_object', expiration timestamp)").succeeds do pending if Fog.mocking? ts = Time.at(1395343213) url_s = Fog::Storage[:openstack].get_object_http_url(@directory.identity, 'fog_object', ts) test_temp_url(url_s, ts, 'http') end tests("#get_object_https_url('directory.identity', 'fog_object', expiration timestamp)").succeeds do pending if Fog.mocking? ts = Time.at(1395343215) url_s = Fog::Storage[:openstack].get_object_https_url(@directory.identity, 'fog_object', ts) test_temp_url(url_s, ts, 'https') end tests("put_object with block") do pending if Fog.mocking? tests("#put_object('fogobjecttests', 'fog_object', &block)").succeeds do begin file = lorem_file buffer_size = file.stat.size / 2 # chop it up into two buffers Fog::Storage[:openstack].put_object('fogobjecttests', 'fog_block_object', nil) do file.read(buffer_size).to_s end ensure file.close end end tests('#get_object').succeeds do Fog::Storage[:openstack].get_object('fogobjecttests', 'fog_block_object').body == lorem_file.read end tests('#delete_object').succeeds do Fog::Storage[:openstack].delete_object('fogobjecttests', 'fog_block_object') end end tests('#delete_multiple_objects') do pending if Fog.mocking? Fog::Storage[:openstack].put_object('fogobjecttests', 'fog_object', lorem_file) Fog::Storage[:openstack].put_object('fogobjecttests', 'fog_object2', lorem_file) Fog::Storage[:openstack].directories.create(:key => 'fogobjecttests2') Fog::Storage[:openstack].put_object('fogobjecttests2', 'fog_object', lorem_file) expected = { "Number Not Found" => 0, "Response Status" => "200 OK", "Errors" => [], "Number Deleted" => 2, "Response Body" => "" } returns(expected, 'deletes multiple objects') do Fog::Storage[:openstack].delete_multiple_objects('fogobjecttests', ['fog_object', 'fog_object2']).body end returns(expected, 'deletes object and container') do Fog::Storage[:openstack].delete_multiple_objects(nil, ['fogobjecttests2/fog_object', 'fogobjecttests2']).body end end end tests('failure') do tests("#get_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].get_object('fogobjecttests', 'fog_non_object') end tests("#get_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].get_object('fognoncontainer', 'fog_non_object') end tests("#head_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].head_object('fogobjecttests', 'fog_non_object') end tests("#head_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].head_object('fognoncontainer', 'fog_non_object') end tests("#delete_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].delete_object('fogobjecttests', 'fog_non_object') end tests("#delete_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].delete_object('fognoncontainer', 'fog_non_object') end tests('#delete_multiple_objects') do pending if Fog.mocking? expected = { "Number Not Found" => 2, "Response Status" => "200 OK", "Errors" => [], "Number Deleted" => 0, "Response Body" => "" } returns(expected, 'reports missing objects') do Fog::Storage[:openstack].delete_multiple_objects('fogobjecttests', ['fog_non_object', 'fog_non_object2']).body end returns(expected, 'reports missing container') do Fog::Storage[:openstack].delete_multiple_objects('fognoncontainer', ['fog_non_object', 'fog_non_object2']).body end tests('deleting non-empty container') do Fog::Storage[:openstack].put_object('fogobjecttests', 'fog_object', lorem_file) expected = { "Number Not Found" => 0, "Response Status" => "400 Bad Request", "Errors" => [['fogobjecttests', '409 Conflict']], "Number Deleted" => 1, "Response Body" => "" } returns(expected, 'deletes object but not container') do Fog::Storage[:openstack].delete_multiple_objects(nil, ['fogobjecttests', 'fogobjecttests/fog_object']).body end end end end unless Fog.mocking? @directory.destroy end end fog-1.34.0/tests/openstack/requests/storage/large_object_tests.rb0000644000004100000410000003413612600047642025251 0ustar www-datawww-dataShindo.tests('Fog::Storage[:openstack] | large object requests', ['openstack']) do unless Fog.mocking? @directory = Fog::Storage[:openstack].directories.create(:key => 'foglargeobjecttests') @directory2 = Fog::Storage[:openstack].directories.create(:key => 'foglargeobjecttests2') @segments = { :a => { :container => @directory.identity, :name => 'fog_large_object/a', :data => 'a' * (1024**2 + 10), :size => 1024**2 + 10, :etag => 'c2e97007d59f0c19b850debdcb80cca5' }, :b => { :container => @directory.identity, :name => 'fog_large_object/b', :data => 'b' * (1024**2 + 20), :size => 1024**2 + 20, :etag => 'd35f50622a1259daad75ff7d5512c7ef' }, :c => { :container => @directory.identity, :name => 'fog_large_object2/a', :data => 'c' * (1024**2 + 30), :size => 1024**2 + 30, :etag => '901d3531a87d188041d4d5b43cb464c1' }, :d => { :container => @directory2.identity, :name => 'fog_large_object2/b', :data => 'd' * (1024**2 + 40), :size => 1024**2 + 40, :etag => '350c0e00525198813920a157df185c8d' } } end tests('success') do tests('upload test segments').succeeds do pending if Fog.mocking? @segments.each_value do |segment| Fog::Storage[:openstack].put_object(segment[:container], segment[:name], segment[:data]) end end tests('dynamic large object requests') do pending if Fog.mocking? tests('#put_object_manifest alias').succeeds do Fog::Storage[:openstack].put_object_manifest(@directory.identity, 'fog_large_object') end tests('using default X-Object-Manifest header') do tests('#put_dynamic_obj_manifest').succeeds do Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object') end tests('#get_object streams all segments matching the default prefix').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] + @segments[:c][:data] Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected end # When the manifest object name is equal to the segment prefix, OpenStack treats it as if it's the first segment. # So you must prepend the manifest object's Etag - Digest::MD5.hexdigest('') tests('#head_object returns Etag that includes manifest object in calculation').succeeds do etags = ['d41d8cd98f00b204e9800998ecf8427e', @segments[:a][:etag], @segments[:b][:etag], @segments[:c][:etag]] expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"2577f38428e895c50de6ea78ccc7da2a"\" Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected end end tests('specifying X-Object-Manifest segment prefix') do tests('#put_dynamic_obj_manifest').succeeds do options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" } Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object', options) end tests('#get_object streams segments only matching the specified prefix').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected end tests('#head_object returns Etag that does not include manifest object in calculation').succeeds do etags = [@segments[:a][:etag], @segments[:b][:etag]] expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"0f035ed3cc38aa0ef46dda3478fad44d"\" Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected end end tests('storing manifest in a different container than the segments') do tests('#put_dynamic_obj_manifest').succeeds do options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" } Fog::Storage[:openstack].put_dynamic_obj_manifest(@directory2.identity, 'fog_large_object', options) end tests('#get_object').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] Fog::Storage[:openstack].get_object(@directory2.identity, 'fog_large_object').body == expected end end end tests('static large object requests') do pending if Fog.mocking? tests('single container') do tests('#put_static_obj_manifest').succeeds do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:a][:size] }, { :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }", :etag => @segments[:c][:etag], :size_bytes => @segments[:c][:size] } ] Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) end tests('#head_object') do etags = [@segments[:a][:etag], @segments[:c][:etag]] etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"ad7e633a12e8a4915b45e6dd1d4b0b4b\"" content_length = (@segments[:a][:size] + @segments[:c][:size]).to_s response = Fog::Storage[:openstack].head_object(@directory.identity, 'fog_large_object') returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] } returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] } returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] } end tests('#get_object').succeeds do expected = @segments[:a][:data] + @segments[:c][:data] Fog::Storage[:openstack].get_object(@directory.identity, 'fog_large_object').body == expected end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 0, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 3, 'Response Body' => '' } returns(expected, 'deletes manifest and segments') do Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_large_object').body end end end tests('multiple containers') do tests('#put_static_obj_manifest').succeeds do segments = [ { :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:b][:size] }, { :path => "#{ @segments[:d][:container] }/#{ @segments[:d][:name] }", :etag => @segments[:d][:etag], :size_bytes => @segments[:d][:size] } ] Fog::Storage[:openstack].put_static_obj_manifest(@directory2.identity, 'fog_large_object', segments) end tests('#head_object') do etags = [@segments[:b][:etag], @segments[:d][:etag]] etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"9801a4cc4472896a1e975d03f0d2c3f8\"" content_length = (@segments[:b][:size] + @segments[:d][:size]).to_s response = Fog::Storage[:openstack].head_object(@directory2.identity, 'fog_large_object') returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] } returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] } returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] } end tests('#get_object').succeeds do expected = @segments[:b][:data] + @segments[:d][:data] Fog::Storage[:openstack].get_object(@directory2.identity, 'fog_large_object').body == expected end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 0, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 3, 'Response Body' => '' } returns(expected, 'deletes manifest and segments') do Fog::Storage[:openstack].delete_static_large_object(@directory2.identity, 'fog_large_object').body end end end end end tests('failure') do tests('dynamic large object requests') do pending if Fog.mocking? tests('#put_dynamic_obj_manifest with missing container').raises(Fog::Storage::OpenStack::NotFound) do Fog::Storage[:openstack].put_dynamic_obj_manifest('fognoncontainer', 'fog_large_object') end end tests('static large object requests') do pending if Fog.mocking? tests('upload test segments').succeeds do Fog::Storage[:openstack].put_object(@segments[:a][:container], @segments[:a][:name], @segments[:a][:data]) Fog::Storage[:openstack].put_object(@segments[:b][:container], @segments[:b][:name], @segments[:b][:data]) end tests('#put_static_obj_manifest with missing container').raises(Fog::Storage::OpenStack::NotFound) do Fog::Storage[:openstack].put_static_obj_manifest('fognoncontainer', 'fog_large_object', []) end tests('#put_static_obj_manifest with missing object') do segments = [ { :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }", :etag => @segments[:c][:etag], :size_bytes => @segments[:c][:size] } ] expected = { 'Errors' => [[segments[0][:path], '404 Not Found']] } error = nil begin Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Excon::Errors::BadRequest) do raise error if error end returns(expected, 'returns error information') do Fog::JSON.decode(error.response.body) end end tests('#put_static_obj_manifest with invalid etag') do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:a][:size] } ] expected = { 'Errors' => [[segments[0][:path], 'Etag Mismatch']] } error = nil begin Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Excon::Errors::BadRequest) do raise error if error end returns(expected, 'returns error information') do Fog::JSON.decode(error.response.body) end end tests('#put_static_obj_manifest with invalid byte_size') do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:b][:size] } ] expected = { 'Errors' => [[segments[0][:path], 'Size Mismatch']] } error = nil begin Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Excon::Errors::BadRequest) do raise error if error end returns(expected, 'returns error information') do Fog::JSON.decode(error.response.body) end end tests('#delete_static_large_object with missing container') do expected = { 'Number Not Found' => 1, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 0, 'Response Body' => '' } returns(expected, 'reports missing object') do Fog::Storage[:openstack].delete_static_large_object('fognoncontainer', 'fog_large_object').body end end tests('#delete_static_large_object with missing manifest') do expected = { 'Number Not Found' => 1, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 0, 'Response Body' => '' } returns(expected, 'reports missing manifest') do Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_non_object').body end end tests('#delete_static_large_object with missing segment') do tests('#put_static_obj_manifest for segments :a and :b').succeeds do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:a][:size] }, { :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:b][:size] } ] Fog::Storage[:openstack].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) end tests('#delete_object segment :b').succeeds do Fog::Storage[:openstack].delete_object(@segments[:b][:container], @segments[:b][:name]) end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 1, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 2, 'Response Body' => '' } returns(expected, 'deletes manifest and segment :a, and reports missing segment :b') do Fog::Storage[:openstack].delete_static_large_object(@directory.identity, 'fog_large_object').body end end end end end unless Fog.mocking? @directory.destroy @directory2.destroy end end fog-1.34.0/tests/openstack/requests/storage/container_tests.rb0000644000004100000410000000346512600047642024614 0ustar www-datawww-dataShindo.tests('Fog::Storage[:openstack] | container requests', ["openstack"]) do @container_format = [String] @containers_format = [{ 'bytes' => Integer, 'count' => Integer, 'name' => String }] tests('success') do tests("#put_container('fogcontainertests')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].put_container('fogcontainertests') end tests("#get_container('fogcontainertests')").formats(@container_format) do pending if Fog.mocking? Fog::Storage[:openstack].get_container('fogcontainertests').body end tests("#get_containers").formats(@containers_format) do pending if Fog.mocking? Fog::Storage[:openstack].get_containers.body end tests("#head_container('fogcontainertests')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].head_container('fogcontainertests') end tests("#head_containers").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].head_containers end tests("#delete_container('fogcontainertests')").succeeds do pending if Fog.mocking? Fog::Storage[:openstack].delete_container('fogcontainertests') end end tests('failure') do tests("#get_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].get_container('fognoncontainer') end tests("#head_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].head_container('fognoncontainer') end tests("#delete_container('fognoncontainer')").raises(Fog::Storage::OpenStack::NotFound) do pending if Fog.mocking? Fog::Storage[:openstack].delete_container('fognoncontainer') end end end fog-1.34.0/tests/openstack/requests/volume/0000755000004100000410000000000012600047642020716 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/volume/availability_zone_tests.rb0000644000004100000410000000053212600047642026172 0ustar www-datawww-dataShindo.tests('Fog::Volume[:openstack] | availability zone requests', ['openstack']) do @flavor_format = { 'zoneName' => String, 'zoneState' => Hash, } tests('success') do tests('#list_zones').data_matches_schema({'availabilityZoneInfo' => [@flavor_format]}) do Fog::Volume[:openstack].list_zones.body end end end fog-1.34.0/tests/openstack/requests/volume/quota_tests.rb0000644000004100000410000000257412600047642023626 0ustar www-datawww-dataShindo.tests('Fog::Volume[:openstack] | quota requests', ['openstack']) do @tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id'] @quota_set_format = { 'volumes' => Fog::Nullable::Integer, 'gigabytes' => Fog::Nullable::Integer, 'snapshots' => Fog::Nullable::Integer, 'id' => String } tests('success') do tests('#get_quota_defaults').formats({ 'quota_set' => @quota_set_format }) do Fog::Volume[:openstack].get_quota_defaults(@tenant_id).body end tests('#get_quota').formats(@quota_set_format) do @quota = Fog::Volume[:openstack].get_quota(@tenant_id).body['quota_set'] @quota end tests('#update_quota') do new_values = @quota.merge({ 'volumes' => @quota['volumes']/2, 'snapshots' => @quota['snapshots']/2 }) succeeds do Fog::Volume[:openstack].update_quota(@tenant_id, new_values.clone) end returns(new_values, 'returns new values') do Fog::Volume[:openstack].get_quota(@tenant_id).body['quota_set'] end # set quota back to old values succeeds do Fog::Volume[:openstack].update_quota(@tenant_id, @quota.clone) end # ensure old values are restored returns(@quota, 'old values restored') do Fog::Volume[:openstack].get_quota(@tenant_id).body['quota_set'] end end end end fog-1.34.0/tests/openstack/requests/metering/0000755000004100000410000000000012600047642021221 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/metering/meter_tests.rb0000644000004100000410000000265712600047642024116 0ustar www-datawww-dataShindo.tests('Fog::Metering[:openstack] | meter requests', ['openstack']) do @sample_format = { 'counter_name' => String, 'user_id' => String, 'resource_id' => String, 'timestamp' => String, 'resource_metadata' => Hash, 'source' => String, 'counter_unit' => String, 'counter_volume' => Float, 'project_id' => String, 'message_id' => String, 'counter_type' => String } @meter_format = { 'user_id' => String, 'name' => String, 'resource_id' => String, 'project_id' => String, 'type' => String, 'unit' => String } @statistics_format = { 'count' => Integer, 'duration_start' => String, 'min' => Float, 'max' => Float, 'duration_end' => String, 'period' => Integer, 'period_end' => String, 'duration' => Float, 'period_start' => String, 'avg' => Float, 'sum' => Float } tests('success') do tests('#list_meters').formats([@meter_format]) do Fog::Metering[:openstack].list_meters.body end tests('#get_samples').formats([@sample_format]) do Fog::Metering[:openstack].get_samples('test').body end tests('#get_statistics').formats([@statistics_format]) do Fog::Metering[:openstack].get_statistics('test').body end end end fog-1.34.0/tests/openstack/requests/metering/resource_tests.rb0000644000004100000410000000076112600047642024623 0ustar www-datawww-dataShindo.tests('Fog::Metering[:openstack] | resource requests', ['openstack']) do @resource_format = { 'resource_id' => String, 'project_id' => String, 'user_id' => String, 'metadata' => Hash, } tests('success') do tests('#list_resource').formats([@resource_format]) do Fog::Metering[:openstack].list_resources.body end tests('#get_resource').formats(@resource_format) do Fog::Metering[:openstack].get_resource('test').body end end end fog-1.34.0/tests/openstack/requests/identity/0000755000004100000410000000000012600047642021240 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/identity/helper.rb0000644000004100000410000000055712600047642023053 0ustar www-datawww-dataclass OpenStack module Identity def self.get_tenant_id identity = Fog::Identity[:openstack] ENV['OPENSTACK_TENANT_NAME'] || identity.list_tenants.body['tenants'].first['id'] end def self.get_user_id identity = Fog::Identity[:openstack] ENV['OPENSTACK_USER_ID'] || identity.list_users.body['users'].first['id'] end end end fog-1.34.0/tests/openstack/requests/identity/role_tests.rb0000644000004100000410000000327712600047642023761 0ustar www-datawww-dataShindo.tests('Fog::Identity[:openstack] | role requests', ['openstack']) do @role_format = { 'id' => String, 'name' => String } @user = Fog::Identity[:openstack].list_users.body['users'].first @tenant = Fog::Identity[:openstack].list_tenants.body['tenants'].first tests('success') do tests('#create_role("Role Name")').formats(@role_format, false) do @role = Fog::Identity[:openstack].create_role("Role Name").body['role'] end tests('#list_roles').formats({'roles' => [@role_format]}) do Fog::Identity[:openstack].list_roles.body end tests("#get_role('#{@role['id']}')").formats(@role_format) do Fog::Identity[:openstack].get_role(@role['id']).body['role'] end tests('#create_user_role(@tenant["id"], @user["id"], @role["id"])').formats(@role_format) do Fog::Identity[:openstack].create_user_role(@tenant['id'], @user['id'], @role['id']).body['role'] end tests("#list_roles_for_user_on_tenant('#{@tenant['id']}','#{@user['id']}')").formats([@role_format]) do Fog::Identity[:openstack].list_roles_for_user_on_tenant(@tenant['id'], @user['id']).body['roles'] end tests("#delete_user_role with tenant").returns("") do Fog::Identity[:openstack].delete_user_role(@tenant['id'], @user['id'], @role['id']).body end tests("#delete_user_role with tenant").formats(@role_format) do # FIXME - Response (under mocks) is empty String which does not match schema pending Fog::Identity[:openstack].delete_user_role(@tenant['id'], @user['id'], @role['id']).body end tests("#delete_role('#{@role['id']}')").succeeds do Fog::Identity[:openstack].delete_role(@role['id']).body end end end fog-1.34.0/tests/openstack/requests/identity/tenant_tests.rb0000644000004100000410000000340612600047642024303 0ustar www-datawww-dataShindo.tests('Fog::Identity[:openstack] | tenant requests', ['openstack']) do @tenant_format = { 'id' => String, 'name' => String, 'enabled' => Fog::Nullable::Boolean, 'description' => Fog::Nullable::String } @role_format = { 'id' => String, 'name' => String } @tenant_name = Fog::Mock.random_hex(64) @tenant_name_update = Fog::Mock.random_hex(64) @tenant_name_update2 = Fog::Mock.random_hex(64) tests('success') do tests('#list_tenants').formats({'tenants' => [@tenant_format], 'tenants_links' => []}) do Fog::Identity[:openstack].list_tenants.body end tests('#list_roles_for_user_on_tenant(0,1)'). formats({'roles' => [@role_format]}) do openstack = Fog::Identity[:openstack] openstack.list_roles_for_user_on_tenant( openstack.current_tenant['id'], OpenStack::Identity.get_user_id).body end tests('#create_tenant').formats({'tenant' => @tenant_format}) do @tenant = Fog::Identity[:openstack].create_tenant('name' => @tenant_name).body end tests('#get_tenant').formats({'tenant' => @tenant_format}) do Fog::Identity[:openstack].get_tenant(@tenant['tenant']['id']).body end tests('#update_tenant check format').formats({'tenant' => @tenant_format}) do @tenant = Fog::Identity[:openstack].update_tenant( @tenant['tenant']['id'], 'name' => @tenant_name_update).body end tests('#update_tenant update name').succeeds do @tenant = Fog::Identity[:openstack].update_tenant( @tenant['tenant']['id'], 'name' => @tenant_name_update2).body @tenant['tenant']['name'] == @tenant_name_update2 end tests('#delete_tenant').succeeds do Fog::Identity[:openstack].delete_tenant(@tenant['tenant']['id']) end end end fog-1.34.0/tests/openstack/requests/identity/ec2_credentials_tests.rb0000644000004100000410000000222312600047642026034 0ustar www-datawww-dataShindo.tests('Fog::Identity[:openstack] | EC2 credential requests', ['openstack']) do @credential_format = { 'access' => String, 'tenant_id' => String, 'secret' => String, 'user_id' => String, } @user_id = OpenStack::Identity.get_user_id @tenant_id = OpenStack::Identity.get_tenant_id tests('success') do tests('#create_ec2_credential'). formats({'credential' => @credential_format}) do response = Fog::Identity[:openstack]. create_ec2_credential(@user_id, @tenant_id) @ec2_credential = response.body['credential'] response.body end tests('#get_ec2_credential'). formats({'credential' => @credential_format}) do Fog::Identity[:openstack]. get_ec2_credential(@user_id, @ec2_credential['access']).body end tests('#list_ec2_credentials'). formats({'credentials' => [@credential_format]}) do Fog::Identity[:openstack]. list_ec2_credentials(@user_id).body end tests('#delete_ec2_credential').succeeds do Fog::Identity[:openstack]. delete_ec2_credential(@user_id, @ec2_credential['access']) end end end fog-1.34.0/tests/openstack/requests/identity/user_tests.rb0000644000004100000410000000253512600047642023772 0ustar www-datawww-dataShindo.tests('Fog::Identity[:openstack] | user requests', ['openstack']) do @user_format = { 'id' => String, 'name' => String, 'enabled' => Fog::Boolean, 'email' => String, 'tenantId' => Fog::Nullable::String } tests('success') do @user_name = Fog::Mock.random_hex(64) @user_name_update = Fog::Mock.random_hex(64) tests("#create_user('#{@user_name}', 'mypassword', 'morph@example.com', 't3n4nt1d', true)").formats(@user_format, false) do @user = Fog::Identity[:openstack].create_user(@user_name, "mypassword", "morph@example.com", OpenStack::Identity.get_tenant_id).body['user'] end tests('#list_users').formats({'users' => [@user_format]}) do Fog::Identity[:openstack].list_users.body end tests('#get_user_by_id').formats(@user_format) do Fog::Identity[:openstack].get_user_by_id(@user['id']).body['user'] end tests('#get_user_by_name').formats(@user_format) do Fog::Identity[:openstack].get_user_by_name(@user['name']).body['user'] end tests("#update_user(#{@user['id']}, :name => 'fogupdateduser')").succeeds do Fog::Identity[:openstack].update_user(@user['id'], :name => @user_name_update, :email => 'fog@test.com') end tests("#delete_user(#{@user['id']})").succeeds do Fog::Identity[:openstack].delete_user(@user['id']) end end end fog-1.34.0/tests/openstack/requests/compute/0000755000004100000410000000000012600047642021063 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/compute/availability_zone_tests.rb0000644000004100000410000000106212600047642026336 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | availability zone requests', ['openstack']) do @flavor_format = { 'zoneName' => String, 'hosts' => Fog::Nullable::Hash, 'zoneState' => Hash, } tests('success') do tests('#list_zones').data_matches_schema({'availabilityZoneInfo' => [@flavor_format]}) do Fog::Compute[:openstack].list_zones.body end tests('#list_zones_detailed').data_matches_schema({'availabilityZoneInfo' => [@flavor_format]}) do Fog::Compute[:openstack].list_zones_detailed.body end end end fog-1.34.0/tests/openstack/requests/compute/security_group_tests.rb0000644000004100000410000000504012600047642025714 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | security group requests', ['openstack']) do @security_group = Hash.new @security_group_rule = Hash.new @security_group_format = { "id" => Integer, "rules" => Array, "tenant_id" => String, "name" => String, "description" => String } @security_group_rule_format = { "id" => Integer, "from_port" => Integer, "to_port" => Integer, "ip_protocol" => String, "group" => Hash, "ip_range" => Hash, "parent_group_id" => Integer } tests('success') do tests('#create_security_group(name, description)').formats({"security_group" => @security_group_format}) do security_group = Fog::Compute[:openstack].create_security_group('from_shindo_test', 'this is from the shindo test').body @security_group_id = security_group['security_group']['id'] security_group end tests('#create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id=nil)').formats({"security_group_rule" => @security_group_rule_format}) do security_group_rule = Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body @security_group_rule_id = security_group_rule['security_group_rule']['id'] security_group_rule end tests('#list_security_groups').formats({"security_groups" => [@security_group_format]}) do Fog::Compute[:openstack].list_security_groups.body end tests('#get_security_group(security_group_id)').formats({"security_group" => @security_group_format}) do Fog::Compute[:openstack].get_security_group(@security_group_id).body end tests('#get_security_group_rule').formats({"security_group_rule" => @security_group_rule_format}) do Fog::Compute[:openstack].create_security_group_rule(@security_group_id, "tcp", 2222, 3333, "20.20.20.20/24").body Fog::Compute[:openstack].get_security_group_rule(@security_group_rule_id).body end tests('#delete_security_group_rule(security_group_rule_id)').succeeds do Fog::Compute[:openstack].delete_security_group_rule(@security_group_rule_id) end tests('#delete_security_group(security_group_id)').succeeds do Fog::Compute[:openstack].delete_security_group(@security_group_id) returns(false) { groups = Fog::Compute[:openstack].list_security_groups.body['security_groups'] groups.any? { |group| group['id'] == @security_group_id } } end end # tests('success') end fog-1.34.0/tests/openstack/requests/compute/helper.rb0000644000004100000410000000167612600047642022701 0ustar www-datawww-dataclass OpenStack module Compute module Formats SUMMARY = { 'id' => String, 'name' => String, 'links' => Array } end end end def compute Fog::Compute[:openstack] end def get_flavor_ref ENV['OPENSTACK_FLAVOR_REF'] || compute.list_flavors.body['flavors'].first['id'] end def get_image_ref ENV['OPENSTACK_IMAGE_REF'] || compute.list_images.body['images'].first['id'] end def get_volume_ref ENV['OPENSTACK_VOLUME_REF'] || compute.list_volumes.body['volumes'].first['id'] end def get_flavor_ref_resize # by default we simply add one to the default flavor ref ENV['OPENSTACK_FLAVOR_REF_RESIZE'] || (get_flavor_ref.to_i + 1).to_s end def set_password_enabled pw_enabled = ENV['OPENSTACK_SET_PASSWORD_ENABLED'] || "true" return pw_enabled == "true" end def get_security_group_ref ENV['OPENSTACK_SECURITY_GROUP_REF'] || compute.list_security_groups.body['security_groups'].first['name'] end fog-1.34.0/tests/openstack/requests/compute/flavor_tests.rb0000644000004100000410000000725512600047642024134 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | flavor requests', ['openstack']) do @flavor_format = { 'id' => String, 'name' => String, 'disk' => Integer, 'ram' => Integer, 'links' => Array, 'swap' => Fog::Nullable::String, 'rxtx_factor' => Fog::Nullable::Float, 'OS-FLV-EXT-DATA:ephemeral' => Integer, 'os-flavor-access:is_public' => Fog::Nullable::Boolean, 'OS-FLV-DISABLED:disabled' => Fog::Nullable::Boolean, 'vcpus' => Integer } tests('success') do tests('#get_flavor_details(1)').data_matches_schema(@flavor_format) do Fog::Compute[:openstack].get_flavor_details("1").body['flavor'] end tests('#list_flavors').data_matches_schema({'flavors' => [OpenStack::Compute::Formats::SUMMARY]}) do Fog::Compute[:openstack].list_flavors.body end tests('#list_flavors_detail').data_matches_schema({'flavors' => [@flavor_format]}) do Fog::Compute[:openstack].list_flavors_detail.body end tests('#create_flavor(attributes)').data_matches_schema({'flavor' => @flavor_format}) do attributes = {:flavor_id => '100', :name => 'shindo test flavor', :disk => 10, :ram => 10, :vcpus => 10, :swap => "0", :rxtx_factor => 2.4, :ephemeral => 0, :is_public => false} Fog::Compute[:openstack].create_flavor(attributes).body end tests('add_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do Fog::Compute[:openstack].add_flavor_access(100, 1).body end tests('remove_flavor_access(flavor_ref, tenant_id)').data_matches_schema({'flavor_access' => []}) do Fog::Compute[:openstack].remove_flavor_access(100, 1).body end tests('list_tenants_with_flavor_access(flavor_ref)').data_matches_schema({'flavor_access' => [{'tenant_id' => String, 'flavor_id' => String}]}) do Fog::Compute[:openstack].list_tenants_with_flavor_access(100).body end tests('delete_flavor(flavor_id)').succeeds do Fog::Compute[:openstack].delete_flavor('100') end tests('#get_flavor_metadata(flavor_ref)').data_matches_schema('extra_specs' => {'cpu_arch' => String}) do Fog::Compute[:openstack].get_flavor_metadata("1").body end tests('#create_flavor_metadata(flavor_ref, metadata)').data_matches_schema('extra_specs' => {'cpu_arch' => String}) do metadata = {:cpu_arch => 'x86_64'} Fog::Compute[:openstack].create_flavor_metadata("1", metadata).body end end tests('failure') do tests('#get_flavor_details(0)').raises(Fog::Compute::OpenStack::NotFound) do Fog::Compute[:openstack].get_flavor_details("0") end tests('add_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].add_flavor_access(1234, 1).body end tests('remove_flavor_access(1234, 1)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].remove_flavor_access(1234, 1).body end tests('list_tenants_with_flavor_access(1234)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].list_tenants_with_flavor_access(1234) end tests('get_flavor_metadata(flavor_ref)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].get_flavor_metadata("1234").body end tests('create_flavor_metadata(flavor_ref)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? metadata = {:cpu_arch => 'x86_64'} Fog::Compute[:openstack].create_flavor_metadata("1234", metadata).body end end end fog-1.34.0/tests/openstack/requests/compute/service_tests.rb0000644000004100000410000000205412600047642024273 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | service requests', ['openstack']) do @service_format = { "id" => Integer, "binary" => String, "host" => String, "state" => String, "status" => String, "updated_at" => String, "zone" => String, 'disabled_reason' => Fog::Nullable::String } tests('success') do tests('#list_services').data_matches_schema({'services' => [@service_format]}) do services = Fog::Compute[:openstack].list_services.body @service = services['services'].last services end tests('#disable_service').succeeds do Fog::Compute[:openstack].disable_service(@service['host'], @service['binary']) end tests('#disable_service_log_reason').succeeds do Fog::Compute[:openstack].disable_service_log_reason(@service['host'], @service['binary'], 'reason') end tests('#enable_service').succeeds do Fog::Compute[:openstack].enable_service(@service['host'], @service['binary']) end end end fog-1.34.0/tests/openstack/requests/compute/image_tests.rb0000644000004100000410000000312512600047642023715 0ustar www-datawww-datarequire 'fog/openstack' Shindo.tests('Fog::Compute[:openstack] | image requests', ['openstack']) do @image_format = { 'created' => Fog::Nullable::String, 'id' => String, 'name' => String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'updated' => String, 'minRam' => Integer, 'minDisk' => Integer, 'server' => Fog::Nullable::Hash, 'metadata' => Hash, 'links' => Array } tests('success') do # Setup @image_id = Fog::Compute[:openstack].images[0].id unless Fog.mocking? Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? } end tests("#get_image_details(#{@image_id})").formats(@image_format) do pending if Fog.mocking? Fog::Compute[:openstack].get_image_details(@image_id).body['image'] end tests('#list_images').formats({'images' => [OpenStack::Compute::Formats::SUMMARY]}) do Fog::Compute[:openstack].list_images.body end tests('#list_images_detail').formats({'images' => [@image_format]}) do Fog::Compute[:openstack].list_images_detail.body end # Teardown unless Fog.mocking? Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? } end end tests('failure') do tests('#delete_image(0)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].delete_image(0) end tests('#get_image_details(0)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].get_image_details(0) end end end fog-1.34.0/tests/openstack/requests/compute/server_tests.rb0000644000004100000410000002442012600047642024142 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do @base_server_format = { 'id' => String, 'addresses' => Hash, 'flavor' => Hash, 'hostId' => String, 'metadata' => Hash, 'name' => String, 'progress' => Integer, 'status' => String, 'accessIPv4' => Fog::Nullable::String, 'accessIPv6' => Fog::Nullable::String, 'links' => Array, 'created' => String, 'updated' => String, 'user_id' => String, 'config_drive' => String, } @server_from_image_format = @base_server_format.merge('image' => Hash) @create_format = { 'adminPass' => String, 'id' => String, 'links' => Array, 'security_groups' => Fog::Nullable::Array, } @reservation_format = { 'reservation_id' => String, } @image_format = { 'created' => Fog::Nullable::String, 'id' => String, 'name' => String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'updated' => String, 'minRam' => Integer, 'minDisk' => Integer, 'server' => Hash, 'metadata' => Hash, 'links' => Array } tests('success') do @image_id = get_image_ref @snapshot_id = nil @flavor_id = get_flavor_ref @security_group_name = get_security_group_ref #CREATE_SERVER_WITH_BLOCK_DEVICE_MAPPING tests('#create_server("test", nil , #{@flavor_id}) with a block_device_mapping').formats(@create_format, false) do @volume1_id = compute.create_volume('test', 'this is a test volume', 1).body["volume"]["id"] volume_data = { :delete_on_termination => true, :device_name => "vda", :volume_id => @volume1_id, :volume_size => 1, } data = compute.create_server("test", nil, @flavor_id, "block_device_mapping" => volume_data).body['server'] @server_id = data['id'] data end tests("#get_server_details(#{@server_id})").formats(@base_server_format, false) do compute.get_server_details(@server_id).body['server'] end tests("#block_device_mapping").succeeds do compute.servers.get(@server_id).volumes.first.id == @volume1_id end #CREATE_SERVER_WITH_BLOCK_DEVICE_MAPPING_V2 tests('#create_server("test", nil , #{@flavor_id}) with multiple block_device_mapping_v2').formats(@create_format, false) do @volume2_id = compute.create_volume('test', 'this is a test volume', 1).body["volume"]["id"] volume_data = [{ :boot_index => 0, :uuid => @volume1_id, :device_name => "vda", :source_type => "volume", :destination_type => "volume", :delete_on_termination => true, :volume_size => 20 }, { :boot_index => 1, :uuid => @volume2_id, :device_name => "vdb", :source_type => "volume", :destination_type => "volume", :delete_on_termination => true, :volume_size => 10 }] data = compute.create_server("test", nil, @flavor_id, "block_device_mapping_v2" => volume_data).body['server'] @server_id = data['id'] data end tests("#get_server_details(#{@server_id})").formats(@base_server_format, false) do compute.get_server_details(@server_id).body['server'] end tests("#block_device_mapping_v2").succeeds do compute.servers.get(@server_id).volumes.collect(&:id).sort == [@volume1_id, @volume2_id].sort end #CREATE_SINGLE_FROM_IMAGE tests('#create_server("test", #{@image_id} , 19)').formats(@create_format, false) do data = Fog::Compute[:openstack].create_server("test", @image_id, @flavor_id).body['server'] @server_id = data['id'] data end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } tests("#get_server_details(#{@server_id})").formats(@server_from_image_format, false) do Fog::Compute[:openstack].get_server_details(@server_id).body['server'] end #MULTI_CREATE_FROM_IMAGE tests('#create_server("test", #{@image_id} , 19, {"min_count" => 2, "return_reservation_id" => "True"})').formats(@reservation_format, false) do data = Fog::Compute[:openstack].create_server("test", @image_id, @flavor_id, {"min_count" => 2, "return_reservation_id" => "True"}).body @reservation_id = data['reservation_id'] data end tests('#validate_multi_create') do passed = false @multi_create_servers = [] if Fog.mocking? @multi_create_servers = [Fog::Mock.random_numbers(6).to_s, Fog::Mock.random_numbers(6).to_s] else @multi_create_servers = Fog::Compute[:openstack].list_servers_detail({'reservation_id' => @reservation_id}).body['servers'].map{|server| server['id']} end if (@multi_create_servers.size == 2) passed = true end end unless Fog.mocking? @multi_create_servers.each {|server| Fog::Compute[:openstack].servers.get(server).destroy } end #LIST #NOTE: we can remove strict=false if we remove uuid from GET /servers tests('#list_servers').formats({'servers' => [OpenStack::Compute::Formats::SUMMARY]}, false) do Fog::Compute[:openstack].list_servers.body end #DETAILS tests('#list_servers_detail').formats({'servers' => [@server_from_image_format]}, false) do Fog::Compute[:openstack].list_servers_detail.body end #CHANGE PASSWORD if set_password_enabled tests("#change_server_password(#{@server_id}, 'fogupdatedserver')").succeeds do Fog::Compute[:openstack].change_server_password(@server_id, 'foggy') end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } end #UPDATE SERVER NAME tests("#update_server(#{@server_id}, :name => 'fogupdatedserver')").succeeds do Fog::Compute[:openstack].update_server(@server_id, :name => 'fogupdatedserver') end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } #ADD SECURITY GROUP tests("#add_security_group(#{@server_id}, #{@security_group_name})").succeeds do Fog::Compute[:openstack].add_security_group(@server_id, @security_group_name) end #REMOVE SECURITY GROUP tests("#remove_security_group(#{@server_id}, #{@security_group_name})").succeeds do Fog::Compute[:openstack].remove_security_group(@server_id, @security_group_name) end #CREATE IMAGE WITH METADATA tests("#create_image(#{@server_id}, 'fog')").formats('image' => @image_format) do data = Fog::Compute[:openstack].create_image(@server_id, 'fog', {"foo" => "bar"}).body @snapshot_id = data['image']['id'] data end Fog::Compute[:openstack].images.get(@snapshot_id).wait_for { ready? } #REBUILD tests("#rebuild_server(#{@server_id}, #{@snapshot_id}, 'fog')").formats({'server' => @server_from_image_format}, false) do Fog::Compute[:openstack].rebuild_server(@server_id, @snapshot_id, 'fog', 'newpass', {"foo" => "bar"}).body end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? #RESIZE tests("#resize_server(#{@server_id}, #{get_flavor_ref_resize})").succeeds do Fog::Compute[:openstack].resize_server(@server_id, get_flavor_ref_resize) end Fog::Compute[:openstack].servers.get(@server_id).wait_for { self.state == 'VERIFY_RESIZE' } if not Fog.mocking? #RESIZE CONFIRM tests("#resize_confirm(#{@server_id}, #{get_flavor_ref_resize})").succeeds do Fog::Compute[:openstack].confirm_resize_server(@server_id) end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? #REBOOT - HARD tests("#reboot_server(#{@server_id}, 'HARD')").succeeds do Fog::Compute[:openstack].reboot_server(@server_id, 'HARD') end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? #REBOOT - SOFT tests("#reboot_server(#{@server_id}, 'SOFT')").succeeds do Fog::Compute[:openstack].reboot_server(@server_id, 'SOFT') end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? #STOP tests("#stop_server(#{@server_id})").succeeds do Fog::Compute[:openstack].stop_server(@server_id) end #START tests("#start_server(#{@server_id})").succeeds do Fog::Compute[:openstack].start_server(@server_id) end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? tests("#shelve_server(#{@server_id})").succeeds do Fog::Compute[:openstack].shelve_server(@server_id) end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? tests("#unshelve_server(#{@server_id})").succeeds do Fog::Compute[:openstack].unshelve_server(@server_id) end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } if not Fog.mocking? #DELETE tests("#delete_server(#{@server_id})").succeeds do Fog::Compute[:openstack].delete_server(@server_id) end #DELETE IMAGE tests("#delete_image(#{@snapshot_id})").succeeds do Fog::Compute[:openstack].delete_image(@snapshot_id) end end tests('failure') do tests('#delete_server(0)').raises(Fog::Compute::OpenStack::NotFound) do Fog::Compute[:openstack].delete_server(0) end tests('#get_server_details(0)').raises(Fog::Compute::OpenStack::NotFound) do Fog::Compute[:openstack].get_server_details(0) end tests("#update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").raises(Fog::Compute::OpenStack::NotFound) do Fog::Compute[:openstack].update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver') end tests('#reboot_server(0)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].reboot_server(0) end tests('#start_server(0)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].start_server(0) end tests('#stop_server(0)').raises(Fog::Compute::OpenStack::NotFound) do pending if Fog.mocking? Fog::Compute[:openstack].stop_server(0) end end end fog-1.34.0/tests/openstack/requests/compute/keypair_tests.rb0000644000004100000410000000151612600047642024301 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | keypair requests', ['openstack']) do @keypair_format = { "public_key" => String, "private_key" => String, "user_id" => String, "name" => String, "fingerprint" => String } @keypair_list_format = { "public_key" => String, "name" => String, "fingerprint" => String } tests('success') do tests('#create_key_pair((key_name, public_key = nil))').formats({"keypair" => @keypair_format}) do Fog::Compute[:openstack].create_key_pair('from_shindo_test').body end tests('#list_key_pairs').formats({"keypairs" => [{"keypair" => @keypair_list_format}]}) do Fog::Compute[:openstack].list_key_pairs.body end tests('#delete_key_pair(key_name)').succeeds do Fog::Compute[:openstack].delete_key_pair('from_shindo_test') end end end fog-1.34.0/tests/openstack/requests/compute/tenant_tests.rb0000644000004100000410000000100712600047642024121 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | tenant requests', ['openstack']) do @tenant_format = { 'id' => String, 'name' => String, 'enabled' => Fog::Boolean, 'description' => Fog::Nullable::String } tests('success') do tests('#list_tenants').formats({'tenants_links' => Array, 'tenants' => [@tenant_format]}) do Fog::Compute[:openstack].list_tenants.body end tests('#set_tenant("admin")').succeeds do Fog::Compute[:openstack].set_tenant("admin") end end end fog-1.34.0/tests/openstack/requests/compute/limit_tests.rb0000644000004100000410000000344612600047642023757 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | limits requests', ['openstack']) do @rate_limit_format = { 'regex' => String, 'uri' => String, 'limit' => Array } @rate_limit_usage_format = { 'next-available' => String, 'unit' => String, 'verb' => String, 'remaining' => Fixnum, 'value' => Fixnum } @absolute_limits_format = { 'maxServerMeta' => Fixnum, 'maxTotalInstances' => Fixnum, 'maxPersonality' => Fixnum, 'maxImageMeta' => Fixnum, 'maxPersonalitySize' => Fixnum, 'maxSecurityGroupRules' => Fixnum, 'maxTotalKeypairs' => Fixnum, 'maxSecurityGroups' => Fixnum, 'maxTotalCores' => Fixnum, 'maxTotalFloatingIps' => Fixnum, 'maxTotalRAMSize' => Fixnum, 'totalCoresUsed' => Fixnum, 'totalRAMUsed' => Fixnum, 'totalInstancesUsed' => Fixnum, 'totalSecurityGroupsUsed' => Fixnum, 'totalFloatingIpsUsed' => Fixnum } @limits_format = { 'rate' => Array, 'absolute' => Hash } tests('success') do tests('#get_limits') do tests('format').formats(@limits_format) do Fog::Compute[:openstack].get_limits.body['limits'] end tests('rate limit format').formats(@rate_limit_format) do Fog::Compute[:openstack].get_limits.body['limits']['rate'].first end tests('rate limit usage format').formats(@rate_limit_usage_format) do Fog::Compute[:openstack].get_limits.body['limits']['rate'].first['limit'].first end tests('absolute limits format').formats(@absolute_limits_format) do Fog::Compute[:openstack].get_limits.body['limits']['absolute'] end end end end fog-1.34.0/tests/openstack/requests/compute/quota_tests.rb0000644000004100000410000000331512600047642023765 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | quota requests', ['openstack']) do @tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id'] @quota_set_format = { 'key_pairs' => Fixnum, 'metadata_items' => Fixnum, 'injected_file_content_bytes' => Fixnum, 'injected_file_path_bytes' => Fixnum, 'injected_files' => Fixnum, 'ram' => Fixnum, 'floating_ips' => Fixnum, 'instances' => Fixnum, 'cores' => Fixnum, 'security_groups' => Fog::Nullable::Integer, 'security_group_rules' => Fog::Nullable::Integer, 'volumes' => Fog::Nullable::Integer, 'gigabytes' => Fog::Nullable::Integer, 'id' => String } tests('success') do tests('#get_quota_defaults').formats({ 'quota_set' => @quota_set_format }) do Fog::Compute[:openstack].get_quota_defaults(@tenant_id).body end tests('#get_quota').formats(@quota_set_format) do @quota = Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set'] @quota end tests('#update_quota') do new_values = @quota.merge({ 'floating_ips' => @quota['floating_ips']/2, 'cores' => @quota['cores']/2 }) succeeds do Fog::Compute[:openstack].update_quota(@tenant_id, new_values.clone) end returns(new_values, 'returns new values') do Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set'] end # set quota back to old values succeeds do Fog::Compute[:openstack].update_quota(@tenant_id, @quota.clone) end # ensure old values are restored returns(@quota, 'old values restored') do Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set'] end end end end fog-1.34.0/tests/openstack/requests/compute/volume_tests.rb0000644000004100000410000000243012600047642024140 0ustar www-datawww-datarequire 'fog/openstack' Shindo.tests('Fog::Compute[:openstack] | volume requests', ['openstack']) do @volume_format = { 'id' => String, 'displayName' => String, 'size' => Integer, 'displayDescription' => String, 'status' => String, 'snapshotId' => Fog::Nullable::String, 'availabilityZone' => String, 'attachments' => Array, 'volumeType' => Fog::Nullable::String, 'createdAt' => String, 'metadata' => Hash } tests('success') do tests('#create_volume').data_matches_schema({'volume' => @volume_format}) do Fog::Compute[:openstack].create_volume('loud', 'this is a loud volume', 3).body end tests('#list_volumes').data_matches_schema({'volumes' => [@volume_format]}) do Fog::Compute[:openstack].list_volumes.body end tests('#get_volume_detail').data_matches_schema({'volume' => @volume_format}) do volume_id = Fog::Compute[:openstack].volumes.all.first.id Fog::Compute[:openstack].get_volume_details(volume_id).body end tests('#delete_volume').succeeds do volume_id = Fog::Compute[:openstack].volumes.all.first.id Fog::Compute[:openstack].delete_volume(volume_id) end end end fog-1.34.0/tests/openstack/requests/compute/address_tests.rb0000644000004100000410000000306512600047642024263 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do compute = Fog::Compute[:openstack] @server_id = compute.create_server("shindo_test_server", get_image_ref, get_flavor_ref).body['server']['id'] @address_format = { "instance_id" => NilClass, "ip" => String, "fixed_ip" => NilClass, "id" => Integer, "pool" => String } @address_pools_format = { "name" => String } tests('success') do tests('#allocate_address').formats({"floating_ip" => @address_format}) do data = compute.allocate_address.body @address_id = data['floating_ip']['id'] @address_ip = data['floating_ip']['ip'] data end tests('#list_all_addresses').formats({"floating_ips" => [@address_format]}) do compute.list_all_addresses.body end tests('#get_address(address_id)').formats({"floating_ip" => @address_format}) do compute.get_address(@address_id).body end tests('#list_address_pools').formats({"floating_ip_pools" => [@address_pools_format]}) do compute.list_address_pools.body end compute.servers.get(@server_id).wait_for { ready? } tests('#associate_address(server_id, ip_address)').succeeds do compute.associate_address(@server_id, @address_ip).body end tests('#disassociate_address(server_id, ip_address)').succeeds do compute.disassociate_address(@server_id, @address_ip).body end tests('#release_address(ip_address)').succeeds do compute.release_address(@address_id) end end compute.delete_server(@server_id) end fog-1.34.0/tests/openstack/requests/compute/aggregate_tests.rb0000644000004100000410000000421012600047642024555 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openstack] | Compute aggregate requests', ['openstack']) do openstack = Fog::Identity[:openstack] @aggregate_format = { "availability_zone" => Fog::Nullable::String, "created_at" => String, "deleted" => Fog::Boolean, "deleted_at" => Fog::Nullable::String, "id" => Integer, "name" => String, "updated_at" => Fog::Nullable::String } @detailed_aggregate_format = @aggregate_format.merge({ 'hosts' => Array, }) @metadata_aggregate_format = @aggregate_format.merge({ "metadata" => Hash, }) tests('success') do tests('#create_aggregate').data_matches_schema({'aggregate' => @aggregate_format}) do aggregate_body = Fog::Compute[:openstack].create_aggregate('test_aggregate').body @aggregate = aggregate_body['aggregate'] aggregate_body end tests('#list_aggregates').data_matches_schema({'aggregates' => [@metadata_aggregate_format]}) do Fog::Compute[:openstack].list_aggregates.body end tests('#update_aggregate').data_matches_schema({'aggregate' => @aggregate_format}) do aggregate_attributes = {'name' => 'test_aggregate2'} Fog::Compute[:openstack].update_aggregate(@aggregate['id'], aggregate_attributes).body end tests('#get_aggregate').data_matches_schema({'aggregate' => @detailed_aggregate_format}) do Fog::Compute[:openstack].get_aggregate(@aggregate['id']).body end tests('#add_aggregate_host').succeeds do @host_name = Fog::Compute[:openstack].hosts.select{ |x| x.service_name == 'compute' }.first.host_name Fog::Compute[:openstack].add_aggregate_host(@aggregate['id'], @host_name) end tests('#remove_aggregate_host').succeeds do Fog::Compute[:openstack].remove_aggregate_host(@aggregate['id'], @host_name) end tests('#update_aggregate_metadata').succeeds do Fog::Compute[:openstack].update_aggregate_metadata(@aggregate['id'], {'test' => 'test', 'test2' => 'test2'}) end tests('#delete_aggregate').succeeds do Fog::Compute[:openstack].delete_aggregate(@aggregate['id']) end end end fog-1.34.0/tests/openstack/requests/image/0000755000004100000410000000000012600047642020471 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/image/image_tests.rb0000644000004100000410000001046512600047642023330 0ustar www-datawww-dataShindo.tests('Fog::Image[:openstack] | image requests', ['openstack']) do openstack = Fog::Identity[:openstack] @image_attributes = { :name => 'new image', :owner => openstack.current_tenant['id'], :is_public => true, :copy_from => 'http://website.com/image.iso', :disk_format => 'iso', :properties => {:user_id => openstack.current_user['id'], :owner_id => openstack.current_tenant['id']}, :container_format => 'bare' } @image_format = { 'name' => String, 'container_format' => String, 'disk_format' => String, 'checksum' => String, 'id' => String, 'size' => Integer } @detailed_image_format = { 'id' => String, 'name' => String, 'size' => Integer, 'disk_format' => String, 'container_format' => String, 'checksum' => String, 'min_disk' => Integer, 'created_at' => String, 'deleted_at' => Fog::Nullable::String, 'updated_at' => String, 'deleted' => Fog::Boolean, 'protected' => Fog::Boolean, 'is_public' => Fog::Boolean, 'status' => String, 'min_ram' => Integer, 'owner' => Fog::Nullable::String, 'properties' => Hash } @image_meta_format ={ 'X-Image-Meta-Is_public'=>String, 'X-Image-Meta-Min_disk'=>Fog::Nullable::String, 'X-Image-Meta-Property-Ramdisk_id'=>Fog::Nullable::String, 'X-Image-Meta-Disk_format'=>Fog::Nullable::String, 'X-Image-Meta-Created_at'=>String, 'X-Image-Meta-Container_format'=>Fog::Nullable::String, 'Etag'=>String, 'Location'=>String, 'X-Image-Meta-Protected'=>String, 'Date'=>String, 'X-Image-Meta-Name'=>String, 'X-Image-Meta-Min_ram'=>String, 'Content-Type'=>String, 'X-Image-Meta-Updated_at'=>String, 'X-Image-Meta-Property-Kernel_id'=>Fog::Nullable::String, 'X-Image-Meta-Size'=>String, 'X-Image-Meta-Checksum'=>Fog::Nullable::String, 'X-Image-Meta-Deleted'=>String, 'Content-Length'=>String, 'X-Image-Meta-Status'=>String, 'X-Image-Meta-Owner'=>String, 'X-Image-Meta-Id'=>String } @image_members_format =[ {'can_share'=>Fog::Nullable::Boolean, 'member_id'=>String } ] tests('success') do tests('#list_public_images').data_matches_schema({'images' => [@image_format]}) do Fog::Image[:openstack].list_public_images.body end tests('#list_public_images_detailed').data_matches_schema({'images' => [@detailed_image_format]}) do Fog::Image[:openstack].list_public_images_detailed.body end tests('#create_image').data_matches_schema({'image' => @detailed_image_format}) do begin if Fog.mocking? image_attributes = @image_attributes else require 'tempfile' image_attributes = @image_attributes.dup image_attributes.delete(:copy_from) test_iso = Tempfile.new(['fog_test_iso', '.iso']) test_iso.write Fog::Mock.random_hex(32) test_iso.close image_attributes[:location] = test_iso.path end @instance = Fog::Image[:openstack].create_image(image_attributes).body ensure test_iso.delete if test_iso end end tests('#get_image').data_matches_schema(@image_meta_format) do Fog::Image[:openstack].get_image(@instance['image']['id']).headers end tests('#update_image').data_matches_schema(@detailed_image_format) do Fog::Image[:openstack].update_image({:id => @instance['image']['id'], :name => 'edit image'}).body['image'] end tests('#add_member_to_image').succeeds do Fog::Image[:openstack].add_member_to_image( @instance['image']['id'], @instance['image']['owner']) end tests('#get_image_members').succeeds do Fog::Image[:openstack].get_image_members(@instance['image']['id']) end tests('#get_shared_images').succeeds do Fog::Image[:openstack].get_shared_images(@instance['image']['owner']) end tests('#remove_member_from_image').succeeds do Fog::Image[:openstack].remove_member_from_image( @instance['image']['id'], @instance['image']['owner']) end tests('#delete_image').succeeds do Fog::Image[:openstack].delete_image(@instance['image']['id']) end end end fog-1.34.0/tests/openstack/requests/planning/0000755000004100000410000000000012600047642021215 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/planning/role_tests.rb0000644000004100000410000000070112600047642023723 0ustar www-datawww-dataShindo.tests('Fog::Openstack[:planning] | Planning role requests', ['openstack']) do openstack = Fog::Identity[:openstack] @role_format = { 'description' => Fog::Nullable::String, 'name' => Fog::Nullable::String, 'uuid' => String, 'version' => Integer, } tests('success') do tests('#list_roles').data_matches_schema([@role_format]) do Fog::Openstack[:planning].list_roles.body end end end fog-1.34.0/tests/openstack/requests/planning/.gitkeep0000644000004100000410000000000012600047642022634 0ustar www-datawww-datafog-1.34.0/tests/openstack/requests/planning/plan_tests.rb0000644000004100000410000000425112600047642023720 0ustar www-datawww-dataShindo.tests('Fog::Openstack[:planning] | Planning plan requests', ['openstack']) do openstack = Fog::Identity[:openstack] @plan_format = { "created_at" => Fog::Nullable::String, "description" => Fog::Nullable::String, "name" => String, "parameters" => Fog::Nullable::Array, "roles" => Fog::Nullable::Array, "updated_at" => Fog::Nullable::String, "uuid" => String, "version" => Fog::Nullable::Integer, } @plan_templates_format = Hash tests('success') do tests('#list_plans').data_matches_schema([@plan_format]) do plans = Fog::Openstack[:planning].list_plans.body @instance = plans.first plans end tests('#get_plan').data_matches_schema(@plan_format) do Fog::Openstack[:planning].get_plan(@instance['uuid']).body end tests('#delete_plan').succeeds do Fog::Openstack[:planning].delete_plan(@instance['uuid']) end tests('#create_plan').data_matches_schema(@plan_format) do plan_attributes = { :name => 'test-plan-name', :description => 'test-plan-desc', } @instance = Fog::Openstack[:planning].create_plan(plan_attributes).body end tests('#add_role_to_plan').data_matches_schema(@plan_format) do @role_instance = Fog::Openstack[:planning].list_roles.body.first Fog::Openstack[:planning].add_role_to_plan(@instance['uuid'], @role_instance['uuid']).body end tests('#patch_plan').data_matches_schema(@plan_format) do parameters = Fog::Openstack[:planning].get_plan(@instance['uuid']).body['parameters'][0..1] plan_parameters = parameters.map do |parameter| { "name" => parameter['name'], "value" => "test-#{parameter['name']}-value", } end Fog::Openstack[:planning].patch_plan(@instance['uuid'], plan_parameters).body end tests('#get_plan_templates').data_matches_schema(@plan_templates_format) do Fog::Openstack[:planning].get_plan_templates(@instance['uuid']).body end tests('#remove_role_from_plan').data_matches_schema(@plan_format) do Fog::Openstack[:planning].remove_role_from_plan(@instance['uuid'], @role_instance['uuid']).body end end end fog-1.34.0/tests/openstack/requests/baremetal/0000755000004100000410000000000012600047642021343 5ustar www-datawww-datafog-1.34.0/tests/openstack/requests/baremetal/port_tests.rb0000644000004100000410000000433412600047642024102 0ustar www-datawww-dataShindo.tests('Fog::Baremetal[:openstack] | Baremetal port requests', ['openstack']) do openstack = Fog::Identity[:openstack] @port_format = { 'address' => String, 'uuid' => String } # {"node_uuid"=>"ebf4e459-ddd6-4ce9-bef5-5181987cb62c", "uuid"=>"82a26de6-6af5-4cd3-a076-a5af1a75d457", "links"=>[{"href"=>"http://192.0.2.1:6385/v1/ports/82a26de6-6af5-4cd3-a076-a5af1a75d457", "rel"=>"self"}, {"href"=>"http://192.0.2.1:6385/ports/82a26de6-6af5-4cd3-a076-a5af1a75d457", "rel"=>"bookmark"}], "extra"=>{}, "created_at"=>"2015-01-15T09:22:23.673409+00:00", "updated_at"=>nil, "address"=>"00:c2:08:85:de:ca"} does not match {"address"=>String, "uuid"=>String, "created_at"=>String, "updated_at"=>String, "extra"=>Hash, "node_uuid"=>String} @detailed_port_format = { 'address' => String, 'uuid' => String, 'created_at' => String, 'updated_at' => Fog::Nullable::String, 'extra' => Hash, 'node_uuid' => String, 'links' => Array } tests('success') do tests('#list_ports').data_matches_schema({'ports' => [@port_format]}) do Fog::Baremetal[:openstack].list_ports.body end tests('#list_ports_detailed').data_matches_schema({'ports' => [@detailed_port_format]}) do Fog::Baremetal[:openstack].list_ports_detailed.body end tests('#create_port').data_matches_schema(@detailed_port_format) do node_attributes = {:driver => 'pxe_ipmitool'} @instance = Fog::Baremetal[:openstack].create_node(node_attributes).body port_attributes = {:address => '00:c2:08:85:de:ca', :node_uuid => @instance['uuid']} @port = Fog::Baremetal[:openstack].create_port(port_attributes).body end tests('#get_port').data_matches_schema(@detailed_port_format) do Fog::Baremetal[:openstack].get_port(@port['uuid']).body end tests('#patch_port').data_matches_schema(@detailed_port_format) do Fog::Baremetal[:openstack].patch_port( @port['uuid'], [{'op' => 'add', 'path' => '/extra/name', 'value' => 'eth1'}]).body end tests('#delete_port').succeeds do Fog::Baremetal[:openstack].delete_port(@port['uuid']) Fog::Baremetal[:openstack].delete_node(@instance['uuid']) end end end fog-1.34.0/tests/openstack/requests/baremetal/driver_tests.rb0000644000004100000410000000246012600047642024407 0ustar www-datawww-dataShindo.tests('Fog::Baremetal[:openstack] | Baremetal driver requests', ['openstack']) do openstack = Fog::Identity[:openstack] @driver_format = { 'hosts' => Array, 'name' => String } @driver_properties_format = { "pxe_deploy_ramdisk" => String, "ipmi_transit_address" => String, "ipmi_terminal_port" => String, "ipmi_target_channel" => String, "ipmi_transit_channel" => String, "ipmi_local_address" => String, "ipmi_username" => String, "ipmi_address" => String, "ipmi_target_address" => String, "ipmi_password" => String, "pxe_deploy_kernel" => String, "ipmi_priv_level" => String, "ipmi_bridging" => String } tests('success') do tests('#list_drivers').data_matches_schema({'drivers' => [@driver_format]}) do instances = Fog::Baremetal[:openstack].list_drivers.body @instance = instances['drivers'].last instances end tests('#get_driver').data_matches_schema(@driver_format) do Fog::Baremetal[:openstack].get_driver(@instance['name']).body end tests('#get_driver_properties').data_matches_schema(@driver_properties_format) do Fog::Baremetal[:openstack].get_driver_properties(@instance['name']).body end end end fog-1.34.0/tests/openstack/requests/baremetal/node_tests.rb0000644000004100000410000000606412600047642024045 0ustar www-datawww-dataShindo.tests('Fog::Baremetal[:openstack] | Baremetal node requests', ['openstack']) do openstack = Fog::Identity[:openstack] @node_format = { 'instance_uuid' => Fog::Nullable::String, 'maintenance' => Fog::Boolean, 'power_state' => Fog::Nullable::String, 'provision_state' => Fog::Nullable::String, 'uuid' => String, 'links' => Array } @detailed_node_format = { 'instance_uuid' => Fog::Nullable::String, 'maintenance' => Fog::Boolean, 'power_state' => Fog::Nullable::String, 'provision_state' => Fog::Nullable::String, 'uuid' => String, 'created_at' => String, 'updated_at' => Fog::Nullable::String, 'chassis_uuid' => Fog::Nullable::String, 'console_enabled' => Fog::Boolean, 'driver' => String, 'driver_info' => Hash, 'extra' => Hash, 'instance_info' => Hash, 'last_error' => Fog::Nullable::String, 'maintenance_reason' => Fog::Nullable::String, 'properties' => Hash, 'provision_updated_at' => Fog::Nullable::String, 'reservation' => Fog::Nullable::String, 'target_power_state' => Fog::Nullable::String, 'target_provision_state' => Fog::Nullable::String, 'links' => Array } tests('success') do tests('#list_nodes').data_matches_schema({'nodes' => [@node_format]}) do Fog::Baremetal[:openstack].list_nodes.body end tests('#list_nodes_detailed').data_matches_schema({'nodes' => [@detailed_node_format]}) do Fog::Baremetal[:openstack].list_nodes_detailed.body end tests('#create_node').data_matches_schema(@detailed_node_format) do node_attributes = {:driver => 'pxe_ipmitool'} @instance = Fog::Baremetal[:openstack].create_node(node_attributes).body end tests('#get_node').data_matches_schema(@detailed_node_format) do Fog::Baremetal[:openstack].get_node(@instance['uuid']).body end tests('#patch_node').data_matches_schema(@detailed_node_format) do Fog::Baremetal[:openstack].patch_node( @instance['uuid'], [{'op' => 'replace', 'path' => '/driver', 'value' => 'pxe_ssh'}]).body end tests('#set_node_power_state').data_matches_schema(@detailed_node_format) do Fog::Baremetal[:openstack].set_node_power_state( @instance['uuid'], 'power off').body end tests('#set_node_provision_state').data_matches_schema(@detailed_node_format) do Fog::Baremetal[:openstack].set_node_provision_state( @instance['uuid'], 'manage').body end tests('#set_node_maintenance').succeeds do Fog::Baremetal[:openstack].set_node_maintenance(@instance['uuid']) end tests('#unset_node_maintenance').succeeds do Fog::Baremetal[:openstack].unset_node_maintenance(@instance['uuid']) end tests('#delete_node').succeeds do Fog::Baremetal[:openstack].delete_node(@instance['uuid']) end end end fog-1.34.0/tests/openstack/requests/baremetal/chassis_tests.rb0000644000004100000410000000307412600047642024553 0ustar www-datawww-dataShindo.tests('Fog::Baremetal[:openstack] | Baremetal chassis requests', ['openstack']) do openstack = Fog::Identity[:openstack] @chassis_format = { 'description' => String, 'uuid' => String, 'links' => Array } @detailed_chassis_format = { 'description' => String, 'uuid' => String, 'created_at' => String, 'updated_at' => Fog::Nullable::String, 'extra' => Hash, 'nodes' => Array, 'links' => Array } tests('success') do tests('#list_chassis').data_matches_schema({'chassis' => [@chassis_format]}) do Fog::Baremetal[:openstack].list_chassis.body end tests('#list_chassis_detailed').data_matches_schema({'chassis' => [@detailed_chassis_format]}) do Fog::Baremetal[:openstack].list_chassis_detailed.body end tests('#create_chassis').data_matches_schema(@detailed_chassis_format) do chassis_attributes = {:description => 'description'} @instance = Fog::Baremetal[:openstack].create_chassis(chassis_attributes).body end tests('#get_chassis').data_matches_schema(@detailed_chassis_format) do Fog::Baremetal[:openstack].get_chassis(@instance['uuid']).body end tests('#patch_chassis').data_matches_schema(@detailed_chassis_format) do Fog::Baremetal[:openstack].patch_chassis( @instance['uuid'], [{'op' => 'replace', 'path' => '/description', 'value' => 'new description'}]).body end tests('#delete_chassis').succeeds do Fog::Baremetal[:openstack].delete_chassis(@instance['uuid']) end end end fog-1.34.0/tests/openstack/volume_tests.rb0000644000004100000410000000100012600047642020601 0ustar www-datawww-dataShindo.tests('Fog::Volume[:openstack]', ['openstack', 'volume']) do volume = Fog::Volume[:openstack] tests("Volumes collection") do %w{ volumes }.each do |collection| test("it should respond to #{collection}") { volume.respond_to? collection } test("it should respond to #{collection}.all") { eval("volume.#{collection}").respond_to? 'all' } # not implemented #test("it should respond to #{collection}.get") { eval("volume.#{collection}").respond_to? 'get' } end end end fog-1.34.0/tests/openstack/models/0000755000004100000410000000000012600047642017017 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/network/0000755000004100000410000000000012600047642020510 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/network/port_tests.rb0000644000004100000410000000176112600047642023250 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | port", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].ports.create(:name => 'port_name', :network_id => 'net_id', :fixed_ips => [], :mac_address => 'fa:16:3e:62:91:7f', :admin_state_up => true, :device_owner => 'device_owner', :device_id => 'device_id', :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.name = 'new_port_name' @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/lb_member_tests.rb0000644000004100000410000000163512600047642024210 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_member", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].lb_members.create(:pool_id => 'pool_id', :address => '10.0.0.1', :protocol_port => '80', :weight => 100, :admin_state_up => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.pool_id = 'new_pool_id' @instance.weight = 50 @instance.admin_state_up = false @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/security_group_tests.rb0000644000004100000410000000105012600047642025336 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_group model', ['openstack']) do model_tests(Fog::Network[:openstack].security_groups, {:name => "fogsecgroup"}, true) tests('success') do tests('#create').succeeds do attributes = {:name => "my_secgroup", :description => "my sec group desc"} @secgroup = Fog::Network[:openstack].security_groups.create(attributes) @secgroup.wait_for { ready? } unless Fog.mocking? !@secgroup.id.nil? end tests('#destroy').succeeds do @secgroup.destroy end end end fog-1.34.0/tests/openstack/models/network/routers_tests.rb0000644000004100000410000000063012600047642023761 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | routers", ['openstack']) do @router = Fog::Network[:openstack].routers.create( :name => 'router_name', :admin_state_up => true ) @routers = Fog::Network[:openstack].routers tests('success') do tests('#all').succeeds do @routers.all end tests('#get').succeeds do @routers.get @router.id end end @router.destroy end fog-1.34.0/tests/openstack/models/network/networks_tests.rb0000644000004100000410000000114112600047642024130 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | networks", ['openstack']) do @network = Fog::Network[:openstack].networks.create(:name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id') @networks = Fog::Network[:openstack].networks tests('success') do tests('#all').succeeds do @networks.all end tests('#get').succeeds do @networks.get @network.id end end @network.destroy end fog-1.34.0/tests/openstack/models/network/lb_pool_tests.rb0000644000004100000410000000354412600047642023713 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_pool", ['openstack']) do tests('success') do before do @lb_health_monitor = Fog::Network[:openstack].lb_health_monitors.create(:type => 'PING', :delay => 1, :timeout => 5, :max_retries => 10) end after do @lb_health_monitor.destroy end tests('#create').succeeds do @instance = Fog::Network[:openstack].lb_pools.create(:subnet_id => 'subnet_id', :protocol => 'HTTP', :lb_method => 'ROUND_ROBIN', :name => 'test-pool', :description => 'Test Pool', :admin_state_up => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.name = 'new-test-pool' @instance.description = 'New Test Pool' @instance.lb_method = 'LEAST_CONNECTIONS' @instance.admin_state_up = false @instance.update end tests('#stats').succeeds do @instance.stats !@instance.active_connections.nil? end tests('#associate_health_monitor').succeeds do @instance.associate_health_monitor(@lb_health_monitor.id) end tests('#disassociate_health_monitor').succeeds do @instance.disassociate_health_monitor(@lb_health_monitor.id) end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/floating_ip_tests.rb0000644000004100000410000000077412600047642024562 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | floating_ip", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].floating_ips.create(:floating_network_id => 'f0000000-0000-0000-0000-000000000000') !@instance.id.nil? end tests('#update').succeeds do @instance.port_id = 'p0000000-0000-0000-0000-000000000000' @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/security_groups_tests.rb0000644000004100000410000000117212600047642025526 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_groups collection', ['openstack']) do attributes = {:name => "my_secgroup", :description => "my sec group desc"} collection_tests(Fog::Network[:openstack].security_groups, attributes, true) tests('success') do attributes = {:name => "fogsecgroup", :description => "fog sec group desc"} @secgroup = Fog::Network[:openstack].security_groups.create(attributes) tests('#all(filter)').succeeds do secgroup = Fog::Network[:openstack].security_groups.all({:name => "fogsecgroup"}) secgroup.first.name == "fogsecgroup" end @secgroup.destroy end end fog-1.34.0/tests/openstack/models/network/floating_ips_tests.rb0000644000004100000410000000071112600047642024734 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | floating_ips", ['openstack']) do @floating_ip = Fog::Network[:openstack].floating_ips.create(:floating_network_id => 'f0000000-0000-0000-0000-000000000000') @floating_ips = Fog::Network[:openstack].floating_ips tests('success') do tests('#all').succeeds do @floating_ips.all end tests('#get').succeeds do @floating_ips.get @floating_ip.id end end @floating_ip.destroy end fog-1.34.0/tests/openstack/models/network/subnet_tests.rb0000644000004100000410000000221712600047642023561 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | subnet", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].subnets.create(:name => 'subnet_name', :network_id => 'net_id', :cidr => '10.2.2.0/24', :ip_version => 4, :gateway_ip => '10.2.2.1', :allocation_pools => [], :dns_nameservers => [], :host_routes => [], :enable_dhcp => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.name = 'new_subnet_name' @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/router_tests.rb0000644000004100000410000000166112600047642023603 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | router", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].routers.create( :name => 'router_name', :admin_state_up => true ) !@instance.id.nil? end tests('#update') do test('router name') do @instance.name = 'new_name' @instance.update @instance.name == 'new_name' end # Needs code from issue #1598 #test 'external_gateway_info' do # net = Fog::Network[:openstack].networks.create( # :name => 'net_name', # :shared => false, # :admin_state_up => true, # :tenant_id => 'tenant_id', # :router_external => true, # ) # @instance.external_gateway_info = net # @instance.update #end end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/lb_vips_tests.rb0000644000004100000410000000112412600047642023713 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_vips", ['openstack']) do @lb_vip = Fog::Network[:openstack].lb_vips.create(:subnet_id => 'subnet_id', :pool_id => 'pool_id', :protocol => 'HTTP', :protocol_port => 80) @lb_vips = Fog::Network[:openstack].lb_vips tests('success') do tests('#all').succeeds do @lb_vips.all end tests('#get').succeeds do @lb_vips.get @lb_vip.id end end @lb_vip.destroy end fog-1.34.0/tests/openstack/models/network/lb_members_tests.rb0000644000004100000410000000117312600047642024370 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_members", ['openstack']) do @lb_member = Fog::Network[:openstack].lb_members.create(:pool_id => 'pool_id', :address => '10.0.0.1', :protocol_port => '80', :weight => 100) @lb_members = Fog::Network[:openstack].lb_members tests('success') do tests('#all').succeeds do @lb_members.all end tests('#get').succeeds do @lb_members.get @lb_member.id end end @lb_member.destroy end fog-1.34.0/tests/openstack/models/network/lb_health_monitors_tests.rb0000644000004100000410000000133512600047642026135 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_health_monitors", ['openstack']) do @lb_health_monitor = Fog::Network[:openstack].lb_health_monitors.create(:type => 'PING', :delay => 1, :timeout => 5, :max_retries => 10) @lb_health_monitors = Fog::Network[:openstack].lb_health_monitors tests('success') do tests('#all').succeeds do @lb_health_monitors.all end tests('#get').succeeds do @lb_health_monitors.get @lb_health_monitor.id end end @lb_health_monitor.destroy end fog-1.34.0/tests/openstack/models/network/security_group_rules_tests.rb0000644000004100000410000000167212600047642026562 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_group_rules collection', ['openstack']) do @secgroup = Fog::Network[:openstack].security_groups.create({:name => "my_secgroup"}) attributes = {:security_group_id => @secgroup.id, :direction => "ingress"} collection_tests(Fog::Network[:openstack].security_group_rules, attributes, true) tests('success') do attributes = { :security_group_id => @secgroup.id, :direction => "ingress", :protocol => "tcp", :port_range_min => 22, :port_range_max => 22, :remote_ip_prefix => "0.0.0.0/0" } @secgrouprule = Fog::Network[:openstack].security_group_rules.create(attributes) tests('#all(filter)').succeeds do secgrouprule = Fog::Network[:openstack].security_group_rules.all({:direction => "ingress"}) secgrouprule.first.direction == "ingress" end @secgrouprule.destroy end @secgroup.destroy end fog-1.34.0/tests/openstack/models/network/network_tests.rb0000644000004100000410000000336312600047642023755 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | network", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].networks.create(:name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#create+extensions').succeeds do net = Fog::Network[:openstack].networks.create( :name => 'net_name', :shared => false, :admin_state_up => true, :tenant_id => 'tenant_id', :router_external => true, # local, gre, vlan. Depends on the provider. # May rise an exception if the network_type isn't valid: # QuantumError: "Invalid input for operation: provider:physical_network" :provider_network_type => 'gre', :provider_segmentation_id => 22 ) net.destroy net.provider_network_type == 'gre' end tests('have attributes') do attributes = [ :name, :subnets, :shared, :status, :admin_state_up, :tenant_id, :provider_network_type, :provider_physical_network, :provider_segmentation_id, :router_external ] tests("The network model should respond to") do attributes.each do |attribute| test("#{attribute}") { @instance.respond_to? attribute } end end end tests('#update').succeeds do @instance.name = 'new_net_name' @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/subnets_tests.rb0000644000004100000410000000203312600047642023740 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | subnets", ['openstack']) do @subnet = Fog::Network[:openstack].subnets.create(:name => 'subnet_name', :network_id => 'net_id', :cidr => '10.2.2.0/24', :ip_version => 4, :gateway_ip => '10.2.2.1', :allocation_pools => [], :dns_nameservers => [], :host_routes => [], :enable_dhcp => true, :tenant_id => 'tenant_id') @subnets = Fog::Network[:openstack].subnets tests('success') do tests('#all').succeeds do @subnets.all end tests('#get').succeeds do @subnets.get @subnet.id end end @subnet.destroy end fog-1.34.0/tests/openstack/models/network/lb_pools_tests.rb0000644000004100000410000000103512600047642024067 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_pools", ['openstack']) do @lb_pool = Fog::Network[:openstack].lb_pools.create(:subnet_id => 'subnet_id', :protocol => 'HTTP', :lb_method => 'ROUND_ROBIN') @lb_pools = Fog::Network[:openstack].lb_pools tests('success') do tests('#all').succeeds do @lb_pools.all end tests('#get').succeeds do @lb_pools.get @lb_pool.id end end @lb_pool.destroy end fog-1.34.0/tests/openstack/models/network/security_group_rule_tests.rb0000644000004100000410000000165712600047642026402 0ustar www-datawww-dataShindo.tests('Fog::Network[:openstack] | security_group_rule model', ['openstack']) do @secgroup = Fog::Network[:openstack].security_groups.create({:name => "fogsecgroup"}) attributes = {:security_group_id => @secgroup.id, :direction => "ingress"} model_tests(Fog::Network[:openstack].security_group_rules, attributes, true) tests('success') do tests('#create').succeeds do attributes = { :security_group_id => @secgroup.id, :direction => "ingress", :protocol => "tcp", :port_range_min => 22, :port_range_max => 22, :remote_ip_prefix => "0.0.0.0/0" } @secgrouprule = Fog::Network[:openstack].security_group_rules.create(attributes) @secgrouprule.wait_for { ready? } unless Fog.mocking? !@secgrouprule.id.nil? end tests('#destroy').succeeds do @secgrouprule.destroy end end @secgroup.destroy end fog-1.34.0/tests/openstack/models/network/lb_health_monitor_tests.rb0000644000004100000410000000355112600047642025754 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_health_monitor", ['openstack']) do tests('success') do before do @lb_pool = Fog::Network[:openstack].lb_pools.create(:subnet_id => 'subnet_id', :protocol => 'HTTP', :lb_method => 'ROUND_ROBIN') end after do @lb_pool.destroy end tests('#create').succeeds do @instance = Fog::Network[:openstack].lb_health_monitors.create(:type => 'PING', :delay => 1, :timeout => 5, :max_retries => 10, :http_method => 'GET', :url_path => '/', :expected_codes => '200, 201', :admin_state_up => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.delay = 5 @instance.timeout = 10 @instance.max_retries = 20 @instance.http_method = 'POST' @instance.url_path = '/varz' @instance.expected_codes = '200' @instance.admin_state_up = false @instance.update end tests('#associate_to_pool').succeeds do @instance.associate_to_pool(@lb_pool.id) end tests('#disassociate_from_pool').succeeds do @instance.disassociate_from_pool(@lb_pool.id) end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/network/ports_tests.rb0000644000004100000410000000155712600047642023436 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | ports", ['openstack']) do @port = Fog::Network[:openstack].ports.create(:name => 'port_name', :network_id => 'net_id', :fixed_ips => [], :mac_address => 'fa:16:3e:62:91:7f', :admin_state_up => true, :device_owner => 'device_owner', :device_id => 'device_id', :tenant_id => 'tenant_id') @ports = Fog::Network[:openstack].ports tests('success') do tests('#all').succeeds do @ports.all end tests('#get').succeeds do @ports.get @port.id end end @port.destroy end fog-1.34.0/tests/openstack/models/network/lb_vip_tests.rb0000644000004100000410000000326712600047642023542 0ustar www-datawww-dataShindo.tests("Fog::Network[:openstack] | lb_vip", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Network[:openstack].lb_vips.create(:subnet_id => 'subnet_id', :pool_id => 'pool_id', :protocol => 'HTTP', :protocol_port => 80, :name => 'test-vip', :description => 'Test VIP', :address => '10.0.0.1', :session_persistence => { "cookie_name" => "COOKIE_NAME", "type" => "APP_COOKIE" }, :connection_limit => 10, :admin_state_up => true, :tenant_id => 'tenant_id') !@instance.id.nil? end tests('#update').succeeds do @instance.pool_id = 'new_pool_id', @instance.name = 'new-test-vip' @instance.description = 'New Test VIP' @instance.session_persistence = { "type" => "HTTP_COOKIE" } @instance.connection_limit = 5 @instance.admin_state_up = false @instance.update end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/storage/0000755000004100000410000000000012600047642020463 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/storage/file_tests.rb0000644000004100000410000001351212600047642023153 0ustar www-datawww-dataShindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do pending if Fog.mocking? def object_attributes(file=@instance) @instance.service.head_object(@directory.key, file.key).headers end def object_meta_attributes @instance.service.head_object(@directory.key, @instance.key).headers.reject {|k, v| !(k =~ /X-Object-Meta-/)} end def clear_metadata @instance.metadata.tap do |metadata| metadata.each_pair {|k, v| metadata[k] = nil } end end file_attributes = { :key => 'fog_file_tests', :body => lorem_file } directory_attributes = { # Add a random suffix to prevent collision :key => "fogfilestests-#{rand(65536)}" } @directory = Fog::Storage[:openstack]. directories. create(directory_attributes) model_tests(@directory.files, file_attributes.merge(:etag => 'foo'), Fog.mocking?) do tests('#save should not blow up with etag') do @instance.save end end model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("#metadata should load empty metadata").returns({}) do @instance.metadata end tests('#save') do tests('#metadata') do before do @instance.metadata[:foo] = 'bar' @instance.save end after do clear_metadata @instance.save end tests("should update metadata").returns('bar') do object_meta_attributes['X-Object-Meta-Foo'] end tests('should cache metadata').returns('bar') do @instance.metadata[:foo] end tests('should remove empty metadata').returns({}) do @instance.metadata[:foo] = nil @instance.save object_meta_attributes end end tests('#content_disposition') do before do @instance = @directory.files.create :key => 'meta-test', :body => lorem_file, :content_disposition => 'ho-ho-ho' end after do clear_metadata @instance.save end tests("sets Content-Disposition on create").returns("ho-ho-ho") do object_attributes(@instance)["Content-Disposition"] end end tests('#metadata keys') do after do clear_metadata @instance.save end @instance.metadata[:foo_bar] = 'baz' tests("should support compound key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end @instance.metadata['foo'] = 'bar' tests("should support string keys").returns('bar') do @instance.save object_meta_attributes['X-Object-Meta-Foo'] end @instance.metadata['foo_bar'] = 'baz' tests("should support compound string key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end @instance.metadata['foo-bar'] = 'baz' tests("should support hyphenated keys").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end @instance.metadata['foo-bar'] = 'baz' @instance.metadata[:'foo_bar'] = 'bref' tests("should only support one value per metadata key").returns('bref') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end end end tests("#access_control_allow_origin") do tests("#access_control_allow_origin should default to nil").returns(nil) do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'http://example.com' @instance.save tests("#access_control_allow_origin should return access control attribute").returns('http://example.com') do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'foo' @instance.save tests("#access_control_allow_origin= should update access_control_allow_origin").returns('bar') do @instance.access_control_allow_origin = 'bar' @instance.save @instance.access_control_allow_origin end tests("#access_control_allow_origin= should not blow up on nil") do @instance.access_control_allow_origin = nil @instance.save end end tests("#delete_at") do @delete_at_time = (Time.now + 300).to_i tests("#delete_at should default to nil").returns(nil) do @instance.delete_at end @instance.delete_at = @delete_at_time @instance.save tests("#delete_at should return delete_at attribute").returns(@delete_at_time) do @instance.delete_at end @instance.delete_at = @delete_at_time @instance.save tests("#delete_at= should update delete_at").returns(@delete_at_time + 100) do @instance.delete_at = @delete_at_time + 100 @instance.save @instance.delete_at end tests("#delete_at= should not blow up on nil") do @instance.delete_at = nil @instance.save end end end model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("#origin") do tests("#origin should default to nil").returns(nil) do @instance.save @instance.origin end @instance.origin = 'http://example.com' @instance.save tests("#origin should return access control attributes").returns('http://example.com') do @instance.origin end @instance.attributes.delete('Origin') @instance.origin = 'foo' @instance.save tests("#origin= should update origin").returns('bar') do @instance.origin = 'bar' @instance.save @instance.origin end tests("#origin= should not blow up on nil") do @instance.origin = nil @instance.save end end end @directory.destroy end fog-1.34.0/tests/openstack/models/identity/0000755000004100000410000000000012600047642020650 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/identity/role_tests.rb0000644000004100000410000000147612600047642023370 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | role", ['openstack']) do @instance = Fog::Identity[:openstack].roles.new({:name => 'Role Name', :user_id => 1, :role_id => 1}) @tenant = Fog::Identity[:openstack].tenants.create(:name => 'test_user') @user = Fog::Identity[:openstack].users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof') tests('success') do tests('#save').returns(true) do @instance.save end tests('#add_to_user(@user.id, @tenant.id)').returns(true) do @instance.add_to_user(@user.id, @tenant.id) end tests('#remove_to_user(@user.id, @tenant.id)').returns(true) do @instance.remove_to_user(@user.id, @tenant.id) end tests('#destroy').returns(true) do @instance.destroy end end @user.destroy @tenant.destroy end fog-1.34.0/tests/openstack/models/identity/tenants_tests.rb0000644000004100000410000000136512600047642024100 0ustar www-datawww-dataShindo.tests("Fog::Compute[:openstack] | tenants", ['openstack']) do @instance = Fog::Identity[:openstack].tenants.create(:name => 'test') tests('success') do tests('#find_by_id').succeeds do tenant = Fog::Identity[:openstack].tenants.find_by_id(@instance.id) tenant.id == @instance.id end tests('#destroy').succeeds do Fog::Identity[:openstack].tenants.destroy(@instance.id) end end tests('fails') do pending if Fog.mocking? tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do Fog::Identity[:openstack].tenants.find_by_id('fake') end tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do Fog::Identity[:openstack].tenants.destroy('fake') end end end fog-1.34.0/tests/openstack/models/identity/tenant_tests.rb0000644000004100000410000000136612600047642023716 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | tenant", ['openstack']) do tests('success') do tests('#roles_for(0)').succeeds do instance = Fog::Identity[:openstack].tenants.first instance.roles_for(0) end tests('#users').succeeds do instance = Fog::Identity[:openstack].tenants.first instance.users.count != Fog::Identity[:openstack].users.count end end tests('CRUD') do tests('#create').succeeds do @instance = Fog::Identity[:openstack].tenants.create(:name => 'test') !@instance.id.nil? end tests('#update').succeeds do @instance.update(:name => 'test2') @instance.name == 'test2' end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/identity/users_tests.rb0000644000004100000410000000234212600047642023561 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | users", ['openstack']) do tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id'] @instance = Fog::Identity[:openstack].users.create({ :name => 'foobar', :email => 'foo@bar.com', :tenant_id => tenant_id, :password => 'spoof', :enabled => true }) tests('success') do tests('#find_by_id').succeeds do user = Fog::Identity[:openstack].users.find_by_id(@instance.id) user.id == @instance.id end tests('#find_by_name').succeeds do user = Fog::Identity[:openstack].users.find_by_name(@instance.name) user.name == @instance.name end tests('#destroy').succeeds do Fog::Identity[:openstack].users.destroy(@instance.id) end end tests('fails') do pending if Fog.mocking? tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do Fog::Identity[:openstack].users.find_by_id('fake') end tests('#find_by_name').raises(Fog::Identity::OpenStack::NotFound) do Fog::Identity[:openstack].users.find_by_name('fake') end tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do Fog::Identity[:openstack].users.destroy('fake') end end end fog-1.34.0/tests/openstack/models/identity/ec2_credential_tests.rb0000644000004100000410000000165612600047642025272 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | ec2_credential", ['openstack']) do before do openstack = Fog::Identity[:openstack] tenant_id = openstack.list_tenants.body['tenants'].first['id'] @user = openstack.users.find { |user| user.name == 'foobar' } @user ||= openstack.users.create({ :name => 'foobar', :email => 'foo@bar.com', :tenant_id => tenant_id, :password => 'spoof', :enabled => true }) @ec2_credential = openstack.ec2_credentials.create({ :user_id => @user.id, :tenant_id => tenant_id, }) end after do @user.ec2_credentials.each do |ec2_credential| ec2_credential.destroy end @user.destroy end tests('success') do tests('#destroy').returns(true) do @ec2_credential.destroy end end tests('failure') do tests('#save').raises(Fog::Errors::Error) do @ec2_credential.save end end end fog-1.34.0/tests/openstack/models/identity/roles_tests.rb0000644000004100000410000000124012600047642023540 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | roles", ['openstack']) do @tenant = Fog::Identity[:openstack].tenants.create(:name => 'test_user') @user = Fog::Identity[:openstack].users.create(:name => 'test_user', :tenant_id => @tenant.id, :password => 'spoof') @role = Fog::Identity[:openstack].roles(:user => @user, :tenant => @tenant).create(:name => 'test_role') @roles = Fog::Identity[:openstack].roles(:user => @user, :tenant => @tenant) tests('success') do tests('#all').succeeds do @roles.all end tests('#get').succeeds do @roles.get @roles.first.id end end @role.destroy @user.destroy @tenant.destroy end fog-1.34.0/tests/openstack/models/identity/ec2_credentials_tests.rb0000644000004100000410000000266012600047642025451 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | ec2_credentials", ['openstack']) do before do openstack = Fog::Identity[:openstack] tenant_id = openstack.list_tenants.body['tenants'].first['id'] @user = openstack.users.find { |user| user.name == 'foobar' } @user ||= openstack.users.create({ :name => 'foobar', :email => 'foo@bar.com', :tenant_id => tenant_id, :password => 'spoof', :enabled => true }) @ec2_credential = openstack.ec2_credentials.create({ :user_id => @user.id, :tenant_id => tenant_id, }) end after do @user.ec2_credentials.each do |ec2_credential| ec2_credential.destroy end @user.destroy end tests('success') do tests('#find_by_access_key').succeeds do ec2_credential = @user.ec2_credentials.find_by_access_key(@ec2_credential.access) ec2_credential.access == @ec2_credential.access end tests('#create').succeeds do @user.ec2_credentials.create end tests('#destroy').succeeds do @user.ec2_credentials.destroy(@ec2_credential.access) end end tests('fails') do pending if Fog.mocking? tests('#find_by_access_key').raises(Fog::Identity::OpenStack::NotFound) do @user.ec2_credentials.find_by_access_key('fake') end tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do @user.ec2_credentials.destroy('fake') end end end fog-1.34.0/tests/openstack/models/identity/user_tests.rb0000644000004100000410000000211312600047642023372 0ustar www-datawww-dataShindo.tests("Fog::Identity[:openstack] | user", ['openstack']) do tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id'] @instance = Fog::Identity[:openstack].users.new({ :name => 'User Name', :email => 'test@fog.com', :tenant_id => tenant_id, :password => 'spoof', :enabled => true }) tests('success') do tests('#save').returns(true) do @instance.save end tests('#roles').succeeds do @instance.roles end tests('#update').returns(true) do @instance.update({:name => 'updatename', :email => 'new@email.com'}) end tests('#update_password').returns(true) do @instance.update_password('swordfish') end tests('#update_tenant').returns(true) do @instance.update_tenant(tenant_id) end tests('#update_enabled').returns(true) do @instance.update_enabled(true) end tests('#destroy').returns(true) do @instance.destroy end end tests('failure') do tests('#save').raises(Fog::Errors::Error) do @instance.save end end end fog-1.34.0/tests/openstack/models/compute/0000755000004100000410000000000012600047642020473 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/compute/security_group_tests.rb0000644000004100000410000000401612600047642025326 0ustar www-datawww-dataShindo.tests("Fog::Compute[:openstack] | security_group", ['openstack']) do tests('success') do begin fog = Fog::Compute[:openstack] security_group = fog.security_groups.create( :name => 'my_group', :description => 'my group' ) tests('#create').succeeds do security_group = fog.security_groups.create( :name => 'my_group', :description => 'my group' ) returns('my_group') { security_group.name } returns('my group') { security_group.description } returns([]) { security_group.security_group_rules } returns(true, "Tenant Id is not nil") { security_group.tenant_id != nil } end tests('#rules').succeeds do tests("#create").succeeds do rules_count = security_group.security_group_rules.count rule = security_group.security_group_rules.create( :parent_group_id => security_group.id, :ip_protocol => 'tcp', :from_port => 1234, :to_port => 1234, :ip_range => { "cidr" => "0.0.0.0/0" } ) returns(true, "added security group rule") { security_group.security_group_rules.count == (rules_count + 1) } security_group_rule = security_group.security_group_rules.find { |r| r.id == rule.id } returns(true, "security group rule has rule attributes") { security_group_rule.attributes == rule.attributes } end tests("#destroy").succeeds do rule = security_group.security_group_rules.create( :parent_group_id => security_group.id, :ip_protocol => 'tcp', :from_port => 1234, :to_port => 1234, :ip_range => { "cidr" => "0.0.0.0/0" } ) rule.destroy returns(true, "successfully destroyed rule") { rule.reload == nil } end end ensure security_group.destroy if security_group end end end fog-1.34.0/tests/openstack/models/compute/server_tests.rb0000644000004100000410000001451512600047642023556 0ustar www-datawww-dataShindo.tests("Fog::Compute[:openstack] | server", ['openstack']) do tests('success') do tests('#floating_ips').succeeds do fog = Fog::Compute[:openstack] net = Fog::Network[:openstack] flavor = fog.flavors.first.id image = fog.images.first.id server = fog.servers.new(:name => 'test server', :flavor_ref => flavor, :image_ref => image) server.save ip1 = net.floating_ips.create(:floating_network_id => 'f0000000-0000-0000-0000\ -000000000000', :fixed_ip_address => '192.168.11.3') server.associate_address(ip1.fixed_ip_address) server.reload returns( ["192.168.11.3"] ) { server.floating_ip_addresses } end tests('#security_groups').succeeds do fog = Fog::Compute[:openstack] begin my_group = fog.security_groups.create(:name => 'my_group', :description => 'my group') flavor = fog.flavors.first.id image = fog.images.first.id server = fog.servers.new(:name => 'test server', :flavor_ref => flavor, :image_ref => image) server.security_groups = my_group server.save found_groups = server.security_groups returns(1) { found_groups.length } group = found_groups.first returns('my_group') { group.name } returns(server.service) { group.service } ensure unless Fog.mocking? then server.destroy if server begin fog.servers.get(server.id).wait_for do false end rescue Fog::Errors::Error # ignore, server went away end end my_group.destroy if my_group end end tests('#failed') do fog = Fog::Compute[:openstack] flavor = fog.flavors.first.id image = fog.images.first.id tests('successful server').returns(false) do server = fog.servers.new( :name => 'test server', :flavor_ref => flavor, :image_ref => image, :state => 'success' ) server.failed? end tests('failed server').returns(true) do server = fog.servers.new( :name => 'test server', :flavor_ref => flavor, :image_ref => image, :state => 'ERROR' ) server.failed? end end tests('#metadata').succeeds do fog = Fog::Compute[:openstack] begin flavor = fog.flavors.first.id image = fog.images.first.id server = fog.servers.new(:name => 'test server', :metadata => {"foo" => "bar"}, :flavor_ref => flavor, :image_ref => image) server.save returns(1) { server.metadata.length } server.metadata.each do |datum| datum.value = 'foo' datum.save datum.destroy end ensure unless Fog.mocking? then server.destroy if server begin fog.servers.get(server.id).wait_for do false end rescue Fog::Errors::Error # ignore, server went away end end end end tests('#resize').succeeds do fog = Fog::Compute[:openstack] begin flavor = fog.flavors.first.id image = fog.images.first.id server = fog.servers.new(:name => 'test server', :flavor_ref => flavor, :image_ref => image) server.save flavor_resize = fog.flavors[1].id server.resize(flavor_resize) server.wait_for { server.state == "VERIFY_RESIZE" } unless Fog.mocking? server.revert_resize server.wait_for { server.state == "ACTIVE" } unless Fog.mocking? server.resize(flavor_resize) server.wait_for { server.state == "VERIFY_RESIZE" } unless Fog.mocking? server.confirm_resize ensure unless Fog.mocking? then server.destroy if server begin fog.servers.get(server.id).wait_for do false end rescue Fog::Errors::Error # ignore, server went away end end end end tests('#volumes').succeeds do fog = Fog::Compute[:openstack] begin volume = fog.volumes.new(:name => 'test volume', :description => 'test volume', :size => 1) volume.save volume.wait_for { volume.status == 'available' } unless Fog.mocking? flavor = fog.flavors.first.id image = fog.images.first.id server = fog.servers.new(:name => 'test server', :flavor_ref => flavor, :image_ref => image) server.save server.wait_for { server.state == "ACTIVE" } unless Fog.mocking? server.attach_volume(volume.id, '/dev/vdc') volume.wait_for { volume.status == 'in-use' } unless Fog.mocking? found_volumes = server.volumes returns(1) { found_volumes.length } volume = found_volumes.first returns('test volume') { volume.name } found_attachments = server.volume_attachments returns(1) { found_attachments.length } attachment = found_attachments.first returns('/dev/vdc') { attachment['device'] } server.detach_volume(volume.id) volume.wait_for { volume.status == 'available' } unless Fog.mocking? found_volumes = server.volumes returns(0) { found_volumes.length } found_attachments = server.volume_attachments returns(0) { found_attachments.length } ensure unless Fog.mocking? then server.destroy if server volume.destroy if volume begin fog.servers.get(server.id).wait_for do false end fog.volumes.get(volume.id).wait_for do false end rescue Fog::Errors::Error # ignore, server went away end end end end end end fog-1.34.0/tests/openstack/models/compute/images_tests.rb0000644000004100000410000000040212600047642023503 0ustar www-datawww-dataShindo.tests("Fog::Compute[:openstack] | images collection", ['openstack']) do tests('success') do tests('#all').succeeds do fog = Fog::Compute[:openstack] test 'not nil' do fog.images.all.is_a? Array end end end end fog-1.34.0/tests/openstack/models/image/0000755000004100000410000000000012600047642020101 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/image/image_tests.rb0000644000004100000410000000144312600047642022734 0ustar www-datawww-dataShindo.tests("Fog::Image[:openstack] | image", ['openstack']) do tests('success') do tests('#create').succeeds do @instance = Fog::Image[:openstack].images.create(:name => 'test image') !@instance.id.nil? end tests('#update').succeeds do @instance.name = 'edit test image' @instance.update @instance.name == 'edit test image' end tests('#get image metadata').succeeds do @instance.metadata end tests('#add member').succeeds do @instance.add_member(@instance.owner) end tests('#show members').succeeds do @instance.members end tests('#remove member').succeeds do @instance.remove_member(@instance.owner) end tests('#destroy').succeeds do @instance.destroy == true end end end fog-1.34.0/tests/openstack/models/image/images_tests.rb0000644000004100000410000000115712600047642023121 0ustar www-datawww-dataShindo.tests("Fog::Image[:openstack] | images", ['openstack']) do @instance = Fog::Image[:openstack].create_image({:name => "model test image"}).body tests('success') do tests('#find_by_id').succeeds do image = Fog::Image[:openstack].images.find_by_id(@instance['image']['id']) image.id == @instance['image']['id'] end tests('#get').succeeds do image = Fog::Image[:openstack].images.get(@instance['image']['id']) image.id == @instance['image']['id'] end tests('#destroy').succeeds do Fog::Image[:openstack].images.destroy(@instance['image']['id']) end end end fog-1.34.0/tests/openstack/models/planning/0000755000004100000410000000000012600047642020625 5ustar www-datawww-datafog-1.34.0/tests/openstack/models/planning/role_tests.rb0000644000004100000410000000061312600047642023335 0ustar www-datawww-dataShindo.tests("Fog::Openstack[:planning] | plan", ['openstack']) do @instance = Fog::Openstack[:planning].roles.first tests('success') do tests('#add_role').succeeds do @plan = Fog::Openstack[:planning].list_plans.body.first @instance.add_to_plan(@plan['uuid']) end tests('#remove_role').succeeds do @instance.remove_from_plan(@plan['uuid']) end end end fog-1.34.0/tests/openstack/models/planning/.gitkeep0000644000004100000410000000000012600047642022244 0ustar www-datawww-datafog-1.34.0/tests/openstack/models/planning/plan_tests.rb0000644000004100000410000000221212600047642023323 0ustar www-datawww-dataShindo.tests("Fog::Openstack[:planning] | plan", ['openstack']) do @instance = Fog::Openstack[:planning].plans.first tests('success') do tests('#add_role').succeeds do @role = Fog::Openstack[:planning].list_roles.body.first @instance.add_role(@role['uuid']) end tests('#templates').succeeds do @instance.templates end tests('#master_template').succeeds do @instance.master_template end tests('#environment').succeeds do @instance.environment end tests('#provider_resource_templates').succeeds do @instance.provider_resource_templates end tests('#patch').succeeds do parameter = @instance.parameters.first @instance.patch(:parameters => [{"name" => parameter['name'], "value" => 'new_value'}]) end tests('#remove_role').succeeds do @instance.remove_role(@role['uuid']) end tests('#save').succeeds do @instance.save end tests('#update').succeeds do @instance.update end tests('#destroy').succeeds do @instance.destroy end tests('#create').succeeds do @instance.create end end end fog-1.34.0/tests/openstack/models/planning/plans_tests.rb0000644000004100000410000000072512600047642023515 0ustar www-datawww-dataShindo.tests("Fog::Openstack[:planning] | plans", ['openstack']) do tests('success') do tests('#all').succeeds do plans = Fog::Openstack[:planning].plans.all @instance = plans.first end tests('#get').succeeds do Fog::Openstack[:planning].plans.get(@instance.uuid) end tests('#find_by_*').succeeds do plan = Fog::Openstack[:planning].plans.find_by_name(@instance.name) plan.name == @instance.name end end end fog-1.34.0/tests/openstack/storage_tests.rb0000644000004100000410000000101112600047642020740 0ustar www-datawww-dataShindo.tests('Fog::Storage[:openstack]', ['openstack', 'storage']) do storage = Fog::Storage[:openstack] original_path = storage.instance_variable_get :@path tests("account changes") do test("#change_account") do new_account = 'AUTH_1234567890' storage.change_account new_account storage.instance_variable_get(:@path) != original_path end test("#reset_account_name") do storage.reset_account_name storage.instance_variable_get(:@path) == original_path end end end fog-1.34.0/tests/openstack/version_tests.rb0000644000004100000410000000427712600047642021002 0ustar www-datawww-dataShindo.tests('OpenStack | versions', ['openstack']) do begin @old_mock_value = Excon.defaults[:mock] Excon.defaults[:mock] = true Excon.stubs.clear body = { "versions" => [ { "status" => "CURRENT", "id" => "v2.0", "links" => [ { "href" => "http://example:9292/v2/", "rel" => "self" } ] }, { "status" => "CURRENT", "id" => "v1.1", "links" => [ { "href" => "http://exampple:9292/v1/", "rel" => "self" } ] }, { "status" => "SUPPORTED", "id"=>"v1.0", "links" => [ { "href" => "http://example:9292/v1/", "rel" => "self" } ] } ] } tests("supported") do Excon.stub({ :method => 'GET' }, { :status => 300, :body => Fog::JSON.encode(body) }) returns("v1.1") do Fog::OpenStack.get_supported_version(/v1(\.(0|1))*/, URI('http://example/'), "authtoken") end end tests("unsupported") do Excon.stub({ :method => 'GET' }, { :status => 300, :body => Fog::JSON.encode(body) }) raises(Fog::OpenStack::Errors::ServiceUnavailable) do Fog::OpenStack.get_supported_version(/v3(\.(0|1))*/, URI('http://example/'), "authtoken") end end ensure Excon.stubs.clear Excon.defaults[:mock] = @old_mock_value end end fog-1.34.0/tests/core/0000755000004100000410000000000012600047642014475 5ustar www-datawww-datafog-1.34.0/tests/core/current_machine_tests.rb0000644000004100000410000000141612600047642021414 0ustar www-datawww-dataShindo.tests('Fog CurrentMachine', 'core') do pending unless Fog.mock? old_excon_defaults_mock = Excon.defaults[:mock] Excon.defaults[:mock] = true tests('ip_address') do tests('should be thread safe') do Excon.stub({:method => :get, :path => '/'}, {:body => ''}) (1..10).map { Thread.new { Fog::CurrentMachine.ip_address } }.each{ |t| t.join } end Fog::CurrentMachine.ip_address = nil Excon.stubs.clear tests('should remove trailing endline characters') do Excon.stub({:method => :get, :path => '/'}, {:body => "192.168.0.1\n"}) Fog::CurrentMachine.ip_address == '192.168.0.1' end end Fog::CurrentMachine.ip_address = nil Excon.stubs.clear Excon.defaults[:mock] = old_excon_defaults_mock end fog-1.34.0/tests/core/service_tests.rb0000644000004100000410000000117012600047642017703 0ustar www-datawww-dataShindo.tests('Fog::Service', ['core']) do class TestService < Fog::Service recognizes :generic_user, :generic_api_key class Real attr_reader :options def initialize(opts={}) @options = opts end end class Mock < Real end end tests('Properly passes headers') do user_agent = 'Generic Fog Client' params = { :generic_user => "bob", :generic_api_key => '1234', :connection_options => {:headers => { 'User-Agent' => user_agent }}} service = TestService.new(params) returns('User-Agent' => user_agent) { service.options[:connection_options][:headers] } end end fog-1.34.0/tests/core/wait_for_tests.rb0000644000004100000410000000045612600047642020063 0ustar www-datawww-dataShindo.tests('Fog#wait_for', 'core') do tests("success") do tests('Fog#wait_for').formats(:duration => Integer) do Fog.wait_for(1) { true } end end tests("failure") do tests('Fog#wait_for').raises(Fog::Errors::TimeoutError) do Fog.wait_for(2) { false } end end end fog-1.34.0/tests/core/uuid_tests.rb0000644000004100000410000000041112600047642017206 0ustar www-datawww-dataShindo.tests('Fog::UUID', 'core') do tests('supported?').succeeds do Fog::UUID.supported? == SecureRandom.respond_to?(:uuid) end tests('success').succeeds do Fog::UUID.uuid =~ /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ end end fog-1.34.0/tests/core/timeout_tests.rb0000644000004100000410000000031212600047642017726 0ustar www-datawww-dataShindo.tests('Fog#timeout', 'core') do tests('timeout').returns(FOG_TESTING_TIMEOUT) do Fog.timeout end tests('timeout = 300').returns(300) do Fog.timeout = 300 Fog.timeout end end fog-1.34.0/tests/core/mocking_tests.rb0000644000004100000410000000351212600047642017674 0ustar www-datawww-dataShindo.tests('Fog mocking', 'core') do before do @fog_was_mocked = Fog.mock? Fog.unmock! if @fog_was_mocked end after do Fog.mock! if @fog_was_mocked end tests('Fog.mock!') do tests('Fog.mock!').returns(true) do Fog.mock! end tests('Fog.mock? without Fog.mock!').returns(false) do Fog.mock? end tests('Fog.mock? with Fog.mock!').returns(true) do Fog.mock! Fog.mock? end tests('Fog.mocking? without Fog.mock!').returns(false) do Fog.mocking? end tests('Fog.mocking? with Fog.mock!').returns(true) do Fog.mock! Fog.mocking? end end tests('Fog::Mock.delay') do tests('Fog::Mock.delay').returns(1, "defaults to 1") do Fog::Mock.delay end tests('Fog::Mock.delay = 2').returns(2, "changes Fog::Mock.delay to 2") do Fog::Mock.delay = 2 Fog::Mock.delay end tests('Fog::Mock.delay = 0').returns(0, "changes Fog::Mock.delay to 0") do Fog::Mock.delay = 0 Fog::Mock.delay end tests('Fog::Mock.delay = -1').raises(ArgumentError) do Fog::Mock.delay = -1 end end tests('Fog::Mock.random_ip') do tests('Fog::Mock.random_ip').returns(true, "default to ipv4") do IPAddr.new(Fog::Mock.random_ip).ipv4? end tests('Fog::Mock.random_ip').returns(true, "explicit ipv4") do IPAddr.new(Fog::Mock.random_ip({:version => :v4})).ipv4? end tests('Fog::Mock.random_ip({:version => :v6})').returns(true, "changes to ipv6") do IPAddr.new(Fog::Mock.random_ip({:version => :v6})).ipv6? end tests('Fog::Mock.random_ip({:version => :v5})').raises(ArgumentError) do IPAddr.new(Fog::Mock.random_ip({:version => :v5})).ipv4? end end tests('Fog::Mock.not_implemented').raises(Fog::Errors::MockNotImplemented) do Fog::Mock.not_implemented end end fog-1.34.0/tests/core/credential_tests.rb0000644000004100000410000000475012600047642020364 0ustar www-datawww-dataShindo.tests do before do @old_home = ENV['HOME'] @old_rc = ENV['FOG_RC'] @old_credential = ENV['FOG_CREDENTIAL'] @old_credentials = Fog.credentials Fog.instance_variable_set('@credential_path', nil) # kill memoization Fog.instance_variable_set('@credential', nil) # kill memoization end after do ENV['HOME'] = @old_home ENV['FOG_RC'] = @old_rc ENV['FOG_CREDENTIAL'] = @old_credential Fog.credentials = @old_credentials end tests('credential') do returns(:default, "is :default") { Fog.credential } returns(:foo, "can be set directly") do Fog.credential = "foo" Fog.credential end returns(:bar, "can be set with environment variable") do ENV["FOG_CREDENTIAL"] = "bar" Fog.credential end end tests('credentials_path') do returns('/rc/path', 'FOG_RC takes precedence over HOME') { ENV['HOME'] = '/home/path' ENV['FOG_RC'] = '/rc/path' } returns('/expanded/path', 'properly expands paths') { ENV['FOG_RC'] = '/expanded/subdirectory/../path' Fog.credentials_path } returns(File.join(ENV['HOME'], '.fog'), 'falls back to home path if FOG_RC not set') { ENV.delete('FOG_RC') Fog.credentials_path } returns(nil, 'ignores home path if it does not exist') { ENV.delete('FOG_RC') ENV['HOME'] = '/no/such/path' Fog.credentials_path } returns(nil, 'File.expand_path raises because of non-absolute path') { ENV.delete('FOG_RC') ENV['HOME'] = '.' if RUBY_PLATFORM == 'java' Fog::Logger.warning("Stubbing out non-absolute path credentials test due to JRuby bug: https://github.com/jruby/jruby/issues/1163") nil else Fog.credentials_path end } returns(nil, 'returns nil when neither FOG_RC or HOME are set') { ENV.delete('HOME') ENV.delete('FOG_RC') Fog.credentials_path } end tests('symbolize_credential?') do returns(true, "username") { Fog.symbolize_credential?(:username) } returns(false, "headers") { Fog.symbolize_credential?(:headers) } end tests('symbolize_credentials') do h = { "a" => 3, :something => 2, "connection_options" => {"val" => 5}, :headers => { 'User-Agent' => "my user agent" } } returns({ :a => 3, :something => 2, :connection_options => {:val => 5}, :headers => { 'User-Agent' => "my user agent" } }) { Fog.symbolize_credentials h } end end fog-1.34.0/tests/core/attribute_tests.rb0000644000004100000410000000360312600047642020251 0ustar www-datawww-dataclass FogAttributeTestModel < Fog::Model attribute :key, :aliases => 'keys', :squash => "id" attribute :time, :type => :time attribute :bool, :type => :boolean end Shindo.tests('Fog::Attributes', 'core') do @model = FogAttributeTestModel.new tests('squash') do tests('"keys" => {:id => "value"}').returns('value') do @model.merge_attributes("keys" => {:id => "value"}) @model.key end tests('"keys" => {"id" => "value"}').returns('value') do @model.merge_attributes("keys" => {'id' => "value"}) @model.key end tests('"keys" => {"id" => false}').returns(false) do @model.merge_attributes("keys" => {'id' => false }) @model.key end tests('"keys" => {:id => false}').returns(false) do @model.merge_attributes("keys" => {:id => false }) @model.key end end tests(':type => :time') do @time = Time.now tests(':time => nil').returns(nil) do @model.merge_attributes(:time => nil) @model.time end tests(':time => ""').returns('') do @model.merge_attributes(:time => '') @model.time end tests(':time => "#{@time.to_s}"').returns(Time.parse(@time.to_s)) do @model.merge_attributes(:time => @time.to_s) @model.time end end tests(':type => :boolean') do tests(':bool => "true"').returns(true) do @model.merge_attributes(:bool => 'true') @model.bool end tests(':bool => true').returns(true) do @model.merge_attributes(:bool => true) @model.bool end tests(':bool => "false"').returns(false) do @model.merge_attributes(:bool => 'false') @model.bool end tests(':bool => false').returns(false) do @model.merge_attributes(:bool => false) @model.bool end tests(':bool => "foo"').returns(nil) do @model.merge_attributes(:bool => "foo") @model.bool end end end fog-1.34.0/tests/core/parser_tests.rb0000644000004100000410000000430512600047642017542 0ustar www-datawww-dataShindo.tests('Fog::Parsers', 'core') do class TestParser < Fog::Parsers::Base def reset super reset_my_array end def reset_my_array @my_array = [] end def end_element(name) case name when 'key1', 'key2', 'key3', 'longText' @response[name] = value when 'myArray' @response[name] = @my_array reset_my_array when 'id' @my_array << value.to_i end end end @xml = %{ value1 value2 1 2 3 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec quis metus arcu, quis cursus turpis. Aliquam leo lacus, luctus vel iaculis id, posuere eu odio. Donec sodales, ante porta condimentum value3 } @xmlNS = %{ value1 value2 1 2 3 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec quis metus arcu, quis cursus turpis. Aliquam leo lacus, luctus vel iaculis id, posuere eu odio. Donec sodales, ante porta condimentum value3 } @response = { 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'myArray' => [1,2,3], 'longText' => %{ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec quis metus arcu, quis cursus turpis. Aliquam leo lacus, luctus vel iaculis id, posuere eu odio. Donec sodales, ante porta condimentum } } tests('TestParser').returns(@response, "returns the response") do test_parser = TestParser.new Nokogiri::XML::SAX::Parser.new(test_parser).parse(@xml) test_parser.response end tests('TestParser for namespaces').returns(@response, "returns the response") do test_parser = TestParser.new Nokogiri::XML::SAX::Parser.new(test_parser).parse(@xmlNS) test_parser.response end end fog-1.34.0/tests/lorem.txt0000644000004100000410000000067612600047642015435 0ustar www-datawww-dataLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.fog-1.34.0/tests/vcloud/0000755000004100000410000000000012600047642015041 5ustar www-datawww-datafog-1.34.0/tests/vcloud/data/0000755000004100000410000000000012600047642015752 5ustar www-datawww-datafog-1.34.0/tests/vcloud/data/api_+_v1.0_+_network_+_10000644000004100000410000000405012600047642022040 0ustar www-datawww-data Some fancy Network false 192.168.0.1 255.255.255.0 172.0.0.2 172.0.0.190 192.168.0.101 192.168.0.150 192.168.0.1 natRouted false 3600 7200 192.168.0.151 192.168.0.254 true false portForwarding allowTraffic fog-1.34.0/tests/vcloud/data/api_+_vApp_+_vm-20000644000004100000410000003041612600047642020725 0ustar www-datawww-data vm-595 VIRTUAL_MACHINE Some VM Description Virtual hardware requirements Virtual Hardware Family 0 vm2 vmx-07 00:50:56:01:02:03 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 1 Hard disk Hard disk 2 3000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.102 192.168.1.103 true 00:50:56:01:02:03 POOL 1 192.168.3.102 true 00:50:56:01:02:04 POOL Specifies Guest OS Customization Settings true false 2 false false true true password false vm2 vmware_RHEL5-U5-64-small_v02 fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-20000644000004100000410000003033312600047642021701 0ustar www-datawww-data vm-595 VIRTUAL_MACHINE Some VM Description Virtual hardware requirements Virtual Hardware Family 0 vm2 vmx-07 00:50:56:01:02:03 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 1 Hard disk Hard disk 2 3000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.102 192.168.1.103 true 00:50:56:01:02:03 POOL 1 192.168.3.102 true 00:50:56:01:02:04 POOL Specifies Guest OS Customization Settings true false 2 false false true true password false vm2 vmware_RHEL5-U5-64-small_v02 fog-1.34.0/tests/vcloud/data/api_+_vdc_+_10000644000004100000410000001100612600047642020144 0ustar www-datawww-data resgroup-1 RESOURCE_POOL Some Description AllocationVApp MB 10240 102400 101650 0 MHz 20000 40000 2000 0 MB 1024 10240 8385 0 10 10 10 true fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-10000644000004100000410000007367212600047642022241 0ustar www-datawww-data Some Description of a vApp Lease settings section 0 0 VApp startup section The list of logical networks The configuration parameters for logical networks Some Network Description false 192.168.2.1 255.255.255.0 192.168.2.1 192.168.2.101 192.168.2.150 192.168.2.101 192.168.2.1 192.168.2.102 natRouted false 7200 7200 true true ipTranslation allowTraffic automatic 192.168.1.102 vm1 0 automatic 192.168.1.103 vm2 0 true vm-595 VIRTUAL_MACHINE Virtual hardware requirements Virtual Hardware Family 0 vm2 vmx-07 00:50:56:01:02:03 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.102 192.168.1.103 true 00:50:56:01:00:03 POOL Specifies Guest OS Customization Settings true false 2 false false true true password false vm2 vmware_RHEL5-U5-64-small_v02 vm-594 VIRTUAL_MACHINE Virtual hardware requirements Virtual Hardware Family 0 vm1 vmx-07 00:50:56:01:02:04 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.101 192.168.1.102 true 00:50:56:01:02:04 POOL Specifies Guest OS Customization Settings true false 1 false false true true password false vm1 vmware_RHEL5-U5-64-small_v01 fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_20000644000004100000410000001264512600047642023434 0ustar www-datawww-data Internet Connection false 172.0.0.1 255.255.255.0 172.0.0.2 172.0.0.190 172.0.0.142 172.0.0.156 172.0.0.160 172.0.0.184 172.0.0.195 172.0.0.235 172.0.0.153 172.0.0.147 172.0.0.221 172.0.0.226 172.0.0.151 172.0.0.161 172.0.0.164 172.0.0.163 172.0.0.218 172.0.0.173 172.0.0.172 172.0.0.175 172.0.0.178 172.0.0.197 172.0.0.180 172.0.0.201 172.0.0.156 172.0.0.202 172.0.0.183 172.0.0.149 172.0.0.214 172.0.0.171 172.0.0.162 172.0.0.198 172.0.0.224 172.0.0.195 172.0.0.196 172.0.0.150 172.0.0.169 172.0.0.170 172.0.0.176 172.0.0.200 172.0.0.179 172.0.0.205 172.0.0.213 172.0.0.210 172.0.0.215 172.0.0.219 172.0.0.208 172.0.0.216 172.0.0.217 172.0.0.204 172.0.0.232 172.0.0.154 172.0.0.235 172.0.0.146 172.0.0.209 172.0.0.211 172.0.0.199 172.0.0.155 172.0.0.142 172.0.0.160 172.0.0.212 172.0.0.177 172.0.0.167 172.0.0.166 172.0.0.168 172.0.0.165 172.0.0.181 172.0.0.184 172.0.0.143 172.0.0.230 172.0.0.206 172.0.0.233 172.0.0.222 172.0.0.225 172.0.0.220 172.0.0.227 172.0.0.148 172.0.0.228 172.0.0.229 172.0.0.231 172.0.0.152 172.0.0.145 172.0.0.174 172.0.0.182 172.0.0.203 172.0.0.207 172.0.0.144 isolated NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555 fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-10000644000004100000410000002660012600047642021702 0ustar www-datawww-data vm-594 VIRTUAL_MACHINE Virtual hardware requirements Virtual Hardware Family 0 vm1 vmx-07 00:50:56:01:02:04 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.101 192.168.1.102 true 00:50:56:01:02:04 POOL Specifies Guest OS Customization Settings true false 1 false false true true password false vm1 vmware_RHEL5-U5-64-small_v01 fog-1.34.0/tests/vcloud/data/api_+_org_+_0000644000004100000410000000110412600047642020074 0ustar www-datawww-data fog-1.34.0/tests/vcloud/data/api_+_org_+_10000644000004100000410000000354012600047642020163 0ustar www-datawww-data Some fancy Description My Full Name fog-1.34.0/tests/vcloud/data/api_+_network_+_10000644000004100000410000000410412600047642021062 0ustar www-datawww-data Some fancy Network false 192.168.0.1 255.255.255.0 172.0.0.2 172.0.0.190 192.168.0.101 192.168.0.150 192.168.0.1 natRouted false 3600 7200 192.168.0.151 192.168.0.254 true false portForwarding allowTraffic fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_login0000644000004100000410000000111712600047642021026 0ustar www-datawww-data fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_org_+_10000644000004100000410000000356712600047642021152 0ustar www-datawww-data Some fancy Description My Full Name fog-1.34.0/tests/vcloud/data/api_+_vApp_+_vapp-10000644000004100000410000007311612600047642021254 0ustar www-datawww-data Some Description of a vApp Lease settings section 0 0 VApp startup section The list of logical networks The configuration parameters for logical networks Some Network Description false 192.168.2.1 255.255.255.0 192.168.2.1 192.168.2.101 192.168.2.150 192.168.2.101 192.168.2.1 192.168.2.102 natRouted false 7200 7200 true true ipTranslation allowTraffic automatic 192.168.1.102 vm1 0 automatic 192.168.1.103 vm2 0 true vm-595 VIRTUAL_MACHINE Virtual hardware requirements Virtual Hardware Family 0 vm2 vmx-07 00:50:56:01:02:03 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.102 192.168.1.103 true 00:50:56:01:00:03 POOL Specifies Guest OS Customization Settings true false 2 false false true true password false vm2 vmware_RHEL5-U5-64-small_v02 vm-594 VIRTUAL_MACHINE Virtual hardware requirements Virtual Hardware Family 0 vm1 vmx-07 00:50:56:01:02:04 0 true Network1 PCNet32 ethernet adapter Network adapter 0 1 PCNet32 10 0 SCSI Controller SCSI Controller 0 2 lsilogicsas 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 0 false CD/DVD Drive CD/DVD Drive 1 3002 3 15 hertz * 10^6 Number of Virtual CPUs 1 virtual CPU(s) 4 0 3 1 0 byte * 2^20 Memory Size 512 MB of memory 5 0 4 512 0 Specifies the operating system installed Red Hat Enterprise Linux 5 (64-bit) Specifies the available VM network connections 0 0 192.168.2.101 192.168.1.102 true 00:50:56:01:02:04 POOL Specifies Guest OS Customization Settings true false 1 false false true true password false vm1 vmware_RHEL5-U5-64-small_v01 fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_vdc_+_10000644000004100000410000001065512600047642021133 0ustar www-datawww-data resgroup-1 RESOURCE_POOL Some Description AllocationVApp MB 10240 102400 101650 0 MHz 20000 40000 2000 0 MB 1024 10240 8385 0 10 10 10 true fog-1.34.0/tests/vcloud/data/api_+_admin_+_network_+_20000644000004100000410000001270512600047642022453 0ustar www-datawww-data Internet Connection false 172.0.0.1 255.255.255.0 172.0.0.2 172.0.0.190 172.0.0.142 172.0.0.156 172.0.0.160 172.0.0.184 172.0.0.195 172.0.0.235 172.0.0.153 172.0.0.147 172.0.0.221 172.0.0.226 172.0.0.151 172.0.0.161 172.0.0.164 172.0.0.163 172.0.0.218 172.0.0.173 172.0.0.172 172.0.0.175 172.0.0.178 172.0.0.197 172.0.0.180 172.0.0.201 172.0.0.156 172.0.0.202 172.0.0.183 172.0.0.149 172.0.0.214 172.0.0.171 172.0.0.162 172.0.0.198 172.0.0.224 172.0.0.195 172.0.0.196 172.0.0.150 172.0.0.169 172.0.0.170 172.0.0.176 172.0.0.200 172.0.0.179 172.0.0.205 172.0.0.213 172.0.0.210 172.0.0.215 172.0.0.219 172.0.0.208 172.0.0.216 172.0.0.217 172.0.0.204 172.0.0.232 172.0.0.154 172.0.0.235 172.0.0.146 172.0.0.209 172.0.0.211 172.0.0.199 172.0.0.155 172.0.0.142 172.0.0.160 172.0.0.212 172.0.0.177 172.0.0.167 172.0.0.166 172.0.0.168 172.0.0.165 172.0.0.181 172.0.0.184 172.0.0.143 172.0.0.230 172.0.0.206 172.0.0.233 172.0.0.222 172.0.0.225 172.0.0.220 172.0.0.227 172.0.0.148 172.0.0.228 172.0.0.229 172.0.0.231 172.0.0.152 172.0.0.145 172.0.0.174 172.0.0.182 172.0.0.203 172.0.0.207 172.0.0.144 isolated NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555 fog-1.34.0/tests/vcloud/data/api_+_sessions0000644000004100000410000000175012600047642020611 0ustar www-datawww-data fog-1.34.0/tests/vcloud/data/api_+_v1.0_+_network_+_20000644000004100000410000000271612600047642022050 0ustar www-datawww-data Description false 192.168.251.254 255.255.255.0 192.168.251.254 192.168.251.101 192.168.251.200 isolated false 3600 7200 192.168.251.1 192.168.251.100 fog-1.34.0/tests/vcloud/requests/0000755000004100000410000000000012600047642016714 5ustar www-datawww-datafog-1.34.0/tests/vcloud/requests/compute/0000755000004100000410000000000012600047642020370 5ustar www-datawww-datafog-1.34.0/tests/vcloud/requests/compute/disk_configure_tests.rb0000644000004100000410000001116312600047642025134 0ustar www-datawww-dataShindo.tests("Vcloud::Compute | disk_requests", ['vcloud']) do @xmlns = { "xmlns" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData", "xmlns:vcloud" => "http://www.vmware.com/vcloud/v1" } def disk_hash [{:"rasd:AddressOnParent"=>"0", :"rasd:Description"=>"Hard disk", :"rasd:ElementName"=>"Hard disk 1", :"rasd:HostResource"=> {:vcloud_capacity=>"8192", :vcloud_busType=>"6", :vcloud_busSubType=>"lsilogic"}, :"rasd:InstanceID"=>"2000", :"rasd:Parent"=>"2", :"rasd:ResourceType"=>"17"}] end def nokogiri_load Nokogiri::XML(MockDiskResponse.new.body) end class MockDiskResponse def body < 0 SCSI Controller SCSI Controller 0 2 lsilogic 6 0 Hard disk Hard disk 1 2000 2 17 0 IDE Controller IDE Controller 0 3 5 EOF end end unless Fog.mocking? Vcloud[:compute].stub!(:request).and_return(MockDiskResponse.new) end tests("Call to generate config returns string").returns(true) do pending if Fog.mocking? Vcloud[:compute].generate_configure_vm_disks_request('http://blah', disk_hash).kind_of? String end tests("Call to generate config with no changes returns input data").returns(true) do pending if Fog.mocking? Nokogiri::XML(Vcloud[:compute].generate_configure_vm_disks_request('http://blah', disk_hash)).to_s == Nokogiri::XML(MockDiskResponse.new.body).to_s end tests("Call to generate config with no disks removes disk").returns(true) do pending if Fog.mocking? xml = Vcloud[:compute].generate_configure_vm_disks_request('http://blah', []) ng = Nokogiri::XML(xml) # Should have 2 controllers, but no disks. ng.xpath("//xmlns:ResourceType", @xmlns).size == 2 && ng.xpath("//xmlns:ResourceType[ .='17']", @xmlns).size == 0 end tests("Call to generate config adding a disk").returns(['4096', true, true]) do pending if Fog.mocking? disks = disk_hash disks << { :"rasd:AddressOnParent"=>"1", :"rasd:Description"=>"Hard disk", :"rasd:ElementName"=>"Hard disk 2", :"rasd:HostResource"=> {:vcloud_capacity=>"4096", :vcloud_busType=>"6", :vcloud_busSubType=>"lsilogic"}, :"rasd:InstanceID"=>"2000", :"rasd:Parent"=>"2", :"rasd:ResourceType"=>"17"} xml = Vcloud[:compute].generate_configure_vm_disks_request('http://blah', disks) ng = Nokogiri::XML(xml) [ # should be 4096mb ng.at("//xmlns:ResourceType[ .='17']/../xmlns:AddressOnParent[.='-1']/../xmlns:HostResource", @xmlns)["capacity"], # Should have 2 controllers, and 2 disks ng.xpath("//xmlns:ResourceType", @xmlns).size == 4, ng.xpath("//xmlns:ResourceType[ .='17']", @xmlns).size == 2 ] end unless Fog.mocking? Vcloud[:compute].unstub!(:request) end end fog-1.34.0/tests/vcloud/models/0000755000004100000410000000000012600047642016324 5ustar www-datawww-datafog-1.34.0/tests/vcloud/models/compute/0000755000004100000410000000000012600047642020000 5ustar www-datawww-datafog-1.34.0/tests/vcloud/models/compute/networks_tests.rb0000644000004100000410000000430712600047642023427 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/networks' Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? tests("from an org perspective") do instance = Fog::Vcloud::Compute::Networks.new( :connection => Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/org/1" ) tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } end end tests("from a vdc perspective") do instance = Fog::Vcloud::Compute::Networks.new( :connection => Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vdc/1" ) tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } end end tests("from a vapp perspective") do instance = Fog::Vcloud::Compute::Networks.new( :connection => Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vApp/vapp-1" ) tests("collection") do returns(1) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } end end end end end fog-1.34.0/tests/vcloud/models/compute/vdcs_tests.rb0000644000004100000410000000156112600047642022511 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vdcs' Shindo.tests("Vcloud::Compute | vdcs", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute::Vdcs.new( :connection => Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1" ) tests("collection") do returns(1) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.first.href } end end end end fog-1.34.0/tests/vcloud/models/compute/helper.rb0000644000004100000410000000110312600047642021577 0ustar www-datawww-dataclass Vcloud module Compute module TestSupport if Fog.mocking? def self.template 'mock_template' end else def self.template template_name = ENV['VCLOUD_TEMPLATE'] raise "Specify VApp template name in VCLOUD_TEMPLATE env var" unless template_name template_res = Vcloud.catalogs.item_by_name template_name raise "URI Not found for specified template - check template name" unless template_res template_res.href end end end module Formats end end end fog-1.34.0/tests/vcloud/models/compute/server_tests.rb0000644000004100000410000001164112600047642023060 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/servers' Shindo.tests("Vcloud::Compute | server", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ).get_server("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") instance.reload tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.href } tests("#name").returns("vm2") { instance.name } tests("#vapp").returns("vApp1") { instance.vapp.name } tests("#description").returns("Some VM Description") { instance.description } tests("#status").returns('8') { instance.status } tests("#deployed").returns(true) { instance.deployed } tests("#os_desc").returns("Red Hat Enterprise Linux 5 (64-bit)") { instance.os_desc } tests("#os_type").returns("rhel5_64Guest") { instance.os_type } tests("#computer_name").returns("vm2") { instance.computer_name } tests("cpu count").returns(1) { instance.cpus[:count] } tests("amount of memory").returns(512){ instance.memory[:amount] } tests("#disks") do tests("#size").returns(2){ instance.disks.size } tests("#number").returns(0){ instance.disks.first[:number] } tests("#size").returns(1600){ instance.disks.first[:size] } tests("#ElementName").returns("Hard disk 1"){ instance.disks.first[:disk_data][:'rasd:ElementName'] } tests("#InstanceID").returns("2000"){ instance.disks.first[:disk_data][:'rasd:InstanceID'] } end tests("#vapp_scoped_local_id").returns("vmware_RHEL5-U5-64-small_v02") { instance.vapp_scoped_local_id } tests("#friendly_status").returns('off') { instance.friendly_status } tests("#on?").returns(false) { instance.on? } tests("#off?").returns(true) { instance.off? } tests("#network_connections") do tests("#size").returns(2) { instance.network_connections.size } end end end #old tests tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do pending if Fog.mocking? @svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password' print "Waiting for server to be ready" @svr.wait_for(1200) { print '.' ; ready? } puts "" @svr.ready? end tests("#svr.power_on()").returns(true) do pending if Fog.mocking? @svr.power_on @svr.wait_for { on? } @svr.wait_for { ready? } @svr.on? end tests("#svr.description(\"testing\")").returns("testing") do pending if Fog.mocking? @svr.wait_for { ready? } @svr.description = "testing" @svr.save @svr.wait_for { ready? } @svr.description end # Power off only stops the OS, doesn't free up resources. #undeploy is for this. tests("#svr.undeploy()").returns(true) do pending if Fog.mocking? @svr.undeploy @svr.wait_for { off? } @svr.wait_for { ready? } @svr.off? end tests("#svr.memory(384)").returns(384) do pending if Fog.mocking? raise 'Server template memory already 384m - change to something different' if @svr.memory[:amount] == 384 @svr.wait_for { ready? } @svr.memory = 384 @svr.save @svr.wait_for { ready? } # Can take a little while for the VM to know it has different ram, and not tied to a task.. (1..20).each do |i| break if @svr.reload.memory[:amount] == '384' sleep 1 end @svr.reload.memory[:amount] end tests("#svr.add_disk(4096)").returns([2, "4096"]) do pending if Fog.mocking? raise 'Server template already has two disks' if @svr.disks.size == 2 @svr.wait_for { ready? } @svr.add_disk(4096) @svr.save @svr.wait_for { ready? } # Can take a little while for the VM to know it has different ram, and not tied to a task.. (1..20).each do |i| break if @svr.reload.disks.size == 2 sleep 1 end [ @svr.disks.size, @svr.disks[1][:resource][:vcloud_capacity] ] end tests("#svr.delete_disk(1)").returns(1) do pending if Fog.mocking? raise "Server doesn't have two disks - did previous step fail? " if @svr.disks.size != 2 @svr.wait_for { ready? } sleep 5 # otherwise complains about being busy @svr.delete_disk 1 @svr.save @svr.wait_for { ready? } # Can take a little while for the VM to know it has different ram, and not tied to a task.. (1..20).each do |i| break if @svr.reload.disks.size == 1 sleep 1 end @svr.disks.size end tests("#svr.destroy").raises(Excon::Errors::Forbidden) do pending if Fog.mocking? @svr.destroy sleep 5 # allow cleanup.. Vcloud.servers.get(@svr.href) == nil end end fog-1.34.0/tests/vcloud/models/compute/organizations_tests.rb0000644000004100000410000000120212600047642024431 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/organizations' Shindo.tests("Vcloud::Compute | organizations", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version).organizations tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1") { instance.first.href } end end end end fog-1.34.0/tests/vcloud/models/compute/organization_tests.rb0000644000004100000410000000155412600047642024260 0ustar www-datawww-dataShindo.tests("Vcloud::Compute | organization", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ).get_organization("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1") instance.reload tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1"){ instance.href } tests("#name").returns('Org1'){ instance.name } tests("#full_name").returns('My Full Name'){ instance.full_name } tests("#description").returns("Some fancy\n\nDescription"){ instance.description } end end end fog-1.34.0/tests/vcloud/models/compute/servers_tests.rb0000644000004100000410000000150112600047642023235 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/servers' Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute::Servers.new( :connection => Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1" ) tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.first.href } end end end end fog-1.34.0/tests/vcloud/models/compute/network_tests.rb0000644000004100000410000000610412600047642023241 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/networks' Shindo.tests("Vcloud::Compute | network", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? connection = Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ) tests("an org network") do instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") instance.reload tests("#href").returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.href } tests("#name").returns("Network1") { instance.name } tests("#description").returns("Some fancy Network") { instance.description } tests("configuration") do tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]} tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} tests("#fence_mode").returns("natRouted") { instance.configuration[:FenceMode] } tests("features") do tests("dhcp_service") do tests("#is_enabled").returns("false") { instance.configuration[:Features][:DhcpService][:IsEnabled] } tests("ip_range") do tests("#start_address").returns("192.168.0.151") { instance.configuration[:Features][:DhcpService][:IpRange][:StartAddress] } end end tests("firewall_server") do tests("is_enabled").returns("true"){ instance.configuration[:Features][:FirewallService][:IsEnabled] } end tests("nat_service") do tests("is_enabled").returns("false"){ instance.configuration[:Features][:NatService][:IsEnabled] } end end end tests("#parent_network") do tests("returned network name").returns("ParentNetwork1"){ p = instance.parent_network; p.name } end end tests("an external network") do instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/admin/network/2") instance.reload tests("#href").returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/admin/network/2") { instance.href } tests("#name").returns("ParentNetwork1") { instance.name } tests("#description").returns("Internet Connection") { instance.description } tests("#provider_info").returns("NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555") { instance.provider_info } tests("configuration") do tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} tests("allocated addresses").returns("172.0.0.144") { instance.configuration[:IpScope][:AllocatedIpAddresses][:IpAddress].first } end tests("#parent_network").returns(nil){ instance.parent_network } end end end end fog-1.34.0/tests/vcloud/models/compute/vdc_tests.rb0000644000004100000410000000372312600047642022330 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vdcs' require 'fog/vcloud/models/compute/vdc' Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ).get_vdc("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") instance.reload tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.href } tests("#name").returns("vDC1") { instance.name } tests('#organization').returns("Org1") { instance.organization.name } tests("#description").returns("Some Description") { instance.description } tests("#network_quota").returns(10) { instance.network_quota } tests("#nic_quota").returns(10) { instance.nic_quota } tests("#vm_quota").returns(10) { instance.vm_quota } tests("#is_enabled").returns(true) { instance.is_enabled } tests("#available_networks") do tests("#size").returns(2) { instance.available_networks.size } end tests("#storage_capacity") do tests("units").returns("MB") { instance.storage_capacity[:Units] } tests("allocated").returns("10240") { instance.storage_capacity[:Allocated] } end tests("#compute_capacity") do tests("cpu") do tests("allocated").returns("20000") { instance.compute_capacity[:Cpu][:Allocated] } tests("units").returns("MHz") { instance.compute_capacity[:Cpu][:Units] } end tests("memory") do tests("allocated").returns("1024") { instance.compute_capacity[:Memory][:Allocated] } tests("units").returns("MB") { instance.compute_capacity[:Memory][:Units] } end end end end end fog-1.34.0/tests/vcloud/models/compute/vapp_tests.rb0000644000004100000410000000253212600047642022517 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vapps' require 'fog/vcloud/models/compute/vapp' Shindo.tests("Vcloud::Compute | vapp", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new( :vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version ).get_vapp("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") instance.reload tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.href } tests("#name").returns("vApp1") { instance.name } tests("#vdc").returns("vDC1"){ instance.vdc.name } tests("#description").returns("Some Description of a vApp") { instance.description } tests("#status").returns('8') { instance.status } tests("#deployed").returns(true) { instance.deployed } tests("#children").returns(2) { instance.children.size } tests("#servers").returns(2) { instance.servers.size } tests("#friendly_status").returns('off') { instance.friendly_status } tests("#on?").returns(false) { instance.on? } tests("#off?").returns(true) { instance.off? } end end end fog-1.34.0/tests/vcloud/models/compute/vapps_tests.rb0000644000004100000410000000136212600047642022702 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vapps' Shindo.tests("Vcloud::Compute | vapps", ['vcloud']) do Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version| tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute::Vapps.new( :connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1" ) tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.first.href } end end end end fog-1.34.0/tests/go_grid/0000755000004100000410000000000012600047642015157 5ustar www-datawww-datafog-1.34.0/tests/go_grid/requests/0000755000004100000410000000000012600047642017032 5ustar www-datawww-datafog-1.34.0/tests/go_grid/requests/compute/0000755000004100000410000000000012600047642020506 5ustar www-datawww-datafog-1.34.0/tests/go_grid/requests/compute/image_tests.rb0000644000004100000410000000000012600047642023325 0ustar www-datawww-datafog-1.34.0/tests/dnsimple/0000755000004100000410000000000012600047642015360 5ustar www-datawww-datafog-1.34.0/tests/dnsimple/requests/0000755000004100000410000000000012600047642017233 5ustar www-datawww-datafog-1.34.0/tests/dnsimple/requests/dns/0000755000004100000410000000000012600047642020017 5ustar www-datawww-datafog-1.34.0/tests/dnsimple/requests/dns/dns_tests.rb0000644000004100000410000000577712600047642022372 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dnsimple] | DNS requests', ['dnsimple', 'dns']) do @domain = nil @domain_count = 0 tests("success") do test("get current domain count") do response = Fog::DNS[:dnsimple].list_domains() if response.status == 200 @domain_count = response.body.size end response.status == 200 end test("create domain") do domain = generate_unique_domain response = Fog::DNS[:dnsimple].create_domain(domain) if response.status == 201 @domain = response.body["domain"] end response.status == 201 end test("get domain by id") do response = Fog::DNS[:dnsimple].get_domain(@domain["id"]) response.status == 200 end test("create an A resource record") do domain = @domain["name"] name = "www" type = "A" content = "1.2.3.4" response = Fog::DNS[:dnsimple].create_record(domain, name, type, content) if response.status == 201 @record = response.body["record"] end response.status == 201 end test("create a MX record") do domain = @domain["name"] name = "" type = "MX" content = "mail.#{domain}" options = { "ttl" => 60, "prio" => 10 } response = Fog::DNS[:dnsimple].create_record(domain, name, type, content, options) test "MX record creation returns 201" do response.status == 201 end options.each do |key, value| test("MX record has option #{key}") { value == response.body["record"][key.to_s] } end test "MX record is correct type" do response.body["record"]["record_type"] == "MX" end end test("get a record") do domain = @domain["name"] record_id = @record["id"] response = Fog::DNS[:dnsimple].get_record(domain, record_id) (response.status == 200) and (@record == response.body["record"]) end test("update a record") do domain = @domain["name"] record_id = @record["id"] options = { "content" => "2.3.4.5", "ttl" => 600 } response = Fog::DNS[:dnsimple].update_record(domain, record_id, options) response.status == 200 end test("list records") do response = Fog::DNS[:dnsimple].list_records(@domain["name"]) if response.status == 200 @records = response.body end test "list records returns all records for domain" do @records.reject { |record| record["record"]["system_record"] }.size == 2 end response.status == 200 end test("delete records") do domain = @domain["name"] result = true @records.each do |record| next if record["record"]["system_record"] response = Fog::DNS[:dnsimple].delete_record(domain, record["record"]["id"]) if response.status != 200 result = false break end end result end test("delete domain") do response = Fog::DNS[:dnsimple].delete_domain(@domain["name"]) response.status == 200 end end end fog-1.34.0/tests/vcloud_director/0000755000004100000410000000000012600047642016734 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/requests/0000755000004100000410000000000012600047642020607 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/requests/compute/0000755000004100000410000000000012600047642022263 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/requests/compute/vdc_storage_profile_tests.rb0000644000004100000410000000215412600047642030054 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | vdc_storage_profile requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) @vdc_id = VcloudDirector::Compute::Helper.first_vdc_id(@org) @vdc = @service.get_vdc(@vdc_id).body @vdc[:VdcStorageProfiles][:VdcStorageProfile].each do |storage_profile| @vdc_storage_profile_id = storage_profile[:href].split('/').last tests(storage_profile[:name]) do tests("#get_vdc_storage_class").data_matches_schema(VcloudDirector::Compute::Schema::VDC_STORAGE_PROFILE_TYPE) do @service.get_vdc_storage_class(@vdc_storage_profile_id).body end tests('#get_vdc_storage_class_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_vdc_storage_class_metadata(@vdc_storage_profile_id).body end end end tests('Retrieve non-existent vDC storage profile').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_vdc_storage_class('00000000-0000-0000-0000-000000000000') end end fog-1.34.0/tests/vcloud_director/requests/compute/edge_gateway_tests.rb0000644000004100000410000002065012600047642026462 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector']) do FIREWALL_RULE_ID = '9999' @dhcp_configuration = { :GatewayDhcpService => { :IsEnabled => "true", :pools => [{ :IsEnabled => "true", :Network => "testNet", :DefaultLeaseTime => "65", :MaxLeaseTime => "650", :LowIpAddress => "192.168.9.2", :HighIpAddress => "192.168.9.20" }] } } @vpn_configuration = { :GatewayIpsecVpnService => { :IsEnabled => "true", :Tunnel => [{ :Name => "test vpn", :PeerIpAddress => "110.110.110.110", :PeerId => "1223-123UDH-12321", :LocalIpAddress => "192.168.90.90", :LocalId => "202UB-9602-UB629", :PeerSubnet => [{ :Name => "192.168.0.0/18", :Gateway => "192.168.0.0", :Netmask => "255.255.192.0", }], :SharedSecret => "dont tell anyone", :SharedSecretEncrypted => "false", :EncryptionProtocol => "AES", :Mtu => "1500", :IsEnabled => "true", :LocalSubnet => [{ :Name => "VDC Network", :Gateway => "192.168.90.254", :Netmask => "255.255.255.0" }] }] } } @routing_service_configuration = { :StaticRoutingService => { :IsEnabled => "true", :StaticRoute => [ { :Name => "Test static route #1", :Network => "192.168.192.0/24", :NextHopIp => "192.168.0.1", :GatewayInterface => {} } ] } } @new_edge_gateway_configuration = { :FirewallService => { :IsEnabled => "true", :DefaultAction => "allow", :LogDefaultAction => "false", :FirewallRule => [ { :IsEnabled => "false", :MatchOnTranslate => "false", :Id => FIREWALL_RULE_ID, :Policy => "drop", :Description => "generated from edge_gateway_tests", :Protocols => { :Tcp => "true" }, :Port => "3412", :DestinationPortRange => "3412", :DestinationIp => "internal", :SourcePort => "3412", :SourceIp => "internal", :SourcePortRange => "3412", :EnableLogging => "false" } ] } }.merge!(@vpn_configuration).merge!(@dhcp_configuration) @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('Get first vDC with an EdgeGatewayRecord') do @org[:Link].each do |l| if l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' id = l[:href].split('/').last edge_gateways = @service.get_org_vdc_gateways(id).body if edge_gateways && edge_gateways[:EdgeGatewayRecord].size >= 1 @vdc_id = id break end end end end tests('#get_org_vdc_gateways').data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_RECORDS_TYPE) do begin @edge_gateways = @service.get_org_vdc_gateways(@vdc_id).body rescue Fog::Compute::VcloudDirector::Unauthorized # bug, may be localised retry end @edge_gateways end @edge_gateways[:EdgeGatewayRecord].each do |result| tests("each EdgeGatewayRecord"). data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_EDGE_GATEWAY_RECORD_TYPE) do result end end tests('#get_edge_gateway').data_matches_schema(VcloudDirector::Compute::Schema::GATEWAY_TYPE) do @edge_gateway_id = @edge_gateways[:EdgeGatewayRecord].first[:href].split('/').last @original_gateway_conf = @service.get_edge_gateway(@edge_gateway_id).body end tests('#configure_edge_gateway_services') do rule = @original_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID } raise('fail fast if our test firewall rule already exists - its likely left over from a broken test run') if rule response = @service.post_configure_edge_gateway_services(@edge_gateway_id, @new_edge_gateway_configuration) @service.process_task(response.body) tests('#check for DHCP configuration').returns(@new_edge_gateway_configuration[:GatewayDhcpService][:IsEnabled]) do edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:GatewayDhcpService][:IsEnabled] end tests('#check for VPN').returns(@new_edge_gateway_configuration[:GatewayIpsecVpnService][:IsEnabled]) do edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:GatewayIpsecVpnService][:IsEnabled] end tests('#check for new firewall rule').returns(@new_edge_gateway_configuration[:FirewallService][:FirewallRule]) do edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule] end tests('#remove the firewall rule added by test').returns(nil) do response = @service.post_configure_edge_gateway_services(@edge_gateway_id, @original_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration]) @service.process_task(response.body) edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID } end tests('#check Static Routing service configuration').returns(true) do edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body gateway_interface = edge_gateway[:Configuration][:GatewayInterfaces][:GatewayInterface].first @routing_service_configuration[:StaticRoutingService][:StaticRoute].first[:GatewayInterface] = { :type => gateway_interface[:type], :name => gateway_interface[:name], :href => gateway_interface[:href] } response = @service.post_configure_edge_gateway_services(@edge_gateway_id, @routing_service_configuration) @service.process_task(response.body) edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:StaticRoutingService][:IsEnabled] == "true" end tests('#check VPN xml from generator').returns(true) do xml = Nokogiri.XML Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(@vpn_configuration).generate_xml #Not comprehensive, only checks that the generator actually knows how to handle it and that the output looks vagely sane paths = { 'GatewayIpsecVpnService>IsEnabled' => 'true', 'Tunnel>Name' => 'test vpn', 'Tunnel>PeerIpAddress' => '110.110.110.110', 'Tunnel>LocalSubnet>Gateway' => '192.168.90.254', 'Tunnel>PeerSubnet>Netmask' => '255.255.192.0' } paths.none? { |path| (xml.css path[0]).inner_text != path[1] } end tests('#check DHCP xml from generator').returns(true) do xml = Nokogiri.XML Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(@dhcp_configuration).generate_xml paths = { 'GatewayDhcpService>IsEnabled' => "true", 'GatewayDhcpService>Pool>IsEnabled' => "true", 'GatewayDhcpService>Pool>Network' => "testNet", 'GatewayDhcpService>Pool>DefaultLeaseTime' => "65", 'GatewayDhcpService>Pool>MaxLeaseTime' => "650", 'GatewayDhcpService>Pool>LowIpAddress' => "192.168.9.2", 'GatewayDhcpService>Pool>HighIpAddress' => "192.168.9.20" } paths.none? { |path| (xml.css path[0]).inner_text != path[1] } end end tests('Retrieve non-existent edge gateway').raises(Fog::Compute::VcloudDirector::Forbidden) do begin @service.get_edge_gateway('00000000-0000-0000-0000-000000000000') rescue Fog::Compute::VcloudDirector::Unauthorized # bug, may be localised retry end end tests('Configure non-existent edge gateway').raises(Fog::Compute::VcloudDirector::Forbidden) do begin @service.post_configure_edge_gateway_services('00000000-0000-0000-0000-000000000000', {}) rescue Fog::Compute::VcloudDirector::Unauthorized # bug, may be localised retry end end end fog-1.34.0/tests/vcloud_director/requests/compute/task_tests.rb0000644000004100000410000000255312600047642025001 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | task requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('error conditions') do tests('retrieve non-existent TasksList').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_task_list('00000000-0000-0000-0000-000000000000') end tests('retrieve non-existent Task').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_task('00000000-0000-0000-0000-000000000000') end tests('cancel non-existent Task').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.post_cancel_task('00000000-0000-0000-0000-000000000000') end end @org_id = VcloudDirector::Compute::Helper.current_org_id(@service) tests('#get_task_list').data_matches_schema(VcloudDirector::Compute::Schema::TASKS_LIST_TYPE) do session = @service.get_current_session.body org_href = session[:Link].find {|l| l[:type] == 'application/vnd.vmware.vcloud.org+xml'}[:href] @org_uuid = org_href.split('/').last @tasks_list = @service.get_task_list(@org_uuid).body end tests('each task in the task list') do @tasks_list[:Task].each do |task| task_id = task[:href].split('/').last tests("#get_task(#{task_id}").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do @service.get_task(task_id).body end end end end fog-1.34.0/tests/vcloud_director/requests/compute/helper.rb0000644000004100000410000000150612600047642024071 0ustar www-datawww-dataclass VcloudDirector module Compute module Helper def self.test_name @test_name ||= 'fog-test-%x' % Time.now.to_i end def self.fixture(filename) File.join(File.expand_path('../../../fixtures', __FILE__), filename) end def self.current_org(service) service.get_organization(current_org_id(service)).body end def self.current_org_id(service) session = service.get_current_session.body link = session[:Link].find do |l| l[:type] == 'application/vnd.vmware.vcloud.org+xml' end link[:href].split('/').last end def self.first_vdc_id(org) link = org[:Link].find do |l| l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end link[:href].split('/').last end end end end fog-1.34.0/tests/vcloud_director/requests/compute/disk_tests.rb0000644000004100000410000001753512600047642024777 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | disk requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @disk_name = VcloudDirector::Compute::Helper.test_name tests('error conditions') do tests('#post_upload_disk') do tests('Invalid size').raises(Fog::Compute::VcloudDirector::BadRequest) do @service.post_upload_disk('00000000-0000-0000-0000-000000000000', @disk_name, -1) end end tests('Upload to non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.post_upload_disk('00000000-0000-0000-0000-000000000000', @disk_name, 0) end tests('Retrieve non-existent Disk').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_disk('00000000-0000-0000-0000-000000000000') end tests('Retrieve owner of non-existent Disk').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_disk_owner('00000000-0000-0000-0000-000000000000') end tests('Retrieve VM list for non-existent Disk').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_vms_disk_attached_to('00000000-0000-0000-0000-000000000000') end tests('Delete non-existent Disk').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.delete_disk('00000000-0000-0000-0000-000000000000') end end @org = VcloudDirector::Compute::Helper.current_org(@service) @size = 1024 tests('Upload and manipulate a disk') do tests('#post_upload_disk').data_matches_schema(VcloudDirector::Compute::Schema::DISK_TYPE) do @vdc_id = VcloudDirector::Compute::Helper.first_vdc_id(@org) @disk = @service.post_upload_disk(@vdc_id, @disk_name, @size).body end @service.process_task(@disk[:Tasks][:Task]) @disk_id = @disk[:href].split('/').last tests("#get_disk(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::DISK_TYPE) do @disk = @service.get_disk(@disk_id).body end tests("disk[:name]").returns(@disk_name) { @disk[:name] } tests("disk[:size]").returns(@size) { @disk[:size].to_i } tests("#get_disk_owner(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::OWNER_TYPE) do @owner = @service.get_disk_owner(@disk_id).body end tests("owner[:User][:name]").returns(@service.user_name) { @owner[:User][:name] } #tests("#put_disk(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do # @disk_name += '-renamed' # @task = @service.put_disk(@disk_id, @disk_name).body #end #@service.process_task(@task) #tests("#get_disk(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::DISK_TYPE) do # @disk = @service.get_disk(@disk_id).body #end #tests("disk[:name]").returns(@disk_name) { @disk[:name] } #tests("disk[:size]").returns(@size) { @disk[:size].to_i } # shouldn't change tests('disk metadata') do pending if Fog.mocking? tests("#put_disk_metadata_item_metadata(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do @task = @service.put_disk_metadata_item_metadata(@disk_id, 'fog-test-key', 'fog-test-value').body end @service.process_task(@task) tests("#put_disk_metadata_item_metadata(#{@disk_id})") do tests("#put_disk_metadata_item_metadata(Boolean)").returns(true) do task = @service.put_disk_metadata_item_metadata(@disk_id, 'fog-test-boolean', true).body @service.process_task(task) end tests("#put_disk_metadata_item_metadata(DateTime)").returns(true) do task = @service.put_disk_metadata_item_metadata(@disk_id, 'fog-test-datetime', DateTime.now).body @service.process_task(task) end tests("#put_disk_metadata_item_metadata(Number)").returns(true) do task = @service.put_disk_metadata_item_metadata(@disk_id, 'fog-test-number', 111).body @service.process_task(task) end end tests("#post_update_disk_metadata(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do metadata = { 'fog-test-key-update' => 'fog-test-value-update', 'fog-test-boolean-update' => false, 'fog-test-datetime-update' => DateTime.now, 'fog-test-number-update' => 222 } @task = @service.post_update_disk_metadata(@disk_id, metadata).body end @service.process_task(@task) tests("#get_disk_metadata(#{@disk_id})") do tests('response format').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do @metadata = @service.get_disk_metadata(@disk_id).body end tests('TypedValue') do pending if @service.api_version.to_f < 5.1 tests('key').returns('MetadataStringValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-key'} entry[:TypedValue][:xsi_type] end tests('boolean').returns('MetadataBooleanValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-boolean'} entry[:TypedValue][:xsi_type] end tests('datetime').returns('MetadataDateTimeValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-datetime'} entry[:TypedValue][:xsi_type] end tests('number').returns('MetadataNumberValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-number'} entry[:TypedValue][:xsi_type] end tests('key-update').returns('MetadataStringValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-key-update'} entry[:TypedValue][:xsi_type] end tests('boolean-update').returns('MetadataBooleanValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-boolean-update'} entry[:TypedValue][:xsi_type] end tests('datetime-update').returns('MetadataDateTimeValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-datetime-update'} entry[:TypedValue][:xsi_type] end tests('number-update').returns('MetadataNumberValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-number-update'} entry[:TypedValue][:xsi_type] end end end end tests("#get_vms_disk_attached_to(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::VMS_TYPE) do pending if Fog.mocking? @service.get_vms_disk_attached_to(@disk_id).body end tests("#delete_disk(#{@disk_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do @task = @service.delete_disk(@disk_id).body end @service.process_task(@task) end tests('Disk no longer exists') do tests("#get_disk(#{@disk_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_disk(@disk_id) end tests("#get_disk_owner(#{@disk_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_disk_owner(@disk_id) end tests("#get_disk_metadata(#{@disk_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do pending if Fog.mocking? @service.get_disk_metadata(@disk_id) end tests("#delete_disk(#{@disk_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.delete_disk(@disk_id) end end tests('#get_disks_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_disks_from_query(:format => format).body end key = (format == 'references') ? 'DiskReference' : 'DiskRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end end fog-1.34.0/tests/vcloud_director/requests/compute/supported_systems_tests.rb0000644000004100000410000000056012600047642027647 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | supported_systems requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new if @service.api_version.to_f >= 5.1 tests('#get_supported_systems_info').formats(VcloudDirector::Compute::Schema::SUPPORTED_OPERATING_SYSTEMS_INFO_TYPE) do @service.get_supported_systems_info.body end end end fog-1.34.0/tests/vcloud_director/requests/compute/catalog_tests.rb0000644000004100000410000000323112600047642025443 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | catalog requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('#get_catalog').data_matches_schema(VcloudDirector::Compute::Schema::CATALOG_TYPE) do link = @org[:Link].find do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.catalog+xml' end @catalog_id = link[:href].split('/').last pending if Fog.mocking? @catalog = @service.get_catalog(@catalog_id).body end tests('#get_catalog_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_catalog_metadata(@catalog_id).body end tests('#get_control_access_params_catalog').data_matches_schema(VcloudDirector::Compute::Schema::CONTROL_ACCESS_PARAMS_TYPE) do pending if Fog.mocking? @service.get_control_access_params_catalog(@org[:href].split('/').last, @catalog_id).body end tests('#get_catalogs_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_catalogs_from_query(:format => format).body end key = (format == 'references') ? 'CatalogReference' : 'CatalogRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end tests('Retrieve non-existent Catalog').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_catalog('00000000-0000-0000-0000-000000000000') end end fog-1.34.0/tests/vcloud_director/requests/compute/versions_tests.rb0000644000004100000410000000064112600047642025703 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | versions requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#get_supported_versions').formats(VcloudDirector::Compute::Schema::SUPPORTED_VERSIONS_TYPE) do @versions = @service.get_supported_versions.body end tests('API 5.1 is supported').returns(true) do !!@versions[:VersionInfo].find {|i| i[:Version] == '5.1'} end end fog-1.34.0/tests/vcloud_director/requests/compute/organization_tests.rb0000644000004100000410000000266412600047642026546 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | organization requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#get_organizations').data_matches_schema(VcloudDirector::Compute::Schema::ORG_LIST_TYPE) do @org_list = @service.get_organizations.body end tests('#get_organization').data_matches_schema(VcloudDirector::Compute::Schema::ORG_TYPE) do org = @org_list[:Org].find {|o| o[:name] == @service.org_name} @org_uuid = org[:href].split('/').last @service.get_organization(@org_uuid).body end tests('#get_organization_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_organization_metadata(@org_uuid).body end tests('#get_organizations_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_organizations_from_query(:format => format).body end key = (format == 'references') ? 'OrganizationReference' : 'OrganizationRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end tests('retrieve non-existent Org').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_organization('00000000-0000-0000-0000-000000000000') end end fog-1.34.0/tests/vcloud_director/requests/compute/query_tests.rb0000644000004100000410000001021512600047642025176 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | query requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('retrieve a summary list of all typed queries types') do tests('#get_execute_query') do @query_list = @service.get_execute_query.body tests(':type').returns('application/vnd.vmware.vcloud.query.queryList+xml') do @query_list[:type] end end end # for each queriable type, query and check that each available format # returns a result that matches the base schema # @query_list[:Link].select do |link| link[:rel] == 'down' end.sort_by do |link| [link[:name], link[:href]] end.each do |link| href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) type = query['type'].first format = query['format'].first next if %w[right role strandedUser].include?(type) tests("type => #{type}, format => #{format}") do pending if Fog.mocking? && (format != 'records' || type != 'orgVdcNetwork') tests("#get_execute_query").data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_execute_query(type, :format => format).body end tests("resource type").returns(link[:type]) { @body[:type] } unless ( type == 'event' || type == 'edgeGateway' ) records_key = @body.keys.find {|key| key.to_s =~ /Record|Reference$/} if records = @body[records_key] records.first do |record| case format when 'records' tests("record is correct schema").data_matches_schema(VcloudDirector::Compute::Schema::REFERENCE_TYPE) do record end end end end end end end if Fog.mocking? tests('ensure Mock logic is sound') do tests('#get_execute_query') do tests('orgVdcNetwork') do output = @service.get_execute_query('orgVdcNetwork').body tests('all records').returns(@service.data[:networks].size) do output[:OrgVdcNetworkRecords].size end output = @service.get_execute_query('orgVdcNetwork', :filter => 'name==vDC1 backend network').body tests(':filter by name').returns(1) do output[:OrgVdcNetworkRecords].size end tests(':page option is ok if :page == 1').returns(@service.data[:networks].size) do output = @service.get_execute_query('orgVdcNetwork', :page => '1').body output[:OrgVdcNetworkRecords].size end tests('AND expression in :filter raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :filter => 'name==Default Network;thing==wibble') end tests('OR expression in :filter raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :filter => 'name==Default Network,thing==wibble') end tests('sortAsc option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :sortAsc => 'name') end tests('sortDesc option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :sortDesc => 'name') end tests('page option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :page => '2') end tests('pageSize option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :pageSize => '50') end tests('offset option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :offset => '5') end tests('fields option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :fields => 'name,thing') end end end end end end fog-1.34.0/tests/vcloud_director/requests/compute/session_tests.rb0000644000004100000410000000070612600047642025520 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | session requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#post_login_sessions').data_matches_schema(VcloudDirector::Compute::Schema::SESSION_TYPE) do pending @service.login.body # calls post_login_sessions end tests('#get_current_session').data_matches_schema(VcloudDirector::Compute::Schema::SESSION_TYPE) do @service.get_current_session.body end end fog-1.34.0/tests/vcloud_director/requests/compute/users_tests.rb0000644000004100000410000000120312600047642025167 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | users requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#get_users_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_users_from_query(:format => format).body end key = (format == 'references') ? 'UserReference' : 'UserRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end end fog-1.34.0/tests/vcloud_director/requests/compute/admin_tests.rb0000644000004100000410000000073412600047642025126 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | admin requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#get_vcloud').data_matches_schema(VcloudDirector::Compute::Schema::VCLOUD_TYPE) do @service.get_vcloud.body end @org = VcloudDirector::Compute::Helper.current_org(@service) tests('#get_org_settings').returns(Hash) do pending if Fog.mocking? @service.get_org_settings(@org[:href].split('/').last).body.class end end fog-1.34.0/tests/vcloud_director/requests/compute/network_tests.rb0000644000004100000410000001444212600047642025530 0ustar www-datawww-data require 'pp' Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) do GET_NETWORK_FORMAT = { :type => String, :name => String, :href => String, :id => String, :description => Fog::Nullable::String, :is_inherited => Fog::Boolean, :gateway => Fog::Nullable::String, :netmask => String, :dns1 => Fog::Nullable::String, :dns2 => Fog::Nullable::String, :dns_suffix => Fog::Nullable::String, :ip_ranges => [{ :start_address => String, :end_address => String }] } @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) @created_net_id = nil tests('Create network in non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.post_create_org_vdc_network('00000000-0000-0000-0000-000000000000', 'bob') end tests('Delete non-existent OrgNetwork').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.delete_network('00000000-0000-0000-0000-000000000000') end tests('Retrieve non-existent OrgNetwork (get_network)').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_network('00000000-0000-0000-0000-000000000000') end tests('Retrieve non-existent OrgNetwork (get_network_complete)').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_network_complete('00000000-0000-0000-0000-000000000000') end tests('#get_network').data_matches_schema(GET_NETWORK_FORMAT) do link = @org[:Link].find do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml' end pending unless link # nothing to test here cannot continue @network_id = link[:href].split('/').last @service.get_network(@network_id).body end tests('#get_network_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? pending unless @network_id # nothing to test here cannot continue @service.get_network_metadata(@network_id).body end tests('#post_create_org_vdc_network') do #pending unless Fog.mocking? link = @org[:Link].find do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end vdc_id = link[:href].split('/').last name = VcloudDirector::Compute::Helper.test_name options = { :Description => "Testing post_create_org_vdc_network #{name}", :Configuration => { :IpScopes => { :IpScope => { :IsInherited => 'false', :Gateway => '198.51.100.1', :Netmask => '255.255.255.0', :Dns1 => '198.51.100.2', :Dns2 => '198.51.100.3', :DnsSuffix => 'example.com', :IpRanges => [ { :IpRange => { :StartAddress => '198.51.100.10', :EndAddress => '198.51.100.20' } }, { :IpRange => { :StartAddress => '198.51.100.30', :EndAddress => '198.51.100.40' } }, ] }, }, :FenceMode => 'isolated', } } body = @service.post_create_org_vdc_network(vdc_id, name, options).body @created_net_id = body[:href].split('/').last if body[:href] @service.process_task(body[:Tasks][:Task]) if body && body.key?(:Tasks) tests('fetched name matches created name').returns(name) do net = @service.get_network_complete(@created_net_id).body net[:name] end end tests('#get_network_complete schema').data_matches_schema(VcloudDirector::Compute::Schema::NETWORK_TYPE) do link = @org[:Link].find do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml' end pending unless link # nothing to test here cannot continue @network_id = link[:href].split('/').last @service.get_network_complete(@network_id).body end tests('#get_network_complete') do new_network = @service.get_network_complete(@created_net_id).body tests('network has a :name') do new_network.fetch(:name) end tests('network has a :Description') do new_network.fetch(:Description) end tests('network has a :Gateway') do new_network[:Configuration][:IpScopes][:IpScope][:Gateway] end tests('network has a several :IpRanges') do new_network[:Configuration][:IpScopes][:IpScope][:IpRanges].size >= 1 end end tests('#put_network') do new_options = { :Description => "Testing put_network", :Configuration => { :IpScopes => { :IpScope => { :IsInherited => 'false', :Gateway => '198.51.100.1', :Netmask => '255.255.255.0', :Dns1 => '198.51.100.2', :Dns2 => '198.51.100.3', :DnsSuffix => 'example.com', :IpRanges => [ { :IpRange => { :StartAddress => '198.51.100.10', :EndAddress => '198.51.100.20' } }, { :IpRange => { :StartAddress => '198.51.100.30', :EndAddress => '198.51.100.40' } }, ] }, }, :FenceMode => 'isolated', } } original_network = @service.get_network_complete(@created_net_id).body name = original_network[:name] task = @service.put_network(@created_net_id, name, new_options).body @service.process_task(task) tests('fetched :Gateway matches updated :Gateway').returns( new_options[:Configuration][:IpScopes][:IpScope][:Gateway] ) do net = @service.get_network_complete(@created_net_id).body net[:Configuration][:IpScopes][:IpScope][:Gateway] end tests('fetched :IpRanges count is matches updated data').returns( new_options[:Configuration][:IpScopes][:IpScope][:IpRanges].size ) do net = @service.get_network_complete(@created_net_id).body # dammit, the API returns with IpRange as a list, not IpRanges net[:Configuration][:IpScopes][:IpScope][:IpRanges][:IpRange].size end tests('fetched :Network matches updated :Description').returns( new_options[:Description] ) do net = @service.get_network_complete(@created_net_id).body net[:Description] end end tests('#delete_network') do @delete_task = @service.delete_network(@created_net_id).body @service.process_task(@delete_task) tests('created network has been deleted').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_network(@created_net_id) end end end fog-1.34.0/tests/vcloud_director/requests/compute/media_tests.rb0000644000004100000410000002117312600047642025115 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | media requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('error conditions') do tests('#post_upload_media') do tests('Invalid image_type').raises(Fog::Compute::VcloudDirector::BadRequest) do @service.post_upload_media('00000000-0000-0000-0000-000000000000', 'test.iso', 'isox', 0) end tests('Invalid size').raises(Fog::Compute::VcloudDirector::BadRequest) do @service.post_upload_media('00000000-0000-0000-0000-000000000000', 'test.iso', 'iso', -1) end end tests('Upload to non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.post_upload_media('00000000-0000-0000-0000-000000000000', 'test.iso', 'iso', 0) end tests('Retrieve non-existent Media').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_media('00000000-0000-0000-0000-000000000000') end tests('Retrieve owner of non-existent Media').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_media_owner('00000000-0000-0000-0000-000000000000') end tests('Delete non-existent Media').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.delete_media('00000000-0000-0000-0000-000000000000') end end @org = VcloudDirector::Compute::Helper.current_org(@service) @media_name = VcloudDirector::Compute::Helper.test_name tests('Upload and manipulate a media object') do File.open(VcloudDirector::Compute::Helper.fixture('test.iso'), 'rb') do |iso| tests('#post_upload_media').data_matches_schema(VcloudDirector::Compute::Schema::MEDIA_TYPE) do @vdc_id = VcloudDirector::Compute::Helper.first_vdc_id(@org) @size = File.size(iso.path) @media = @service.post_upload_media(@vdc_id, @media_name, 'iso', @size).body end tests('media object has exactly one file').returns(true) do @media[:Files][:File].size == 1 end tests('media object file has an upload link').returns(true) do @link = @media[:Files][:File].first[:Link] @link[:rel] == 'upload:default' end unless Fog.mocking? headers = { 'Content-Length' => @size, 'Content-Type' => 'application/octet-stream', 'x-vcloud-authorization' => @service.vcloud_token } Excon.put( @link[:href], :body => iso.read, :expects => 200, :headers => headers ) end @service.process_task(@media[:Tasks][:Task]) @media_id = @media[:href].split('/').last tests("#get_media(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::MEDIA_TYPE) do @media = @service.get_media(@media_id).body end tests("media[:name]").returns(@media_name) { @media[:name] } tests("media[:imageType]").returns('iso') { @media[:imageType] } tests("media[:size]").returns(@size) { @media[:size].to_i } tests("#get_media_owner(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::OWNER_TYPE) do @owner = @service.get_media_owner(@media_id).body end tests("owner[:User][:name]").returns(@service.user_name) { @owner[:User][:name] } tests('media metadata') do pending if Fog.mocking? tests("#put_media_metadata_item_metadata(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do @task = @service.put_media_metadata_item_metadata(@media_id, 'fog-test-key', 'fog-test-value').body end @service.process_task(@task) tests("#put_media_metadata_item_metadata(#{@media_id})") do tests("#put_media_metadata_item_metadata(Boolean)").returns(true) do task = @service.put_media_metadata_item_metadata(@media_id, 'fog-test-boolean', true).body @service.process_task(task) end tests("#put_media_metadata_item_metadata(DateTime)").returns(true) do task = @service.put_media_metadata_item_metadata(@media_id, 'fog-test-datetime', DateTime.now).body @service.process_task(task) end tests("#put_media_metadata_item_metadata(Number)").returns(true) do task = @service.put_media_metadata_item_metadata(@media_id, 'fog-test-number', 111).body @service.process_task(task) end end tests("#post_update_media_metadata(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do metadata = { 'fog-test-key-update' => 'fog-test-value-update', 'fog-test-boolean-update' => false, 'fog-test-datetime-update' => DateTime.now, 'fog-test-number-update' => 222 } @task = @service.post_update_media_metadata(@media_id, metadata).body end @service.process_task(@task) tests("#get_media_metadata(#{@media_id})") do tests('response format').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do @metadata = @service.get_media_metadata(@media_id).body end tests('TypedValue') do pending if @service.api_version.to_f < 5.1 tests('key').returns('MetadataStringValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-key'} entry[:TypedValue][:xsi_type] end tests('boolean').returns('MetadataBooleanValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-boolean'} entry[:TypedValue][:xsi_type] end tests('datetime').returns('MetadataDateTimeValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-datetime'} entry[:TypedValue][:xsi_type] end tests('number').returns('MetadataNumberValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-number'} entry[:TypedValue][:xsi_type] end tests('key-update').returns('MetadataStringValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-key-update'} entry[:TypedValue][:xsi_type] end tests('boolean-update').returns('MetadataBooleanValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-boolean-update'} entry[:TypedValue][:xsi_type] end tests('datetime-update').returns('MetadataDateTimeValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-datetime-update'} entry[:TypedValue][:xsi_type] end tests('number-update').returns('MetadataNumberValue') do entry = @metadata[:MetadataEntry].find {|e| e[:Key] == 'fog-test-number-update'} entry[:TypedValue][:xsi_type] end end end end tests("#post_clone_media(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::MEDIA_TYPE) do @media = @service.post_clone_media(@vdc_id, @media_id, :IsSourceDelete => true).body end @service.process_task(@media[:Tasks][:Task]) @media_id = @media[:href].split('/').last tests("media[:name] starts '#{@media_name}-copy-'").returns(true) do !!(@media[:name] =~ /^#{@media_name}-copy-/) end tests("#delete_media(#{@media_id})").data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do @task = @service.delete_media(@media_id).body end @service.process_task(@task) end end tests('Media item no longer exists') do tests("#get_media(#{@media_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_media(@media_id) end tests("#get_media_owner(#{@media_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_media_owner(@media_id) end tests("#get_media_metadata(#{@media_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do pending if Fog.mocking? @service.get_media_metadata(@media_id) end tests("#delete_media(#{@media_id})").raises(Fog::Compute::VcloudDirector::Forbidden) do @service.delete_media(@media_id) end end tests('#get_medias_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_medias_from_query(:format => format).body end key = (format == 'references') ? 'MediaReference' : 'MediaRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end end fog-1.34.0/tests/vcloud_director/requests/compute/schema_helper.rb0000644000004100000410000005244612600047642025422 0ustar www-datawww-dataclass VcloudDirector module Compute module Schema # Mapping of a content media type to a xsd complex type. MEDIA_TYPE_MAPPING_TYPE = { :MediaType => String, :ComplexTypeName => String, :SchemaLocation => String } # Information for one version of the API. VERSION_INFO_TYPE = { :Version => String, :LoginUrl => String, :MediaTypeMapping => [MEDIA_TYPE_MAPPING_TYPE] } # List all supported versions. SUPPORTED_VERSIONS_TYPE = { :VersionInfo => [VERSION_INFO_TYPE] } # The standard error message type used in the vCloud REST API. ERROR_TYPE = { :majorErrorCode => String, :message => String, :minorErrorCode => String, :stackTrace => Fog::Nullable::String, :vendorSpecificErrorCode => Fog::Nullable::String } # The base type for all objects in the vCloud model. Has an optional list # of links and href and type attributes. REFERENCE_TYPE = { :href => String, :id => Fog::Nullable::String, :name => Fog::Nullable::String, :type => Fog::Nullable::String } # Extends reference type by adding relation attribute. Defines a # hyper-link with a relationship, hyper-link reference, and an optional # MIME type. LINK_TYPE = REFERENCE_TYPE.merge({ :rel => String }) # Represents a reference to a resource. Contains an href attribute, a # resource status attribute, and optional name and type attributes. RESOURCE_REFERENCE_TYPE = REFERENCE_TYPE.merge({ :status => Fog::Nullable::String }) # The base type for all objects in the vCloud model. Has an optional list # of links and href and type attributes. RESOURCE_TYPE = { :href => Fog::Nullable::String, :type => Fog::Nullable::String, # :Link => [LINK_TYPE] -- FIXME: not required } # The base type for all resource types which contain an id attribute. IDENTIFIABLE_RESOURCE_TYPE = RESOURCE_TYPE.merge({ :id => Fog::Nullable::String, :operationKey => Fog::Nullable::String, }) # Basic entity type in the vCloud object model. Includes a name, an # optional description, and an optional list of links. ENTITY_TYPE = IDENTIFIABLE_RESOURCE_TYPE.merge({ :name => String }) # Represents a file to be transferred (uploaded or downloaded). FILE_TYPE = ENTITY_TYPE.merge({ :bytesTransfered => Fog::Nullable::String, :checksum => Fog::Nullable::String, # normalizedString :size => Fog::Nullable::String }) # Represents a list of files to be transferred (uploaded or downloaded). FILES_LIST_TYPE = { :File => [FILE_TYPE] } # Container for query result sets. CONTAINER_TYPE = RESOURCE_TYPE.merge({ :name => String, :page => String, :pageSize => String, :total => String }) # Represents an asynchronous operation in vCloud Director. TASK_TYPE = ENTITY_TYPE.merge({ :cancelRequested => Fog::Nullable::String, :endTime => Fog::Nullable::String, :expiryTime => String, :operation => Fog::Nullable::String, :operationName => Fog::Nullable::String, :serviceNamespace => Fog::Nullable::String, :startTime => Fog::Nullable::String, :status => String, # :Tasks => TASKS_IN_PROGRESS_TYPE, # not happening! :Owner => REFERENCE_TYPE, # :Error => ERROR_TYPE, :User => REFERENCE_TYPE, :Organization => REFERENCE_TYPE, :Progress => Fog::Nullable::String, # :Params => anyType, :Details => Fog::Nullable::String }) # A list of queued, running, or recently completed tasks. TASKS_IN_PROGRESS_TYPE = { :Task => [TASK_TYPE] } # Base type that represents a resource entity such as a vApp template or # virtual media. RESOURCE_ENTITY_TYPE = ENTITY_TYPE.merge({ :status => Fog::Nullable::String, :Description => Fog::Nullable::String, # :Tasks => TASKS_IN_PROGRESS_TYPE, # :Files => FILES_LIST_TYPE }) # Container for references to ResourceEntity objects in this vDC. RESOURCE_ENTITIES_TYPE = { :ResourceEntity => [RESOURCE_REFERENCE_TYPE] } # Represents a supported virtual hardware version. SUPPORTED_HARDWARE_VERSION_TYPE = String # Contains a list of VMware virtual hardware versions supported in this # vDC. SUPPORTED_HARDWARE_VERSIONS_TYPE = { :SupportedHardwareVersion => SUPPORTED_HARDWARE_VERSION_TYPE } # Represents a base type for VAppType and VmType. ABSTRACT_VAPP_TYPE = RESOURCE_ENTITY_TYPE.merge({ :deployed => String, :DateCreated => String }) VAPP_CHILDREN_TYPE = { #:VApp => ABSTRACT_VAPP_TYPE, :Vm => [ABSTRACT_VAPP_TYPE] } # Controls access to the resource. ACCESS_SETTING_TYPE = { :Subject => REFERENCE_TYPE, :AccessLevel => String } # A list of access settings for a resource. ACCESS_SETTINGS_TYPE = { :AccessSettingType => [ACCESS_SETTING_TYPE] } # Container for references to available organization vDC networks. AVAILABLE_NETWORKS_TYPE = { :Network => [REFERENCE_TYPE] } # Collection of supported hardware capabilities. CAPABILITIES_TYPE = { :SupportedHardwareVersions => SUPPORTED_HARDWARE_VERSIONS_TYPE } # Represents the capacity of a given resource. CAPACITY_TYPE = { :Units => String, :Allocated => Fog::Nullable::String, :Limit => String } # Represents a capacity and usage of a given resource. CAPACITY_WITH_USAGE_TYPE = CAPACITY_TYPE.merge({ :Reserved => String, :Used => Fog::Nullable::String, :Overhead => Fog::Nullable::String }) # Represents vDC compute capacity. COMPUTE_CAPACITY_TYPE = { :Cpu => CAPACITY_WITH_USAGE_TYPE, :Memory => CAPACITY_WITH_USAGE_TYPE } # Represents a guest customization settings. GUEST_CUSTOMIZATION_SECTION_TYPE = { # TODO: extends Section_Type :Enabled => Fog::Nullable::String, :ChangeSid => Fog::Nullable::String, :VirtualMachineId => Fog::Nullable::String, :JoinDomainEnabled => Fog::Nullable::String, :UseOrgSettings => Fog::Nullable::String, :DomainName => Fog::Nullable::String, :DomainUserName => Fog::Nullable::String, :DomainUserPassword => Fog::Nullable::String, :MachineObjectOU => Fog::Nullable::String, :AdminPasswordEnabled => Fog::Nullable::String, :AdminPasswordAuto => Fog::Nullable::String, :AdminPassword => Fog::Nullable::String, :ResetPasswordRequired => Fog::Nullable::String, :CustomizationScript => Fog::Nullable::String, :ComputerName => String, :Link => LINK_TYPE } # Represents the owner of this entity. OWNER_TYPE = RESOURCE_TYPE.merge({ :User => REFERENCE_TYPE }) # VMware Tools and other runtime information for this virtual machine. RUNTIME_INFO_SECTION_TYPE = { # TODO: extends Section_Type :VMWareTools => { :version => Fog::Nullable::String } } # Container for references to storage profiles associated with a vDC. VDC_STORAGE_PROFILES_TYPE = { :VdcStorageProfile => [REFERENCE_TYPE] } # Allows you to specify certain capabilities of this virtual machine. VM_CAPABILITIES_TYPE = RESOURCE_TYPE.merge({ :MemoryHotAddEnabled => String, :CpuHotAddEnabled => String }) # Represents the user view of a Catalog object. CATALOG_TYPE = ENTITY_TYPE.merge({ #:Owner => OWNER_TYPE, #:CatalogItems => CATALOG_ITEMS_TYPE, :IsPublished => String, :DateCreated => String }) # Specifies access controls for a resource. CONTROL_ACCESS_PARAMS_TYPE = { :IsSharedToEveryone => String, :EveryoneAccessLevel => Fog::Nullable::String, # :AccessSettings => ACCESS_SETTINGS_TYPE } # Represents a Media object. MEDIA_TYPE = RESOURCE_ENTITY_TYPE.merge({ :imageType => String, :size => String, :Owner => OWNER_TYPE, :VdcStorageProfile => REFERENCE_TYPE }) METADATA_TYPE = RESOURCE_TYPE.merge({ #:MetadataEntry => METADATA_ENTRY_TYPE }) # Represents a list of organizations. ORG_LIST_TYPE = RESOURCE_TYPE.merge({ :Org => [REFERENCE_TYPE] }) # Represents the user view of a vCloud Director organization. ORG_TYPE = ENTITY_TYPE.merge({ :Description => Fog::Nullable::String, :Tasks => TASKS_IN_PROGRESS_TYPE, :FullName => String, :IsEnabled => Fog::Nullable::String }) # Represents a vCloud Session. SESSION_TYPE = RESOURCE_TYPE.merge({ :org => String, :user => String, :Link => [LINK_TYPE] }) # A list of tasks. TASKS_LIST_TYPE = ENTITY_TYPE.merge({ #:Task => TASK_TYPE }) # Represents a vApp. VAPP_TYPE = ABSTRACT_VAPP_TYPE.merge({ :ovfDescriptorUploaded => String, :Owner => OWNER_TYPE, :InMaintenanceMode => String, :Children => VAPP_CHILDREN_TYPE }) # Represents the user view of an organization vDC. VDC_TYPE = ENTITY_TYPE.merge({ :status => Fog::Nullable::String, :AllocationModel => String, # :StorageCapacity => CAPACITY_WITH_USAGE_TYPE, :ComputeCapacity => COMPUTE_CAPACITY_TYPE, :ResourceEntities => RESOURCE_ENTITIES_TYPE, :AvailableNetworks => AVAILABLE_NETWORKS_TYPE, :Capabilities => CAPABILITIES_TYPE, :NicQuota => String, :NetworkQuota => String, :UsedNetworkCount => String, :VmQuota => Fog::Nullable::String, :IsEnabled => Fog::Nullable::String, :VdcStorageProfiles => VDC_STORAGE_PROFILES_TYPE # >= 5.1 }) # Represents a storage profile in an organization vDC. VDC_STORAGE_PROFILE_TYPE = ENTITY_TYPE.merge({ :Enabled => Fog::Nullable::String, :Units => String, :Limit => String, :Default => String }) # Information about an individual operating system. OPERATING_SYSTEM_INFO_TYPE = { :OperatingSystemId => String, :DefaultHardDiskAdapterType => String, :MinimumHardDiskSizeGigabytes => String, :MinimumMemoryMegabytes => String, :Name => String, :InternalName => String, :Supported => String, :x64 => String, :MaximumCpuCount => String, :MinimumHardwareVersion => String, :PersonalizationEnabled => String, :PersonalizationAuto => String, :SysprepPackagingSupported => String, :SupportsMemHotAdd => String, :cimOsId => String, :CimVersion => String, :SupportedForCreate => String } # Represents an operating system family. OPERATING_SYSTEM_FAMILY_INFO_TYPE = { :Name => String, :OperatingSystemFamilyId => String, :OperatingSystem => [OPERATING_SYSTEM_INFO_TYPE] } # Operating systems available for use on virtual machines owned by this # organization. SUPPORTED_OPERATING_SYSTEMS_INFO_TYPE = RESOURCE_TYPE.merge({ :OperatingSystemFamilyInfo => [OPERATING_SYSTEM_FAMILY_INFO_TYPE] }) # Container for query results in records format. # Combine with QUERY_RESULT_RECORD_TYPE subtypes to validate query results QUERY_RESULT_RECORDS_TYPE = CONTAINER_TYPE # Base type for a single record from query result in records format. # Subtypes define more specific elements. QUERY_RESULT_RECORD_TYPE = { :href => String, :id => Fog::Nullable::String, :type => Fog::Nullable::String } # Type for a single edgeGateway query result in records format. QUERY_RESULT_EDGE_GATEWAY_RECORD_TYPE = QUERY_RESULT_RECORD_TYPE.merge({ :gatewayStatus => String, :haStatus => String, :isBusy => String, :name => String, :numberOfExtNetworks => String, :numberOfOrgNetworks=> String, :vdc => String }) FIREWALL_RULE_TYPE__PROTOCOLS = { :Icmp => Fog::Nullable::String, :Asny => Fog::Nullable::String, :Other => Fog::Nullable::String } # Represents a firewall rule. FIREWALL_RULE_TYPE = { :Id => String, :IsEnabled => String, :MatchOnTranslate => Fog::Nullable::String, :Description => Fog::Nullable::String, :Policy => Fog::Nullable::String, :IcmpSubType => Fog::Nullable::String, :Port => Fog::Nullable::String, :DestinationPortRange => String, :SourcePort => Fog::Nullable::String, :SourcePortRange => String, :Direction => Fog::Nullable::String, :EnableLogging => Fog::Nullable::String, :Protocols => FIREWALL_RULE_TYPE__PROTOCOLS } # Represents a network firewall service. FIREWALL_SERVICE_TYPE = { :IsEnabled => String, :DefaultAction => String, :LogDefaultAction => String, #:FirewallRule => [FIREWALL_RULE_TYPE] # not required } #Represents the SNAT and DNAT rules. GATEWAY_NAT_RULE_TYPE = { :Interface => REFERENCE_TYPE, :OriginalIp => String, :OriginalPort => Fog::Nullable::String, :TranslatedIp => String, :TranslatedPort => Fog::Nullable::String, :Protocol => Fog::Nullable::String, :IcmpSubType => Fog::Nullable::String } #Represents a NAT rule. NAT_RULE_TYPE = { :Description => Fog::Nullable::String, :RuleType => String, :IsEnabled => String, :Id => String, :GatewayNatRule => GATEWAY_NAT_RULE_TYPE } # Represents a NAT network service. NAT_SERVICE_TYPE = { :IsEnabled => String, :NatType => Fog::Nullable::String, :Policy => Fog::Nullable::String, #:NatRule => [NAT_RULE_TYPE], # not required :ExternalIp => Fog::Nullable::String } # Represents a service port in a load balancer pool. LB_POOL_SERVICE_PORT_TYPE = { :IsEnabled => Fog::Nullable::String, :Protocol => String, :Algorithm => Fog::Nullable::String, :Port => String, :HealthCheckPort => String, #:HealthCheck => LBPoolHealthCheckType # not required } # Represents a member in a load balancer pool. LB_POOL_MEMBER_TYPE = { :IpAddress => String, :Weight => String, :ServicePort => [LB_POOL_SERVICE_PORT_TYPE] } # Represents a load balancer pool. LOAD_BALANCER_POOL_TYPE = { :Id => Fog::Nullable::String, :Name => String, :Description => Fog::Nullable::String, :ServicePort => [LB_POOL_SERVICE_PORT_TYPE], :Member => [LB_POOL_MEMBER_TYPE], :Operational => String, :ErrorDetails => Fog::Nullable::String } # Represents persistence type for a load balancer service profile. LB_PERSISTENCE_TYPE = { :Method => String, :CookieName => Fog::Nullable::String, :CookieMode => Fog::Nullable::String } # Represents service profile for a load balancing virtual server. LB_VIRTUAL_SERVER_SERVICE_PROFILE_TYPE = { :IsEnabled => String, :Protocol => String, :Port => String, :Persistence => LB_PERSISTENCE_TYPE } # Information about a vendor service template. This is optional. VENDOR_TEMPLATE_TYPE = { :Name => String, :Id => String } # Represents a load balancer virtual server. LOAD_BALANCER_VIRTUAL_SERVER_TYPE = { :IsEnabled => String, :Name => String, :Description => Fog::Nullable::String, :Interface => REFERENCE_TYPE, :IpAddress => String, :ServiceProfile => [LB_VIRTUAL_SERVER_SERVICE_PROFILE_TYPE], :Logging => String, :Pool => String, #:LoadBalancerTemplates => VENDOR_TEMPLATE_TYPE # not required } # Represents gateway load balancer service. LOAD_BALANCER_SERVICE_TYPE = { :Pool => LOAD_BALANCER_POOL_TYPE, :VirtualServer => LOAD_BALANCER_VIRTUAL_SERVER_TYPE, :IsEnabled => Fog::Nullable::String } # Represents Gateway DHCP service. GATEWAY_DHCP_SERVICE_TYPE = { :IsEnabled => String, #:Pool => DHCP_POOL_SERVICE_TYPE # not required } # Represents edge gateway services. GATEWAY_FEATURES_TYPE = { #:StaticRoutingService => STATIC_ROUTING_SERVICE_TYPE, #not required #:GatewayIpsecVpnService => GATEWAY_IPSEC_VPN_SERVICE_TYPE, #not required #:GatewayDhcpService => GATEWAY_DHCP_SERVICE_TYPE, #not required #:LoadBalancerService => LOAD_BALANCER_SERVICE_TYPE, #not required #:NatService => NAT_SERVICE_TYPE, #not required :FirewallService => FIREWALL_SERVICE_TYPE } # Represents a range of IP addresses, start and end inclusive. IP_RANGE_TYPE = { :StartAddress => String, :EndAddress => String } # Represents a list of IP ranges. IP_RANGES_TYPE = { :IpRange => [IP_RANGE_TYPE] } # Allows to chose which subnets a gateway can be part of SUBNET_PARTICIPATION_TYPE = { :Gateway => String, :Netmask => String, :IpAddress => String, :IpRanges => IP_RANGES_TYPE } # Gateway Interface configuration. GATEWAY_INTERFACE_TYPE = { :Name => String, :DisplayName => String, :Network => REFERENCE_TYPE, :InterfaceType => String, #:SubnetParticipation => [SUBNET_PARTICIPATION_TYPE], #bug in parser means list or hash :ApplyRateLimit => String, :InRateLimit => Fog::Nullable::String, :OutRateLimit => Fog::Nullable::String, :UseForDefaultRoute => String, } # A list of Gateway Interfaces. GATEWAY_INTERFACES_TYPE = { :GatewayInterface => [GATEWAY_INTERFACE_TYPE] } # Gateway Configuration. GATEWAY_CONFIGURATION_TYPE = { :BackwardCompatibilityMode => Fog::Nullable::String, :GatewayBackingConfig => String, :GatewayInterfaces => GATEWAY_INTERFACES_TYPE, :EdgeGatewayServiceConfiguration => GATEWAY_FEATURES_TYPE, :HaEnabled => Fog::Nullable::String, :UseDefaultRouteForDnsRelay => Fog::Nullable::String } # Represents a gateway. GATEWAY_TYPE = { :href => String, :type => String, :id => String, :operationKey => Fog::Nullable::String, :name => String, :status => Fog::Nullable::String, #:Link => LINK_TYPE, # not required :Description => Fog::Nullable::String, #:Tasks => TASKS_IN_PROGRESS_TYPE, # not required :Configuration => GATEWAY_CONFIGURATION_TYPE } ORGANIZATION_REFERENCE_TYPE = REFERENCE_TYPE PROVIDER_VDC_REFERENCE_TYPE = REFERENCE_TYPE RIGHT_REFERENCE_TYPE = REFERENCE_TYPE ROLE_REFERENCE_TYPE = REFERENCE_TYPE # Represents the admin view of this cloud. ORGANIZATION_REFERENCES_TYPE = { :OrganizationReference => [REFERENCE_TYPE] } # Container for references to Provider vDCs. PROVIDER_VDC_REFERENCES_TYPE = { :ProviderVdcReference => [PROVIDER_VDC_REFERENCE_TYPE] } # Container for references to rights. RIGHT_REFERENCES_TYPE = { :RightReference => [RIGHT_REFERENCE_TYPE] } # Container for references to roles. ROLE_REFERENCES_TYPE = { :RoleReference => [ROLE_REFERENCE_TYPE] } # Container for references to ExternalNetwork objects. NETWORKS_TYPE = { :Network => [REFERENCE_TYPE] } NETWORK_CONFIGURATION_TYPE = { :IpScopes => { :IpScope => { :IsInherited => String, :Gateway => Fog::Nullable::String, :Netmask => String, :Dns1 => String, :Dns2 => String, :DnsSuffix => String, :IsEnabled=> String, :IpRanges=> IP_RANGES_TYPE, } }, :FenceMode => Fog::Nullable::String, :RetainNetInfoAcrossDeployments => String, } NETWORK_TYPE = { :name => String, :href => String, :type => String, :id => String, :Description => String, :Configuration => NETWORK_CONFIGURATION_TYPE, :IsShared => String, } VCLOUD_TYPE = ENTITY_TYPE.merge({ :OrganizationReferences => ORGANIZATION_REFERENCES_TYPE, :ProviderVdcReferences => PROVIDER_VDC_REFERENCES_TYPE, :RightReferences => RIGHT_REFERENCES_TYPE, :RoleReferences => ROLE_REFERENCES_TYPE, :Networks => NETWORKS_TYPE }) # Represents a named disk. DISK_TYPE = RESOURCE_ENTITY_TYPE.merge({ :busSubType => Fog::Nullable::String, :busType => Fog::Nullable::String, :size => String, :StorageProfile => REFERENCE_TYPE, :Owner => OWNER_TYPE }) VMS_TYPE = RESOURCE_TYPE.merge({ :VmReference => [REFERENCE_TYPE] }) end end end fog-1.34.0/tests/vcloud_director/requests/compute/groups_tests.rb0000644000004100000410000000121012600047642025343 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | groups requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new tests('#get_groups_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_groups_from_query(:format => format).body end key = (format == 'references') ? 'GroupReference' : 'GroupRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end end fog-1.34.0/tests/vcloud_director/requests/compute/vdc_tests.rb0000644000004100000410000000246512600047642024615 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | vdc requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('#get_vdc').data_matches_schema(VcloudDirector::Compute::Schema::VDC_TYPE) do link = @org[:Link].find do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end @vdc_id = link[:href].split('/').last @service.get_vdc(@vdc_id).body end tests('#get_vdc_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_vdc_metadata(@vdc_id).body end tests('#get_vdcs_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_vdcs_from_query(:format => format).body end key = (format == 'references') ? 'OrgVdcReference' : 'OrgVdcRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end tests('Retrieve non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_vdc('00000000-0000-0000-0000-000000000000') end end fog-1.34.0/tests/vcloud_director/requests/compute/ovf_descriptor_tests.rb0000644000004100000410000000252312600047642027064 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | ovf requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('Get first vDC') do session = @service.get_current_session.body link = @org[:Link].find do |l| l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end @vdc = @service.get_vdc(link[:href].split('/').last).body end # 'Envelope' is the outer type of the parsed XML document. tests('#get_vapp_ovf_descriptor').returns('Envelope') do pending if Fog.mocking? link = @vdc[:ResourceEntities][:ResourceEntity].find do |l| l[:type] == 'application/vnd.vmware.vcloud.vApp+xml' end pending if link.nil? body = @service.get_vapp_ovf_descriptor(link[:href].split('/').last).body Nokogiri::XML::Document.parse(body).children.first.name end # 'Envelope' is the outer type of the parsed XML document. tests('#get_vapp_template_ovf_descriptor').returns('Envelope') do pending if Fog.mocking? link = @vdc[:ResourceEntities][:ResourceEntity].find do |l| l[:type] == 'application/vnd.vmware.vcloud.vAppTemplate+xml' end pending if link.nil? body = @service.get_vapp_template_ovf_descriptor(link[:href].split('/').last).body Nokogiri::XML::Document.parse(body).children.first.name end end fog-1.34.0/tests/vcloud_director/requests/compute/vapp_tests.rb0000644000004100000410000001166212600047642025006 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | vapp requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('Each vDC') do @org[:Link].select do |l| l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end.each do |link| @vdc = @service.get_vdc(link[:href].split('/').last).body tests('Each vApp') do @vdc[:ResourceEntities][:ResourceEntity].select do |r| r[:type] == 'application/vnd.vmware.vcloud.vApp+xml' end.each do |v| @vapp_id = v[:href].split('/').last #tests("#get_vapp(#{@vapp_id})").data_matches_schema(VcloudDirector::Compute::Schema::VAPP_TYPE) do tests("#get_vapp(#{@vapp_id}).body").returns(Hash) do @service.get_vapp(@vapp_id).body.class end tests("#get_vapp(#{@vapp_id}).body[:name]").returns(String) do @service.get_vapp(@vapp_id).body[:name].class end tests("#get_vapp(#{@vapp_id}).body[:href]").returns(v[:href]) do @service.get_vapp(@vapp_id).body[:href] end tests("#get_lease_settings_section_vapp(#{@vapp_id})").returns(Hash) do @service.get_lease_settings_section_vapp(@vapp_id).body.class end tests("#get_lease_settings_section_vapp(#{@vapp_id}).body[:DeploymentLeaseInSeconds] is >= 0").returns(true) do Integer(@service.get_lease_settings_section_vapp(@vapp_id).body[:DeploymentLeaseInSeconds]) >= 0 end tests("#get_vapp(#{@vapp_id}).body[:LeaseSettingsSection[:DeploymentLeaseInSeconds] is >= 0").returns(true) do Integer(@service.get_vapp(@vapp_id).body[:LeaseSettingsSection][:DeploymentLeaseInSeconds]) >= 0 end tests("#get_vapp(#{@vapp_id}).body[:NetworkConfigSection]").returns(Hash) do @service.get_vapp(@vapp_id).body[:NetworkConfigSection].class end tests("#get_network_config_section_vapp(#{@vapp_id})").returns(Hash) do @service.get_network_config_section_vapp(@vapp_id).body.class end tests("#get_network_section_vapp(#{@vapp_id})").returns(Hash) do pending if Fog.mocking? @service.get_network_section_vapp(@vapp_id).body.class end tests("#get_product_sections_vapp(#{@vapp_id})").returns(Hash) do pending if Fog.mocking? @service.get_product_sections_vapp(@vapp_id).body.class end tests("#get_vapp(#{@vapp_id}).body[:'ovf:StartupSection']").returns(Hash) do @service.get_vapp(@vapp_id).body[:"ovf:StartupSection"].class end tests("#put_product_sections(#{@vapp_id})").returns(Hash) do pending if Fog.mocking? @service.put_product_sections(@vapp_id, ["a" => "1"]).body.class end tests("#get_startup_section(#{@vapp_id})").returns(Hash) do @service.get_startup_section(@vapp_id).body.class end tests("#get_vapp_metadata(#{@vapp_id})").data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_vapp_metadata(@vapp_id).body end tests("#get_vapp_owner(#{@vapp_id})").data_matches_schema(VcloudDirector::Compute::Schema::OWNER_TYPE) do @service.get_vapp_owner(@vapp_id).body end tests("#get_vapp(#{@vapp_id}).body[:Owner]").data_matches_schema(VcloudDirector::Compute::Schema::OWNER_TYPE) do @service.get_vapp(@vapp_id).body[:Owner] end tests("#get_control_access_params_vapp(#{@vapp_id})").data_matches_schema(VcloudDirector::Compute::Schema::CONTROL_ACCESS_PARAMS_TYPE) do pending if Fog.mocking? @service.get_control_access_params_vapp(@vapp_id).body end end end end end tests('#get_vapps_in_lease_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_vapps_in_lease_from_query(:format => format).body end key = (format == 'references') ? 'VAppReference' : 'VAppRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end tests('Retrieve non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do pending if Fog.mocking? @service.get_vapp('00000000-0000-0000-0000-000000000000') end tests('Retrieve owner of non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_vapp_owner('00000000-0000-0000-0000-000000000000') end tests('Delete non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do pending if Fog.mocking? @service.delete_vapp('00000000-0000-0000-0000-000000000000') end end fog-1.34.0/tests/vcloud_director/requests/compute/vm_tests.rb0000644000004100000410000001753512600047642024467 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) tests('Each vDC') do @org[:Link].select do |l| l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' end.each do |link| @vdc = @service.get_vdc(link[:href].split('/').last).body tests('Each vApp') do @vdc[:ResourceEntities][:ResourceEntity].select do |r| r[:type] == 'application/vnd.vmware.vcloud.vApp+xml' end.each do |vapp| vapp_id = vapp[:href].split('/').last vapp = @service.get_vapp(vapp_id).body tests('Each VM') do vapp[:Children][:Vm].each do |vm| vm_id = vm[:href].split('/').last tests("#get_vapp(#{vm_id}).body").returns(Hash) do @service.get_vapp(vm_id).body.class end tests("#get_vapp(#{vm_id}).body[:name]").returns(String) do @service.get_vapp(vm_id).body[:name].class end tests("#get_vapp(#{vm_id}).body[:href]").returns(vm[:href]) do @service.get_vapp(vm_id).body[:href] end tests("#get_vapp(#{vm_id}).body[:GuestCustomizationSection]").returns(Hash) do @service.get_vapp(vm_id).body[:GuestCustomizationSection].class end tests("#get_vapp(#{vm_id}).body[:GuestCustomizationSection]").data_matches_schema(VcloudDirector::Compute::Schema::GUEST_CUSTOMIZATION_SECTION_TYPE) do @service.get_vapp(vm_id).body[:GuestCustomizationSection] end tests("#get_guest_customization_system_section_vapp(#{vm_id})").returns(Hash) do @service.get_guest_customization_system_section_vapp(vm_id).body.class end tests("#get_guest_customization_system_section_vapp(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::GUEST_CUSTOMIZATION_SECTION_TYPE) do @service.get_guest_customization_system_section_vapp(vm_id).body end tests("#get_vapp(#{vm_id}).body[:NetworkConnectionSection]").returns(Hash) do @service.get_vapp(vm_id).body[:NetworkConnectionSection].class end tests("#get_network_connection_system_section_vapp(#{vm_id})").returns(Hash) do @service.get_network_connection_system_section_vapp(vm_id).body.class end tests("#get_vapp(#{vm_id}).body[:'ovf:OperatingSystemSection']").returns(Hash) do @service.get_vapp(vm_id).body[:'ovf:OperatingSystemSection'].class end tests("#get_operating_system_section(#{vm_id})").returns(Hash) do @service.get_operating_system_section(vm_id).body.class end tests("#get_product_sections_vapp(#{vm_id})").returns(Hash) do pending if Fog.mocking? @service.get_product_sections_vapp(vm_id).body.class end tests("#get_vapp(#{vm_id}).body[:RuntimeInfoSection]").data_matches_schema(VcloudDirector::Compute::Schema::RUNTIME_INFO_SECTION_TYPE) do @service.get_vapp(vm_id).body[:RuntimeInfoSection] end tests("#get_runtime_info_section_type(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::RUNTIME_INFO_SECTION_TYPE) do @service.get_runtime_info_section_type(vm_id).body end tests("#get_snapshot_section(#{vm_id})").returns(Hash) do @service.get_snapshot_section(vm_id).body.class end tests("#get_vapp(#{vm_id}).body[:VmCapabilities]").data_matches_schema(VcloudDirector::Compute::Schema::VM_CAPABILITIES_TYPE) do @service.get_vapp(vm_id).body[:VmCapabilities] end tests("#get_vm_capabilities(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::VM_CAPABILITIES_TYPE) do @service.get_vm_capabilities(vm_id).body end tests("#get_vapp(#{vm_id}).body[:'ovf:VirtualHardwareSection']").returns(Hash) do @section = @service.get_vapp(vm_id).body[:'ovf:VirtualHardwareSection'].class end tests("#get_virtual_hardware_section(#{vm_id})").returns(Hash) do pending if Fog.mocking? @section = @service.get_virtual_hardware_section(vm_id).body.class end tests("#get_cpu_rasd_item(#{vm_id})").returns(Hash) do @service.get_cpu_rasd_item(vm_id).body.class end tests("#get_disks_rasd_items_list(#{vm_id})").returns(Hash) do @service.get_disks_rasd_items_list(vm_id).body.class end tests("#get_disks_rasd_items_list(#{vm_id}).body[:Item]").returns(Array) do @service.get_disks_rasd_items_list(vm_id).body[:Item].class end tests("#get_media_drives_rasd_items_list(#{vm_id})").returns(Hash) do @service.get_media_drives_rasd_items_list(vm_id).body.class end tests("#get_media_drives_rasd_items_list(#{vm_id}).body[:Item]").returns(Array) do @service.get_media_drives_rasd_items_list(vm_id).body[:Item].class end tests("#get_memory_rasd_item(#{vm_id})").returns(Hash) do @service.get_memory_rasd_item(vm_id).body.class end tests("#get_vapp(#{vm_id}) ovf:VirtualHardwareSection has a Network adapter listed").returns(Hash) do @service.get_vapp(vm_id).body[:'ovf:VirtualHardwareSection'][:'ovf:Item'].detect do |rasd_item| rasd_item[:'rasd:ElementName'] =~ /^Network adapter/ end.class end tests("#get_network_cards_items_list(#{vm_id})").returns(Hash) do @service.get_network_cards_items_list(vm_id).body.class end tests("#get_serial_ports_items_list(#{vm_id})").returns(Hash) do pending if Fog.mocking? @service.get_serial_ports_items_list(vm_id).body.class end tests("#get_vapp_metadata(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending if Fog.mocking? @service.get_vapp_metadata(vm_id).body end tests("#post_acquire_ticket(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do pending # result depends on power state @service.post_acquire_ticket(vm_id).body end end end end end end end tests('#get_vms_in_lease_from_query') do pending if Fog.mocking? %w[idrecords records references].each do |format| tests(":format => #{format}") do tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do @body = @service.get_vms_in_lease_from_query(:format => format).body end key = (format == 'references') ? 'VMReference' : 'VMRecord' tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) } end end end #tests('Retrieve non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do # pending if Fog.mocking? # @service.get_vapp('00000000-0000-0000-0000-000000000000') #end #tests('Retrieve owner of non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do # pending if Fog.mocking? # @service.get_vapp_owner('00000000-0000-0000-0000-000000000000') #end #tests('Delete non-existent vApp').raises(Fog::Compute::VcloudDirector::Forbidden) do # pending if Fog.mocking? # @service.delete_vapp('00000000-0000-0000-0000-000000000000') #end end fog-1.34.0/tests/vcloud_director/fixtures/0000755000004100000410000000000012600047642020605 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/fixtures/test.iso0000644000004100000410000000001612600047642022275 0ustar www-datawww-dataNOT A REAL ISOfog-1.34.0/tests/vcloud_director/ensure_list_tests.rb0000644000004100000410000000505512600047642023044 0ustar www-datawww-dataShindo.tests('Compute::VcloudDirector | ensure_list!', ['vclouddirector']) do # ensure list is not available in mocking mode unless Fog.mocking? @service = Fog::Compute::VcloudDirector.new tests('#ensure_list! for single key ensures our key has an array as a value') do tests('for key with a hash').returns(Array) do testdata = {:k => {:A => '1'}} @service.ensure_list!(testdata, :k) testdata[:k].class end tests('for key with empty array').returns(Array) do testdata = {:k => []} @service.ensure_list!(testdata, :k) testdata[:k].class end tests('for key with nothing').returns(Array) do testdata = {} @service.ensure_list!(testdata, :k) testdata[:k].class end tests('for key with non-empty array').returns(Array) do testdata = {:k => ['one', 'two']} @service.ensure_list!(testdata, :k) testdata[:k].class end end tests('#ensure_list! for nested keys ensures that the child key has an array as a value') do tests('with no key').returns(Array) do testdata = {} @service.ensure_list!(testdata, :keys, :key) testdata[:keys][:key].class end tests('with empty string').returns(Array) do testdata = {:keys => ''} @service.ensure_list!(testdata, :keys, :key) testdata[:keys][:key].class end tests('with nested hashes').returns(Array) do testdata = {:keys => {:key => {:a => '1'}}} @service.ensure_list!(testdata, :keys, :key) testdata[:keys][:key].class end end tests('#ensure_list! with parent and child keys does not effect existing data') do tests('for existing array').returns([:one, :two]) do testdata = {:keys => {:key => [:one, :two]}} @service.ensure_list!(testdata, :keys, :key) testdata[:keys][:key] end tests('for existing hash').returns([{:one => :two}]) do testdata = {:keys => {:key => {:one => :two}}} @service.ensure_list!(testdata, :keys, :key) testdata[:keys][:key] end end tests('#ensure_list! with single key does not effect existing data') do tests('for existing array').returns([:one, :two]) do testdata = {:k => [:one, :two]} @service.ensure_list!(testdata, :k) testdata[:k] end tests('for existing hash').returns([{:one => 'two'}]) do testdata = {:k => {:one => 'two'}} @service.ensure_list!(testdata, :k) testdata[:k] end end end end fog-1.34.0/tests/vcloud_director/models/0000755000004100000410000000000012600047642020217 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/models/compute/0000755000004100000410000000000012600047642021673 5ustar www-datawww-datafog-1.34.0/tests/vcloud_director/models/compute/vdcs_tests.rb0000644000004100000410000000420512600047642024402 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | vdcs", ['vclouddirector', 'all']) do tests("#There is one or more vdc").returns(true){ organization.vdcs.size >= 1 } vdcs = organization.vdcs vdc = vdcs.first tests("Compute::VcloudDirector | vdc") do tests("#id").returns(String) { vdc.id.class } tests("#name").returns(String) { vdc.name.class } tests("#href").returns(String) { vdc.href.class } tests("#type").returns("application/vnd.vmware.vcloud.vdc+xml") { vdc.type } end tests("Compute::VcloudDirector | vdc", ['lazy load attrs']) do vdc.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { vdc.attributes[lazy_attr] } end end tests("Compute::VcloudDirector | vdc", ['load on demand']) do tests("#description is not loaded yet").returns(NonLoaded) { vdc.attributes[:description] } tests("#description is loaded on demand").returns(String) { vdc.description.class } tests("#description is now loaded").returns(true) { vdc.attributes[:description] != NonLoaded } end tests("Compute::VcloudDirector | vdc", ['lazy load attrs']) do lazy_attrs = vdc.lazy_load_attrs lazy_attrs.delete(:storage_capacity) if vcloud_director.api_version.to_f >= 5.1 lazy_attrs.each do |lazy_attr| tests("##{lazy_attr} is now loaded").returns(true) { vdc.attributes[lazy_attr] != NonLoaded } end end tests("Compute::VcloudDirector | vdc", ['get']) do tests("#get_by_name").returns(vdc.name) { vdcs.get_by_name(vdc.name).name } tests("#get").returns(vdc.id) { vdcs.get(vdc.id).id } end pending if Fog.mocking? # We should also be able to find this same vdc via Query API tests("Compute::VcloudDirector | vdcs", ['find_by_query']) do tests('we can retrieve :name without lazy loading').returns(vdc.name) do query_vdc = vdcs.find_by_query(:filter => "name==#{vdc.name}").first query_vdc.attributes[:name] end tests('by name').returns(vdc.name) do query_vdc = vdcs.find_by_query(:filter => "name==#{vdc.name}").first query_vdc.name end end end fog-1.34.0/tests/vcloud_director/models/compute/helper.rb0000644000004100000410000000202612600047642023477 0ustar www-datawww-datarequire 'fog/vcloud_director/compute' def boolean?(item) [TrueClass, FalseClass].include?(item.class) end def vcloud_director @vcloud_director ||= Fog::Compute::VcloudDirector.new( :connection_options => { :ssl_verify_peer => false, :connect_timeout => 200, :read_timeout => 200 } ) end def organizations @organizations ||= vcloud_director.organizations end def organization @organization ||= organizations.get_by_name(vcloud_director.org_name) end def catalogs @catalogs ||= organization.catalogs end def catalog catalogs.first end def vdcs @vdcs ||= organization.vdcs end def vdc vdcs.first end def vapps @vapps ||= vdc.vapps end def vapp vapps.find {|vapp| vapp.vms.size >= 1 } end def the_network @network ||= organization.networks.get_by_name(NETWORK_NAME) end def the_catalog @catalog ||= organization.catalogs.get_by_name(CATALOG_NAME) end def the_catalog_item return nil unless the_catalog @catalog_item ||= the_catalog.catalog_items.get_by_name(CATALOG_ITEM_NAME) end fog-1.34.0/tests/vcloud_director/models/compute/catalogs_tests.rb0000644000004100000410000000331412600047642025240 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | catalogs", ['vclouddirector', 'all']) do pending if Fog.mocking? pending if organization.catalogs.empty? catalogs = organization.catalogs tests("#There is one or more catalog").returns(true) { catalogs.size >= 1 } catalog = catalogs.first tests("Compute::VcloudDirector | catalog") do tests("#id").returns(String){ catalog.id.class } tests("#name").returns(String){ catalog.name.class } tests("#href").returns(String){ catalog.href.class } tests("#type").returns("application/vnd.vmware.vcloud.catalog+xml"){ catalog.type } end tests("Compute::VcloudDirector | catalog", ['lazy load attrs']) do catalog.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { catalog.attributes[lazy_attr] } end end tests("Compute::VcloudDirector | catalog", ['load on demand']) do tests("#description is not loaded yet").returns(NonLoaded) { catalog.attributes[:description] } tests("#description is loaded on demand").returns(String) { catalog.description.class } tests("#description is now loaded").returns(true) { catalog.attributes[:description] != NonLoaded } end tests("Compute::VcloudDirector | catalog", ['lazy load attrs']) do catalog.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is now loaded").returns(true) { catalog.attributes[lazy_attr] != NonLoaded } end end tests("Compute::VcloudDirector | catalog", ['get']) do tests("#get_by_name").returns(catalog.name) { catalogs.get_by_name(catalog.name).name } tests("#get").returns(catalog.id) { catalogs.get(catalog.id).id } end end fog-1.34.0/tests/vcloud_director/models/compute/organizations_tests.rb0000644000004100000410000000141312600047642026330 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | organizations", ['vclouddirector', 'all']) do organizations = vcloud_director.organizations tests("#There is at least one organization").returns(true) { organizations.size >= 1 } org = organizations.get_by_name(vcloud_director.org_name) tests("Compute::VcloudDirector | organization") do tests("#name").returns(String) { org.name.class } tests("#type").returns("application/vnd.vmware.vcloud.org+xml") { org.type } end tests("Compute::VcloudDirector | organization", ['get']) do tests("#get_by_name").returns(org.name) { organizations.get_by_name(org.name).name } tests("#get").returns(org.id) { organizations.get(org.id).id } end end fog-1.34.0/tests/vcloud_director/models/compute/vapp_life_cycle_tests.rb0000644000004100000410000001012712600047642026567 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) VAPP_NAME = "shindo07" NETWORK_NAME = "DevOps - Dev Network Connection" NETWORK_MODE = "POOL" CATALOG_NAME = "Public VM Templates" CATALOG_ITEM_NAME = "DEVWEB" TAGS = { :company => "acme", :environment => "testing" } Shindo.tests("Compute::VcloudDirector | vapp", ['vclouddirector', 'creation']) do pending if Fog.mocking? pending # FIXME: vCloud environment needs to be set up in advance tests("#it creates a vApp from a catalog item").returns(true){ the_catalog_item.instantiate(VAPP_NAME, { :network_id => the_network.id, :network_name => NETWORK_NAME}) } vapp = vapps.get_by_name(VAPP_NAME) tests("#Finds the just created vApp").returns(VAPP_NAME) { vapp.name } tests("#it has one vm").returns(1) { vapp.vms.size} tests("Compute::VcloudDirector | vm", ['configuration']) do vm = vapp.vms.first tests("Compute::VcloudDirector | vm", ['network']) do network = vm.network network.network = NETWORK_NAME network.is_connected = true network.ip_address_allocation_mode = NETWORK_MODE tests("save network changes").returns(true){ network.save } network.reload tests("#network").returns(NETWORK_NAME) { network.network } tests("#is_connected").returns(true) { network.is_connected } tests("#ip_address_allocation_mode").returns(NETWORK_MODE) { network.ip_address_allocation_mode } end tests("Compute::VcloudDirector | vm", ['customization']) do customization = vm.customization customization.script = 'this is the user data' customization.enabled = true tests("save customization changes").returns(true){ customization.save } tests("#script").returns('this is the user data') { customization.script } tests("#enabled").returns(true) { customization.enabled } end tests("Compute::VcloudDirector | vm", ['doble the disk size']) do disk = vm.disks.get_by_name('Hard disk 1') tests("#disk_size").returns(Fixnum) { disk.capacity.class} new_size = disk.capacity * 2 disk.capacity = new_size disk.reload tests("#disk_size is now doubled").returns(new_size) { disk.capacity } end tests("Compute::VcloudDirector | vm", ['add a new disk']) do tests("hard disk 2 doesn't exist").returns(nil) { vm.disks.get_by_name('Hard disk 2') } tests("#create").returns(true) { vm.disks.create(1024) } tests("hard disk 2 exists").returns(1024) { vm.disks.get_by_name('Hard disk 2').capacity } tests("delete disk 2").returns(true) { vm.disks.get_by_name('Hard disk 2').destroy } tests("hard disk 2 doesn't exist anymore").returns(nil) { vm.disks.get_by_name('Hard disk 2') } end tests("Compute::VcloudDirector | vm", ['doble the memory size']) do tests("#memory").returns(Fixnum) { vm.memory.class} new_size = vm.memory * 2 vm.memory = new_size vm.reload tests("#memory is now doubled").returns(new_size) { vm.memory } end tests("Compute::VcloudDirector | vm", ['doble the cpu size']) do tests("#cpu").returns(Fixnum) { vm.cpu.class} new_size = vm.cpu * 2 vm.cpu = new_size vm.reload tests("#memory is now doubled").returns(new_size) { vm.cpu } end tests("Compute::VcloudDirector | vm", ['tags']) do TAGS.each_pair do |k,v| tests('create tag').returns(true) {vm.tags.create(k, v)} end tests('there are two tags').returns(2){ vm.tags.size } tests('#get_by_name').returns("acme"){ vm.tags.get_by_name('company').value } tests('#get_by_name').returns("testing"){ vm.tags.get_by_name('environment').value } tests('delete company').returns(true){ vm.tags.get_by_name('company').destroy } tests("company doesn't exists anymore").returns(nil){ vm.tags.get_by_name('company') } tests('there is only one tag').returns(1){ vm.tags.size } end tests("Compute::VcloudDirector | vm", ['power on']) do tests('#vm is off').returns("off"){ vm.status } tests('#power_on').returns(true){ vm.power_on } vm.reload tests('#vm is on').returns("on"){ vm.status } end end end fog-1.34.0/tests/vcloud_director/models/compute/catalog_items_tests.rb0000644000004100000410000000355112600047642026261 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | catalog_items", ['vclouddirector', 'all']) do pending if Fog.mocking? pending if catalog.nil? catalog_items = catalog.catalog_items pending if catalog_items.empty? tests("#There is one or more catalog item").returns(true) { catalog_items.size >= 1 } catalog_item = catalog_items.first tests("Compute::VcloudDirector | catalog_item") do tests("#id").returns(String){ catalog_item.id.class } tests("#name").returns(String){ catalog_item.name.class } tests("#href").returns(String){ catalog_item.href.class } tests("#type").returns("application/vnd.vmware.vcloud.catalogItem+xml"){ catalog_item.type } end tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do catalog_item.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { catalog_item.attributes[lazy_attr] } end end tests("Compute::VcloudDirector | catalog_item", ['load on demand']) do tests("#description is not loaded yet").returns(NonLoaded) { catalog_item.attributes[:description] } tests("#description is loaded on demand").returns(String) { catalog_item.description.class } tests("#description is now loaded").returns(true) { catalog_item.attributes[:description] != NonLoaded } end tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do catalog.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is now loaded").returns(true) { catalog_item.attributes[lazy_attr] != NonLoaded } end end tests("Compute::VcloudDirector | catalog_item", ['get']) do tests("#get_by_name").returns(catalog_item.name) { catalog_items.get_by_name(catalog_item.name).name } tests("#get").returns(catalog_item.id) { catalog_items.get(catalog_item.id).id } end end fog-1.34.0/tests/vcloud_director/models/compute/vms_tests.rb0000644000004100000410000001176412600047642024260 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | vms", ['vclouddirector', 'all']) do pending if Fog.mocking? vapp = vapps.find {|v| v.vms.size >= 1} # we can't run these tests if there is no vapps with a vm in them pending unless vapp vms = vapp.vms vm = vms.first tests("Compute::VcloudDirector | vm") do tests("#model").returns(Fog::Compute::VcloudDirector::Vm){vm.class} tests("#id").returns(String){ vm.id.class } tests("#name").returns(String){ vm.name.class } tests("#href").returns(String){ vm.href.class } tests("#type").returns("application/vnd.vmware.vcloud.vm+xml"){ vm.type } tests("#vapp_id").returns(String){ vm.vapp_id.class } tests("#status").returns(String){ vm.status.class } tests("#operating_system").returns(String){ vm.operating_system.class } tests("#ip_address").returns(String){ vm.ip_address.class } tests("#cpu").returns(Fixnum){ vm.cpu.class } tests("#memory").returns(Fixnum){ vm.memory.class } tests("#hard_disks").returns(Array){ vm.hard_disks.class } end tests("Compute::VcloudDirector | vm", ['get']) do tests("#get_by_name").returns(vm.name) { vms.get_by_name(vm.name).name } tests("#get").returns(vm.id) { vms.get(vm.id).id } end tests("Compute::VcloudDirector | vm | disks") do tests("#collection").returns(Fog::Compute::VcloudDirector::Disks){ vm.disks.class } tests("#get_by_name").returns(Fog::Compute::VcloudDirector::Disk) { vm.disks.get_by_name("Hard disk 1").class } hard_disk = vm.disks.get_by_name("Hard disk 1") tests("#id").returns(2000){ hard_disk.id } tests("#name").returns("Hard disk 1"){ hard_disk.name } tests("#description").returns("Hard disk"){ hard_disk.description } tests("#resource_type").returns(17){ hard_disk.resource_type } tests("#address_on_parent").returns(0){ hard_disk.address_on_parent } tests("#parent").returns(2){ hard_disk.parent } tests("#capacity").returns(Fixnum){ hard_disk.capacity.class } tests("#bus_sub_type").returns(String){ hard_disk.bus_sub_type.class } tests("#bus_type").returns(6){ hard_disk.bus_type } end tests("Compute::VcloudDirector | vm | customization") do customization = vm.customization tests("#model").returns(Fog::Compute::VcloudDirector::VmCustomization){customization.class} tests("#id").returns(String){ customization.id.class } tests("#href").returns(String){ customization.href.class } tests("#type").returns("application/vnd.vmware.vcloud.guestCustomizationSection+xml"){ customization.type } tests("#virtual_machine_id").returns(String){ customization.virtual_machine_id.class } tests("#computer_name").returns(String){ customization.computer_name.class } tests("#enabled").returns(true){ boolean? customization.enabled } tests("#change_sid").returns(true){ boolean? customization.change_sid } tests("#join_domain_enabled").returns(true){ boolean? customization.join_domain_enabled } tests("#use_org_settings").returns(true){ boolean? customization.use_org_settings } tests("#admin_password_enabled").returns(true){ boolean? customization.admin_password_enabled } tests("#reset_password_required").returns(true){ boolean? customization.reset_password_required } end tests("Compute::VcloudDirector | vm | network") do network = vm.network tests("#model").returns(Fog::Compute::VcloudDirector::VmNetwork){network.class} tests("#id").returns(String){ network.id.class } tests("#href").returns(String){ network.href.class } tests("#type").returns("application/vnd.vmware.vcloud.networkConnectionSection+xml"){ network.type } tests("#info").returns(String){ network.info.class } tests("#primary_network_connection_index").returns(Fixnum){ network.primary_network_connection_index.class } tests("#network").returns(String){ network.network.class } tests("#network_connection_index").returns(Fixnum){ network.network_connection_index.class } tests("#mac_address").returns(String){ network.mac_address.class } tests("#ip_address_allocation_mode").returns(String){ network.ip_address_allocation_mode.class } tests("#needs_customization").returns(true){ boolean? network.needs_customization } tests("#is_connected").returns(true){ boolean? network.is_connected } end tests("Compute::VcloudDirector | vm | tags") do tags = vm.tags tests("#collection").returns(Fog::Compute::VcloudDirector::Tags){ tags.class } end # We should also be able to find this VM via Query API # :name is not unique for VMs though, so let us query by href tests("Compute::VcloudDirector | vm", ['find_by_query']) do tests('we can retrieve :name without lazy loading').returns(vm.name) do query_vm = vms.find_by_query(:filter => "href==#{vm.href}").first query_vm.attributes[:name] end tests('we can retrieve name via model object returned by query').returns(vm.name) do query_vm = vms.find_by_query(:filter => "href==#{vm.href}").first query_vm.name end end end fog-1.34.0/tests/vcloud_director/models/compute/tasks_tests.rb0000644000004100000410000000377012600047642024576 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests('Compute::VcloudDirector | tasks', ['vclouddirector']) do @service = Fog::Compute::VcloudDirector.new() if Fog.mocking? # add a bunch of tasks 50.times do task_id = @service.enqueue_task( "Bogus Task", 'BogusTaskName', { :href => 'https://example.com/api/bogus/12345678-1234-1234-1234-123456789012', :name => 'Bogus object', :type => 'application/vnd.vmware.vcloud.bogus+xml' } ) end end tasks = organization.tasks pending if tasks.empty? task = tasks.first tests('Compute::VcloudDirector | task') do tests('#href').returns(String) { task.href.class } tests('#type').returns('application/vnd.vmware.vcloud.task+xml') { task.type } tests('#id').returns(String) { task.id.class } tests('#name').returns(String) { task.name.class } tests('#status').returns(String) { task.status.class } tests('#end_time').returns(Time) { task.end_time.class } tests('#expiry_time').returns(Time) { task.expiry_time.class } tests('#operation').returns(String) { task.operation.class } tests('#operation_name').returns(String) { task.operation_name.class } end tests('Compute::VcloudDirector | task', ['get']) do tests('#get_by_name').returns(task.name) { tasks.get_by_name(task.name).name } tests('#get').returns(task.id) { tasks.get(task.id).id } end # We should also be able to find tasks via the Query API # NB: Query name == task.operation_name tests("Compute::VcloudDirector | tasks", ['find_by_query']) do tests('we can retrieve :name without lazy loading').returns(task.operation_name) do query_task = tasks.find_by_query(:filter => "name==#{task.operation_name}").first query_task.attributes[:name] end tests('by name').returns(task.operation_name) do query_task = tasks.find_by_query(:filter => "name==#{task.operation_name}").first query_task.name end end end fog-1.34.0/tests/vcloud_director/models/compute/network_tests.rb0000644000004100000410000001121712600047642025135 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | networks", ['vclouddirector', 'all']) do # unless there is at least one network we cannot run these tests pending if organization.networks.empty? service = Fog::Compute::VcloudDirector.new networks = organization.networks network_raw = nil # Run initial tests against a natRouted network, since these # are more likely to be created, and must be populated with # Gateway and EdgeGateway sections network = networks.find do |net| network_raw = service.get_network_complete(net.id).body network_raw[:Configuration][:FenceMode] == 'natRouted' end # We don't have a sufficiently populated natRouted network to test against pending if network_raw.nil? UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ IP_REGEX = /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ tests("Compute::VcloudDirector | network") do tests("#id").returns(0) { network.id =~ UUID_REGEX } tests("#name").returns(String) { network.name.class } tests("#href").returns(String) { network.href.class } tests("#type").returns("application/vnd.vmware.vcloud.orgNetwork+xml"){ network.type } end tests("Compute::VcloudDirector | network", ['lazy load attrs']) do network.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { network.attributes[lazy_attr] } end end tests("Compute::VcloudDirector | network", ['load on demand']) do network_raw_gateway = network_raw[:Configuration][:IpScopes][:IpScope][:Gateway] tests("#gateway is not loaded yet").returns(NonLoaded) { network.attributes[:gateway] } tests("#gateway is loaded on demand").returns(network_raw_gateway) { network.gateway } tests("#gateway is now loaded").returns(true) { network.attributes[:gateway] != NonLoaded } end tests("Compute::VcloudDirector | network", ['all lazy load attrs should now be loaded with data']) do network.lazy_load_attrs.each do |field| tests("##{field.to_s} is now loaded").returns(true) { network.attributes[field] != NonLoaded } end end tests("Compute::VcloudDirector | network", ['ip_ranges is an array of start-end pairs']) do tests("#ip_ranges is an Array").returns(Array) { network.ip_ranges.class } network.ip_ranges.each do |range| tests("each ip_range has a :start_address").returns(0) { range[:start_address] =~ IP_REGEX } tests("each ip_range has an :end_address").returns(0) { range[:end_address] =~ IP_REGEX } end end tests("Compute::VcloudDirector | network", ['is_shared is a string boolean']) do tests("#is_shared is either 'true' or 'false'").returns(true) { [ 'false', 'true' ].include?(network.is_shared) } end # NB: get_by_name is buggy with orgVdcNetworks - network names are only # unique per-vDC, not per organization. # As a result, it returns the *first* network matching that name. tests("Compute::VcloudDirector | networks", ['get']) do tests("#get_by_name").returns(network.name) { networks.get_by_name(network.name).name } tests("#get").returns(network.id) { networks.get(network.id).id } end # Now let's also check against an isolated network, since these have some # additional features like DHCP ServiceConfigurations. isolated_network_raw = nil isolated_network = networks.find do |net| isolated_network_raw = service.get_network_complete(net.id).body isolated_network_raw[:Configuration][:FenceMode] == 'isolated' end pending if isolated_network_raw.nil? tests("Compute::VcloudDirector | isolated network", ['load on demand']) do tests("#fence_mode is not loaded yet").returns(NonLoaded) { isolated_network.attributes[:fence_mode] } tests("#fence_mode is loaded on demand").returns('isolated') { isolated_network.fence_mode } tests("#fence_mode is now loaded").returns(true) { isolated_network.attributes[:fence_mode] != NonLoaded } end # We should also be able to find these same networks via Query API tests("Compute::VcloudDirector | networks", ['find_by_query']) do tests('we can retrieve :name without lazy loading').returns(network.name) do query_network = networks.find_by_query(:filter => "name==#{network.name}").first query_network.attributes[:name] end tests('by name: natRouted').returns(network.name) do query_network = networks.find_by_query(:filter => "name==#{network.name}").first query_network.name end tests('by name: isolated').returns(isolated_network.name) do query_network = networks.find_by_query(:filter => "name==#{isolated_network.name}").first query_network.name end end end fog-1.34.0/tests/vcloud_director/models/compute/media_tests.rb0000644000004100000410000000435012600047642024523 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests('Compute::VcloudDirector | media', ['vclouddirector']) do pending if Fog.mocking? medias = vdc.medias media_name = VcloudDirector::Compute::Helper.test_name tests('Compute::VcloudDirector | media', ['create']) do tests('#create').returns(Fog::Compute::VcloudDirector::Media) do File.open(VcloudDirector::Compute::Helper.fixture('test.iso'), 'rb') do |iso| medias.create(media_name, iso).class end end end media = medias.get_by_name(media_name) tests('Compute::VcloudDirector | media') do tests('#href').returns(String) { media.href.class } tests('#type').returns('application/vnd.vmware.vcloud.media+xml') { media.type } tests('#id').returns(String) { media.id.class } tests('#name').returns(String) { media.name.class } end tests('Compute::VcloudDirector | media', ['lazy load attrs']) do media.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { media.attributes[lazy_attr] } end end tests('Compute::VcloudDirector | media', ['load on demand']) do tests('#description is not loaded yet').returns(NonLoaded) { media.attributes[:description] } tests('#description is loaded on demand').returns(String) { media.description.class } tests('#description is now loaded').returns(true) { media.attributes[:description] != NonLoaded } end tests('Compute::VcloudDirector | media', ['lazy load attrs']) do media.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is now loaded").returns(true) { media.attributes[lazy_attr] != NonLoaded } end end tests('Compute::VcloudDirector | media' ['attributes']) do tests('#status').returns(Fixnum) { media.status.class } tests('#image_type').returns(String) { media.image_type.class } tests('#size').returns(Fixnum) { media.size.class } end tests('Compute::VcloudDirector | media', ['get']) do tests('#get_by_name').returns(media.name) { medias.get_by_name(media.name).name } tests('#get').returns(media.id) { medias.get(media.id).id } end tests('Compute::VcloudDirector | media', ['destroy']) do tests('#destroy').returns(true) { media.destroy } end end fog-1.34.0/tests/vcloud_director/models/compute/vapp_tests.rb0000644000004100000410000000472612600047642024421 0ustar www-datawww-datarequire File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | vapps", ['vclouddirector', 'all']) do # unless there is atleast one vapp we cannot run these tests pending if vdc.vapps.empty? vapps = vdc.vapps vapp = vapps.first tests("Compute::VcloudDirector | vapp") do tests("#id").returns(String){ vapp.id.class } tests("#name").returns(String){ vapp.name.class } tests("#href").returns(String){ vapp.href.class } tests("#type").returns("application/vnd.vmware.vcloud.vApp+xml"){ vapp.type } end tests("Compute::VcloudDirector | vapp", ['lazy load attrs']) do vapp.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { vapp.attributes[lazy_attr] } end end tests("Compute::VcloudDirector | vapp", ['load on demand']) do tests("#description is not loaded yet").returns(NonLoaded) { vapp.attributes[:description] } tests("#description is loaded on demand").returns(String) { vapp.description.class } tests("#description is now loaded").returns(true) { vapp.attributes[:description] != NonLoaded } end tests("Compute::VcloudDirector | vapp", ['lazy load attrs']) do vapp.lazy_load_attrs.each do |lazy_attr| tests("##{lazy_attr} is now loaded").returns(true) { vapp.attributes[lazy_attr] != NonLoaded } end end tests("Compute::VcloudDirector | vapp", ['get']) do tests("#get_by_name").returns(vapp.name) { vapps.get_by_name(vapp.name).name } tests("#get").returns(vapp.id) { vapps.get(vapp.id).id } end tests("Compute::VcloudDirector | vapp", ['custom_fields']) do pending if Fog.mocking? tests("#set_custom_field").returns('2'){ vapp.custom_fields[:custom_field] = '2' } tests("#get_custom_field_by_name").returns('2') { vapp.custom_fields[:custom_field].value } tests("#delete_custom_field").returns([]){ vapp.custom_fields.delete(:custom_field); vapp.custom_fields } end # We should also be able to find this vApp via Query API tests("Compute::VcloudDirector | vapps", ['find_by_query']) do tests('we can retrieve :name without lazy loading').returns(vapp.name) do query_vapp = vapps.find_by_query(:filter => "name==#{vapp.name}").first query_vapp.attributes[:name] end tests('we can retrieve name via model object returned by query').returns(vapp.name) do query_vapp = vapps.find_by_query(:filter => "name==#{vapp.name}").first query_vapp.name end end end fog-1.34.0/tests/ibm/0000755000004100000410000000000012600047642014314 5ustar www-datawww-datafog-1.34.0/tests/ibm/requests/0000755000004100000410000000000012600047642016167 5ustar www-datawww-datafog-1.34.0/tests/ibm/requests/storage/0000755000004100000410000000000012600047642017633 5ustar www-datawww-datafog-1.34.0/tests/ibm/requests/storage/volume_tests.rb0000644000004100000410000000620712600047642022716 0ustar www-datawww-dataShindo.tests('Fog::Storage[:ibm] | volume requests', ['ibm']) do @volume_format = { "id" => String, "instanceId" => Fog::Nullable::String, "name" => String, "format" => String, "state" => Integer, "size" => String, "offeringId" => String, "owner" => String, "createdTime" => Integer, "location" => String, "productCodes" => Array, } @full_volume_format = @volume_format.merge({ "ioPrice" => { "rate" => Float, "unitOfMeasure" => String, "countryCode" => String, "effectiveDate" => Integer, "currencyCode" => String, "pricePerQuantity" => Integer, } }) @volumes_format = { 'volumes' => [ @volume_format ] } tests('success') do @volume_id = nil @name = "fog-test-volume" + Time.now.to_i.to_s(32) @format = "RAW" @location_id = "41" @size = "256" @offering_id = "20001208" @instance_id = nil @image_id = "20010001" @instance_type = "BRZ32.1/2048/60*175" # Instance-using tests are pending, so don't create the key now # @key_name = "fog-test-key-" + Time.now.to_i.to_s(32) # @key = Fog::Compute[:ibm].keys.create(:name => @key_name) tests("#create_volume('#{@name}', '#{@offering_id}', '#{@format}', '#{@location_id}', '#{@size}')").formats(@volume_format) do data = Fog::Storage[:ibm].create_volume(@name, @offering_id, @format, @location_id, @size).body @volume_id = data['id'] data end tests("#list_volumes").formats(@volumes_format) do Fog::Storage[:ibm].list_volumes.body end tests("#get_volume('#{@volume_id}')").formats(@full_volume_format) do Fog::Storage[:ibm].get_volume(@volume_id).body end # Tests which use this instance are pending # @instance_id = Fog::Compute[:ibm].create_instance( # 'fog-test-volume-instance-' + Time.now.to_i.to_s(32), # @image_id, # @instance_type, # @location_id, # :key_name => @key_name # ).body['instances'][0]['id'] tests("#attach_volume('#{@instance_id}','#{@volume_id}')") do pending # TODO: Add assertions for this whenever it is properly supported Fog::Compute[:ibm].modify_instance(@instance_id, 'type' => 'attach', 'volume_id' => @volume_id) end tests("#detach_volume('#{@instance_id}','#{@volume_id}')") do pending # TODO: Add assertions for this whenever it is properly supported Fog::Compute[:ibm].modify_instance(@instance_id, 'type' => 'attach', 'volume_id' => @volume_id) Fog::Compute[:ibm].delete_instance(@instance_id) end Fog::Storage[:ibm].volumes.get(@volume_id).wait_for(Fog::IBM.timeout) { ready? } tests("#delete_volume('#{@volume_id}')") do returns(true) { Fog::Storage[:ibm].delete_volume(@volume_id).body['success'] } end # See above # @server = Fog::Compute[:ibm].servers.get(@instance_id) # @server.wait_for(Fog::IBM.timeout) { ready? } # @server.destroy # @key.wait_for(Fog::IBM.timeout) { instance_ids.empty? } # @key.destroy end end fog-1.34.0/tests/ibm/requests/compute/0000755000004100000410000000000012600047642017643 5ustar www-datawww-datafog-1.34.0/tests/ibm/requests/compute/image_tests.rb0000644000004100000410000000615612600047642022504 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do @image_format = { 'state' => Integer, 'visibility' => String, 'platform' => String, 'owner' => String, 'architecture' => Fog::Nullable::String, 'createdTime' => Integer, 'location' => String, 'productCodes' => Array, 'name' => String, 'id' => String, 'description' => String, 'supportedInstanceTypes' => Array, 'manifest' => Fog::Nullable::String, 'documentation' => Fog::Nullable::String, } # TODO: Actually check this format @product_code_format = { 'detail' => String, 'label' => String, 'price' => @price_format, 'id' => String } # TODO: Actually check this format @price_format = { 'rate' => Float, 'unitOfMeasure' => String, 'effectiveDate' => Integer, 'currencyCode' => String, 'pricePerQuantity' => Integer } @images_format = { 'images' => [ @image_format ] } @create_image_format = { "name" => String, "createdTime" => Integer, "productCodes"=> Array, "id" => String, "description" => String, "visibility" => String, "state" => Integer } @instance_id = nil @name = "fog-test-image-instance-" + Time.now.to_i.to_s(32) @image_id = "20010001" @instance_type = "BRZ32.1/2048/60*175" @location = "41" @id = nil @cloned_id = nil @image_name = "fog test create image" @key_name = "fog-test-key-" + Time.now.to_i.to_s(32) @key = Fog::Compute[:ibm].keys.create(:name => @key_name) tests('success') do tests("#list_images").formats(@images_format) do Fog::Compute[:ibm].list_images.body end tests('#get_image').formats(@image_format) do Fog::Compute[:ibm].get_image("20010001").body end tests('#create_image').formats(@create_image_format) do response = Fog::Compute[:ibm].create_instance( @name, @image_id, @instance_type, @location, :key_name => @key_name ).body @instance_id = response['instances'][0]['id'] Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM.timeout) { ready? } data = Fog::Compute[:ibm].create_image(@instance_id, @image_name, "").body @id = data['id'] data end tests('#clone_image') do clone_name = 'fog-test-clone-image-' + Time.now.to_i.to_s(32) data = Fog::Compute[:ibm].clone_image(@image_id, clone_name, clone_name).body @cloned_id = data['ImageID'] returns(String) { data['ImageID'].class } end tests('#delete_image') do pending returns(true) { Fog::Compute[:ibm].delete_image(@id).body['success'] } returns(true) { Fog::Compute[:ibm].delete_image(@cloned_id).body['success'] } end @server = Fog::Compute[:ibm].servers.get(@instance_id) @server.wait_for(Fog::IBM.timeout) { ready? } @server.destroy @key.wait_for(Fog::IBM.timeout) { instance_ids.empty? } @key.destroy end end fog-1.34.0/tests/ibm/requests/compute/key_tests.rb0000644000004100000410000000342712600047642022210 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do @key_format = { 'default' => Fog::Boolean, 'instanceIds' => Array, 'keyMaterial' => String, 'keyName' => String, 'lastModifiedTime' => Integer } @keys_format = { 'keys' => [ @key_format ] } tests('success') do @key_name = 'fog-test-key' + Time.now.to_i.to_s(32) @public_key = 'AAAAB3NzaC1yc2EAAAADAQABAAABAQCvVCQA6JWWCAwjUjXDFUH8wOm15slX+WJOYCPNNrW+xipvHq5zDOCnus0xfl/zjWLVDkIz+1ku0Qapd4Q2a+NyyyH09iRxmclQaZdNoj+l4RRL0TRzeJT+l9FU0e4eUYKylrEgQCkZPFVsgn8Vly9Nh/NRcBMA1BgLMiCMebPu3N3bZIVjUrVp8MB66hqAivA36zVQ4ogykTXO8XKG9Mth7yblLjcVyDq7tecSrvM/RAUkZp0Z6SHihQwdnJwqLTcBMXeV3N2VRF3TZWayOWFgTlr1M3ZL7HD3adjRFzY8lmzbOdL/L6BamwDL9nP6bnHeH5oDnUuOIsJng04BC9Ht' tests("#create_key('#{@key_name}')").formats(@key_format) do Fog::Compute[:ibm].create_key(@key_name + '-gen').body end tests("#create_key('#{@key_name}', '#{@public_key}')") do returns(true) { Fog::Compute[:ibm].create_key(@key_name, @public_key).body['success'] } end tests("#list_keys").formats(@keys_format) do Fog::Compute[:ibm].list_keys.body end tests("#get_key('#{@key_name}')").formats(@key_format) do Fog::Compute[:ibm].get_key(@key_name).body end tests("#set_default_key('#{@key_name}')") do returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'default' => true).body['success'] } end tests("#update_key('#{@key_name}', 'publicKey' => '#{@public_key}')") do returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'publicKey' => @public_key).body['success'] } end tests("#delete_key('#{@key_name}')") do returns(true) { Fog::Compute[:ibm].delete_key(@key_name).body['success'] } end end end fog-1.34.0/tests/ibm/requests/compute/vlan_tests.rb0000644000004100000410000000055212600047642022354 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | location requests', ['ibm']) do @vlan_format = { 'id' => String, 'name' => String, 'location' => String, } @vlans_format = { 'vlan' => [ @vlan_format ] } tests('success') do tests("#list_vlans").formats(@vlans_format) do Fog::Compute[:ibm].list_vlans.body end end end fog-1.34.0/tests/ibm/requests/compute/location_tests.rb0000644000004100000410000000115112600047642023220 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | location requests', ['ibm']) do @location_format = { 'state' => Integer, 'location' => String, 'capabilities' => Array, 'name' => String, 'id' => String, 'description' => String } @locations_format = { 'locations' => [ @location_format ] } tests('success') do tests("#list_locations").formats(@locations_format) do Fog::Compute[:ibm].list_locations.body end tests('#get_locations').formats(@location_format) do Fog::Compute[:ibm].get_location('41').body end end end fog-1.34.0/tests/ibm/requests/compute/address_tests.rb0000644000004100000410000000250412600047642023040 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | address requests', ['ibm']) do @address_format = { "state" => Integer, "offeringId"=> String, "location" => String, "ip" => String, "id" => String, "mode" => Integer, "hostname" => String, "type" => Integer, "instanceId" => Fog::Nullable::String, "vlan" => Fog::Nullable::String, } # create_address doesn't return mode, hostname or type attributes @create_address_format = @address_format.reject { |k,v| ["mode", "hostname", "type"].include? k } # list_address returns everything @list_address_format = { 'addresses' => [ @address_format ] } @address_id = nil @location_id = "41" @offering_id = "20001223" tests('success') do tests("#create_address('#{@location_id}')").formats(@create_address_format) do data = Fog::Compute[:ibm].create_address(@location_id, @offering_id).body @address_id = data['id'] data end tests("#list_addresses").formats(@list_address_format) do Fog::Compute[:ibm].list_addresses.body end tests("#delete_address('#{@address_id}')") do Fog::Compute[:ibm].addresses.get(@address_id).wait_for(Fog::IBM.timeout) { ready? } returns(true) { Fog::Compute[:ibm].delete_address(@address_id).body['success'] } end end end fog-1.34.0/tests/ibm/requests/compute/instance_tests.rb0000644000004100000410000000654112600047642023224 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do @instance_format = { 'name' => String, 'location' => String, 'keyName' => String, 'primaryIP' => { 'vlan' => Fog::Nullable::String, 'type' => Integer, 'ip' => String, 'hostname' => String, }, 'productCodes' => Array, 'requestId' => String, 'imageId' => String, 'launchTime' => Integer, 'id' => String, 'ip' => Fog::Nullable::String, 'volumes' => Array, 'root-only' => Fog::Nullable::String, 'isMiniEphemeral' => Fog::Nullable::String, 'instanceType' => String, 'diskSize' => Fog::Nullable::String, 'requestName' => String, 'secondaryIP' => Array, 'status' => Integer, 'software' => Array, 'expirationTime'=> Integer, 'owner' => String, } @instances_format = { 'instances' => [ @instance_format ] } tests('success') do @instance_id = nil @name = "fog-test-instance-" + Time.now.to_i.to_s(32) @image_id = "20010001" @instance_type = "COP32.1/2048/60" @location = "41" @key_name = "fog-test-key-" + Time.now.to_i.to_s(32) @key = Fog::Compute[:ibm].keys.create(:name => @key_name) tests("#create_instance('#{@name}', '#{@image_id}', '#{@instance_type}', '#{@location}', :key_name => '#{@key_name}')").formats(@instances_format) do response = Fog::Compute[:ibm].create_instance(@name, @image_id, @instance_type, @location, :key_name => @key_name).body @instance_id = response['instances'][0]['id'] response end tests("#get_instance('#{@instance_id}')").formats(@instance_format) do response = Fog::Compute[:ibm].get_instance(@instance_id).body end Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM.timeout) { ready? } tests("#list_instances").formats(@instances_format) do instances = Fog::Compute[:ibm].list_instances.body end tests("#modify_instance('#{@instance_id}', 'state' => 'restart')") do returns(true) { Fog::Compute[:ibm].modify_instance(@instance_id, 'state' => 'restart').body["success"] } end tests("#modify_instance('#{@instance_id}', 'name' => '#{@name} 2')") do returns(true) { Fog::Compute[:ibm].modify_instance(@instance_id, 'name' => @name + " 2").body["success"] } end @expiration_time = (Time.now.to_i + 10) * 1000 tests("#modify_instance('#{@instance_id}', 'expirationTime' => '#{@expiration_time}')") do returns(@expiration_time) { Fog::Compute[:ibm].modify_instance(@instance_id, 'expirationTime' => @expiration_time).body["expirationTime"] } end tests("#delete_instance('#{@instance_id}')") do if Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM.timeout) { ready? } data = Fog::Compute[:ibm].delete_instance(@instance_id) else pending end end if @key.wait_for(Fog::IBM.timeout) { instance_ids.empty? } @key.destroy else pending end end tests('failures') do tests('#create_instance => 412') do raises(Excon::Errors::PreconditionFailed) do Fog::Compute[:ibm].create_instance("FAIL: 412", @image_id, @instance_type, @location, :key_name => "invalid") end end end end fog-1.34.0/tests/ibm/models/0000755000004100000410000000000012600047642015577 5ustar www-datawww-datafog-1.34.0/tests/ibm/models/storage/0000755000004100000410000000000012600047642017243 5ustar www-datawww-datafog-1.34.0/tests/ibm/models/storage/volume_tests.rb0000644000004100000410000000310012600047642022313 0ustar www-datawww-dataShindo.tests('Fog::Storage[:ibm] | volume', ['ibm']) do tests('success') do @volume = nil @volume_id = nil @name = "fog test volume" @format = "RAW" @location_id = "41" @size = "256" @offering_id = "20001208" tests('Fog::Storage::IBM::Volume.new') do @volume = Fog::Storage[:ibm].volumes.new( :name => @name, :format => @format, :location_id => @location_id, :size => @size, :offering_id => @offering_id ) returns(@name) { @volume.name } end tests('Fog::Storage::IBM::Volume#save') do returns(true) { @volume.save } returns(String) { @volume.id.class } @volume.wait_for(Fog::IBM.timeout) { ready? } @volume_id = @volume.id end tests("Fog::Storage::IBM::Volume#instance") do returns(nil) { @volume.instance } end tests("Fog::Storage::IBM::Volume#location_id") do returns(String) { @volume.location_id.class } end tests('Fog::Storage::IBM::Volume#id') do returns(@volume_id) { @volume.id } end tests('Fog::Storage::IBM::Volume#ready?') do # We do a "get" to advance the state if we are mocked. # TODO: Fix this for real connections Fog::Storage[:ibm].get_volume(@volume_id) returns(true) { @volume.ready? } end tests('Fog::Storage::IBM::Volume#state') do returns("Detached") { @volume.state } end tests('Fog::Storage::IBM::Volume#destroy') do returns(true) { @volume.destroy } end end end fog-1.34.0/tests/ibm/models/compute/0000755000004100000410000000000012600047642017253 5ustar www-datawww-datafog-1.34.0/tests/ibm/models/compute/keys_tests.rb0000644000004100000410000000167412600047642022005 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | keys', ['ibm']) do tests('success') do @key_name = 'fog-test-key' + Time.now.to_i.to_s(32) @key = nil tests("Fog::Compute[:ibm].keys.create(:name => '#{@key_name}')") do @key = Fog::Compute[:ibm].keys.create(:name => @key_name) returns(@key_name) { @key.name } end tests('Fog::Compute[:ibm].keys') do returns(true) { Fog::Compute[:ibm].keys.length > 0 } end tests("Fog::Compute[:ibm].keys.default = '#{@key_name}'") do returns(@key_name) { Fog::Compute[:ibm].keys.default = @key_name } end tests("Fog::Compute[:ibm].keys.default") do @key = Fog::Compute[:ibm].keys.get(@key_name) returns(@key.name) { Fog::Compute[:ibm].keys.default.name } end tests("Fog::Compute[:ibm].keys.get('#{@key_name}')") do key = Fog::Compute[:ibm].keys.get(@key_name) returns(@key_name) { key.name } end @key.destroy end end fog-1.34.0/tests/ibm/models/compute/image_tests.rb0000644000004100000410000000120412600047642022101 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | image', ['ibm']) do @image_id = '20010001' @clone_name = 'fog-test-clone-image-' + Time.now.to_i.to_s(32) tests('success') do tests("Fog::Compute[:ibm].images.get('#{@image_id}')") do @image = Fog::Compute[:ibm].images.get(@image_id) returns(@image_id) { @image.id } end tests("Fog::Compute::Image#clone") do clone_id = @image.clone(@clone_name, @clone_name) @clone = Fog::Compute[:ibm].images.get(clone_id) returns(@clone_name) { @clone.name } end tests("Fog::Compute::Image#destroy") do returns(true) { @clone.destroy } end end end fog-1.34.0/tests/ibm/models/compute/server_tests.rb0000644000004100000410000000506112600047642022332 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do tests('success') do # TODO: Fix this for non-mock tests @server = nil @instance_id = nil @name = "fog-test-instance-" + Time.now.to_i.to_s(32) @image_id = "20010001" @instance_type = "BRZ32.1/2048/60*175" @location_id = "41" @key_name = "fog-test-key-" + Time.now.to_i.to_s(32) @key = Fog::Compute[:ibm].keys.create(:name => @key_name) tests('Fog::Compute::IBM::Server.new') do @server = Fog::Compute[:ibm].servers.new( :name => @name, :image_id => @image_id, :instance_type => @instance_type, :location_id => @location, :key_name => @key_name ) returns(@name) { @server.name } end tests('Fog::Compute::IBM::Server#save') do returns(true) { @server.save } returns(String) { @server.id.class } @instance_id = @server.id end tests('Fog::Compute::IBM::Server#wait_for { ready? }') do @server = Fog::Compute[:ibm].servers.get(@instance_id) @server.wait_for(Fog::IBM.timeout) { ready? } end tests('Fog::Compute::IBM::Server#id') do returns(@instance_id) { @server.id } end tests('Fog::Compute::IBM::Server#ready?') do returns(true) { @server.ready? } end tests('Fog::Compute::IBM::Server#state') do returns("Active") { @server.state } end # TODO: make this work # tests('Fog::Compute::IBM::Server#reboot') do # returns(true) { @server.reboot } # end tests('Fog::Compute::IBM::Server#rename("name")') do name = @server.name + "-rename" returns(true) { @server.rename(name) } returns(name) { @server.name } end tests('Fog::Compute::IBM::Server#image') do returns(@image_id) { @server.image.id } end tests('Fog::Compute::IBM::Server#to_image') do body = @server.to_image(:name => @server.name) returns(@server.name) { body['name'] } image = Fog::Compute[:ibm].images.get(body['id']) image.wait_for(Fog::IBM.timeout) { ready? || state == 'New' } unless image.state == 'Capturing' returns(true) { Fog::Compute[:ibm].delete_image(image.id).body['success'] } end end tests('Fog::Compute::IBM::Server#expire_at') do returns(true) { @server.expire_at(Time.now + 60) } end tests('Fog::Compute::IBM::Server#destroy') do returns(true) { @server.destroy } end @key.wait_for(Fog::IBM.timeout) { instance_ids.empty? } @key.destroy end end fog-1.34.0/tests/ibm/models/compute/key_tests.rb0000644000004100000410000000103112600047642021605 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | key', ['ibm']) do tests('success') do @key_name = 'fog-test-key-' + Time.now.to_i.to_s(32) @key = nil tests("Fog::Compute::IBM::Key.create(:name => '#{@key_name}')") do @key = Fog::Compute[:ibm].keys.create(:name => @key_name) returns(@key_name) { @key.name } end tests("Fog::Compute::IBM::Key#instances") do returns([]) { @key.instances } end tests('Fog::Compute::IBM::Key#destroy') do returns(true) { @key.destroy } end end end fog-1.34.0/tests/ibm/models/compute/servers_tests.rb0000644000004100000410000000214712600047642022517 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | servers', ['ibm']) do tests('success') do @name = "fog-test-instance-" + Time.now.to_i.to_s(32) @image_id = "20010001" @instance_type = "BRZ32.1/2048/60*175" @location_id = "41" @key_name = "fog-test-key-" + Time.now.to_i.to_s(32) @key = Fog::Compute[:ibm].keys.create(:name => @key_name) @n_servers = Fog::Compute[:ibm].servers.length @instance_id = Fog::Compute[:ibm].create_instance(@name, @image_id, @instance_type, @location_id, :key_name => @key_name).body["instances"][0]["id"] tests('Fog::Compute[:ibm].servers') do returns(@n_servers + 1) { Fog::Compute[:ibm].servers.length } end tests('Fog::Compute[:ibm].servers.get("#{@instance_id}")') do @server = Fog::Compute[:ibm].servers.get(@instance_id) returns(@instance_id) { @server.id } end if @server.wait_for(Fog::IBM.timeout) { ready? } @server.destroy else pending end if @key.wait_for(Fog::IBM.timeout) { instance_ids.empty? } @key.destroy else pending end end end fog-1.34.0/tests/ibm/models/compute/locations_tests.rb0000644000004100000410000000065012600047642023016 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ibm] | locations', ['ibm']) do tests('success') do @location_id = '41' tests('Fog::Compute[:ibm].locations') do returns(true) { Fog::Compute[:ibm].locations.length > 0 } end tests('Fog::Compute[:ibm].locations.get("#{@location_id}")') do @location = Fog::Compute[:ibm].locations.get(@location_id) returns(@location_id) { @location.id } end end end fog-1.34.0/tests/ninefold/0000755000004100000410000000000012600047642015343 5ustar www-datawww-datafog-1.34.0/tests/ninefold/requests/0000755000004100000410000000000012600047642017216 5ustar www-datawww-datafog-1.34.0/tests/ninefold/requests/compute/0000755000004100000410000000000012600047642020672 5ustar www-datawww-datafog-1.34.0/tests/ninefold/requests/compute/helper.rb0000644000004100000410000003156412600047642022507 0ustar www-datawww-dataclass Ninefold module Compute module TestSupport # 1CPU, 1.7GB RAM, 160GB Storage SERVICE_OFFERING = 67 # alternate for testing - ALT_SERVICE_OFFERING = 68 # XEN Basic Ubuntu 10.04 Server x64 PV r2.0 TEMPLATE_ID = 421 # Sydney ZONE_ID = 1 # Max time to wait for job completion (2 mins) MAXWAIT = 2 * 60 ## Waits for a job, returning the completed jobs payload. ## Accepts an integer jobid, or a hash containing a jobid or id. def wait_for_job(job) job = job['jobid'] || job['id'] unless job.kind_of? Integer while Fog::Compute[:ninefold].query_async_job_result(:jobid => job)['jobstatus'] == 0 sleep 1 end Fog::Compute[:ninefold].query_async_job_result(:jobid => job) end module_function :wait_for_job end module Formats module Lists SERVICE_OFFERING = { "id" => Integer, "name" => String, "displaytext" => String, "cpunumber" => Integer, "cpuspeed" => Integer, "memory" => Integer, "created" => String, "storagetype" => String, "offerha" => Fog::Boolean, "domainid" => Integer, "domain" => String, "issystem" => Fog::Boolean, "limitcpuuse" => Fog::Boolean, "defaultuse" => Fog::Boolean } SERVICE_OFFERINGS = [Ninefold::Compute::Formats::Lists::SERVICE_OFFERING] ACCOUNTS = [{ "id"=>Integer, "name"=>String, "accounttype"=>Integer, "domainid"=>Integer, "domain"=>String, "receivedbytes"=>Integer, "sentbytes"=>Integer, "vmlimit"=>String, "vmtotal"=>Integer, "vmavailable"=>String, "iplimit"=>String, "iptotal"=>Integer, "ipavailable"=>String, "volumelimit"=>String, "volumetotal"=>Integer, "volumeavailable"=>String, "snapshotlimit"=>String, "snapshottotal"=>Integer, "snapshotavailable"=>String, "templatelimit"=>String, "templatetotal"=>Integer, "templateavailable"=>String, "vmstopped"=>Integer, "vmrunning"=>Integer, "state"=>String, "user"=> [{ "id"=>Integer, "username"=>String, "firstname"=>String, "lastname"=>String, "email"=>String, "created"=>String, "state"=>String, "account"=>String, "accounttype"=>Integer, "domainid"=>Integer, "domain"=>String, "apikey"=>String, "secretkey"=>String }] }] EVENTS = [{ "id"=>Integer, "username"=>String, "type"=>String, "level"=>String, "description"=>String, "account"=>String, "domainid"=>Integer, "domain"=>String, "created"=>String, "state"=>String, "parentid"=>Integer }] DISK_OFFERINGS = [{ "id"=>Integer, "domainid"=>Integer, "domain"=>String, "name"=>String, "displaytext"=>String, "disksize"=>Integer, "created"=>String, "iscustomized"=>Fog::Boolean, "tags"=>String }] CAPABILITIES = { "securitygroupsenabled" => Fog::Boolean, "cloudstackversion" => String, "userpublictemplateenabled" => Fog::Boolean } HYPERVISORS = [{ "name"=>String }] ZONES = [{ "allocationstate"=>String, "dhcpprovider"=>String, "id"=>Integer, "name"=>String, "networktype"=>String, "securitygroupsenabled"=>Fog::Boolean }] NETWORK_OFFERINGS = [{ "id"=>Integer, "name"=>String, "displaytext"=>String, "traffictype"=>String, "isdefault"=>Fog::Boolean, "specifyvlan"=>Fog::Boolean, "availability"=>String, "guestiptype"=>String, "networkrate"=>Integer }] RESOURCE_LIMITS = [{ "account"=>String, "domainid"=>Integer, "domain"=>String, "resourcetype"=>String, "max"=>Integer }] end module VirtualMachines VIRTUAL_MACHINE = { "id"=>Integer, "name"=>String, "displayname"=>String, "account"=>String, "domainid"=>Integer, "domain"=>String, "created"=>String, "state"=>String, "haenable"=>Fog::Boolean, "zoneid"=>Integer, "zonename"=>String, "templateid"=>Integer, "templatename"=>String, "templatedisplaytext"=>String, "passwordenabled"=>Fog::Boolean, "serviceofferingid"=>Integer, "serviceofferingname"=>String, "cpunumber"=>Integer, "cpuspeed"=>Integer, "memory"=>Integer, "guestosid"=>Integer, "rootdeviceid"=>Integer, "rootdevicetype"=>String, "nic"=>[{ "id"=>Integer, "networkid"=>Integer, "netmask"=>Fog::Nullable::String, "gateway"=>Fog::Nullable::String, "ipaddress"=>Fog::Nullable::String, "traffictype"=>String, "type"=>String, "isdefault"=>Fog::Boolean, }], "hypervisor"=>String, "cpuused"=>Fog::Nullable::String, "networkkbsread"=>Fog::Nullable::Integer, "networkkbswrite"=>Fog::Nullable::Integer } VIRTUAL_MACHINES = [VIRTUAL_MACHINE] end module Templates TEMPLATES = [{ "id"=>Integer, "name"=>String, "displaytext"=>String, "ispublic"=>Fog::Boolean, "created"=>String, "isready"=>Fog::Boolean, "passwordenabled"=>Fog::Boolean, "format"=>String, "isfeatured"=>Fog::Boolean, "crossZones"=>Fog::Boolean, "ostypeid"=>Integer, "ostypename"=>String, "account"=>String, "zoneid"=>Integer, "zonename"=>String, "size"=>Integer, "templatetype"=>String, "hypervisor"=>String, "domain"=>String, "domainid"=>Integer, "isextractable"=>Fog::Boolean, }] end module Jobs JOB = { "jobid"=>Integer, "accountid"=>Integer, "userid"=>Integer, "cmd"=>String, "jobstatus"=>Integer, "jobprocstatus"=>Integer, "jobresultcode"=>Integer, "jobresult"=>Hash, "created"=>String } JOBS = [JOB] JOB_QUERY = { "jobid"=>Integer, "jobstatus"=>Integer, "jobprocstatus"=>Integer, "jobresultcode"=>Integer, "jobresulttype"=>String, "jobresult"=>Hash } end module Networks NETWORKS=[{"id"=>Integer, "name"=>String, "displaytext"=>String, "broadcastdomaintype"=>String, "traffictype"=>String, "zoneid"=>Integer, "networkofferingid"=>Integer, "networkofferingname"=>String, "networkofferingdisplaytext"=>String, "networkofferingavailability"=>String, "isshared"=>Fog::Boolean, "issystem"=>Fog::Boolean, "state"=>String, "related"=>Integer, "broadcasturi"=>Fog::Nullable::String, "dns1"=>String, "dns2"=>String, "type"=>String, "account"=>String, "domainid"=>Integer, "domain"=>String, "isdefault"=>Fog::Boolean, "service"=>Array, "networkdomain"=>Fog::Nullable::String, "securitygroupenabled"=>Fog::Boolean, "netmask"=>Fog::Nullable::String, "startip"=>Fog::Nullable::String, "endip"=>Fog::Nullable::String, "gateway"=>Fog::Nullable::String, "vlan"=>Fog::Nullable::String }] end module Addresses ADDRESS = { "id"=>Integer, "ipaddress"=>String, "allocated"=>String, "zoneid"=>Integer, "zonename"=>String, "issourcenat"=>Fog::Boolean, "account"=>String, "domainid"=>Integer, "domain"=>String, "forvirtualnetwork"=>Fog::Boolean, "isstaticnat"=>Fog::Boolean, "associatednetworkid"=>Integer, "networkid"=>Integer, "state"=>String, "virtualmachineid"=>Fog::Nullable::Integer, "virtualmachinename"=>Fog::Nullable::String } ADDRESSES = [ADDRESS] DISASSOC_ADDRESS = {"jobid"=>Integer} end module Nat ENABLE_NAT_RESPONSE = { 'success' => String } DISABLE_NAT_RESPONSE = { 'success' => Fog::Boolean } DELETE_RULE_RESPONSE = { 'success' => Fog::Boolean } FORWARDING_RULE = { "id"=>Integer, "protocol"=>String, "virtualmachineid"=>Integer, "virtualmachinename"=>String, "ipaddressid"=>Integer, "ipaddress"=>String, "startport"=>Integer, "endport"=>Integer, "state"=>String } FORWARDING_RULES = [FORWARDING_RULE] end module LoadBalancers CREATE_LOAD_BALANCER_RULE_RESPONSE = { "id"=>Integer, "account"=>String, "algorithm"=>String, "cidrlist"=>String, "domain"=>String, "domainid"=>Integer, "name"=>String, "privateport"=>String, "publicip"=>String, "publicipid"=>Integer, "publicport"=>String, "state"=>String, "zoneid"=>Integer } ASSIGN_LOAD_BALANCER_RULE_RESPONSE = { "success"=>Fog::Boolean } LIST_LOAD_BALANCER_RULES_RESPONSE = { "id"=>Integer, "name"=>String, "publicipid"=>Integer, "publicip"=>String, "publicport"=>String, "privateport"=>String, "algorithm"=>String, "cidrlist"=>String, "account"=>String, "domainid"=>Integer, "domain"=>String, "state"=>String, "zoneid"=>Integer } UPDATE_LOAD_BALANCER_RULE_RESPONSE = { "id"=>Integer, "name"=>String, "publicipid"=>Integer, "publicip"=>String, "publicport"=>String, "privateport"=>String, "algorithm"=>String, "cidrlist"=>String, "account"=>String, "domainid"=>Integer, "domain"=>String, "state"=>String, "zoneid"=>Integer } REMOVE_FROM_LOAD_BALANCER_RULE_RESPONSE = { "success"=>Fog::Boolean } end end end end fog-1.34.0/tests/ninefold/requests/compute/async_job_tests.rb0000644000004100000410000000162112600047642024410 0ustar www-datawww-data# This will fail until there are jobs in the system. Shindo.tests('Fog::Compute[:ninefold] | async job requests', ['ninefold']) do tests('success') do tests("#list_async_jobs()").formats(Ninefold::Compute::Formats::Jobs::JOBS) do pending if Fog.mocking? jobs = Fog::Compute[:ninefold].list_async_jobs() unless jobs[0] raise "No async jobs in system yet - create a VM through web UI to create" end @jobid = jobs[0]['jobid'] jobs end tests("#query_async_job_result()").formats(Ninefold::Compute::Formats::Jobs::JOB_QUERY) do pending if Fog.mocking? Fog::Compute[:ninefold].query_async_job_result(:jobid => @jobid) end end tests('failure') do #tests("#deploy_virtual_machine()").raises(Excon::Errors::HTTPStatusError) do # pending if Fog.mocking? # Fog::Compute[:ninefold].deploy_virtual_machine #end end end fog-1.34.0/tests/ninefold/requests/compute/template_tests.rb0000644000004100000410000000102012600047642024245 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | template requests', ['ninefold']) do tests('success') do tests("#list_templates()").formats(Ninefold::Compute::Formats::Templates::TEMPLATES) do pending if Fog.mocking? Fog::Compute[:ninefold].list_templates(:templatefilter => 'executable') end end tests('failure') do #tests("#deploy_virtual_machine()").raises(Excon::Errors::HTTPStatusError) do # pending if Fog.mocking? # Fog::Compute[:ninefold].deploy_virtual_machine #end end end fog-1.34.0/tests/ninefold/requests/compute/nat_tests.rb0000644000004100000410000000732312600047642023230 0ustar www-datawww-data## Note: # If needed, these tests will create a new VM and public IP address. Because this is expensive, you # can optionally specify VM_ID and IP_ID as environment variables, and we will use those. Note: # The IP must not already have static nat enabled or any port mappings. Shindo.tests('Fog::Compute[:ninefold] | nat requests', ['ninefold']) do if ENV['VM_ID'] && ENV['IP_ID'] @ipid, @vmid = ENV['IP_ID'], ENV['VM_ID'] elsif !Fog.mock? begin # Create a VM to work with networks = Fog::Compute[:ninefold].list_networks vm_job = Fog::Compute[:ninefold].deploy_virtual_machine(:serviceofferingid => Ninefold::Compute::TestSupport::SERVICE_OFFERING, :templateid => Ninefold::Compute::TestSupport::TEMPLATE_ID, :zoneid => Ninefold::Compute::TestSupport::ZONE_ID, :networkids => networks[0]['id']) @vm = Ninefold::Compute::TestSupport.wait_for_job(vm_job)['jobresult']['virtualmachine'] @vmid = @vm['id'] # Allocate a public IP to work with ip_job = Fog::Compute[:ninefold].associate_ip_address(:zoneid => Ninefold::Compute::TestSupport::ZONE_ID) @ip = Ninefold::Compute::TestSupport.wait_for_job(ip_job)['jobresult']['ipaddress'] @ipid = @ip['id'] rescue => e puts "*** CREATING VM OR IP FAILED - PLEASE TEST AND CORRECT THIS FIRST" raise e end end tests('success') do tests("#enable_static_nat()").formats(Ninefold::Compute::Formats::Nat::ENABLE_NAT_RESPONSE) do pending if Fog.mocking? Fog::Compute[:ninefold].enable_static_nat(:ipaddressid => @ipid, :virtualmachineid => @vmid) end tests("#create_ip_forwarding_rule()").formats(Ninefold::Compute::Formats::Nat::FORWARDING_RULE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].create_ip_forwarding_rule(:ipaddressid => @ipid, :protocol => 'TCP', :startport => 22) result = Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['ipforwardingrule'] @fwd_rule_id = result['id'] result end tests("#list_ip_forwarding_rules()").formats(Ninefold::Compute::Formats::Nat::FORWARDING_RULES) do pending if Fog.mocking? Fog::Compute[:ninefold].list_ip_forwarding_rules end tests("#delete_ip_forwarding_rule()").formats(Ninefold::Compute::Formats::Nat::DELETE_RULE_RESPONSE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].delete_ip_forwarding_rule(:id => @fwd_rule_id) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult'] end tests("#disable_static_nat()").formats(Ninefold::Compute::Formats::Nat::DISABLE_NAT_RESPONSE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].disable_static_nat(:ipaddressid => @ipid) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult'] end end tests('failure') do tests("#associate_ip_address()").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:ninefold].associate_ip_address end end unless ENV['VM_ID'] && ENV['IP_ID'] || Fog.mock? begin # Kill test VM vm_job = Fog::Compute[:ninefold].destroy_virtual_machine(:id => @vmid) Ninefold::Compute::TestSupport.wait_for_job(vm_job) # Disassociate public IP ip_job = Fog::Compute[:ninefold].disassociate_ip_address(:id => @ipid) Ninefold::Compute::TestSupport.wait_for_job(ip_job) rescue => e puts "*** DESTROYING VM OR IP FAILED - PLEASE TEST AND CORRECT THIS FIRST" raise e end end end fog-1.34.0/tests/ninefold/requests/compute/virtual_machine_tests.rb0000644000004100000410000000610512600047642025615 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | server requests', ['ninefold']) do tests('success') do tests("#deploy_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? networks = Fog::Compute[:ninefold].list_networks unless networks[0] raise "No networks, ensure a network has been created by deploying a VM from the web UI and verify list_networks test" end newvm = Fog::Compute[:ninefold].deploy_virtual_machine(:serviceofferingid => Ninefold::Compute::TestSupport::SERVICE_OFFERING, :templateid => Ninefold::Compute::TestSupport::TEMPLATE_ID, :zoneid => Ninefold::Compute::TestSupport::ZONE_ID, :networkids => networks[0]['id']) # wait for deployment, stash the job id. @newvmid = newvm['id'] Ninefold::Compute::TestSupport.wait_for_job(newvm['jobid'])['jobresult']['virtualmachine'] end tests("#list_virtual_machines()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINES) do pending if Fog.mocking? Fog::Compute[:ninefold].list_virtual_machines end tests("#reboot_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].reboot_virtual_machine(:id => @newvmid) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine'] end tests("#stop_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].stop_virtual_machine(:id => @newvmid) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine'] end tests("#change_service_for_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? Fog::Compute[:ninefold].change_service_for_virtual_machine(:id => @newvmid, :serviceofferingid => Ninefold::Compute::TestSupport::ALT_SERVICE_OFFERING) end tests("#start_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].start_virtual_machine(:id => @newvmid) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine'] end tests("#destroy_virtual_machine()").formats(Ninefold::Compute::Formats::VirtualMachines::VIRTUAL_MACHINE) do pending if Fog.mocking? job = Fog::Compute[:ninefold].destroy_virtual_machine(:id => @newvmid) Ninefold::Compute::TestSupport.wait_for_job(job)['jobresult']['virtualmachine'] end end tests('failure') do tests("#deploy_virtual_machine()").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:ninefold].deploy_virtual_machine end end end fog-1.34.0/tests/ninefold/requests/compute/list_tests.rb0000644000004100000410000000334312600047642023417 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | list only requests', ['ninefold']) do tests('success') do tests("#list_accounts()").formats(Ninefold::Compute::Formats::Lists::ACCOUNTS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_accounts end tests("#list_events()").formats(Ninefold::Compute::Formats::Lists::EVENTS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_events end tests("#list_service_offerings()").formats(Ninefold::Compute::Formats::Lists::SERVICE_OFFERINGS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_service_offerings end tests("#list_disk_offerings()").formats(Ninefold::Compute::Formats::Lists::DISK_OFFERINGS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_disk_offerings end tests("#list_capabilities()").formats(Ninefold::Compute::Formats::Lists::CAPABILITIES) do pending if Fog.mocking? Fog::Compute[:ninefold].list_capabilities end tests("#list_hypervisors()").formats(Ninefold::Compute::Formats::Lists::HYPERVISORS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_hypervisors end tests("#list_zones()").formats(Ninefold::Compute::Formats::Lists::ZONES) do pending if Fog.mocking? Fog::Compute[:ninefold].list_zones end tests("#list_network_offerings()").formats(Ninefold::Compute::Formats::Lists::NETWORK_OFFERINGS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_network_offerings end tests("#list_resource_limits()").formats(Ninefold::Compute::Formats::Lists::RESOURCE_LIMITS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_resource_limits end end tests('failure') do end end fog-1.34.0/tests/ninefold/requests/compute/network_tests.rb0000644000004100000410000000075412600047642024140 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | network requests', ['ninefold']) do tests('success') do tests("#list_networks()").formats(Ninefold::Compute::Formats::Networks::NETWORKS) do pending if Fog.mocking? Fog::Compute[:ninefold].list_networks() end end tests('failure') do #tests("#deploy_virtual_machine()").raises(Excon::Errors::HTTPStatusError) do # pending if Fog.mocking? # Fog::Compute[:ninefold].deploy_virtual_machine #end end end fog-1.34.0/tests/ninefold/requests/compute/address_tests.rb0000644000004100000410000000263612600047642024075 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | address requests', ['ninefold']) do tests('success') do tests("#associate_ip_address()").formats(Ninefold::Compute::Formats::Addresses::ADDRESS) do pending if Fog.mocking? job = newaddress = Fog::Compute[:ninefold].associate_ip_address(:zoneid => Ninefold::Compute::TestSupport::ZONE_ID) while Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobstatus'] == 0 sleep 1 end result = Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobresult']['ipaddress'] @newaddressid = result['id'] result end tests("#list_public_ip_addresses()").formats(Ninefold::Compute::Formats::Addresses::ADDRESSES) do pending if Fog.mocking? result = Fog::Compute[:ninefold].list_public_ip_addresses result end tests("#disassociate_ip_address()").formats(Ninefold::Compute::Formats::Addresses::DISASSOC_ADDRESS) do pending if Fog.mocking? job = Fog::Compute[:ninefold].disassociate_ip_address(:id => @newaddressid) while Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobstatus'] == 0 sleep 1 end job end end tests('failure') do tests("#associate_ip_address()").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:ninefold].associate_ip_address end end end fog-1.34.0/tests/ninefold/requests/compute/load_balancer_tests.rb0000644000004100000410000000616212600047642025214 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ninefold] | load balancers', ['ninefold']) do # NOTE: all of these tests require you to have a vm built with a public IP address. tests('success') do before do @compute = Fog::Compute[:ninefold] unless Fog.mocking? @public_ip_id = @compute.list_public_ip_addresses.first['id'] @server_id = @compute.servers.all.first.id @create_load_balancer = @compute.create_load_balancer_rule(:algorithm => 'roundrobin', :name => 'test', :privateport => 1000, :publicport => 2000, :publicipid => @public_ip_id) end end after do unless Fog.mocking? delete = @compute.delete_load_balancer_ruler(:id => @create_load_balancer['id']) Ninefold::Compute::TestSupport.wait_for_job(delete['jobid']) end end tests("#create_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::CREATE_LOAD_BALANCER_RULE_RESPONSE) do pending if Fog.mocking? result = Ninefold::Compute::TestSupport.wait_for_job(@create_load_balancer['jobid']) result['jobresult']['loadbalancer'] end tests("#assign_to_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::ASSIGN_LOAD_BALANCER_RULE_RESPONSE) do pending if Fog.mocking? assign_load_balancer = @compute.assign_to_load_balancer_rule(:id => @create_load_balancer['id'], :virtualmachineids => @server_id) result = Ninefold::Compute::TestSupport.wait_for_job(assign_load_balancer['jobid']) result['jobresult'] end tests("#list_to_load_balancer_rules()").formats(Ninefold::Compute::Formats::LoadBalancers::LIST_LOAD_BALANCER_RULES_RESPONSE) do pending if Fog.mocking? list_load_balancer_rules = @compute.list_load_balancer_rules list_load_balancer_rules['loadbalancerrule'].first end tests("#update_to_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::UPDATE_LOAD_BALANCER_RULE_RESPONSE) do pending if Fog.mocking? update_load_balancer = @compute.update_load_balancer_rule(:id => @create_load_balancer['id'], :algorithm => 'source') result = Ninefold::Compute::TestSupport.wait_for_job(update_load_balancer['jobid']) result['jobresult']['loadbalancer'] end tests('with assigned to load balancer rule') do before do unless Fog.mocking? assign_load_balancer = @compute.assign_to_load_balancer_rule(:id => @create_load_balancer['id'], :virtualmachineids => @server_id) result = Ninefold::Compute::TestSupport.wait_for_job(assign_load_balancer['jobid']) end end tests("#remove_from_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::REMOVE_FROM_LOAD_BALANCER_RULE_RESPONSE) do pending if Fog.mocking? remove = @compute.remove_from_load_balancer_rule(:id => @create_load_balancer['id'], :virtualmachineids => @server_id) result = Ninefold::Compute::TestSupport.wait_for_job(remove['jobid']) result['jobresult'] end end end end fog-1.34.0/tests/ninefold/models/0000755000004100000410000000000012600047642016626 5ustar www-datawww-datafog-1.34.0/tests/ninefold/models/storage/0000755000004100000410000000000012600047642020272 5ustar www-datawww-datafog-1.34.0/tests/ninefold/models/storage/file_update_tests.rb0000644000004100000410000000075312600047642024327 0ustar www-datawww-dataShindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do unless Fog.mocking? @directory = Fog::Storage[:ninefold].directories.create(:key => 'updatefiletests') end ninefold = Fog::Storage[:ninefold] tests("update a file").succeeds do pending if Fog.mocking? file = @directory.files.create(:key => 'lorem.txt', :body => lorem_file) file.body = "xxxxxx" file.save end unless Fog.mocking? @directory.destroy(:recursive => true) end end fog-1.34.0/tests/ninefold/models/storage/nested_directories_tests.rb0000644000004100000410000000137312600047642025723 0ustar www-datawww-dataShindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do ninefold = Fog::Storage[:ninefold] tests("create a directory with a / character").succeeds do pending if Fog.mocking? ninefold.directories.create(:key => 'sub/path') end tests("List of top directory returns sub dir").returns(1) do pending if Fog.mocking? ninefold.directories.get('sub').directories.count end tests("create a directory in a sub dir").returns('sub/path/newdir/') do pending if Fog.mocking? ninefold.directories.get('sub/path').directories.create(:key => 'newdir').identity end tests("Recursively destroy parent dir").succeeds do pending if Fog.mocking? ninefold.directories.get('sub').destroy(:recursive => true) end end fog-1.34.0/tests/ovirt/0000755000004100000410000000000012600047642014710 5ustar www-datawww-datafog-1.34.0/tests/ovirt/requests/0000755000004100000410000000000012600047642016563 5ustar www-datawww-datafog-1.34.0/tests/ovirt/requests/compute/0000755000004100000410000000000012600047642020237 5ustar www-datawww-datafog-1.34.0/tests/ovirt/requests/compute/update_volume_tests.rb0000644000004100000410000000134512600047642024662 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | update_volume request', ['ovirt']) do compute = Fog::Compute[:ovirt] if compute.servers.all(:search => 'fog-*').empty? compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default') end vm_id = compute.servers.all(:search => 'fog-*').last tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm id is missing') { compute.update_volume(nil, {:id => 1}) } raises(ArgumentError, 'raises ArgumentError when disk_id option is missing') { compute.update_volume(1, {:any => 1}) } end tests('The response should') do response = compute.update_volume(vm_id, :id => 1) test('be a success') { response ? true: false } end end fog-1.34.0/tests/ovirt/requests/compute/list_storage_domains_tests.rb0000644000004100000410000000065612600047642026226 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | storage_domains request', ['ovirt']) do compute = Fog::Compute[:ovirt] tests("When listing all storage_domains") do response = compute.storage_domains tests("The response data format ...") do test("it should be a kind of Array") { response.kind_of? Array } test("be a kind of OVIRT::StorageDomain") { response.first.kind_of? OVIRT::StorageDomain } end end end fog-1.34.0/tests/ovirt/requests/compute/update_vm_tests.rb0000644000004100000410000000116712600047642023777 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | vm_update request', ['ovirt']) do compute = Fog::Compute[:ovirt] if compute.servers.all(:search => 'fog-*').empty? compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default') end vm = compute.servers.all(:search => 'fog-*').last tests('The response should') do response = compute.update_vm(:id => vm.id, :name => vm.name + 'updated') test("be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.update_vm } end end fog-1.34.0/tests/ovirt/requests/compute/create_vm_tests.rb0000644000004100000410000000176612600047642023765 0ustar www-datawww-dataShindo.tests("Fog::Compute[:ovirt] | vm_create request", 'ovirt') do compute = Fog::Compute[:ovirt] name_base = Time.now.to_i tests("Create VM") do response = compute.create_vm(:name => 'fog-'+name_base.to_s, :cluster_name => 'Default') test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} end tests("Create VM from template (clone)") do response = compute.create_vm(:name => 'fog-'+(name_base+ 1).to_s, :template_name => 'hwp_small', :cluster_name => 'Default') test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} end tests("Fail Creating VM") do begin response = compute.create_vm(:name => 'fog-'+name_base.to_s, :cluster_name => 'Default') test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} #mock never raise exceptions rescue => e #should raise vm name already exist exception. test("error should be a kind of OVIRT::OvirtException") { e.kind_of? OVIRT::OvirtException} end end end fog-1.34.0/tests/ovirt/requests/compute/destroy_vm_tests.rb0000644000004100000410000000112312600047642024176 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | vm_destroy request', ['ovirt']) do compute = Fog::Compute[:ovirt] if compute.servers.all(:search => 'fog-*').empty? compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default') end vm_id = compute.servers.all(:search => 'fog-*').last.id tests('The response should') do response = compute.destroy_vm(:id => vm_id) test('be a success') { response ? true: false } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.destroy_vm } end end fog-1.34.0/tests/ovirt/requests/compute/list_quotas_tests.rb0000644000004100000410000000046212600047642024357 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | quotas request', ['ovirt']) do compute = Fog::Compute[:ovirt] tests("When listing all quotas") do response = compute.quotas tests("The response data format ...") do test("it should be a kind of Array") { response.kind_of? Array } end end end fog-1.34.0/tests/ovirt/requests/compute/list_datacenters_tests.rb0000644000004100000410000000060212600047642025334 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | datacenters request', ['ovirt']) do compute = Fog::Compute[:ovirt] tests("When listing all datacenters") do response = compute.datacenters tests("The response data format ...") do test("it should be a kind of Array") { response.kind_of? Array } test("be a kind of Hash") { response.first.kind_of? Hash } end end end fog-1.34.0/tests/ovirt/compute_tests.rb0000644000004100000410000000164212600047642020136 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do compute = Fog::Compute[:ovirt] tests("Compute attributes") do %w{ ovirt_attrs }.each do |attr| test("it should respond to #{attr}") { compute.respond_to? attr } end end tests("Compute collections") do %w{ servers templates clusters interfaces }.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end tests("Compute requests") do %w{ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template get_virtual_machine list_clusters list_networks list_template_interfaces list_templates list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action api_version update_volume}.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end end fog-1.34.0/tests/ovirt/models/0000755000004100000410000000000012600047642016173 5ustar www-datawww-datafog-1.34.0/tests/ovirt/models/compute/0000755000004100000410000000000012600047642017647 5ustar www-datawww-datafog-1.34.0/tests/ovirt/models/compute/clusters_tests.rb0000644000004100000410000000043112600047642023260 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | clusters collection', ['ovirt']) do clusters = Fog::Compute[:ovirt].clusters tests('The clusters collection') do test('should be a kind of Fog::Compute::Ovirt::Clusters') { clusters.kind_of? Fog::Compute::Ovirt::Clusters } end end fog-1.34.0/tests/ovirt/models/compute/template_tests.rb0000644000004100000410000000157612600047642023242 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | template model', ['ovirt']) do templates = Fog::Compute[:ovirt].templates template = templates.last tests('The template model should') do tests('have the action') do test('reload') { template.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = template.attributes attributes = [ :id, :name] tests("The template model should respond to") do attributes.each do |attribute| test("#{attribute}") { template.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Ovirt::Template') { template.kind_of? Fog::Compute::Ovirt::Template } end end fog-1.34.0/tests/ovirt/models/compute/server_tests.rb0000644000004100000410000000274212600047642022731 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | server model', ['ovirt']) do servers = Fog::Compute[:ovirt].servers server = servers.last tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ start stop destroy reboot suspend }.each do |action| test(action) { server.respond_to? action } end %w{ start reboot suspend stop }.each do |action| test("#{action} returns successfully") { begin server.send(action.to_sym) ? true : false rescue OVIRT::OvirtException #ovirt exceptions are acceptable for the above actions. true end } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :id, :name, :description, :profile, :display, :creation_time, :os, :status, :cores, :memory, :cluster, :template] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Ovirt::Server') { server.kind_of? Fog::Compute::Ovirt::Server } end end fog-1.34.0/tests/ovirt/models/compute/interface_tests.rb0000644000004100000410000000163212600047642023360 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | interface model', ['ovirt']) do interfaces = Fog::Compute[:ovirt].servers.last.interfaces interface = interfaces.last tests('The interface model should') do tests('have the action') do test('reload') { interface.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = interface.attributes attributes = [ :id, :name, :network] tests("The interface model should respond to") do attributes.each do |attribute| test("#{attribute}") { interface.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Ovirt::Interface') { interface.kind_of? Fog::Compute::Ovirt::Interface } end end fog-1.34.0/tests/ovirt/models/compute/servers_tests.rb0000644000004100000410000000102212600047642023102 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | servers collection', ['ovirt']) do servers = Fog::Compute[:ovirt].servers tests('The servers collection') do test('should not be empty') { not servers.empty? } test('should be a kind of Fog::Compute::Ovirt::Servers') { servers.kind_of? Fog::Compute::Ovirt::Servers } tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do tests('by instance uuid').succeeds { servers.get servers.first.id } end end end fog-1.34.0/tests/ovirt/models/compute/cluster_tests.rb0000644000004100000410000000172512600047642023104 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | cluster model', ['ovirt']) do clusters = Fog::Compute[:ovirt].clusters cluster = clusters.last tests('The cluster model should') do tests('have the action') do test('reload') { cluster.respond_to? 'reload' } %w{ networks }.each do |action| test(action) { cluster.respond_to? action } end end tests('have attributes') do model_attribute_hash = cluster.attributes attributes = [ :id, :name] tests("The cluster model should respond to") do attributes.each do |attribute| test("#{attribute}") { cluster.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Ovirt::Cluster') { cluster.kind_of? Fog::Compute::Ovirt::Cluster } end end fog-1.34.0/tests/ovirt/models/compute/templates_tests.rb0000644000004100000410000000044012600047642023412 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | templates collection', ['ovirt']) do templates = Fog::Compute[:ovirt].templates tests('The templates collection') do test('should be a kind of Fog::Compute::Ovirt::Templates') { templates.kind_of? Fog::Compute::Ovirt::Templates } end end fog-1.34.0/tests/ovirt/models/compute/interfaces_tests.rb0000644000004100000410000000044712600047642023546 0ustar www-datawww-dataShindo.tests('Fog::Compute[:ovirt] | interfaces collection', ['ovirt']) do interfaces = Fog::Compute[:ovirt].interfaces tests('The interfaces collection') do test('should be a kind of Fog::Compute::Ovirt::Interfaces') { interfaces.kind_of? Fog::Compute::Ovirt::Interfaces } end end fog-1.34.0/tests/internet_archive/0000755000004100000410000000000012600047642017076 5ustar www-datawww-datafog-1.34.0/tests/internet_archive/signaturev4_tests.rb0000644000004100000410000000521412600047642023122 0ustar www-datawww-data# encoding: utf-8 Shindo.tests('InternetArchive | signaturev4', ['internetarchive']) do # These testcases are from http://docs.amazonwebservices.com/general/latest/gr/signature-v4-test-suite.html @signer = Fog::InternetArchive::SignatureV4.new('AKIDEXAMPLE', 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', 'us-east-1','host') Fog::Time.now = ::Time.utc(2011,9,9,23,36,0) tests('get-vanilla') do returns(@signer.sign({:headers => {'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470' end end tests('get-vanilla-query-order-key with symbol keys') do returns(@signer.sign({:query => {:'a' => 'foo', :'b' => 'foo'}, :headers => {:'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b' end end tests('get-vanilla-query-order-key') do returns(@signer.sign({:query => {'a' => 'foo', 'b' => 'foo'}, :headers => {'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b' end end tests('get-unreserved') do returns(@signer.sign({:headers => {'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e' end end tests('post-x-www-form-urlencoded-parameter') do returns(@signer.sign({:headers => {'Content-type' => 'application/x-www-form-urlencoded; charset=utf8', 'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :post, :path => '/', :body => 'foo=bar'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71' end end Fog::Time.now = ::Time.now end fog-1.34.0/tests/internet_archive/requests/0000755000004100000410000000000012600047642020751 5ustar www-datawww-datafog-1.34.0/tests/internet_archive/requests/storage/0000755000004100000410000000000012600047642022415 5ustar www-datawww-datafog-1.34.0/tests/internet_archive/requests/storage/multipart_upload_tests.rb0000644000004100000410000001111412600047642027547 0ustar www-datawww-dataShindo.tests('Fog::Storage[:internetarchive] | multipart upload requests', ["internetarchive"]) do @directory = Fog::Storage[:internetarchive].directories.create(:key => "fogmultipartuploadtests-#{rand(65536)}") tests('success') do @initiate_multipart_upload_format = { 'Bucket' => String, 'Key' => String, 'UploadId' => String } tests("#initiate_multipart_upload('#{@directory.identity}')", 'fog_multipart_upload').formats(@initiate_multipart_upload_format) do pending if Fog.mocking? data = Fog::Storage[:internetarchive].initiate_multipart_upload(@directory.identity, 'fog_multipart_upload').body @upload_id = data['UploadId'] data end @list_multipart_uploads_format = { 'Bucket' => String, 'IsTruncated' => Fog::Boolean, 'MaxUploads' => Integer, 'KeyMarker' => NilClass, 'NextKeyMarker' => String, 'NextUploadIdMarker' => Fog::Nullable::String, 'Upload' => [{ 'Initiated' => Time, 'Initiator' => { 'DisplayName' => String, 'ID' => String }, 'Key' => String, 'Owner' => { 'DisplayName' => String, 'ID' => String }, 'StorageClass' => String, 'UploadId' => String }], 'UploadIdMarker' => NilClass, } tests("#list_multipart_uploads('#{@directory.identity})").formats(@list_multipart_uploads_format) do pending if Fog.mocking? Fog::Storage[:internetarchive].list_multipart_uploads(@directory.identity).body end @parts = [] tests("#upload_part('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', 1, ('x' * 6 * 1024 * 1024))").succeeds do pending if Fog.mocking? data = Fog::Storage[:internetarchive].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 1, ('x' * 6 * 1024 * 1024)) @parts << data.headers['ETag'] end @list_parts_format = { 'Bucket' => String, 'Initiator' => { 'DisplayName' => String, 'ID' => String }, 'IsTruncated' => Fog::Boolean, 'Key' => String, 'MaxParts' => Integer, 'NextPartNumberMarker' => String, 'Part' => [{ 'ETag' => String, 'LastModified' => Time, 'PartNumber' => Integer, 'Size' => Integer }], 'PartNumberMarker' => String, 'StorageClass' => String, 'UploadId' => String } tests("#list_parts('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}')").formats(@list_parts_format) do pending if Fog.mocking? Fog::Storage[:internetarchive].list_parts(@directory.identity, 'fog_multipart_upload', @upload_id).body end if !Fog.mocking? @parts << Fog::Storage[:internetarchive].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 2, ('x' * 4 * 1024 * 1024)).headers['ETag'] end @complete_multipart_upload_format = { 'Bucket' => String, 'ETag' => String, 'Key' => String, 'Location' => String } tests("#complete_multipart_upload('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', #{@parts.inspect})").formats(@complete_multipart_upload_format) do pending if Fog.mocking? Fog::Storage[:internetarchive].complete_multipart_upload(@directory.identity, 'fog_multipart_upload', @upload_id, @parts).body end tests("#get_object('#{@directory.identity}', 'fog_multipart_upload').body").succeeds do pending if Fog.mocking? Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_multipart_upload').body == ('x' * 10 * 1024 * 1024) end if !Fog.mocking? @directory.files.new(:key => 'fog_multipart_upload').destroy end if !Fog.mocking? @upload_id = Fog::Storage[:internetarchive].initiate_multipart_upload(@directory.identity, 'fog_multipart_abort').body['UploadId'] end tests("#abort_multipart_upload('#{@directory.identity}', 'fog_multipart_abort', '#{@upload_id}')").succeeds do pending if Fog.mocking? Fog::Storage[:internetarchive].abort_multipart_upload(@directory.identity, 'fog_multipart_abort', @upload_id) end end tests('failure') do tests("initiate_multipart_upload") tests("list_multipart_uploads") tests("upload_part") tests("list_parts") tests("complete_multipart_upload") tests("abort_multipart_upload") end @directory.destroy end fog-1.34.0/tests/internet_archive/requests/storage/object_tests.rb0000644000004100000410000001646612600047642025447 0ustar www-datawww-dataShindo.tests('InternetArchive::Storage | object requests', ['internetarchive']) do @directory = Fog::Storage[:internetarchive].directories.create(:key => 'fogobjecttests-' + Time.now.to_i.to_s(32)) @ia_owner = Fog::Storage[:internetarchive].get_bucket_acl(@directory.key).body['Owner'] tests('success') do @multiple_delete_format = { 'DeleteResult' => [{ 'Deleted' => { 'Key' => String } }] } tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file)").succeeds do Fog::Storage[:internetarchive].put_object(@directory.identity, 'fog_object', lorem_file) end tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object') end @directory.files.get('fog_other_object').destroy tests("#get_object('#{@directory.identity}', 'fog_object')").returns(lorem_file.read) do Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object').body end tests("#get_object('#{@directory.identity}', 'fog_object', &block)").returns(lorem_file.read) do data = '' Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object') do |chunk, remaining_bytes, total_bytes| data << chunk end data end tests("#get_object('#{@directory.identity}', 'fog_object', {'Range' => 'bytes=0-20'})").returns(lorem_file.read[0..20]) do Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object', {'Range' => 'bytes=0-20'}).body end tests("#get_object('#{@directory.identity}', 'fog_object', {'Range' => 'bytes=0-0'})").returns(lorem_file.read[0..0]) do Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_object', {'Range' => 'bytes=0-0'}).body end tests("#head_object('#{@directory.identity}', 'fog_object')").succeeds do Fog::Storage[:internetarchive].head_object(@directory.identity, 'fog_object') end tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'private')").succeeds do Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', 'private') end acl = { 'Owner' => @ia_owner, 'AccessControlList' => [ { 'Grantee' => @ia_owner, 'Permission' => "FULL_CONTROL" } ]} tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(acl) do Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', acl) Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body end tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with email)").returns({ 'Owner' => @ia_owner, 'AccessControlList' => [ { 'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' }, 'Permission' => "FULL_CONTROL" } ]}) do pending if Fog.mocking? Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', { 'Owner' => @ia_owner, 'AccessControlList' => [ { 'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' }, 'Permission' => "FULL_CONTROL" } ]}) Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body end acl = { 'Owner' => @ia_owner, 'AccessControlList' => [ { 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' }, 'Permission' => "FULL_CONTROL" } ]} tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(acl) do Fog::Storage[:internetarchive].put_object_acl(@directory.identity, 'fog_object', acl) Fog::Storage[:internetarchive].get_object_acl(@directory.identity, 'fog_object').body end tests("#delete_object('#{@directory.identity}', 'fog_object')").succeeds do Fog::Storage[:internetarchive].delete_object(@directory.identity, 'fog_object') end tests("#get_object_http_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do object_url = Fog::Storage[:internetarchive].get_object_http_url(@directory.identity, 'fog_object', (Time.now + 60)) puts "get_object_http_url object_url: #{object_url}" (object_url =~ /http:\/\/#{Regexp.quote(@directory.identity)}\.s3\.us\.archive\.org\/fog_object/) != nil end tests("delete_multiple_objects('#{@directory.identity}', ['fog_object', 'fog_other_object'])").formats(@multiple_delete_format) do Fog::Storage[:internetarchive].delete_multiple_objects(@directory.identity, ['fog_object', 'fog_other_object']).body end end tests('failure') do tests("#put_object('fognonbucket', 'fog_non_object', lorem_file)").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].put_object('fognonbucket', 'fog_non_object', lorem_file) end tests("#copy_object('fognonbucket', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].copy_object('fognonbucket', 'fog_object', @directory.identity, 'fog_other_object') end tests("#copy_object('#{@directory.identity}', 'fog_non_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_non_object', @directory.identity, 'fog_other_object') end tests("#copy_object('#{@directory.identity}', 'fog_object', 'fognonbucket', 'fog_other_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].copy_object(@directory.identity, 'fog_object', 'fognonbucket', 'fog_other_object') end tests("#get_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].get_object('fognonbucket', 'fog_non_object') end tests("#get_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].get_object(@directory.identity, 'fog_non_object') end tests("#head_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].head_object('fognonbucket', 'fog_non_object') end tests("#head_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].head_object(@directory.identity, 'fog_non_object') end tests("#delete_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do Fog::Storage[:internetarchive].delete_object('fognonbucket', 'fog_non_object') end tests("#delete_multiple_objects('fognonbucket', ['fog_non_object'])").raises(Excon::Errors::NotFound) do pending if Fog.mocking? Fog::Storage[:internetarchive].delete_multiple_objects('fognonbucket', ['fog_non_object']) end tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'invalid')").raises(Excon::Errors::BadRequest) do Fog::Storage[:internetarchive].put_object_acl('#{@directory.identity}', 'fog_object', 'invalid') end end @directory.destroy end fog-1.34.0/tests/internet_archive/requests/storage/acl_utils_tests.rb0000644000004100000410000002315312600047642026147 0ustar www-datawww-datarequire 'fog/internet_archive/requests/storage/acl_utils' Shindo.tests('Fog::Storage::InternetArchive | ACL utils', ["internetarchive"]) do tests(".hash_to_acl") do tests(".hash_to_acl({}) at xpath //AccessControlPolicy").returns("", "has an empty AccessControlPolicy") do xml = Fog::Storage::InternetArchive.hash_to_acl({}) Nokogiri::XML(xml).xpath("//AccessControlPolicy").first.content.chomp end tests(".hash_to_acl({}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do xml = Fog::Storage::InternetArchive.hash_to_acl({}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first end tests(".hash_to_acl('Owner' => {}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do xml = Fog::Storage::InternetArchive.hash_to_acl('Owner' => {}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first end tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/ID").returns("abcdef0123456789", "returns the Owner ID") do xml = Fog::Storage::InternetArchive.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first.content end tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/ID").returns(nil, "does not have an Owner ID element") do xml = Fog::Storage::InternetArchive.hash_to_acl('Owner' => {'DisplayName' => 'bob'}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first end tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns("bob", "returns the Owner DisplayName") do xml = Fog::Storage::InternetArchive.hash_to_acl('Owner' => {'DisplayName' => 'bob'}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first.content end tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns(nil, "does not have an Owner DisplayName element") do xml = Fog::Storage::InternetArchive.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first end tests(".hash_to_acl({}) at xpath //AccessControlPolicy/AccessControlList").returns(nil, "has no AccessControlList") do xml = Fog::Storage::InternetArchive.hash_to_acl({}) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlPolicy").first end acl = { 'AccessControlList' => [ { 'Grantee' => { 'ID' => 'abcdef0123456789', 'DisplayName' => 'bob' }, 'Permission' => 'READ' } ] } tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("CanonicalUser", "has an xsi:type of CanonicalUser") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the Grantee ID") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").returns("bob", "returns the Grantee DisplayName") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("READ", "returns the Grantee Permission") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content end acl = { 'AccessControlList' => [ { 'Grantee' => { 'EmailAddress' => 'user@example.com' }, 'Permission' => 'FULL_CONTROL' } ] } tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("AmazonCustomerByEmail", "has an xsi:type of AmazonCustomerByEmail") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the Grantee EmailAddress") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("FULL_CONTROL", "returns the Grantee Permission") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content end acl = { 'AccessControlList' => [ { 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' }, 'Permission' => 'WRITE' } ] } tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("Group", "has an xsi:type of Group") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the Grantee URI") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("WRITE", "returns the Grantee Permission") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content end acl = { 'AccessControlList' => [ { 'Grantee' => { 'ID' => 'abcdef0123456789', 'DisplayName' => 'bob' }, 'Permission' => 'READ' }, { 'Grantee' => { 'EmailAddress' => 'user@example.com' }, 'Permission' => 'FULL_CONTROL' }, { 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' }, 'Permission' => 'WRITE' } ] } tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant").returns(3, "has three elements") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant").size end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the first Grant's Grantee ID") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the second Grant's Grantee EmailAddress") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content end tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the third Grant's Grantee URI") do xml = Fog::Storage::InternetArchive.hash_to_acl(acl) Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content end end tests(".acl_to_hash") do acl_xml = <<-XML 2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0 me 2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0 me FULL_CONTROL XML tests(".acl_to_hash(#{acl_xml.inspect})").returns({ "Owner" => { "DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0" }, "AccessControlList" => [{ "Grantee" => { "DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0" }, "Permission" => "FULL_CONTROL" }] }, 'returns hash of ACL XML') do Fog::Storage::InternetArchive.acl_to_hash(acl_xml) end end end fog-1.34.0/tests/internet_archive/requests/storage/cors_utils_tests.rb0000644000004100000410000001214312600047642026353 0ustar www-datawww-datarequire 'fog/internet_archive/requests/storage/cors_utils' Shindo.tests('Fog::Storage::InternetArchive | CORS utils', ["internetarchive"]) do tests(".hash_to_cors") do tests(".hash_to_cors({}) at xpath //CORSConfiguration").returns("", "has an empty CORSConfiguration") do xml = Fog::Storage::InternetArchive.hash_to_cors({}) Nokogiri::XML(xml).xpath("//CORSConfiguration").first.content.chomp end tests(".hash_to_cors({}) at xpath //CORSConfiguration/CORSRule").returns(nil, "has no CORSRules") do xml = Fog::Storage::InternetArchive.hash_to_cors({}) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule").first end cors = { 'CORSConfiguration' => [ { 'AllowedOrigin' => ['origin_123', 'origin_456'], 'AllowedMethod' => ['GET', 'POST'], 'AllowedHeader' => ['Accept', 'Content-Type'], 'ID' => 'blah-888', 'MaxAgeSeconds' => 2500, 'ExposeHeader' => ['x-some-header', 'x-other-header'] } ] } tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_123", "returns the CORSRule AllowedOrigin") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_456", "returns the CORSRule AllowedOrigin") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[1].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("GET", "returns the CORSRule AllowedMethod") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("POST", "returns the CORSRule AllowedMethod") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[1].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Accept", "returns the CORSRule AllowedHeader") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Content-Type", "returns the CORSRule AllowedHeader") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[1].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ID").returns("blah-888", "returns the CORSRule ID") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ID")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/MaxAgeSeconds").returns("2500", "returns the CORSRule MaxAgeSeconds") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/MaxAgeSeconds")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-some-header", "returns the CORSRule ExposeHeader") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[0].content end tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-other-header", "returns the CORSRule ExposeHeader") do xml = Fog::Storage::InternetArchive.hash_to_cors(cors) Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[1].content end end tests(".cors_to_hash") do cors_xml = <<-XML http://www.example.com http://www.example2.com Content-Length X-Foobar PUT GET 3000 x-amz-server-side-encryption x-amz-balls XML tests(".cors_to_hash(#{cors_xml.inspect})").returns({ "CORSConfiguration" => [{ "AllowedOrigin" => ["http://www.example.com", "http://www.example2.com"], "AllowedHeader" => ["Content-Length", "X-Foobar"], "AllowedMethod" => ["PUT", "GET"], "MaxAgeSeconds" => 3000, "ExposeHeader" => ["x-amz-server-side-encryption", "x-amz-balls"] }] }, 'returns hash of CORS XML') do Fog::Storage::InternetArchive.cors_to_hash(cors_xml) end end end fog-1.34.0/tests/internet_archive/requests/storage/bucket_tests.rb0000644000004100000410000003041212600047642025441 0ustar www-datawww-dataShindo.tests('Fog::Storage[:internetarchive] | bucket requests', ["internetarchive"]) do @ia_bucket_name = 'fogbuckettests-' + Time.now.to_i.to_s(32) tests('success') do @bucket_format = { 'CommonPrefixes' => [], 'IsTruncated' => Fog::Boolean, 'Marker' => NilClass, 'MaxKeys' => Integer, 'Name' => String, 'Prefix' => NilClass, 'Contents' => [{ 'ETag' => String, 'Key' => String, 'LastModified' => Time, 'Owner' => { 'DisplayName' => String, 'ID' => String }, 'Size' => Integer }] } @bucket_lifecycle_format = { 'Rules' => [{ 'ID' => String, 'Prefix' => Fog::Nullable::String, 'Enabled' => Fog::Boolean, 'Expiration' => Fog::Nullable::Hash, 'Transition' => Fog::Nullable::Hash }] } @service_format = { 'Buckets' => [{ 'CreationDate' => Time, 'Name' => String, }], 'Owner' => { 'DisplayName' => String, 'ID' => String } } tests("#put_bucket('#{@ia_bucket_name}')").succeeds do Fog::Storage[:internetarchive].put_bucket(@ia_bucket_name) @aws_owner = Fog::Storage[:internetarchive].get_bucket_acl(Fog::Storage[:internetarchive].directories.first.key).body['Owner'] end tests("#get_service").formats(@service_format) do Fog::Storage[:internetarchive].get_service.body end dirs = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name) file = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'y', :key => 'x') tests("#get_bucket('#{@ia_bucket_name}')").formats(@bucket_format) do Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name).body end file.destroy file1 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'a', :key => 'a/a1/file1') file2 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'ab', :key => 'a/file2') file3 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'abc', :key => 'b/file3') file4 = Fog::Storage[:internetarchive].directories.get(@ia_bucket_name).files.create(:body => 'abcd', :key => 'file4') tests("#get_bucket('#{@ia_bucket_name}')") do before do @bucket = Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name) end tests(".body['Contents'].map{|n| n['Key']}").returns(["a/a1/file1", "a/file2", "b/file3", "file4"]) do @bucket.body['Contents'].map{|n| n['Key']} end tests(".body['Contents'].map{|n| n['Size']}").returns([1, 2, 3, 4]) do @bucket.body['Contents'].map{|n| n['Size']} end tests(".body['CommonPrefixes']").returns([]) do @bucket.body['CommonPrefixes'] end end tests("#get_bucket('#{@ia_bucket_name}', 'delimiter' => '/')") do before do @bucket = Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name, 'delimiter' => '/') end tests(".body['Contents'].map{|n| n['Key']}").returns(['file4']) do @bucket.body['Contents'].map{|n| n['Key']} end tests(".body['CommonPrefixes']").returns(['a/', 'b/']) do @bucket.body['CommonPrefixes'] end end tests("#get_bucket('#{@ia_bucket_name}', 'delimiter' => '/', 'prefix' => 'a/')") do before do @bucket = Fog::Storage[:internetarchive].get_bucket(@ia_bucket_name, 'delimiter' => '/', 'prefix' => 'a/') end tests(".body['Contents'].map{|n| n['Key']}").returns(['a/file2']) do @bucket.body['Contents'].map{|n| n['Key']} end tests(".body['CommonPrefixes']").returns(['a/a1/']) do @bucket.body['CommonPrefixes'] end end file1.destroy; file2.destroy; file3.destroy; file4.destroy tests("#get_bucket_location('#{@ia_bucket_name}')").formats('LocationConstraint' => NilClass) do Fog::Storage[:internetarchive].get_bucket_location(@ia_bucket_name).body end tests("#get_request_payment('#{@ia_bucket_name}')").formats('Payer' => String) do Fog::Storage[:internetarchive].get_request_payment(@ia_bucket_name).body end tests("#put_request_payment('#{@ia_bucket_name}', 'Requester')").succeeds do Fog::Storage[:internetarchive].put_request_payment(@ia_bucket_name, 'Requester') end tests("#put_bucket_website('#{@ia_bucket_name}', 'index.html')").succeeds do Fog::Storage[:internetarchive].put_bucket_website(@ia_bucket_name, 'index.html') end tests("#put_bucket_acl('#{@ia_bucket_name}', 'private')").succeeds do Fog::Storage[:internetarchive].put_bucket_acl(@ia_bucket_name, 'private') end acl = { 'Owner' => @aws_owner, 'AccessControlList' => [ { 'Grantee' => @aws_owner, 'Permission' => "FULL_CONTROL" } ] } tests("#put_bucket_acl('#{@ia_bucket_name}', hash with id)").returns(acl) do Fog::Storage[:internetarchive].put_bucket_acl(@ia_bucket_name, acl) Fog::Storage[:internetarchive].get_bucket_acl(@ia_bucket_name).body end tests("#put_bucket_acl('#{@ia_bucket_name}', hash with email)").returns({ 'Owner' => @aws_owner, 'AccessControlList' => [ { 'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' }, 'Permission' => "FULL_CONTROL" } ] }) do pending if Fog.mocking? Fog::Storage[:internetarchive].put_bucket_acl(@ia_bucket_name, { 'Owner' => @aws_owner, 'AccessControlList' => [ { 'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' }, 'Permission' => "FULL_CONTROL" } ] }) Fog::Storage[:internetarchive].get_bucket_acl(@ia_bucket_name).body end acl = { 'Owner' => @aws_owner, 'AccessControlList' => [ { 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' }, 'Permission' => "FULL_CONTROL" } ] } tests("#put_bucket_acl('#{@ia_bucket_name}', hash with uri)").returns(acl) do Fog::Storage[:internetarchive].put_bucket_acl(@ia_bucket_name, acl) Fog::Storage[:internetarchive].get_bucket_acl(@ia_bucket_name).body end tests("#delete_bucket_website('#{@ia_bucket_name}')").succeeds do pending if Fog.mocking? Fog::Storage[:internetarchive].delete_bucket_website(@ia_bucket_name) end tests('bucket lifecycle') do pending if Fog.mocking? lifecycle = {'Rules' => [{'ID' => 'test rule', 'Prefix' => '/prefix', 'Enabled' => true, 'Days' => 42}]} tests('non-existant bucket') do tests('#put_bucket_lifecycle').returns([404, 'NoSuchBucket']) do begin Fog::Storage[:internetarchive].put_bucket_lifecycle('fognonbucket', lifecycle) rescue Excon::Errors::NotFound => e [e.response.status, e.response.body.match(%r{(.*)})[1]] end end tests('#get_bucket_lifecycle').returns([404, 'NoSuchBucket']) do begin Fog::Storage[:internetarchive].get_bucket_lifecycle('fognonbucket') rescue Excon::Errors::NotFound => e [e.response.status, e.response.body.match(%r{(.*)})[1]] end end tests('#delete_bucket_lifecycle').returns([404, 'NoSuchBucket']) do begin Fog::Storage[:internetarchive].delete_bucket_lifecycle('fognonbucket') rescue Excon::Errors::NotFound => e [e.response.status, e.response.body.match(%r{(.*)})[1]] end end end tests('no lifecycle') do tests('#get_bucket_lifecycle').returns([404, 'NoSuchLifecycleConfiguration']) do begin Fog::Storage[:internetarchive].get_bucket_lifecycle(@ia_bucket_name) rescue Excon::Errors::NotFound => e [e.response.status, e.response.body.match(%r{(.*)})[1]] end end tests('#delete_bucket_lifecycle').succeeds do Fog::Storage[:internetarchive].delete_bucket_lifecycle(@ia_bucket_name) end end tests('create').succeeds do Fog::Storage[:internetarchive].put_bucket_lifecycle(@ia_bucket_name, lifecycle) end tests('read').formats(@bucket_lifecycle_format) do Fog::Storage[:internetarchive].get_bucket_lifecycle(@ia_bucket_name).body end lifecycle = { 'Rules' => 5.upto(6).map { |i| {'ID' => "rule\##{i}", 'Prefix' => i.to_s, 'Enabled' => true, 'Days' => i} } } lifecycle_return = { 'Rules' => 5.upto(6).map { |i| {'ID' => "rule\##{i}", 'Prefix' => i.to_s, 'Enabled' => true, 'Expiration' => {'Days' => i}} } } tests('update').returns(lifecycle_return) do Fog::Storage[:internetarchive].put_bucket_lifecycle(@ia_bucket_name, lifecycle) Fog::Storage[:internetarchive].get_bucket_lifecycle(@ia_bucket_name).body end lifecycle = {'Rules' => [{'ID' => 'test rule', 'Prefix' => '/prefix', 'Enabled' => true, 'Expiration' => {'Date' => '2012-12-31T00:00:00.000Z'}}]} tests('date').returns(lifecycle) do Fog::Storage[:internetarchive].put_bucket_lifecycle(@ia_bucket_name, lifecycle) Fog::Storage[:internetarchive].get_bucket_lifecycle(@ia_bucket_name).body end tests('delete').succeeds do Fog::Storage[:internetarchive].delete_bucket_lifecycle(@ia_bucket_name) end tests('read').returns([404, 'NoSuchLifecycleConfiguration']) do begin Fog::Storage[:internetarchive].get_bucket_lifecycle(@ia_bucket_name) rescue Excon::Errors::NotFound => e [e.response.status, e.response.body.match(%r{(.*)})[1]] end end end tests("put_bucket_cors('#{@ia_bucket_name}', cors)").succeeds do cors = {'CORSConfiguration' => [ { 'AllowedOrigin' => 'http://localhost:3000', 'AllowedMethod' => ['POST', 'GET'], 'AllowedHeader' => '*', 'MaxAgeSeconds' => 3000 } ] } Fog::Storage[:internetarchive].put_bucket_cors(@ia_bucket_name, cors) end tests("#delete_bucket('#{@ia_bucket_name}')").succeeds do Fog::Storage[:internetarchive].delete_bucket(@ia_bucket_name) end end # tests('failure') do # tests("#delete_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].delete_bucket('fognonbucket') # end # @fognonempty = "fognonempty-#{rand(65536)}" # @bucket = Fog::Storage[:internetarchive].directories.create(:key => "fognonempty-#{rand(65536)}") # @file = @bucket.files.create(:key => 'foo', :body => 'bar') # tests("#delete_bucket('fognonempty')").raises(Excon::Errors::Conflict) do # Fog::Storage[:internetarchive].delete_bucket('fognonempty') # end # @file.destroy # @bucket.destroy # tests("#get_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].get_bucket('fognonbucket') # end # tests("#get_bucket_location('fognonbucket')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].get_bucket_location('fognonbucket') # end # tests("#get_request_payment('fognonbucket')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].get_request_payment('fognonbucket') # end # tests("#put_request_payment('fognonbucket', 'Requester')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].put_request_payment('fognonbucket', 'Requester') # end # tests("#put_bucket_acl('fognonbucket', 'invalid')").raises(Excon::Errors::BadRequest) do # Fog::Storage[:internetarchive].put_bucket_acl('fognonbucket', 'invalid') # end # tests("#put_bucket_website('fognonbucket', 'index.html')").raises(Excon::Errors::NotFound) do # Fog::Storage[:internetarchive].put_bucket_website('fognonbucket', 'index.html') # end # end # don't keep the bucket around # Fog::Storage[:internetarchive].delete_bucket(@ia_bucket_name) rescue nil end fog-1.34.0/tests/internet_archive/models/0000755000004100000410000000000012600047642020361 5ustar www-datawww-datafog-1.34.0/tests/internet_archive/models/storage/0000755000004100000410000000000012600047642022025 5ustar www-datawww-datafog-1.34.0/tests/internet_archive/models/storage/file_tests.rb0000644000004100000410000000306512600047642024517 0ustar www-datawww-dataShindo.tests("Storage[:internetarchive] | file", ["internetarchive"]) do # Fog.mock! require 'tempfile' file_attributes = { :key => 'fog_file_tests', :body => lorem_file, :public => true, :auto_make_bucket => 1, } directory_attributes = { # Add a random suffix to prevent collision :key => "fogfilestests-#{rand(65536)}", :collections => ['test_collection'] } @directory = Fog::Storage[:internetarchive].directories.create(directory_attributes) model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("#set_metadata_array_headers") do @instance.collections = ['test_collection', 'opensource'] @options = {} @instance.set_metadata_array_headers(:collections, @options) tests("#set_metadata_array_headers should set options").returns(true) do @options['x-archive-meta01-collection'] == 'opensource' && @options['x-archive-meta02-collection'] == 'test_collection' end end end model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("multipart upload") do pending if Fog.mocking? # A 6MB file @large_file = Tempfile.new("fog-test-ia-s3-multipart") 6.times { @large_file.write("x" * (1024**2)) } @large_file.rewind tests("#save(:multipart_chunk_size => 5242880)").succeeds do @directory.files.create(:key => 'multipart-upload', :body => @large_file, :multipart_chunk_size => 5242880) end @large_file.close end end # @directory.versions.each(&:destroy) @directory.destroy end fog-1.34.0/tests/internet_archive/models/storage/directory_tests.rb0000644000004100000410000000225512600047642025604 0ustar www-datawww-dataShindo.tests("Storage[:internet_archive] | directory", ["internetarchive"]) do directory_attributes = { :key => "fogdirectorytests-#{rand(65536)}", :collections => ['test_collection'] } tests('success') do params = directory_attributes mocks_implemented = Fog.mocking? collection = Fog::Storage[:internetarchive].directories @instance = collection.new(params) tests("#save").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.save end tests("#public_url").returns("http://archive.org/details/#{directory_attributes[:key]}") do @instance.public_url end end tests("#set_metadata_array_headers") do params = directory_attributes collection = Fog::Storage[:internetarchive].directories @instance = collection.new(params) @instance.collections = ['test_collection', 'opensource'] @options = {} @instance.set_metadata_array_headers(:collections, @options) tests("#set_metadata_array_headers should set options").returns(true) do @options['x-archive-meta01-collection'] == 'opensource' && @options['x-archive-meta02-collection'] == 'test_collection' end end end fog-1.34.0/tests/internet_archive/models/storage/files_tests.rb0000644000004100000410000000365012600047642024702 0ustar www-datawww-dataShindo.tests("Storage[:internetarchive] | files", ["internetarchive"]) do file_attributes = { :key => 'fog_file_tests', :body => lorem_file, :public => true, :auto_make_bucket => 1, :collections => ['test_collection'] } directory_attributes = { :key => "fogfilestests-#{rand(65536)}" } @directory = Fog::Storage[:internetarchive].directories.create(directory_attributes) # @directory.versioning = true model_tests(@directory.files, file_attributes, Fog.mocking?) do @instance # v2 = @directory.connection.put_object(@directory.key, @instance.key, 'version 2 content').headers['x-amz-version-id'] # v3 = @directory.connection.delete_object(@directory.key, @instance.key).headers['x-amz-version-id'] # v4 = @directory.connection.put_object(@directory.key, @instance.key, 'version 3 content').headers['x-amz-version-id'] # tests("#get") do # tests("#get without version fetches the latest version").returns(v4) do # @directory.files.get(@instance.key).version # end # tests("#get with version fetches that exact version").returns(v2) do # @directory.files.get(@instance.key, 'versionId' => v2).version # end # tests("#get with a deleted version returns nil").returns(nil) do # @directory.files.get(@instance.key, 'versionId' => v3) # end # end # tests("#head") do # tests("#head without version fetches the latest version").returns(v4) do # @directory.files.head(@instance.key).version # end # tests("#head with version fetches that exact version").returns(v2) do # @directory.files.head(@instance.key, 'versionId' => v2).version # end # tests("#head with a deleted version returns nil").returns(nil) do # @directory.files.head(@instance.key, 'versionId' => v3) # end # end end # @directory.versions.each(&:destroy) # @directory.destroy end fog-1.34.0/tests/internet_archive/models/storage/url_tests.rb0000644000004100000410000000146112600047642024400 0ustar www-datawww-data# encoding: utf-8 Shindo.tests('InternetArchive | url', ["internetarchive"]) do @expires = Time.utc(2013,1,1).utc.to_i @storage = Fog::Storage.new( :provider => 'InternetArchive', :ia_access_key_id => '123', :ia_secret_access_key => 'abc', :region => 'us-east-1' ) @file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt') if Fog.mock? signature = Fog::Storage::InternetArchive.new.signature(nil) else signature = 'tajHIhKHAdFYsigmzybCpaq8N0Q%3D' end tests('#url w/ response-cache-control').returns( "http://fognonbucket.s3.us.archive.org/test.txt?response-cache-control=No-cache&AWSAccessKeyId=123&Signature=#{signature}&Expires=1356998400" ) do @file.url(@expires, :query => { 'response-cache-control' => 'No-cache' }) end end fog-1.34.0/tests/internet_archive/signed_params_tests.rb0000644000004100000410000000031712600047642023462 0ustar www-datawww-data# encoding: utf-8 Shindo.tests('InternetArchive | signed_params', ['internetarchive']) do returns( Fog::InternetArchive.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27%20said%20Fred_-~." } end fog-1.34.0/tests/watchr.rb0000644000004100000410000000070712600047642015366 0ustar www-datawww-dataENV['FOG_MOCK'] ||= 'true' ENV['AUTOTEST'] = 'true' ENV['WATCHR'] = '1' def file2shindo(file) result = file.sub('lib/fog/', 'tests/').gsub(/\.rb$/, '_tests.rb') end def run_shindo_test(file) if File.exist? file system("shindont #{file}") else puts "FIXME: No test #{file} [#{Time.now}]" end end watch( 'tests/.*_tests\.rb' ) do |md| run_shindo_test(md[0]) end watch( 'lib/.*\.rb' ) do |md| run_shindo_test(file2shindo(md[0])) end fog-1.34.0/tests/vsphere/0000755000004100000410000000000012600047642015221 5ustar www-datawww-datafog-1.34.0/tests/vsphere/requests/0000755000004100000410000000000012600047642017074 5ustar www-datawww-datafog-1.34.0/tests/vsphere/requests/compute/0000755000004100000410000000000012600047642020550 5ustar www-datawww-datafog-1.34.0/tests/vsphere/requests/compute/vm_reboot_tests.rb0000644000004100000410000000176012600047642024317 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_reboot request', ['vsphere']) do compute = Fog::Compute[:vsphere] powered_on_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381' tests('The response should') do response = compute.vm_reboot('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } test('should have a reboot_type key') { response.key? 'reboot_type' } end # When forcing the shutdown, we expect the result to be { true => 'reset_power', false => 'reboot_guest'}.each do |force, expected| tests("When force => #{force}") do response = compute.vm_reboot('instance_uuid' => powered_on_vm, 'force' => force) test("should return reboot_type of #{expected}") { response['reboot_type'] == expected } end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reboot } end end fog-1.34.0/tests/vsphere/requests/compute/set_vm_customvalue_tests.rb0000644000004100000410000000146212600047642026246 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | set_vm_customvalue request', ['vsphere']) do compute = Fog::Compute[:vsphere] instance_uuid = '50137835-88a1-436e-768e-9b2677076e67' custom_key = nil custom_value = nil tests('The response should') do response = compute.set_vm_customvalue(instance_uuid, custom_key, custom_value) test('be nil') { response.nil? } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.set_vm_customvalue } raises(ArgumentError, 'raises ArgumentError when custom_key option is missing') { compute.set_vm_customvalue(instance_uuid) } raises(ArgumentError, 'raises ArgumentError when custom_value option is missing') { compute.set_vm_customvalue(instance_uuid, custom_key) } end end fog-1.34.0/tests/vsphere/requests/compute/vm_migrate_tests.rb0000644000004100000410000000106412600047642024452 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_migrate request', ['vsphere']) do compute = Fog::Compute[:vsphere] powered_on_vm = '50137835-88a1-436e-768e-9b2677076e67' tests('The response should') do response = compute.vm_migrate('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_migrate } end end fog-1.34.0/tests/vsphere/requests/compute/list_clusters_tests.rb0000644000004100000410000000055612600047642025224 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | list_clusters request', ['vsphere']) do tests("When listing all clusters") do response = Fog::Compute[:vsphere].list_clusters test("Clusters extracted from folders... ") {response.length == 4} tests("The response data format ...") do test("be a kind of Hash") { response.kind_of? Array } end end endfog-1.34.0/tests/vsphere/requests/compute/vm_config_vnc_tests.rb0000644000004100000410000000132512600047642025135 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_config_vnc request', ['vsphere']) do compute = Fog::Compute[:vsphere] reconfig_target = '50137835-88a1-436e-768e-9b2677076e67' vnc_spec = {:port => '5900', :password => 'ssaaa', :enabled => 'true'} tests('The response should') do response = compute.vm_config_vnc('instance_uuid' => reconfig_target).merge(vnc_spec) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('VNC attrs response should') do response = compute.vm_get_vnc(reconfig_target) test('be a kind of Hash') { response.kind_of? Hash } test('should have a port key') { response.key? :port } end end fog-1.34.0/tests/vsphere/requests/compute/vm_reconfig_hardware_tests.rb0000644000004100000410000000155012600047642026473 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_reconfig_hardware request', ['vsphere']) do compute = Fog::Compute[:vsphere] reconfig_target = '50137835-88a1-436e-768e-9b2677076e67' reconfig_spec = {'guestId' => 'rhel5_64Guest'} tests('The response should') do response = compute.vm_reconfig_hardware('instance_uuid' => reconfig_target, 'hardware_spec' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_hardware('hardware_spec' => reconfig_spec) } raises(ArgumentError, 'raises ArgumentError when hardware_spec option is missing') { compute.vm_reconfig_hardware('instance_uuid' => reconfig_target) } end end fog-1.34.0/tests/vsphere/requests/compute/get_network_tests.rb0000644000004100000410000000354112600047642024652 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | get_network request', ['vsphere']) do compute = Fog::Compute[:vsphere] class DistributedVirtualPortgroup attr_accessor :name, :dvs_name def initialize attrs @name = attrs.fetch(:name) @dvs_name = attrs.fetch(:dvs_name) end def config OpenStruct.new( :distributedVirtualSwitch => OpenStruct.new(:name => dvs_name)) end end fake_networks = [OpenStruct.new(:name => 'non-dvs'), DistributedVirtualPortgroup.new( :name => 'web1', :dvs_name => 'dvs5'), DistributedVirtualPortgroup.new( :name => 'web1', :dvs_name => 'dvs11'), DistributedVirtualPortgroup.new( :name => 'other', :dvs_name => 'other'), ] tests('#choose_finder should') do test('choose the network based on network name and dvs name'){ finder = compute.send(:choose_finder, 'web1', 'dvs11') found_network = fake_networks.find{ |n| finder.call(n) } found_network.name == 'web1' && found_network.dvs_name == 'dvs11' } test('choose the network based on network name and any dvs'){ finder = compute.send(:choose_finder, 'web1', :dvs) found_network = fake_networks.find{ |n| finder.call(n) } found_network.name == 'web1' && found_network.dvs_name == 'dvs5' } test('choose the network based on network name only'){ finder = compute.send(:choose_finder, 'other', nil) found_network = fake_networks.find{ |n| finder.call(n) } found_network.name == 'other' && found_network.dvs_name == 'other' } test('choose the network based on network name only for non-dvs'){ finder = compute.send(:choose_finder, 'non-dvs', nil) found_network = fake_networks.find{ |n| finder.call(n) } found_network.name == 'non-dvs' && found_network.class.name.to_s == 'OpenStruct' } end end fog-1.34.0/tests/vsphere/requests/compute/vm_clone_tests.rb0000644000004100000410000000466512600047642024134 0ustar www-datawww-dataShindo.tests("Fog::Compute[:vsphere] | vm_clone request", 'vsphere') do # require 'guid' compute = Fog::Compute[:vsphere] response = nil response_linked = nil template = "rhel64" datacenter = "Solutions" tests("Standard Clone | The return value should") do servers_size = compute.servers.size response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'wait' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' } end tests("Standard Clone setting ram and cpu | The return value should") do servers_size = compute.servers.size response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm', 'memoryMB' => '8192', 'numCPUs' => '8', 'wait' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm' } end tests("Linked Clone | The return value should") do servers_size = compute.servers.size response = compute.vm_clone('datacenter' => datacenter, 'template_path' => template, 'name' => 'cloning_vm_linked', 'wait' => 1, 'linked_clone' => true) test("be a kind of Hash") { response.kind_of? Hash } %w{ vm_ref new_vm task_ref }.each do |key| test("have a #{key} key") { response.key? key } end test("creates a new server") { compute.servers.size == servers_size+1 } test("new server name is set") { compute.get_virtual_machine(response['new_vm']['id'])['name'] == 'cloning_vm_linked' } end tests("When invalid input is presented") do raises(ArgumentError, 'it should raise ArgumentError') { compute.vm_clone(:foo => 1) } raises(Fog::Compute::Vsphere::NotFound, 'it should raise Fog::Compute::Vsphere::NotFound when the UUID is not a string') do pending # require 'guid' compute.vm_clone('instance_uuid' => Guid.from_s(template), 'name' => 'jefftestfoo') end end end fog-1.34.0/tests/vsphere/requests/compute/vm_reconfig_cpus_tests.rb0000644000004100000410000000144012600047642025646 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_reconfig_cpus request', ['vsphere']) do compute = Fog::Compute[:vsphere] reconfig_target = '50137835-88a1-436e-768e-9b2677076e67' reconfig_spec = 2 tests('The response should') do response = compute.vm_reconfig_cpus('instance_uuid' => reconfig_target, 'cpus' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_cpus('cpus' => reconfig_spec) } raises(ArgumentError, 'raises ArgumentError when cpus option is missing') { compute.vm_reconfig_cpus('instance_uuid' => reconfig_target) } end end fog-1.34.0/tests/vsphere/requests/compute/vm_power_off_tests.rb0000644000004100000410000000201112600047642025001 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_power_off request', ['vsphere']) do compute = Fog::Compute[:vsphere] powered_on_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381' tests('The response should') do response = compute.vm_power_off('instance_uuid' => powered_on_vm) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } test('should have a power_off_type key') { response.key? 'power_off_type' } end # When forcing the shutdown, we expect the result to be { true => 'cut_power', false => 'shutdown_guest'}.each do |force, expected| tests("When 'force' => #{force}") do response = compute.vm_power_off('instance_uuid' => powered_on_vm, 'force' => force) test('should retur power_off_type of #{expected}') { response['power_off_type'] == expected } end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_power_off } end end fog-1.34.0/tests/vsphere/requests/compute/vm_power_on_tests.rb0000644000004100000410000000102712600047642024651 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_power_on request', ['vsphere']) do compute = Fog::Compute[:vsphere] powered_off_vm = nil tests('The response should') do response = compute.vm_power_on('instance_uuid' => powered_off_vm) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_power_on } end end fog-1.34.0/tests/vsphere/requests/compute/vm_destroy_tests.rb0000644000004100000410000000105512600047642024513 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_destroy request', ['vsphere']) do compute = Fog::Compute[:vsphere] booted_vm = '5032c8a5-9c5e-ba7a-3804-832a03e16381' tests('The response should') do response = compute.vm_destroy('instance_uuid' => booted_vm) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_destroy } end end fog-1.34.0/tests/vsphere/requests/compute/list_virtual_machines_tests.rb0000644000004100000410000000225512600047642026713 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | list_virtual_machines request', ['vsphere']) do tests("When listing all machines") do response = Fog::Compute[:vsphere].list_virtual_machines tests("The response data format ...") do test("be a kind of Hash") { response.kind_of? Array } end end tests("When providing an instance_uuid") do # pending unless Fog.mock? tests("that does exist") do uuid = "5029c440-85ee-c2a1-e9dd-b63e39364603" response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid}) tests("The response should") do test("contain one vm") { response.length == 1 } test("contain that is an attribute hash") { response[0].kind_of? Hash } test("find jefftest") { response.first['name'] == 'jefftest' } end end tests("that does not exist or is a template") do %w{ does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a }.each do |uuid| response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid}) tests("The response should") do test("be empty") { response.empty? } end end end end end fog-1.34.0/tests/vsphere/requests/compute/current_time_tests.rb0000644000004100000410000000064312600047642025022 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | current_time request', ['vsphere']) do compute = Fog::Compute[:vsphere] tests('The response should') do response = compute.current_time test('be a kind of Hash') { response.kind_of? Hash } test('have a current_time key') { response.key? 'current_time' } test('have a current_time key with a Time value') { response['current_time'].kind_of? Time } end end fog-1.34.0/tests/vsphere/requests/compute/vm_reconfig_memory_tests.rb0000644000004100000410000000146112600047642026207 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | vm_reconfig_memory request', ['vsphere']) do compute = Fog::Compute[:vsphere] reconfig_target = '50137835-88a1-436e-768e-9b2677076e67' reconfig_spec = 4096 tests('The response should') do response = compute.vm_reconfig_memory('instance_uuid' => reconfig_target, 'memory' => reconfig_spec) test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.key? 'task_state' } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_reconfig_memory('memory' => reconfig_spec) } raises(ArgumentError, 'raises ArgumentError when memory option is missing') { compute.vm_reconfig_memory('instance_uuid' => reconfig_target) } end end fog-1.34.0/tests/vsphere/compute_tests.rb0000644000004100000410000000316412600047642020450 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere]', ['vsphere']) do compute = Fog::Compute[:vsphere] tests("| convert_vm_mob_ref_to_attr_hash") do # Mock the RbVmomi::VIM::ManagedObject class class MockManagedObject attr_reader :parent, :_ref def initialize @parent = @_ref = 'vm-123' end def collect! *pathSet { '_ref' => 'vm-123', 'name' => 'fakevm' } end end fake_vm_mob_ref = MockManagedObject.new tests("When converting an incomplete vm object") do test("it should return a Hash") do compute.send(:convert_vm_mob_ref_to_attr_hash, fake_vm_mob_ref).kind_of? Hash end tests("The converted Hash should") do attr_hash = compute.send(:convert_vm_mob_ref_to_attr_hash, fake_vm_mob_ref) test("have a name") { attr_hash['name'] == 'fakevm' } test("have a mo_ref") {attr_hash['mo_ref'] == 'vm-123' } test("have an id") { attr_hash['id'] == 'vm-123' } test("not have a instance_uuid") { attr_hash['instance_uuid'].nil? } end end tests("When passed a nil object") do attr_hash = compute.send :convert_vm_mob_ref_to_attr_hash, nil test("it should return a nil object") do attr_hash.nil? end end end tests("Compute attributes") do %w{ vsphere_is_vcenter vsphere_rev vsphere_username vsphere_server }.each do |attr| test("it should respond to #{attr}") { compute.respond_to? attr } end end tests("Compute collections") do %w{ servers }.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end end fog-1.34.0/tests/vsphere/models/0000755000004100000410000000000012600047642016504 5ustar www-datawww-datafog-1.34.0/tests/vsphere/models/compute/0000755000004100000410000000000012600047642020160 5ustar www-datawww-datafog-1.34.0/tests/vsphere/models/compute/server_tests.rb0000644000004100000410000000251412600047642023237 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | server model', ['vsphere']) do servers = Fog::Compute[:vsphere].servers server = servers.last tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ stop start destroy reboot }.each do |action| test(action) { server.respond_to? action } test("#{action} returns successfully") { server.send(action.to_sym) ? true : false } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :id, :instance_uuid, :uuid, :power_state, :tools_state, :mo_ref, :tools_version, :hostname, :mac_addresses, :operatingsystem, :connection_state, :hypervisor, :name, :public_ip_address] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Vsphere::Server') { server.kind_of? Fog::Compute::Vsphere::Server } end end fog-1.34.0/tests/vsphere/models/compute/servers_tests.rb0000644000004100000410000000117712600047642023426 0ustar www-datawww-dataShindo.tests('Fog::Compute[:vsphere] | servers collection', ['vsphere']) do servers = Fog::Compute[:vsphere].servers tests('The servers collection') do test('should not be empty') { not servers.empty? } test('should be a kind of Fog::Compute::Vsphere::Servers') { servers.kind_of? Fog::Compute::Vsphere::Servers } tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do tests('by managed object reference').succeeds { servers.get 'vm-715' } tests('by instance uuid').succeeds { servers.get '5032c8a5-9c5e-ba7a-3804-832a03e16381' } end end end fog-1.34.0/tests/dns/0000755000004100000410000000000012600047642014331 5ustar www-datawww-datafog-1.34.0/tests/dns/helper.rb0000644000004100000410000000212112600047642016131 0ustar www-datawww-datadef dns_providers { :aws => { :mocked => false }, :bluebox => { :mocked => false, :zone_attributes => { :ttl => 60 } }, :dnsimple => { :mocked => false }, :dnsmadeeasy => { :mocked => false }, :dynect => { :mocked => false, :zone_attributes => { :email => 'fog@example.com' } }, :linode => { :mocked => false, :zone_attributes => { :email => 'fog@example.com' } }, :zerigo => { :mocked => false }, :rackspace => { :mocked => false, :zone_attributes => { :email => 'fog@example.com' } }, :rage4 => { :mocked => false } } end def generate_unique_domain( with_trailing_dot = false) #get time (with 1/100th of sec accuracy) #want unique domain name and if provider is fast, this can be called more than once per second time= (Time.now.to_f * 100).to_i domain = 'test-' + time.to_s + '.com' if with_trailing_dot domain+= '.' end domain end fog-1.34.0/tests/dns/models/0000755000004100000410000000000012600047642015614 5ustar www-datawww-datafog-1.34.0/tests/dns/models/zones_tests.rb0000644000004100000410000000065512600047642020527 0ustar www-datawww-datafor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | zones", [provider.to_s]) do zone_attributes = { :domain => domain_name }.merge!(config[:zone_attributes] || {}) collection_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked]) end end fog-1.34.0/tests/dns/models/zone_tests.rb0000644000004100000410000000064712600047642020345 0ustar www-datawww-datafor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | zone", [provider.to_s]) do zone_attributes = { :domain => domain_name }.merge!(config[:zone_attributes] || {}) model_tests(Fog::DNS[provider].zones, zone_attributes, config[:mocked]) end end fog-1.34.0/tests/dns/models/records_tests.rb0000644000004100000410000000132412600047642021024 0ustar www-datawww-datafor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | records", [provider.to_s]) do record_attributes = { :name => 'www.' + domain_name, :type => 'A', :value => '1.2.3.4' }.merge!(config[:record_attributes] || {}) if !Fog.mocking? || config[:mocked] zone_attributes = { :domain => domain_name }.merge(config[:zone_attributes] || {}) @zone = Fog::DNS[provider].zones.create(zone_attributes) collection_tests(@zone.records, record_attributes, config[:mocked]) @zone.destroy end end end fog-1.34.0/tests/dns/models/record_tests.rb0000644000004100000410000000235212600047642020643 0ustar www-datawww-datafor provider, config in dns_providers # FIXME: delay/timing breaks things :( next if [:dnsmadeeasy, :rage4].include?(provider) domain_name = uniq_id + '.com' Shindo.tests("Fog::DNS[:#{provider}] | record", [provider.to_s]) do a_record_attributes = { :name => 'a.' + domain_name, :type => 'A', :value => '1.2.3.4' }.merge!(config[:record_attributes] || {}) aaaa_record_attributes = { :name => 'aaaa.' + domain_name, :type => 'AAAA', :value => '2001:0db8:0000:0000:0000:ff00:0042:8329' }.merge!(config[:record_attributes] || {}) cname_record_attributes = { :name => 'cname.' + domain_name, :type => 'CNAME', :value => 'real.' + domain_name }.merge!(config[:record_attributes] || {}) if !Fog.mocking? || config[:mocked] zone_attributes = { :domain => domain_name }.merge(config[:zone_attributes] || {}) @zone = Fog::DNS[provider].zones.create(zone_attributes) model_tests(@zone.records, a_record_attributes, config[:mocked]) model_tests(@zone.records, aaaa_record_attributes, config[:mocked]) model_tests(@zone.records, cname_record_attributes, config[:mocked]) @zone.destroy end end end fog-1.34.0/tests/joyent/0000755000004100000410000000000012600047642015055 5ustar www-datawww-datafog-1.34.0/tests/joyent/requests/0000755000004100000410000000000012600047642016730 5ustar www-datawww-datafog-1.34.0/tests/joyent/requests/analytics/0000755000004100000410000000000012600047642020717 5ustar www-datawww-datafog-1.34.0/tests/joyent/requests/analytics/instrumentation_tests.rb0000644000004100000410000000231112600047642025726 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | instrumentation requests", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @instrumentation_schema = { 'id' => String, 'module' => String, 'stat' => String, 'predicate' => Hash, 'decomposition' => [String], 'value-dimension' => Integer, 'value-arity' => String, 'retention-time' => Integer, 'granularity' => Integer, 'idle-max' => Integer, 'transformations' => [String], 'persist-data' => Fog::Boolean, 'crtime' => Integer, 'value-scope' => String, 'uris' => [ { 'uri' => String, 'name' => String } ] } tests('#create_instrumentation').data_matches_schema(@instrumentation_schema) do @analytics.create_instrumentation.body end tests('#list_instrumentations') do data_matches_schema(@instrumentation_schema) do @analytics.list_instrumentations.body.first end returns(Array) { @analytics.list_instrumentations.body.class } end tests('#delete_instrumentation') do returns(204) { @analytics.delete_instrumentation(Fog::Joyent::Analytics::Mock.data[:instrumentation]['id']).status } end end fog-1.34.0/tests/joyent/requests/compute/0000755000004100000410000000000012600047642020404 5ustar www-datawww-datafog-1.34.0/tests/joyent/requests/compute/keys_tests.rb0000644000004100000410000000275512600047642023137 0ustar www-datawww-dataShindo.tests("Fog::Compute[:joyent] | key requests", ['joyent']) do @key_format = { "name" => String, "key" => String, "created" => Time, "updated" => Time } before do # # Clear out all the test keys on the account in prep for test # Fog::Compute[:joyent].list_keys.body.each do |key| if key["name"] =~ /^fog-test/ Fog::Compute[:joyent].delete_key(key["name"]) end end @test_key_name = "fog-test-#{Time.now.utc.to_i}" Fog::Compute[:joyent].create_key( :name => @test_key_name, :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWxSNYngOTeu0pYd+2tpfYGISuMfMUNGyAIh4yRprAbacVddRq4Nyr12vDklzaRTzgd9PgX/82JMb4RARbVTtUKXJXmaBLvg2epGM+ScanZIitzL53whJrlGx+7nT+TnRdkB1XG7uIf2EpTQBaKrT4iG0magCXh5bmOqCyWte2gV8fArMg5bZclUT1p2E7qEW0htaLOiMSyGkjBlxb6vYQCA/Pa8VWETHehIF46S942gCj0aaL81gTocfyTm5/F+AgvUAsjHzRVkB/Dlhwq7Q7sK+4iAhlKPYMflkKC8r+nF0/LL9S3lllLZvbkEWJfEqlMCAbgmjTpYlBzQEqf/eN" ) end tests("#list_keys").formats(@key_format) do Fog::Compute[:joyent].list_keys.body.first end tests("#get_key").formats(@key_format) do Fog::Compute[:joyent].get_key(@test_key_name).body end tests("#delete_key") do returns(204 , "returns status code 204") do Fog::Compute[:joyent].delete_key(@test_key_name).status end raises(Excon::Errors::NotFound, "when a key no longer exists") do Fog::Compute[:joyent].delete_key(@test_key_name) Fog::Compute[:joyent].delete_key(@test_key_name) end end end fog-1.34.0/tests/joyent/requests/compute/networks_tests.rb0000644000004100000410000000177012600047642024034 0ustar www-datawww-dataShindo.tests("Fog::Compute[:joyent] | network requests", ["joyent"]) do @provider = Fog::Compute[:joyent] @network_format = { "id" => String, "name" => String, "public" => Fog::Boolean } if Fog.mock? @networks = Fog::Compute[:joyent].data[:networks] = { "193d6804-256c-4e89-a4cd-46f045959993" => { "id" => "193d6804-256c-4e89-a4cd-46f045959993", "name" => "Joyent-SDC-Private", "public" => false }, "1e7bb0e1-25a9-43b6-bb19-f79ae9540b39" => { "id" => "1e7bb0e1-25a9-43b6-bb19-f79ae9540b39", "name" => "Joyent-SDC-Public", "public" => true } } end tests("#list_networks") do if Fog.mock? returns(@networks.length, "correct number of networks") do @provider.list_networks.body.length end end returns(Array, "returns an Array of networks") do @provider.list_networks.body.class end formats([@network_format]) do @provider.list_networks.body end end end fog-1.34.0/tests/joyent/requests/compute/datasets_tests.rb0000644000004100000410000000324012600047642023762 0ustar www-datawww-dataShindo.tests("Fog::Compute[:joyent] | dataset requests", ["joyent"]) do @dataset_format = { "description" => String, "requirements" => { "max_memory" => Integer, "min_memory" => Integer }, "name" => String, "version" => String, "os" => String, "id" => String, "urn" => String, "default" => Fog::Boolean, "type" => String, "created" => Time, } if Fog.mock? Fog::Compute[:joyent].data[:datasets] = { "33904834-1f01-49d3-bed3-b642e158c375" => { "id" => "33904834-1f01-49d3-bed3-b642e158c375", "urn" => "sdc:sdc:zeus-simple-lb-200mbps:1.1.1", "name" => "zeus-simple-lb-200mbps", "os" => "smartos", "type" => "smartmachine", "description" => "Zeus Simple Load Balancer 200 Mbps SmartMachine", "default" => false, "requirements" => { "max_memory" => 32768, "min_memory" => 4096 }, "version" => "1.1.1", "created" => Time.parse("2011-09-15T07:39:13+00:00") }, "3fcf35d2-dd79-11e0-bdcd-b3c7ac8aeea6" => { "id" => "3fcf35d2-dd79-11e0-bdcd-b3c7ac8aeea6", "urn" => "sdc:sdc:mysql:1.4.1", "name" => "mysql", "os" => "smartos", "type" => "smartmachine", "description" => "MySQL SmartMachine", "default" => false, "requirements" => { "max_memory" => 32768, "min_memory" => 4096 }, "version" => "1.4.1", "created" => Time.parse("2011-09-15T05:01:34+00:00") } } end tests("#list_datasets") do formats(@dataset_format) do Fog::Compute[:joyent].list_datasets.body.first end end end fog-1.34.0/tests/joyent/requests/compute/machines_tests.rb0000644000004100000410000000322712600047642023746 0ustar www-datawww-dataShindo.tests("Fog::Compute[:joyent] | machine requests", ["joyent"]) do @machine_format = { "id" => String, "name" => String, "type" => String, "state" => String, "dataset" => String, "memory" => Integer, "disk" => Integer, "ips" => Array, "metadata" => Hash, "created" => Time, "updated" => Time } if Fog.mock? @machines = Fog::Compute[:joyent].data[:machines] = { "15080eca-3786-4bb8-a4d0-f43e1981cd72" => { "id" => "15080eca-3786-4bb8-a4d0-f43e1981cd72", "name" => "getting-started", "type" => "smartmachine", "state" => "running", "dataset" => "sdc:sdc:smartos:1.3.15", "memory" => 256, "disk" => 5120, "ips" => ["10.88.88.50"], "metadata" => {}, "created" => Time.parse("2011-06-03T00:02:31+00:00"), "updated" => Time.parse("2011-06-03T00:02:31+00:00") } } end @provider = Fog::Compute[:joyent] # # https://us-west-1.api.joyentcloud.com/docs#ListMachines # tests("#list_machines") do if Fog.mock? returns(@machines.length, "correct number of machines") do @provider.list_machines.body.length end end returns(Array, "returns an Array of machines") do @provider.list_machines.body.class end formats([@machine_format]) do @provider.list_machines.body end end # https://us-west-1.api.joyentcloud.com/docs#GetMachine tests("#get_machine") do machines = @provider.list_machines.body unless machines.empty? formats(@machine_format) do id = machines.first["id"] @provider.get_machine(id).body end end end end fog-1.34.0/tests/joyent/requests/compute/packages_tests.rb0000644000004100000410000000276712600047642023745 0ustar www-datawww-dataShindo.tests("Fog::Compute[:joyent] | package requests", ["joyent"]) do @package_format = { 'name' => String, 'vcpus' => Integer, 'memory' => Integer, 'disk' => Integer, 'swap' => Integer, 'default' => Fog::Boolean } if Fog.mock? @data = Fog::Compute[:joyent].data @data[:packages] = { "regular_128" => { "name" => "regular_128", "memory" => 128, "disk" => 5120, "vcpus" => 1, "swap" => 256, "default" => true }, "regular_256" => { "name" => "regular_256", "memory" => 256, "disk" => 5120, "vcpus" => 1, "swap" => 512, "default" => false }, "regular_512" => { "name" => "regular_512", "memory" => 512, "disk" => 10240, "vcpus" => 1, "swap" => 1024, "default" => false } } end tests("#list_packages") do formats([@package_format]) do Fog::Compute[:joyent].list_packages.body end end if Fog.mock? tests("#list_packages") do actual = @data[:packages].values.length returns(actual, "has correct number of packages") do Fog::Compute[:joyent].list_packages.body.length end end end tests("#get_package") do pkgid = if Fog.mock? @data[:packages].keys.first else Fog::Compute[:joyent].list_packages.body.first["name"] end formats(@package_format) do Fog::Compute[:joyent].get_package(pkgid).body end end end fog-1.34.0/tests/joyent/models/0000755000004100000410000000000012600047642016340 5ustar www-datawww-datafog-1.34.0/tests/joyent/models/analytics/0000755000004100000410000000000012600047642020327 5ustar www-datawww-datafog-1.34.0/tests/joyent/models/analytics/type_tests.rb0000644000004100000410000000062412600047642023061 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | type", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @type = @analytics.types.first tests('read only') do returns(false, 'should not save') { @type.respond_to?(:save)} returns(false, 'should not allow creating a new one') { @type.respond_to?(:create)} returns(false, 'should not allow destroying') { @type.respond_to?(:destroy)} end end fog-1.34.0/tests/joyent/models/analytics/transformation_tests.rb0000644000004100000410000000072012600047642025143 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | transformation", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @transformation = @analytics.transformations.first tests('read only') do returns(false, 'should not save') { @transformation.respond_to?(:save)} returns(false, 'should not allow creating a new one') { @transformation.respond_to?(:create)} returns(false, 'should not allow destroying') { @transformation.respond_to?(:destroy)} end end fog-1.34.0/tests/joyent/models/analytics/instrumentation_tests.rb0000644000004100000410000000074012600047642025342 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | instrumentation", %w{joyent }) do model_tests(Fog::Joyent[:analytics].instrumentations, {:joyent_module => 'cpu', :stat => 'usage'}, true) @analytics = Fog::Joyent[:analytics] @instrumentation = @analytics.instrumentations.first tests('#values') do @values = @instrumentation.values(Time.now.utc.to_i - 600, 5) returns(Array) { @values.class } returns(Fog::Joyent::Analytics::Value) { @values.first.class } end end fog-1.34.0/tests/joyent/models/analytics/types_tests.rb0000644000004100000410000000043612600047642023245 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | types", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @types = @analytics.types tests('#all').succeeds do @types.all end tests('#new').succeeds do @types.new(['string', {'arity' => 'discrete', 'unit' => ''}]) end end fog-1.34.0/tests/joyent/models/analytics/field_tests.rb0000644000004100000410000000063212600047642023162 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | field", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @field = @analytics.fields.first tests('read only') do returns(false, 'should not save') { @field.respond_to?(:save)} returns(false, 'should not allow creating a new one') { @field.respond_to?(:create)} returns(false, 'should not allow destroying') { @field.respond_to?(:destroy)} end end fog-1.34.0/tests/joyent/models/analytics/fields_tests.rb0000644000004100000410000000045112600047642023344 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | fields", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @fields = @analytics.fields tests('#all').succeeds do @fields.all end tests('#new').succeeds do @fields.new(['apache', { 'label' => 'Apache', 'type' => 'string' }]) end end fog-1.34.0/tests/joyent/models/analytics/metrics_tests.rb0000644000004100000410000000107512600047642023547 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | metrics", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @metrics = @analytics.metrics tests('#all').succeeds do @metrics.all end tests('#new').succeeds do @metrics.new({ "module" => "cpu", "stat" => "thread_executions", "label" => "thread executions", "interval" => "interval", "fields" => ["hostname", "zonename", "runtime"], "unit" => "operations" }) end end fog-1.34.0/tests/joyent/models/analytics/joyent_modules_tests.rb0000644000004100000410000000046712600047642025145 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | joyent_modules", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @joyent_modules = @analytics.joyent_modules tests('#all').succeeds do @joyent_modules.all end tests('#new').succeeds do @joyent_modules.new(['cpu', { 'label' => 'CPU' }]) end end fog-1.34.0/tests/joyent/models/analytics/instrumentations_tests.rb0000644000004100000410000000027612600047642025531 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | instrumentations", %w{joyent}) do collection_tests(Fog::Joyent[:analytics].instrumentations, {:joyent_module => 'cpu', :stat => 'usage'}, true) end fog-1.34.0/tests/joyent/models/analytics/transformations_tests.rb0000644000004100000410000000055412600047642025333 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | transformations", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @transformations = @analytics.transformations tests('#all').succeeds do @transformations.all end tests('#new').succeeds do @transformations.new(['geolocate', { 'label' => 'geolocate IP addresses', "fields" => ["raddr"] }]) end end fog-1.34.0/tests/joyent/models/analytics/metric_tests.rb0000644000004100000410000000064012600047642023361 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | metric", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @metric = @analytics.metrics.first tests('read only') do returns(false, 'should not save') { @metric.respond_to?(:save)} returns(false, 'should not allow creating a new one') { @metric.respond_to?(:create)} returns(false, 'should not allow destroying') { @metric.respond_to?(:destroy)} end end fog-1.34.0/tests/joyent/models/analytics/joyent_module_tests.rb0000644000004100000410000000071212600047642024753 0ustar www-datawww-dataShindo.tests("Fog::Joyent[:analytics] | joyent_module", %w{joyent}) do @analytics = Fog::Joyent[:analytics] @joyent_module = @analytics.joyent_modules.first tests('read only') do returns(false, 'should not save') { @joyent_module.respond_to?(:save)} returns(false, 'should not allow creating a new one') { @joyent_module.respond_to?(:create)} returns(false, 'should not allow destroying') { @joyent_module.respond_to?(:destroy)} end end fog-1.34.0/tests/xenserver/0000755000004100000410000000000012600047642015566 5ustar www-datawww-datafog-1.34.0/tests/xenserver/helper.rb0000644000004100000410000000145212600047642017374 0ustar www-datawww-datadef test_template_name ENV['FOG_XENSERVER_TEMPLATE'] || 'squeeze-test' end def test_ephemeral_vm_name 'fog-test-server-shindo' end def valid_ref?(ref) (ref =~ /OpaqueRef:/) and \ (ref != "OpaqueRef:NULL" ) end def create_ephemeral_vm Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) end def create_ephemeral_server create_ephemeral_vm end def destroy_ephemeral_servers servers = Fog::Compute[:xenserver].servers # Teardown cleanup (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end (servers.templates.select { |t| t.name == test_ephemeral_vm_name}).each do |s| s.destroy end end def destroy_ephemeral_vms destroy_ephemeral_servers end fog-1.34.0/tests/xenserver/README0000644000004100000410000000124712600047642016452 0ustar www-datawww-data# Running the XenServer tests. Tweak the helper.rb file in tests/xenserver/helper.rb to fit your needs. Fog credentials in $HOME/.fog file are used to run the tests. In particular: :default: :xenserver_url: xenserver-test :xenserver_username: root :xenserver_password: secret We need a working template named squeeze-test available in the XenServer to perform the tests. Change the template name to fit your needs or create a working template named squeeze-test. The tests creates a few VMs during the flight. Make sure you have enough RAM and Storage available in the hypervisor. Run the XenServer provider tests issuing: shindo tests/xenserver fog-1.34.0/tests/xenserver/requests/0000755000004100000410000000000012600047642017441 5ustar www-datawww-datafog-1.34.0/tests/xenserver/requests/compute/0000755000004100000410000000000012600047642021115 5ustar www-datawww-datafog-1.34.0/tests/xenserver/requests/compute/create_sr_tests.rb0000644000004100000410000000317212600047642024636 0ustar www-datawww-data# # @rubiojr # # Testing this requires a very specific setup: # # I use VirtualBox to virtualize XenServer/XCP and create the XenServer VM using # two virtual disks under the same SATA controller. One of the virtual disks # will be /dev/sdb, used to perform the tests. # Shindo.tests('Fog::Compute[:xenserver] | create_sr request', ['xenserver']) do compute = Fog::Compute[:xenserver] tests('#create_sr "FOG TEST SR" with device /dev/sdb') do test('create an EXT SR') do ref = compute.create_sr compute.hosts.first.reference, 'FOG TEST SR', 'ext', '', { :device => '/dev/sdb' }, '0', 'user', false, {} valid_ref? ref end raises(Fog::XenServer::RequestFailed, 'raise when device in use') do ref = compute.create_sr compute.hosts.first.reference, 'FOG TEST SR', 'ext', '', { :device => '/dev/sdb' }, '0', 'user', false, {} valid_ref? ref end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when arguments missing') { compute.create_sr } end # Clean-up compute.storage_repositories.each do |sr| next unless sr.name == 'FOG TEST SR' sr.pbds.each { |pbd| pbd.unplug } sr.destroy end end fog-1.34.0/tests/xenserver/requests/compute/create_network_tests.rb0000644000004100000410000000114712600047642025703 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | create_network request', ['xenserver']) do compute = Fog::Compute[:xenserver] tests('success') do test('#create_network') do @ref = compute.create_network 'test-net' !(compute.networks.find { |n| n.reference == @ref }).nil? end test('#create_network with description') do # Destroy previously created network compute.networks.get(@ref).destroy @ref = compute.create_network 'test-net', :description => 'foo' !(compute.networks.find { |n| n.description == 'foo' }).nil? end end compute.destroy_network @ref end fog-1.34.0/tests/xenserver/requests/compute/create_vlan_tests.rb0000644000004100000410000000174512600047642025156 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | create_vlan request', ['xenserver']) do compute = Fog::Compute[:xenserver] tests('success') do test('#create_vlan') do @net = compute.networks.create :name => 'test-net' # try to use a bonded interface first @pif = compute.pifs.find { |p| p.device == 'bond0' and p.vlan == "-1" } unless @pif @pif = compute.pifs.find { |p| p.device == 'eth0' and p.vlan == "-1" } end @ref = compute.create_vlan @pif.reference, 1499, @net.reference @ref.start_with? "OpaqueRef" end end tests('failure') do test('#create_vlan duplicated') do raises = false # Try to create a VLAN with a duplicated tag begin @ref = compute.create_vlan @pif.reference, 1499, @net.reference rescue Fog::XenServer::RequestFailed => e raises = true if (e.message =~ /NETWORK_ALREADY_CONNECTED/) end raises end end compute.destroy_vlan @ref @net.destroy end fog-1.34.0/tests/xenserver/requests/compute/disable_host_tests.rb0000644000004100000410000000052012600047642025321 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | disable_host request', ['xenserver']) do compute = Fog::Compute[:xenserver] host = compute.hosts.first tests('#disable_host') do test('disables the host') do compute.disable_host host.reference host.reload !host.enabled end end # Cleanup host.enable end fog-1.34.0/tests/xenserver/requests/compute/destroy_network_tests.rb0000644000004100000410000000052612600047642026131 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | destroy_network request', ['xenserver']) do compute = Fog::Compute[:xenserver] tests('success') do test('#destroy_network') do @ref = compute.create_network 'test-net' compute.destroy_network @ref (compute.networks.find { |n| n.reference == @ref }).nil? end end end fog-1.34.0/tests/xenserver/requests/compute/create_vdi_tests.rb0000644000004100000410000000457112600047642025000 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | create_vdi request', ['xenserver']) do compute = Fog::Compute[:xenserver] sr = compute.storage_repositories.find { |sr| sr.name == 'Local storage' } tests('create_vdi should') do raises(ArgumentError, 'raise ArgumentError if virtual_size is no specified') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :type => 'system', :read_only => false, :sharable => false, :other_config => {} } ) end raises(ArgumentError, 'raise ArgumentError if type is no specified') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :read_only => false, :sharable => false, :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if read_only is no specified') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :sharable => false, :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if sharable is no specified') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if other_config is no specified') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :sharable => false, } ) valid_ref? ref end test('create a VDI') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :sharable => false, :other_config => {} } ) valid_ref? ref end end compute.vdis.each { |vdi| vdi.destroy if vdi.name == 'foovdi' } tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.create_vdi } end end fog-1.34.0/tests/xenserver/requests/compute/destroy_sr_tests.rb0000644000004100000410000000261412600047642025064 0ustar www-datawww-data# # @rubiojr # # Testing this requires a very specific setup: # # I use VirtualBox to virtualize XenServer/XCP and create the XenServer VM using # two virtual disks under the same SATA controller. One of the virtual disks # will be /dev/sdb, used to perform the tests. # Shindo.tests('Fog::Compute[:xenserver] | destroy_sr request', ['xenserver']) do compute = Fog::Compute[:xenserver] # We need the SR available for this to work, so create it first ref = compute.create_sr compute.hosts.first.reference, 'FOG TEST SR', 'ext', '', { :device => '/dev/sdb' }, '0', 'user', false, {} tests('#destroy_sr') do test('destroyed "FOG TEST SR"') do compute.storage_repositories.each do |sr| next unless sr.name == 'FOG TEST SR' sr.pbds.each { |pbd| pbd.unplug } end compute.destroy_sr ref (compute.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? end raises(Fog::XenServer::RequestFailed, 'raises HandleInvalid trying to destroy it twice') do compute.destroy_sr ref end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when arguments missing') \ { compute.destroy_sr } end end fog-1.34.0/tests/xenserver/requests/compute/create_vif_tests.rb0000644000004100000410000000552412600047642025001 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | create_vif request', ['xenserver']) do compute = Fog::Compute[:xenserver] servers = compute.servers # pre-flight cleanup (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end tests('create_vif should') do vm_ref = compute.create_server test_ephemeral_vm_name, test_template_name ref = compute.create_vif vm_ref, compute.networks.first.reference s = servers.get vm_ref test('return a valid reference') do if (ref != "OpaqueRef:NULL") and (ref.split("1") != "NULL") true else false end end test('add the VIF to the server') do !(s.vifs.find { |vif| vif.reference == ref }).nil? end raises(ArgumentError, 'raise ArgumentError when vm_ref nil') do ref = compute.create_vif nil, compute.networks.first.reference end raises(ArgumentError, 'raise ArgumentError when network_ref nil') do ref = compute.create_vif vm_ref, nil end test('create a VIF with device number 9') do ref = compute.create_vif vm_ref, compute.networks.first.reference, 9 s.reload (compute.vifs.get(ref).device == 9.to_s) and \ !(s.vifs.find { |vif| vif.reference == ref }).nil? end end tests('create_vif_custom should') do vm_ref = compute.create_server test_ephemeral_vm_name, test_template_name network_ref = compute.networks.first.reference conf = { 'MAC_autogenerated' => 'True', 'VM' => vm_ref, 'network' => network_ref, 'MAC' => '', 'device' => '4', 'MTU' => '0', 'other_config' => {}, 'qos_algorithm_type' => 'ratelimit', 'qos_algorithm_params' => {} } ref = compute.create_vif_custom conf s = servers.get vm_ref test('return a valid reference') do if (ref != "OpaqueRef:NULL") and (ref.split("1") != "NULL") true else false end end test('add the VIF to the server') do !(s.vifs.find { |vif| vif.reference == ref }).nil? end raises(ArgumentError, 'raise ArgumentError when conf is not a Hash') do conf['device'] = '5' ref = compute.create_vif_custom 'foobar' end test('create a VIF with device number 9') do conf['device'] = '9' ref = compute.create_vif_custom conf s.reload (compute.vifs.get(ref).device == 9.to_s) and \ !(s.vifs.find { |vif| vif.reference == ref }).nil? end test('create a VIF with MAC 11:22:33:44:55:66') do conf['MAC_autogenerated'] = 'False' conf['MAC'] = '11:22:33:44:55:66' conf['device'] = '6' ref = compute.create_vif_custom conf vif = compute.vifs.get ref vif.mac == '11:22:33:44:55:66' end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.create_vif } end end fog-1.34.0/tests/xenserver/requests/compute/set_attribute_tests.rb0000644000004100000410000000477612600047642025560 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | set_attribute request', ['xenserver']) do # Setup cleanup destroy_ephemeral_servers connection = Fog::Compute[:xenserver] servers = connection.servers server = create_ephemeral_server tests('Setting an attribute with set_attribute should') do test('set the PV_bootloader attr to foobar') do response = connection.set_attribute('VM', server.reference, 'PV_bootloader', 'foobar') server.reload server.pv_bootloader == 'foobar' end test('set the PV-bootloader attr to stuff') do response = connection.set_attribute('VM', server.reference, 'PV-bootloader', 'stuff') server.reload server.pv_bootloader == 'stuff' end test('set the other_config attr { "foo" => "bar", :stuff => "crap" }') do response = connection.set_attribute('VM', server.reference, 'other_config', { "foo" => "bar", :stuff => 'crap' }) server.reload (server.other_config['foo'] == 'bar') and \ (server.other_config['stuff'] == 'crap') end test('set the multiple valued attribute memory_limits }') do server = create_ephemeral_server server.stop 'hard' server.wait_for { not running? } response = connection.set_attribute('VM', server.reference, 'memory_limits', '1073741824', '1073741824', '1073741824', '1073741824' ) server.reload (server.memory_dynamic_max == "1073741824") and \ (server.memory_dynamic_min == "1073741824") and \ (server.memory_static_max == "1073741824") and \ (server.memory_static_min == "1073741824") server.start end test('set an array valued attribute') do server = create_ephemeral_server response = connection.set_attribute('VM', server.reference, 'tags', ['foo','bar'] ) server.reload server.tags.include?('foo') and server.tags.include?('bar') end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,attr,value missing') { connection.get_record } end # Teardown cleanup destroy_ephemeral_servers end fog-1.34.0/tests/xenserver/requests/compute/unplug_pbd_tests.rb0000644000004100000410000000260512600047642025026 0ustar www-datawww-data# # @rubiojr # # Testing this requires a very specific setup: # # I use VirtualBox to virtualize XenServer/XCP and create the XenServer VM using # two virtual disks under the same SATA controller. One of the virtual disks # will be /dev/sdb, used to perform the tests. # Shindo.tests('Fog::Compute[:xenserver] | unplug_pbd request', ['xenserver']) do compute = Fog::Compute[:xenserver] # Creating a new SR automatically plugs the PBD # We need the SR available for this to work, so create it first ref = compute.create_sr compute.hosts.first.reference, 'FOG TEST SR', 'ext', '', { :device => '/dev/sdb' }, '0', 'user', false, {} tests('#unplug_pbd') do test('unplugged') do sr = compute.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' } pbd = sr.pbds.first compute.unplug_pbd pbd.reference pbd.reload pbd.currently_attached == false end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when arguments missing') \ { compute.unplug_pbd } end # Clean-up compute.storage_repositories.each do |sr| next unless sr.name == 'FOG TEST SR' sr.pbds.each { |pbd| pbd.unplug } sr.destroy end end fog-1.34.0/tests/xenserver/requests/compute/clone_server_tests.rb0000644000004100000410000000222512600047642025353 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | clone_server request', ['xenserver']) do compute = Fog::Compute[:xenserver] servers = compute.servers (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end tests('clone_server should') do raises(ArgumentError, 'raise exception when template nil') do compute.clone_server 'fooserver', nil end raises(ArgumentError, 'raise exception when name nil') do compute.clone_server nil, 'fooref' end compute.default_template = test_template_name tmpl = compute.default_template test('accept a string template ref') do ref = compute.clone_server test_ephemeral_vm_name, tmpl.reference (ref =~ /OpaqueRef:/) == 0 and !(servers.custom_templates.find { |s| s.reference == ref }).nil? end test('accept a Server object') do ref = compute.clone_server test_ephemeral_vm_name, tmpl (ref =~ /OpaqueRef:/) == 0 and !(servers.custom_templates.find { |s| s.reference == ref }).nil? end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.clone_server } end end fog-1.34.0/tests/xenserver/requests/compute/enable_host_tests.rb0000644000004100000410000000051312600047642025146 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | enable_host request', ['xenserver']) do compute = Fog::Compute[:xenserver] host = compute.hosts.first tests('#enable_host') do test('enables the host') do compute.enable_host host.reference host.reload host.enabled end end # Cleanup host.enable end fog-1.34.0/tests/xenserver/requests/compute/destroy_vlan_tests.rb0000644000004100000410000000173012600047642025376 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | destroy_vlan request', ['xenserver']) do compute = Fog::Compute[:xenserver] tests('success') do test('#destroy_vlan') do @net = compute.networks.create :name => 'test-net' # try to use a bonded interface first @pif = compute.pifs.find { |p| p.device == 'bond0' and p.vlan == "-1" } unless @pif @pif = compute.pifs.find { |p| p.device == 'eth0' and p.vlan == "-1" } end @ref = compute.create_vlan @pif.reference, 1499, @net.reference compute.destroy_vlan @ref (compute.vlans.reload.find { |v| v.reference == @ref }).nil? end end tests('failure') do test('#destroy_vlan invalid') do raises = false # Try to create a VLAN with a duplicated tag begin compute.destroy_vlan @ref rescue Fog::XenServer::RequestFailed => e raises = true if (e.message =~ /HANDLE_INVALID/) end raises end end @net.destroy end fog-1.34.0/tests/xenserver/requests/compute/destroy_vdi_tests.rb0000644000004100000410000000135312600047642025221 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | destroy_vdi request', ['xenserver']) do compute = Fog::Compute[:xenserver] sr = compute.storage_repositories.find { |sr| sr.name == 'Local storage' } tests('destroy_vdi should') do ref = compute.create_vdi( { :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :sharable => false, :other_config => {} } ) raises(Fog::XenServer::RequestFailed, 'destroy it') do compute.destroy_vdi ref compute.vdis.get ref end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.destroy_vdi } end end fog-1.34.0/tests/xenserver/requests/compute/get_record_tests.rb0000644000004100000410000000071212600047642025001 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | get_record request', ['xenserver']) do compute = Fog::Compute[:xenserver] vm_ref = 'alksjdfoiuoiwueroiwe' tests('The response should') do raises(Fog::XenServer::RequestFailed, 'when ref invalid') do response = compute.get_record(vm_ref, 'VM') end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.get_record } end end fog-1.34.0/tests/xenserver/requests/compute/create_server_tests.rb0000644000004100000410000000746612600047642025532 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | create_server request', ['xenserver']) do compute = Fog::Compute[:xenserver] servers = compute.servers # pre-flight cleanup (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end (servers.templates.select { |t| t.name == test_ephemeral_vm_name}).each do |s| s.destroy end tests('create_server should') do raises(StandardError, 'raise exception when template nil') do compute.create_server 'fooserver', nil end ref = compute.create_server test_ephemeral_vm_name, test_template_name test('return a valid reference') do if (ref != "OpaqueRef:NULL") and (ref.split("1") != "NULL") true else false end end end tests('get_vm_by_name should') do test('return a valid OpaqueRef') do (compute.get_vm_by_name(test_template_name) =~ /OpaqueRef:/) and \ (compute.get_vm_by_name(test_template_name) != "OpaqueRef:NULL" ) end returns(nil, 'return nil if VM does not exist') { compute.get_vm_by_name('sdfsdf') } end tests('create_server_raw should') do raises(ArgumentError, 'raise exception when name_label nil') do compute.create_server_raw end test('create a server') do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first } ) valid_ref? ref end test('create a server with name foobar') do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first } ) (compute.servers.get ref).name == test_ephemeral_vm_name end test('set the PV_bootloader attribute to eliloader') do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first, :PV_bootloader => 'eliloader', } ) (compute.servers.get ref).pv_bootloader == 'eliloader' end test('set the :pv_bootloader attribute to eliloader') do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first, :pv_bootloader => 'eliloader', } ) (compute.servers.get ref).pv_bootloader == 'eliloader' end test('set the "vcpus_attribute" to 1') do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first, 'vcpus_max' => '1', } ) (compute.servers.get ref).vcpus_max == '1' end tests('set lowercase hash attributes') do %w{ VCPUs_params HVM_boot_params }.each do |a| test("set the :#{a} to { :foo => 'bar' }") do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first, a.downcase.to_sym => {:foo => :bar}, } ) eval "(compute.servers.get ref).#{a.to_s.downcase}['foo'] == 'bar'" end end %w{ VCPUs_at_startup VCPUs_max PV_bootloader_args PV_bootloader PV_kernel PV_ramdisk PV_legacy_args }.each do |a| test("set the :#{a} to 1") do ref = compute.create_server_raw( { :name_label => test_ephemeral_vm_name, :affinity => compute.hosts.first, a.downcase.to_sym => '1', } ) eval "(compute.servers.get ref).#{a.to_s.downcase} == '1'" end end end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.create_server } end end fog-1.34.0/tests/xenserver/xenserver_tests.rb0000644000004100000410000000167112600047642021363 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver]', ['xenserver']) do tests("Login") do raises(Fog::XenServer::InvalidLogin, 'raises error when invalid password') do conn = Fog::Compute.new({ :provider => 'XenServer', :xenserver_url => 'xenserver-test', :xenserver_username => 'root', :xenserver_password => 'asdfsadf' }) end raises(Fog::XenServer::InvalidLogin, 'raises error when invalid user') do conn = Fog::Compute.new({ :provider => 'XenServer', :xenserver_url => 'xenserver-test', :xenserver_username => 'rootffff', :xenserver_password => 'changeme' }) end raises(SocketError, 'raises error when invalid host') do conn = Fog::Compute.new({ :provider => 'XenServer', :xenserver_url => 'xenserver-testlakjsdflkj', :xenserver_username => 'root', :xenserver_password => 'changeme' }) end end end fog-1.34.0/tests/xenserver/compute_tests.rb0000644000004100000410000000416112600047642021013 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver]', ['xenserver']) do compute = Fog::Compute[:xenserver] tests("Compute attributes") do %w{ default_template }.each do |attr| test("it should respond to #{attr}") { compute.respond_to? attr } end end tests("Compute collections") do %w{ pifs vifs hosts storage_repositories servers networks vbds vdis pools consoles}.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } test("it should respond to #{collection}.all") { eval("compute.#{collection}").respond_to? 'all' } test("it should respond to #{collection}.get") { eval("compute.#{collection}").respond_to? 'get' } end # This will fail if there are no PIFs # (not sure if that's gonna be a real scenario though) tests("PIFs collection") do test("should have at least one PIF") { compute.pifs.size >= 1 } end # This will fail if there are no VIFs # (not sure if that's gonna be a real scenario though) tests("VIFs collection") do test("should have at least one VIF") { compute.vifs.size >= 1 } end # This will fail if there are no VIFs # (not sure if that's gonna be a real scenario though) tests("Networks collection") do test("should have at least one Network") { compute.networks.size >= 1 } tests("each network should be a Fog::Compute::XenServer::Network") do ok = true compute.networks.each { |n| ok = false if n.kind_of? Fog::Compute::XenServer::Network } end end end tests "Default template" do test("it should NOT have a default template") { compute.default_template.nil? } # This template exists in our XenServer compute.default_template = 'squeeze-test' test("it should have a default template if template exists") { compute.default_template.name == 'squeeze-test' } test("it should be a Fog::Compute::XenServer::Server") { compute.default_template.is_a? Fog::Compute::XenServer::Server } test("it should return nil when not found") do compute.default_template = 'asdfasdfasfdwe' compute.default_template.nil? end end end fog-1.34.0/tests/xenserver/models/0000755000004100000410000000000012600047642017051 5ustar www-datawww-datafog-1.34.0/tests/xenserver/models/compute/0000755000004100000410000000000012600047642020525 5ustar www-datawww-datafog-1.34.0/tests/xenserver/models/compute/networks_tests.rb0000644000004100000410000000120012600047642024141 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | Networks collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The networks collection') do networks = conn.networks.all test('should not be empty') { !networks.empty? } test('should be a kind of Fog::Compute::XenServer::Networks') { networks.kind_of? Fog::Compute::XenServer::Networks } tests('should be able to reload itself').succeeds { networks.reload } tests('should be able to get a model') do tests('by reference').succeeds { networks.get(networks.first.reference).is_a? Fog::Compute::XenServer::Network } end end end fog-1.34.0/tests/xenserver/models/compute/host_metrics_tests.rb0000644000004100000410000000256612600047642025010 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | HostMetrics model', ['xenserver']) do host = Fog::Compute[:xenserver].hosts.first tests('The HostMetrics model should') do tests('have attributes') do model_attribute_hash = host.metrics.attributes attributes = [ :reference, :uuid, :memory_free, :memory_total, :other_config, :last_updated ] tests("The HostMetrics model should respond to") do attributes.each do |attribute| test("#{attribute}") { host.metrics.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::HostMetrics') do host.metrics.kind_of? Fog::Compute::XenServer::HostMetrics end test("have a last_updated Time property") { host.metrics.last_updated.kind_of? Time } test("return a valid memory_free ammount") do (host.metrics.memory_free =~ /^\d+$/) == 0 end test("have memory_free > 0") { host.metrics.memory_free.to_i > 0 } test("return a valid memory_total ammount") do (host.metrics.memory_total =~ /^\d+$/) == 0 end test("have memory_total > 0") { host.metrics.memory_total.to_i > 0 } end end fog-1.34.0/tests/xenserver/models/compute/vlans_tests.rb0000644000004100000410000000163512600047642023424 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | Vlans collection', ['xenserver']) do service = Fog::Compute[:xenserver] tests('The Vlans collection') do test('should not be empty') { !service.vlans.empty? } test('should be a kind of Fog::Compute::XenServer::Vlans') do service.vlans.kind_of? Fog::Compute::XenServer::Vlans end tests('should be able to reload itself').succeeds { service.vlans.reload } tests('should be able to get a model') do tests('by reference').succeeds { service.vlans.get(service.vlans.first.reference).is_a? \ Fog::Compute::XenServer::VLAN } end end tests('failures') do test 'with an invalid reference' do raises = false begin service.vlans.get('OpaqueRef:foo') rescue Fog::XenServer::RequestFailed => e raises = true if e.message =~ /HANDLE_INVALID/ end raises end end end fog-1.34.0/tests/xenserver/models/compute/server_tests.rb0000644000004100000410000001334612600047642023611 0ustar www-datawww-data Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do connection = Fog::Compute[:xenserver] servers = connection.servers # pre-flight cleanup (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end (servers.templates.select { |t| t.name == test_ephemeral_vm_name}).each do |s| s.destroy end server = Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) server.reload tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ affinity set_attribute refresh stop clean_shutdown hard_shutdown start destroy reboot hard_reboot clean_reboot }.each do |action| test(action) { server.respond_to? action } #test("#{action} returns successfully") { server.send(action.to_sym) ? true : false } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :reference, :uuid, :is_a_template, :__affinity, :allowed_operations, :__consoles, :domarch, :domid, :__guest_metrics, :is_a_snapshot, :is_a_template, :is_control_domain, :memory_dynamic_max, :memory_dynamic_min, :memory_static_max, :memory_static_min, :memory_target, :metrics, :name_description, :other_config, :power_state, :pv_args, :__resident_on, :__vbds, :__vifs, :vcpus_params, :vcpus_at_startup, :vcpus_max, :hvm_boot_policy, :hvm_boot_params, :pci_bus, :pv_kernel, :pv_ramdisk, :pv_legacy_args, :pv_bootloader_args, :snapshots ] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::Server') { server.kind_of? Fog::Compute::XenServer::Server } #test('return a Fog::Compute::XenServer::Host affinity') { server.affinity.kind_of? Fog::Compute::XenServer::Host } end tests("Creating a server") do tests("it should create a server") do s = nil test("named #{test_ephemeral_vm_name}") do s = servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) servers.get(s.reference).name == test_ephemeral_vm_name end test("and destroy it afterwards") { s.destroy } end tests("it should create a server") do s = nil # The template has 2 VIFs already, we add 2 more test("with 4 NICs") do s = servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name, :networks => [connection.default_network, connection.default_network]) s.reload s.networks.size == 4 end test("and destroy it afterwards") { s.destroy } end end tests("A real server should") do tests("return valid vbds") do test("as an array") { server.vbds.kind_of? Array } server.vbds.each { |i| test("and each VBD should be a Fog::Compute::XenServer::VBD") { i.kind_of? Fog::Compute::XenServer::VBD } } end tests('return valid consoles') do test('as an array') { server.consoles.kind_of? Array } server.consoles.each { |i| test('and each Console should be a Fog::Compute::XenServer::Console') { i.kind_of? Fog::Compute::XenServer::Console } } end test("have 0 or more networks") { server.networks.kind_of? Array } tests("have networks if networks > 0") do if server.networks.size > 0 server.networks.each do |n| test("and network is of type Fog::Compute::XenServer::Network") do n.kind_of? Fog::Compute::XenServer::Network end end end end test("reside on a Fog::Compute::XenServer::Host") { server.resident_on.kind_of? Fog::Compute::XenServer::Host } #test("have Fog::Compute::XenServer::GuestMetrics") { server.guest_metrics.kind_of? Fog::Compute::XenServer::GuestMetrics } test("be able to refresh itself") { server.refresh } test("always stop when I say stop('hard')") do server.stop 'hard' end # shutdown is async apparently, we wait test("not be running when it's stopped") do server.wait_for { !server.running? } true end test("do nothing when I say stop('hard') but it's not running") do server.stop('hard') == false end test("always start when I say start") do server.start end # start is async apparently, we wait test("be running if I started the server") do server.wait_for { server.running? } true end test("set attribute PV_bootloader to supergrub") do server.set_attribute 'PV_bootloader', 'supergrub' server.reload server.pv_bootloader == 'supergrub' end tests("Creating a snapshot") do snap_ref = server.snapshot('newsnapshot') tests("it should create a snapshot") do snap_ref = server.snapshot('newsnapshot') servers.get(snap_ref).reference == snap_ref end test("and destroy it afterwards") { servers.get(snap_ref).destroy } end test("be able to be destroyed!") do server.destroy servers.get_by_name('fog-test-server-shindo') == nil end end end fog-1.34.0/tests/xenserver/models/compute/pool_tests.rb0000644000004100000410000000333012600047642023244 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | Pool model', ['xenserver']) do pools = Fog::Compute[:xenserver].pools pool = pools.first tests('The Pool model should') do tests('have the action') do test('reload') { pool.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = pool.attributes attributes = [ :reference, :uuid, :name, :description, :__default_sr, :__master, :tags, :restrictions, :ha_enabled, :vswitch_controller, :__suspend_image_sr ] tests("The Pool model should respond to") do attributes.each do |attribute| test("#{attribute}") { pool.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::Pool') { pool.kind_of? Fog::Compute::XenServer::Pool} end tests("A real Pool should") do tests("return a valid default_storage_repository") do test("should be a Fog::Compute::XenServer::StorageRepository") { pool.default_storage_repository.kind_of? Fog::Compute::XenServer::StorageRepository } end tests("return valid Host as the master") do test("should be a Fog::Compute::XenServer::Host") { pool.master.kind_of? Fog::Compute::XenServer::Host } end test("be able to be configured as a valid suspend_image_sr") do pool.suspend_image_sr = pool.default_storage_repository pool.reload pool.suspend_image_sr.reference == pool.default_storage_repository.reference end end end fog-1.34.0/tests/xenserver/models/compute/vbd_tests.rb0000644000004100000410000000611512600047642023052 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do vbds = Fog::Compute[:xenserver].vbds vbd = vbds.first servers = Fog::Compute[:xenserver].servers server = create_ephemeral_vm tests('The VBD model should') do tests('have the action') do test('reload') { vbd.respond_to? 'reload' } test('eject') { vbd.respond_to? 'eject' } test('insert') { vbd.respond_to? 'insert' } test('unplug') { vbd.respond_to? 'unplug' } test('unplug_force') { vbd.respond_to? 'unplug_force' } end tests('have attributes') do model_attribute_hash = vbd.attributes attributes = [ :reference, :uuid, :currently_attached, :__vdi, :__vm, :device, :status_detail, :type, :allowed_operations, :current_operations, :status_code, :storage_lock, :mode, :runtime_properties, :unpluggable, :userdevice, :bootable, :empty, :__metrics ] tests("The VBD model should respond to") do attributes.each do |attribute| test("#{attribute}") { vbd.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::VBD') { vbd.kind_of? Fog::Compute::XenServer::VBD} end tests("A real VBD should") do test("have a valid OpaqueRef") do puts vbd.reference (vbd.reference =~ /OpaqueRef:/).eql?(0) and \ vbd.reference != "OpaqueRef:NULL" end tests("belong to a VM when attached") do vbds.each do |vbd| test("#{vbd.uuid}") do if vbd.currently_attached (vbd.__vm =~ /OpaqueRef/).eql?(0) and \ vbd.__vm != "OpaqueRef:NULL" else true end end end end vbds.each do |vbd| test("return a Fog::Compute::XenServer::VDI when type Disk") do if vbd.type == 'Disk' vbd.vdi.kind_of? Fog::Compute::XenServer::VDI else true end end test("return a nil VDI when type CD") do if vbd.type == 'CD' vbd.vdi.nil? else true end end test("return a VbdMetrics object when attached") do if vbd.currently_attached vbd.metrics.kind_of? Fog::Compute::XenServer::VbdMetrics else vbd.metrics.nil? end end end tests("return valid Server") do test("should be a Fog::Compute::XenServer::Server") { vbd.server.kind_of? Fog::Compute::XenServer::Server } end test("be able to be unplugged when type is CD") do if vbd.type == "CD" vbd.unpluggable == true else vbd.unpluggable == false end end end tests("VBD Metrics should") do test("have a last_updated Time property") { server.vbds.first.metrics.last_updated.kind_of? Time } end destroy_ephemeral_servers end fog-1.34.0/tests/xenserver/models/compute/pbd_tests.rb0000644000004100000410000000460712600047642023050 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | PBD model', ['xenserver']) do pbds = Fog::Compute[:xenserver].pbds pbd = pbds.first tests('The PBD model should') do tests('have the action') do test('reload') { pbd.respond_to? 'reload' } test('unplug') { pbd.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = pbd.attributes attributes = [ :reference, :uuid, :__host, :__sr, :currently_attached ] tests("The PBD model should respond to") do attributes.each do |attribute| test("#{attribute}") { pbd.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::PBD') { pbd.kind_of? Fog::Compute::XenServer::PBD} end tests("A real PBD should") do tests("return valid host") do test("should be a Fog::Compute::XenServer::Host") { pbd.host.kind_of? Fog::Compute::XenServer::Host } end tests("return valid storage repository") do test("should be a Fog::Compute::XenServer::StorageRepository") { pbd.storage_repository.kind_of? Fog::Compute::XenServer::StorageRepository } end # FIXME: find a better way (faster, lighter) to tests this tests("be plugged or unplugged") do compute = Fog::Compute[:xenserver] # Create a storage repository only to tests PBD.unplug ref = compute.create_sr compute.hosts.first.reference, 'FOG TEST SR', 'ext', '', { :device => '/dev/sdb' }, '0', 'user', false, {} sr = compute.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' } pbd = sr.pbds.first test('plugged') do pbd.currently_attached == true end pbd.unplug pbd.reload test('unplugged') do pbd.currently_attached == false end # Clean-up compute.storage_repositories.each do |sr| next unless sr.name == 'FOG TEST SR' sr.pbds.each { |pbd| pbd.unplug } sr.destroy end end end end fog-1.34.0/tests/xenserver/models/compute/storage_repositories_tests.rb0000644000004100000410000000205112600047642026545 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | StorageRepositories collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The storage_repositories collection') do storage_repositories = conn.storage_repositories.all test('should not be empty') { !storage_repositories.empty? } test('should be a kind of Fog::Compute::XenServer::StorageRepositories') { storage_repositories.kind_of? Fog::Compute::XenServer::StorageRepositories } tests('should be an array of Fog::Compute::XenServer::StorageRepository') do storage_repositories.each do |p| test("#{p.uuid} is a Fog::Compute::XenServer::StorageRepository") { p.is_a? Fog::Compute::XenServer::StorageRepository } end end tests('should be able to reload itself').succeeds { storage_repositories.reload } tests('should be able to get a model') do tests('by reference').succeeds { storage_repositories.get(storage_repositories.first.reference).is_a? Fog::Compute::XenServer::StorageRepository } end end end fog-1.34.0/tests/xenserver/models/compute/servers_tests.rb0000644000004100000410000000612512600047642023771 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | servers collection', ['xenserver']) do conn = Fog::Compute[:xenserver] destroy_ephemeral_servers servers = conn.servers templates = conn.servers.templates tests('The servers collection') do servers = conn.servers.all test('should be empty') do servers.empty? end server = conn.servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) test('should NOT be empty') do servers.reload !servers.empty? end server.destroy test('should be a kind of Fog::Compute::XenServer::Servers') { servers.kind_of? Fog::Compute::XenServer::Servers } test('should be a kind of Fog::Compute::XenServer::Servers') { servers.kind_of? Fog::Compute::XenServer::Servers } tests('should have Fog::Compute::XenServer::Servers inside') do conn.servers.each do |s| test { s.kind_of? Fog::Compute::XenServer::Server } end end test("should return a list of templates") do templates.kind_of? Array end tests("The servers template list should") do test("should include only templates in servers.templates") do ok = true templates.each { |t| ok = false if !t.is_a_template } ok end test("include a #{test_template_name} template in custom_templates") do found = false servers.custom_templates.each do |s| found = (s.name == test_template_name) end found end test("NOT include a #{test_template_name} template in built-in templates") do found = false servers.builtin_templates.each do |s| found = (s.name != test_template_name) end found end # This may fail in other test scenarios with more than one built-in template # present test("include only one custom template") { servers.custom_templates.size == 1 } tests("not include built-in templates in custom_templates") do servers.custom_templates.each do |s| test("#{s.name} is NOT a built-in template") {s.allowed_operations.include?('destroy') } end end test("include more than one built-in templates") { servers.builtin_templates.size >= 1 } tests("not include real servers") do servers.builtin_templates.each do |s| test("#{s.name} is not a real server") { s.is_a_template } end end end tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do server = conn.servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) test('by name') { servers.get_by_name(test_ephemeral_vm_name).kind_of? Fog::Compute::XenServer::Server } test('by instance uuid') { servers.get_by_uuid(server.uuid).kind_of? Fog::Compute::XenServer::Server } test('by instance reference') { servers.get(server.reference).kind_of? Fog::Compute::XenServer::Server } server.destroy end end # Teardown cleaup destroy_ephemeral_servers end fog-1.34.0/tests/xenserver/models/compute/storage_repository_tests.rb0000644000004100000410000000777312600047642026255 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver']) do storage_repositories = Fog::Compute[:xenserver].storage_repositories storage_repository = storage_repositories.first conn = Fog::Compute[:xenserver] tests('The StorageRepository model should') do tests('have the action') do test('reload') { storage_repository.respond_to? 'reload' } test('destroy') { storage_repository.respond_to? 'destroy' } test('scan') { storage_repository.respond_to? 'scan' } test('save') { storage_repository.respond_to? 'save' } end tests('have attributes') do model_attribute_hash = storage_repository.attributes attributes = [ :reference, :name, :uuid, :description, :uuid, :allowed_operations, :current_operations, :content_type, :other_config, :__pbds, :shared, :type, :tags, :__vdis, :physical_size, :physical_utilisation, :virtual_allocation, :sm_config ] tests("The StorageRepository model should respond to") do attributes.each do |attribute| test("#{attribute}") { storage_repository.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::StorageRepository') { storage_repository.kind_of? Fog::Compute::XenServer::StorageRepository } end tests("A real StorageRepository should") do tests("return a valid list of VDIs") do storage_repository.vdis.each do |vdi| test("where #{vdi.uuid} is a Fog::Compute::XenServer::VDI") { vdi.is_a? Fog::Compute::XenServer::VDI } end end tests("return a valid list of PBDs") do storage_repository.pbds.each do |pbd| test("where #{pbd.uuid} is a Fog::Compute::XenServer::PBD") { pbd.is_a? Fog::Compute::XenServer::PBD } end end end tests('#save should') do sr = nil test('save with required attributes') do sr = conn.storage_repositories.create :name => 'FOG TEST SR', :host => conn.hosts.first, :type => 'ext', :device_config => { :device => '/dev/sdb' } !(conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? end # Cleanup sr.pbds.each { |pbd| pbd.unplug } sr.destroy test('save with additional attributes') do sr = conn.storage_repositories.create :name => 'FOG TEST SR', :host => conn.hosts.first, :type => 'ext', :content_type => 'user', :device_config => { :device => '/dev/sdb' }, :shared => false !(conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? end # Cleanup sr.pbds.each { |pbd| pbd.unplug } sr.destroy test('return sane defaults') do sr = conn.storage_repositories.create :name => 'FOG TEST SR', :host => conn.hosts.first, :type => 'ext', :device_config => { :device => '/dev/sdb' } sr.reload (sr.content_type == 'user') and \ (sr.shared == false) and (sr.sm_config.is_a? Hash) and \ (sr.description == '') end end tests('#destroy should') do test('destroy existing FOG TEST SR') do sr = (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }) sr.pbds.each { |pbd| pbd.unplug } sr.destroy (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? end end end fog-1.34.0/tests/xenserver/models/compute/vbds_tests.rb0000644000004100000410000000112012600047642023224 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | VBDs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The vbds collection') do vbds = conn.vbds.all test('should not be empty') { !vbds.empty? } test('should be a kind of Fog::Compute::XenServer::Vbds') { vbds.kind_of? Fog::Compute::XenServer::Vbds } tests('should be able to reload itself').succeeds { vbds.reload } tests('should be able to get a model') do tests('by reference').succeeds { vbds.get(vbds.first.reference).is_a? Fog::Compute::XenServer::VBD } end end end fog-1.34.0/tests/xenserver/models/compute/vlan_tests.rb0000644000004100000410000000411412600047642023234 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | VLAN model', ['xenserver']) do service = Fog::Compute[:xenserver] vlans = service.vlans vlan = vlans.first tests('The VLAN model should') do tests('have the action') do %w{ reload destroy save untagged_pif tagged_pif }.each do |action| test(action) { vlan.respond_to? action } end end tests('have attributes') do model_attribute_hash = vlan.attributes attributes = [ :reference, :uuid, :__untagged_pif, :__tagged_pif, :tag ] tests("The VLAN model should respond to") do attributes.each do |attribute| test("#{attribute}") { vlan.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::VLAN') { vlan.kind_of? Fog::Compute::XenServer::VLAN} end tests("#save") do test 'should create a VLAN' do @net = service.networks.create :name => 'test-net' # try to use a bonded interface first pif = service.pifs.find { |p| p.device == 'bond0' and p.vlan == "-1" } unless pif pif = compute.pifs.find { |p| p.device == 'eth0' and p.vlan == "-1" } end @vlan = vlans.create :tag => 1499, :pif => pif, :network => @net @vlan.is_a? Fog::Compute::XenServer::VLAN end test 'VLAN ID should be 1449' do @vlan.tag == 1499 end end tests("#destroy") do test 'should destroy the network' do @vlan.destroy @net.destroy (vlans.reload.find { |v| v.reference == @vlan.reference }).nil? end end tests("#tagged_pif") do test 'should return a PIF' do vlans.find.first.tagged_pif.is_a? Fog::Compute::XenServer::PIF end end tests("#untagged_pif") do test 'should return a PIF' do vlans.find.first.untagged_pif.is_a? Fog::Compute::XenServer::PIF end end end fog-1.34.0/tests/xenserver/models/compute/pools_tests.rb0000644000004100000410000000150412600047642023430 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | Pools collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The pools collection') do pools = conn.pools.all test('should not be empty') { !pools.empty? } test('should be a kind of Fog::Compute::XenServer::Pools') { pools.kind_of? Fog::Compute::XenServer::Pools } tests('should be an array of Fog::Compute::XenServer::Pool') do pools.each do |p| test("#{p.uuid} is a Fog::Compute::XenServer::Pool") { p.is_a? Fog::Compute::XenServer::Pool } end end tests('should be able to reload itself').succeeds { pools.reload } tests('should be able to get a model') do tests('by reference').succeeds { pools.get(pools.first.reference).is_a? Fog::Compute::XenServer::Pool } end end end fog-1.34.0/tests/xenserver/models/compute/consoles_test.rb0000644000004100000410000000117012600047642023735 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | console collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The console collection') do consoles = conn.consoles.all test('should not be empty') { !consoles.empty? } test('should be a kind of Fog::Compute::XenServer::Consoles') { consoles.kind_of? Fog::Compute::XenServer::Consoles } tests('should be able to reload itself').succeeds { consoles.reload } tests('should be able to get a model') do tests('by reference').succeeds { consoles.get(hosts.first.reference).is_a? Fog::Compute::XenServer::Console } end end end fog-1.34.0/tests/xenserver/models/compute/host_cpu_tests.rb0000644000004100000410000000264012600047642024122 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | HostCpu model', ['xenserver']) do host = Fog::Compute[:xenserver].hosts.first host_cpu = host.host_cpus.first tests('The HostCpu model should') do tests('have attributes') do model_attribute_hash = host_cpu.attributes attributes = [ :reference, :uuid, :family, :flags, :__host, :model_name, :model, :number, :other_config, :speed, :stepping, :utilisation, :vendor ] tests("The HostCpu model should respond to") do attributes.each do |attribute| test("#{attribute}") { host_cpu.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::HostCpu') do host_cpu.kind_of? Fog::Compute::XenServer::HostCpu end test("return a valid host") do host_cpu.host.kind_of? Fog::Compute::XenServer::Host end test("have a valid vendor string") do host_cpu.vendor.kind_of? String end test("have a valid other_config") do host_cpu.other_config.kind_of? Hash end test("have a valid utilisation attribute") do host_cpu.utilisation.kind_of? Float end end end fog-1.34.0/tests/xenserver/models/compute/network_tests.rb0000644000004100000410000000436112600047642023771 0ustar www-datawww-dataShindo.tests('Fog::Compute[:network] | network model', ['xenserver']) do networks = Fog::Compute[:xenserver].networks network = networks.first tests('The network model should') do tests('have the action') do %w{ reload refresh destroy save vifs pifs }.each do |action| test(action) { network.respond_to? action } #test("#{action} returns successfully") { server.send(action.to_sym) ? true : false } end end tests('have attributes') do model_attribute_hash = network.attributes attributes = [ :reference, :uuid, :__vifs, :tags, :mtu, :bridge, :name, :other_config, :__pifs, :allowed_operations, :current_operations, :blobs ] tests("The network model should respond to") do attributes.each do |attribute| test("#{attribute}") { network.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::Network') { network.kind_of? Fog::Compute::XenServer::Network } end tests("A real network should") do tests("return valid vifs") do test("as an array") { network.vifs.kind_of? Array } network.vifs.each { |i| test("and each VIF should be a Fog::Compute::XenServer::VIF") { i.kind_of? Fog::Compute::XenServer::VIF } } end tests("return valid PIFs") do networks.each do |network| test("as an array") { network.pifs.kind_of? Array } network.pifs.each { |i| test("and each PIF should be a Fog::Compute::XenServer::PIF") { i.kind_of? Fog::Compute::XenServer::PIF} } end end test("be able to refresh itself") { network.refresh } end tests("#save") do test 'should create a network' do @net = networks.create :name => 'foo-net' @net.is_a? Fog::Compute::XenServer::Network end end tests("#destroy") do test 'should destroy the network' do @net.destroy (networks.find { |n| n.reference == @net.reference }).nil? end end end fog-1.34.0/tests/xenserver/models/compute/pifs_tests.rb0000644000004100000410000000112012600047642023227 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | PIFs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The pifs collection') do pifs = conn.pifs.all test('should not be empty') { !pifs.empty? } test('should be a kind of Fog::Compute::XenServer::Pifs') { pifs.kind_of? Fog::Compute::XenServer::Pifs } tests('should be able to reload itself').succeeds { pifs.reload } tests('should be able to get a model') do tests('by reference').succeeds { pifs.get(pifs.first.reference).is_a? Fog::Compute::XenServer::PIF } end end end fog-1.34.0/tests/xenserver/models/compute/pif_tests.rb0000644000004100000410000000277112600047642023061 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | PIF model', ['xenserver']) do pifs = Fog::Compute[:xenserver].pifs pif = pifs.first tests('The PIF model should') do tests('have the action') do test('reload') { pif.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = pif.attributes attributes = [ :reference, :uuid, :physical, :mac, :currently_attached, :device, :metrics, :dns, :gateway, :ip, :ip_configuration_mode, :mtu, :__network, :netmask, :management, :vlan, :other_config, :__host ] tests("The PIF model should respond to") do attributes.each do |attribute| test("#{attribute}") { pif.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::PIF') { pif.kind_of? Fog::Compute::XenServer::PIF} end tests("A real PIF should") do tests("return a valid network") do test("should be a Fog::Compute::XenServer::Network") { pif.network.kind_of? Fog::Compute::XenServer::Network } end tests("return valid host") do test("should be a Fog::Compute::XenServer::Host") { pif.host.kind_of? Fog::Compute::XenServer::Host } end end end fog-1.34.0/tests/xenserver/models/compute/console_test.rb0000644000004100000410000000202212600047642023547 0ustar www-datawww-data Shindo.tests('Fog::Compute[:xenserver] | console model', ['xenserver']) do consoles = Fog::Compute[:xenserver].consoles console = consoles.first tests('The console model should') do tests('have attributes') do model_attribute_hash = console.attributes attributes = [ :reference, :location, :protocol, :uuid, :__vm ] tests("The console model should respond to") do attributes.each do |attribute| test("#{attribute}") { console.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::Console') { console.kind_of? Fog::Compute::XenServer::Console } end tests('A real console should') do tests('return valid vm') do test('object') { console.vm.kind_of? Fog::Compute::XenServer::Server } end end end fog-1.34.0/tests/xenserver/models/compute/hosts_tests.rb0000644000004100000410000000113412600047642023433 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | hosts collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The hosts collection') do hosts = conn.hosts.all test('should not be empty') { !hosts.empty? } test('should be a kind of Fog::Compute::XenServer::Hosts') { hosts.kind_of? Fog::Compute::XenServer::Hosts } tests('should be able to reload itself').succeeds { hosts.reload } tests('should be able to get a model') do tests('by reference').succeeds { hosts.get(hosts.first.reference).is_a? Fog::Compute::XenServer::Host } end end end fog-1.34.0/tests/xenserver/models/compute/host_tests.rb0000644000004100000410000000535312600047642023257 0ustar www-datawww-data Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do hosts = Fog::Compute[:xenserver].hosts host = hosts.first tests('The host model should') do tests('have the action') do test('reload') { host.respond_to? 'reload' } test('shutdown') { host.respond_to? 'shutdown' } test('disable') { host.respond_to? 'disable' } test('reboot') { host.respond_to? 'reboot' } end tests('have attributes') do model_attribute_hash = host.attributes attributes = [ :reference, :uuid, :name, :address, :allowed_operations, :enabled, :hostname, :__metrics, :name_description, :other_config, :__pbds, :__pifs, :__resident_vms, :__host_cpus, :edition, :software_version ] tests("The host model should respond to") do attributes.each do |attribute| test("#{attribute}") { host.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::Host') { host.kind_of? Fog::Compute::XenServer::Host } end tests("A real host should") do tests("return valid PIFs") do test("as an array") { host.pifs.kind_of? Array } host.pifs.each { |i| test("and each PIF should be a Fog::Compute::XenServer::PIF") { i.kind_of? Fog::Compute::XenServer::PIF} } end tests("return valid PBDs") do test("as an array") { host.pbds.kind_of? Array } host.pbds.each { |i| test("and each PBD should be a Fog::Compute::XenServer::PBD") { i.kind_of? Fog::Compute::XenServer::PBD} } end tests("return valid resident servers") do test("as an array") { host.resident_servers.kind_of? Array } host.resident_servers.each { |i| test("and each Server should be a Fog::Compute::XenServer::Server") { i.kind_of? Fog::Compute::XenServer::Server} } end tests("return valid HostMetrics") do test("object") { host.metrics.kind_of? Fog::Compute::XenServer::HostMetrics } end tests('be able to be') do test('disable') do host.disable host.reload host.enabled == false end test('enabled') do host.enable host.reload host.enabled end end tests('return a list of HostCpu') do test('as an Array') do host.host_cpus.kind_of? Array end test('with one element at least') do host.host_cpus.first.kind_of? Fog::Compute::XenServer::HostCpu end end end end fog-1.34.0/tests/xenserver/models/compute/vif_tests.rb0000644000004100000410000000272212600047642023063 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | VIF model', ['xenserver']) do vifs = Fog::Compute[:xenserver].vifs vif = vifs.first tests('The VIF model should') do tests('have the action') do test('reload save destroy network server') { vif.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = vif.attributes attributes = [ :reference, :mac, :uuid, :allowed_operations, :currently_attached, :device, :mac_autogenerated, :metrics, :mtu, :__network, :status_code, :status_detail, :__vm ] tests("The VIF model should respond to") do attributes.each do |attribute| test("#{attribute}") { vif.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::XenServer::VIF') { vif.kind_of? Fog::Compute::XenServer::VIF} end tests("A real VIF should") do tests("return a valid network") do test("should be a Fog::Compute::XenServer::Network") { vif.network.kind_of? Fog::Compute::XenServer::Network } end tests("return valid VIF") do test("should be a Fog::Compute::XenServer::Server") { vif.server.kind_of? Fog::Compute::XenServer::Server } end end end fog-1.34.0/tests/xenserver/models/compute/pbds_tests.rb0000644000004100000410000000112012600047642023216 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | pbds collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The pbds collection') do pbds = conn.pbds.all test('should not be empty') { !pbds.empty? } test('should be a kind of Fog::Compute::XenServer::Pbds') { pbds.kind_of? Fog::Compute::XenServer::Pbds } tests('should be able to reload itself').succeeds { pbds.reload } tests('should be able to get a model') do tests('by reference').succeeds { pbds.get(pbds.first.reference).is_a? Fog::Compute::XenServer::PBD } end end end fog-1.34.0/tests/xenserver/models/compute/vifs_tests.rb0000644000004100000410000000112012600047642023235 0ustar www-datawww-dataShindo.tests('Fog::Compute[:xenserver] | VIFs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] tests('The vifs collection') do vifs = conn.vifs.all test('should not be empty') { !vifs.empty? } test('should be a kind of Fog::Compute::XenServer::Vifs') { vifs.kind_of? Fog::Compute::XenServer::Vifs } tests('should be able to reload itself').succeeds { vifs.reload } tests('should be able to get a model') do tests('by reference').succeeds { vifs.get(vifs.first.reference).is_a? Fog::Compute::XenServer::VIF } end end end fog-1.34.0/tests/dnsmadeeasy/0000755000004100000410000000000012600047642016042 5ustar www-datawww-datafog-1.34.0/tests/dnsmadeeasy/requests/0000755000004100000410000000000012600047642017715 5ustar www-datawww-datafog-1.34.0/tests/dnsmadeeasy/requests/dns/0000755000004100000410000000000012600047642020501 5ustar www-datawww-datafog-1.34.0/tests/dnsmadeeasy/requests/dns/dns_tests.rb0000644000004100000410000000650412600047642023041 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dnsmadeeasy] | DNS requests', ['dnsmadeeasy', 'dns']) do @domain = '' @domain_count = 0 tests("success") do test("get current domain count") do pending if Fog.mocking? response = Fog::DNS[:dnsmadeeasy].list_domains() if response.status == 200 @domain_count = response.body['list'].size end response.status == 200 end test("create domain") do pending if Fog.mocking? domain = generate_unique_domain response = Fog::DNS[:dnsmadeeasy].create_domain(domain) if response.status == 201 @domain = response.body end response.status == 201 end test("get domain by name") do pending if Fog.mocking? response = Fog::DNS[:dnsmadeeasy].get_domain(@domain["name"]) response.status == 200 end test("create an A resource record") do pending if Fog.mocking? domain = @domain["name"] name = "www" type = "A" data = "1.2.3.4" response = Fog::DNS[:dnsmadeeasy].create_record(domain, name, type, data) if response.status == 201 @record = response.body end response.status == 201 end test("create a MX record") do pending if Fog.mocking? domain = @domain["name"] name = "" type = "MX" data = "10 mail.#{domain}" options = { :ttl => 60 } response = Fog::DNS[:dnsmadeeasy].create_record(domain, name, type, data, options) response.status == 201 end test("update a record") do pending if Fog.mocking? domain = @domain["name"] record_id = @record["id"] options = {:name => '', :type => 'A', :data => "2.3.4.5", :ttl => 600} response = Fog::DNS[:dnsmadeeasy].update_record(domain, record_id, options) response.status == 200 end test("get record - check ip/ttl") do pending if Fog.mocking? response = Fog::DNS[:dnsmadeeasy].get_record(@domain["name"], @record['id']) record = response.body result = false if response.status == 200 && record['data'] == '2.3.4.5' && record['ttl'] == 600 result = true end result end test("list records") do pending if Fog.mocking? response = Fog::DNS[:dnsmadeeasy].list_records(@domain["name"]) if response.status == 200 @records = response.body end (response.status == 200) and (response.body.size == 2) end test("delete records") do pending if Fog.mocking? domain = @domain["name"] result = true @records.each do |record| response = Fog::DNS[:dnsmadeeasy].delete_record(domain, record["id"]) if(response.status != 200) result = false break end end result end test("delete domain") do pending if Fog.mocking? puts "DNS Made Easy - Sleeping for 10 seconds, otherwise test fails because DNS Made Easy queues requests, it still might fail if DNS Made Easy is busy! MOCK IT!" puts "THIS MOST LIKELY WILL FAIL ON LIVE because it can take while for DNS Made Easy to create a domain/zone, changing the host to api.sandbox.dnsmadeeasy.com should make it work" sleep 10 response = Fog::DNS[:dnsmadeeasy].delete_domain(@domain["name"]) response.status == 200 end end tests( 'failure') do end end fog-1.34.0/tests/glesys/0000755000004100000410000000000012600047642015053 5ustar www-datawww-datafog-1.34.0/tests/glesys/requests/0000755000004100000410000000000012600047642016726 5ustar www-datawww-datafog-1.34.0/tests/glesys/requests/compute/0000755000004100000410000000000012600047642020402 5ustar www-datawww-datafog-1.34.0/tests/glesys/requests/compute/helper.rb0000644000004100000410000002212112600047642022204 0ustar www-datawww-dataclass Glesys module Compute module Formats module Servers LIST = { 'debug' => { 'input' => Array }, 'servers' => [{ 'serverid' => String, 'hostname' => String, 'datacenter' => String, 'platform' => String }], 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } DETAILS = { 'debug' => { 'input' => { 'serverid' => Fog::Nullable::String } }, 'server' => { 'managedhosting' => String, 'cost' => { 'timeperiod' => String, 'currency' => String }, 'serverid' => String, 'datacenter' => String, 'memorysize' => Integer, 'cpucores' => Integer, 'transfer' => Integer, 'bandwidth' => Integer, 'templatename' => String, 'iplist' => [{ 'cost' => Integer, 'version' => Fog::Nullable::Integer, 'ipaddress' => Fog::Nullable::String, 'currency' => String }], 'description' => String, 'hostname' => String, 'disksize' => Integer, 'platform' => String, 'state' => Fog::Nullable::String }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } STOP = DETAILS.merge( 'debug' => { 'input' => { 'serverid' => Fog::Nullable::String, 'type' => String } } ) CREATE = DETAILS.merge( 'debug' => { 'input' => { 'serverid' => Fog::Nullable::String, 'hostname' => String, 'rootpassword' => String, 'datacenter' => String, 'platform' => String, 'templatename' => String, 'disksize' => String, 'memorysize' => String, 'cpucores' => String, 'transfer' => String, 'bandwidth' => String, 'description' => String } } ) EDIT = DETAILS.merge( 'debug' => { 'input' => { 'serverid' => Fog::Nullable::String, 'disksize' => String, 'memorysize' => String, 'cpucores' => String, 'bandwidth' => String } } ) STATUS = { 'debug' => { 'input' => { 'serverid' => String } }, 'server' => { 'memory' => { 'usage' => Fog::Nullable::Integer, 'max' => Fog::Nullable::Integer, 'unit' => Fog::Nullable::String }, 'transfer' => { 'usage' => Fog::Nullable::Integer, 'max' => Fog::Nullable::Integer, 'unit' => Fog::Nullable::String }, 'disk' => { 'usage' => Fog::Nullable::Integer, 'max' => Fog::Nullable::Integer, 'unit' => Fog::Nullable::String }, 'state' => String, 'transfer' => { 'usage' => Fog::Nullable::Integer, 'max' => Fog::Nullable::Integer, 'unit' => Fog::Nullable::String }, 'cpu' => { 'usage' => Fog::Nullable::Float, 'max' => Fog::Nullable::Integer, 'unit' => Fog::Nullable::String }, 'uptime' => { 'current' => Fog::Nullable::Integer, 'unit' => String }, 'warnings' => Array }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } DESTROY = { 'debug' => { 'input' => { 'serverid' => String, 'keepip' => String } }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } end module Ips IPLIST = { 'debug' => { 'input' => [] }, 'iplist' => [{ 'cost' => { 'amount' => Integer, 'timeperiod' => String, 'currency' => String }, 'netmask' => Fog::Nullable::String, 'broadcast' => Fog::Nullable::String, 'gateway' => Fog::Nullable::String, 'nameservers' => Array, 'datacenter' => String, 'serverid' => Fog::Nullable::String, 'platform' => String, 'ipaddress' => String, 'ipversion' => Integer, 'ptr' => String, 'reserved' => String }], 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } IPLIST_ALL = { 'debug' => { 'input' => { 'datacenter' => String, 'ipversion' => String, 'platform' => String } }, 'iplist' => { 'ipversion' => Integer, 'datacenter' => String, 'platform' => String, "ipaddresses" => Array }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String }, } IPLIST_CATCH_RELEASE = { 'debug' => { 'input' => { 'ipaddress' => String, } }, 'details' => { 'cost' => { 'amount' => Integer, 'timeperiod' => String, 'currency' => String }, 'ipaddress' => String, 'netmask' => String, 'broadcast' => String, 'gateway' => String, 'nameservers' => Array, 'datacenter' => String, 'serverid' => Fog::Nullable::String, 'platform' => String, 'ipaddress' => String, 'ipversion' => Integer, 'ptr' => String, 'reserved' => String }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } end module SshKeys ADD = { 'debug' => { 'input' => { 'sshkey' => String, 'description' => String } }, 'sshkey' => { 'id' => Integer, 'account' => String, 'description' => String, 'data' => String }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String, 'transactionid' => Fog::Nullable::String } } REMOVE = { 'debug' => { 'input' => { 'sshkeyids' => String, } }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String, 'transactionid' => Fog::Nullable::String } } LIST = { 'debug' => { 'input' => [] }, 'sshkeys' => [ { 'id' => Integer, 'account' => String, 'description' => String, 'data' => String, } ], 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } end module Templates LIST = { 'debug' => { 'input' => [] }, 'templates' => { 'Xen' => [{ 'name' => String, 'operatingsystem' => String, 'minimummemorysize' => Integer, 'minimumdisksize' => Integer, 'platform' => String }], 'OpenVZ' => [{ 'name' => String, 'operatingsystem' => String, 'minimummemorysize' => Integer, 'minimumdisksize' => Integer, 'platform' => String }] }, 'status' => { 'timestamp' => String, 'code' => Integer, 'text' => String } } end end end end fog-1.34.0/tests/glesys/requests/compute/template_tests.rb0000644000004100000410000000044212600047642023764 0ustar www-datawww-dataShindo.tests('Fog::Compute[:glesys] | template requests', ['glesys']) do tests('success') do tests("#template_list()").formats(Glesys::Compute::Formats::Templates::LIST) do pending if Fog.mocking? Fog::Compute[:glesys].template_list.body['response'] end end end fog-1.34.0/tests/glesys/requests/compute/server_tests.rb0000644000004100000410000001162112600047642023460 0ustar www-datawww-dataShindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do @serverid = nil @hostname = "fog-#{Time.now.to_i}" @create = ":hostname => #@hostname, :rootpassword => 'pw#{Time.now.to_i}', "+ ":datacenter => 'Falkenberg', :platform => 'VMware', :templatename => 'Debian 7.0 64-bit', "+ ":disksize => '10', :memorysize => '512', :cpucores => '1', :transfer => '500', :bandwidth => '10'" @create_vz = ":hostname => #@hostname, :rootpassword => 'pw#{Time.now.to_i}', "+ ":datacenter => 'Stockholm', :platform => 'OpenVZ', :templatename => 'Debian 7.0 64-bit', "+ ":disksize => '10', :memorysize => '256', :cpucores => '2', :transfer => '500', :bandwidth => '10'" tests('success') do tests("#list_servers()").formats(Glesys::Compute::Formats::Servers::LIST) do pending if Fog.mocking? Fog::Compute[:glesys].list_servers.body['response'] end tests("#create(#{@create})").formats(Glesys::Compute::Formats::Servers::CREATE) do pending if Fog.mocking? vm = Fog::Compute[:glesys].create( :hostname => @hostname, :description => "Fog test server", :rootpassword => "pw#{Time.now.to_i}", :datacenter => "Falkenberg", :platform => "VMware", :templatename => "Debian 7.0 64-bit", :disksize => "10", :memorysize => "512", :cpucores => "1", :transfer => "500", :bandwidth => "10" ) @serverid = vm.body['response']['server']['serverid'] vm.body['response'] end unless Fog.mocking? Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? } end tests("#server_details(#{@serverid})").formats(Glesys::Compute::Formats::Servers::DETAILS) do pending if Fog.mocking? Fog::Compute[:glesys].server_details(@serverid).body['response'] end tests("#server_status(#{@serverid})").formats(Glesys::Compute::Formats::Servers::STATUS) do pending if Fog.mocking? Fog::Compute[:glesys].server_status(@serverid).body['response'] end tests("#stop(:serverid => #{@serverid})").formats(Glesys::Compute::Formats::Servers::STOP) do pending if Fog.mocking? Fog::Compute[:glesys].stop(:serverid => @serverid).body['response'] end # Wait for stopped unless Fog.mocking? pending if Fog.mocking? s = Fog::Compute[:glesys].servers.get(@serverid) s.wait_for { s.state == 'stopped' } end tests("#start(:serverid => #{@serverid})").formats(Glesys::Compute::Formats::Servers::DETAILS) do pending if Fog.mocking? Fog::Compute[:glesys].start(:serverid => @serverid).body['response'] end # Wait for started unless Fog.mocking? Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? } end tests("#destroy(:serverid => #{@serverid})").formats(Glesys::Compute::Formats::Servers::DESTROY) do pending if Fog.mocking? Fog::Compute[:glesys].destroy(:serverid => @serverid).body['response'] end # Test of OpenVZ tests("#create(#{@create_vz})").formats(Glesys::Compute::Formats::Servers::CREATE) do pending if Fog.mocking? vm = Fog::Compute[:glesys].create( :hostname => @hostname, :rootpassword => "pw#{Time.now.to_i}", :datacenter => "Stockholm", :platform => "OpenVZ", :templatename => "Debian 7.0 64-bit", :disksize => "10", :memorysize => "256", :cpucores => "2", :transfer => "500", :bandwidth => "10" ) @serverid = vm.body['response']['server']['serverid'] vm.body['response'] end unless Fog.mocking? Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? } end tests("#edit #{@serverid}").formats(Glesys::Compute::Formats::Servers::EDIT) do pending if Fog.mocking? vm = Fog::Compute[:glesys].edit( :serverid => @serverid, :disksize => "10", :memorysize => "512", :cpucores => "1", :bandwidth => "10" ) vm.body['response'] end tests("#server_details(#{@serverid})").formats(Glesys::Compute::Formats::Servers::DETAILS) do pending if Fog.mocking? Fog::Compute[:glesys].server_details(@serverid).body['response'] end unless Fog.mocking? Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? } end tests("#destroy(:serverid => #{@serverid})").formats(Glesys::Compute::Formats::Servers::DESTROY) do pending if Fog.mocking? Fog::Compute[:glesys].destroy(:serverid => @serverid).body['response'] end end tests('failure') do tests("#create(:hostname => 0)").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:glesys].create(:hostname => 0) end end end fog-1.34.0/tests/glesys/requests/compute/ip_tests.rb0000644000004100000410000000346512600047642022571 0ustar www-datawww-dataShindo.tests('Fog::Compute[:glesys] | ip requests', ['glesys']) do @free_ip = nil @ips = nil tests('success') do tests("#ip_list_own()").formats(Glesys::Compute::Formats::Ips::IPLIST) do pending if Fog.mocking? Fog::Compute[:glesys].ip_list_own.body['response'] end tests("#ip_list_free(:datacenter => 'Falkenberg, :platform => 'Xen', :ipversion => 4)" ).formats(Glesys::Compute::Formats::Ips::IPLIST_ALL) do pending if Fog.mocking? ips = Fog::Compute[:glesys].ip_list_free( :datacenter => "Falkenberg", :platform => "Xen", :ipversion => 4 ) @free_ip = ips.body['response']['iplist']['ipaddresses'].first ips.body['response'] end tests("#ip_take(:datacenter => 'Falkenberg', :platform => 'Xen', :ipversion => 4, :ipaddress => #{@free_ip})" ).formats(Glesys::Compute::Formats::Ips::IPLIST_CATCH_RELEASE) do pending if Fog.mocking? Fog::Compute[:glesys].ip_take( :datacenter => "Falkenberg", :platform => "Xen", :ipversion => 4, :ipaddress => @free_ip ).body['response'] end tests("#ip_release(:ipaddress => '#{@free_ip}', :ipversion => 4)" ).formats(Glesys::Compute::Formats::Ips::IPLIST_CATCH_RELEASE) do pending if Fog.mocking? Fog::Compute[:glesys].ip_release( :ipaddress => @free_ip, :ipversion => 4 ).body['response'] end # ip_details() # ip_add() # ip_remove() end tests('failure') do tests("#ip_take_argument_error()").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? ip = Fog::Compute[:glesys].ips.new( :datacenter => "Falkenberg", :platform => "Xen", :version => 4, :ip => "127.0.0.1" ) ip.take end end end fog-1.34.0/tests/glesys/requests/compute/ssh_key_tests.rb0000644000004100000410000000356412600047642023626 0ustar www-datawww-dataShindo.tests("Fog::Compute[:glesys] | ssh_key requests", ["glesys", "compute"]) do @testdescription = "My test key to be removed" @testdata = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDv+r/dCIDv+YazWsyc1WCixR+iOeaswTx1U45h6vh4/ fog-unittest@GleSYS" @testdata_malformed = "ssh-rot13 AAAAthis_is_not_an_ssh_key fog-unittest@GleSYS" tests("success") do tests("#ssh_key_add").formats(Glesys::Compute::Formats::SshKeys::ADD) do pending if Fog.mocking? @resp = Fog::Compute[:glesys].ssh_key_add(:description => @testdescription, :sshkey => @testdata) @resp.body["response"] end unless Fog.mocking? Fog::Compute[:glesys].ssh_keys.destroy(@resp.body["response"]["sshkey"]["id"]) @key = Fog::Compute[:glesys].ssh_keys.create(:description => @testdescription, :data => @testdata) end tests("#ssh_key_list").formats(Glesys::Compute::Formats::SshKeys::LIST) do pending if Fog.mocking? @resp = Fog::Compute[:glesys].ssh_key_list @resp.body["response"] end unless Fog.mocking? Fog::Compute[:glesys].ssh_keys.destroy(@key.id) @key = Fog::Compute[:glesys].ssh_keys.create(:description => @testdescription, :data => @testdata) end tests("#ssh_key_remove").formats(Glesys::Compute::Formats::SshKeys::REMOVE) do pending if Fog.mocking? @resp = Fog::Compute[:glesys].ssh_key_remove(:sshkeyids => @key.id) @resp.body["response"] end end tests("failure") do tests("#ssh_key_add with malformed key data").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:glesys].ssh_key_add(:description => @testdescription, :data => @testdata_malformed) end tests("#ssh_key_remove with nonexistent/invalid key id").raises(Excon::Errors::HTTPStatusError) do pending if Fog.mocking? Fog::Compute[:glesys].ssh_key_remove(:id => -1) end end end fog-1.34.0/tests/rage4/0000755000004100000410000000000012600047642014547 5ustar www-datawww-datafog-1.34.0/tests/rage4/requests/0000755000004100000410000000000012600047642016422 5ustar www-datawww-datafog-1.34.0/tests/rage4/requests/dns/0000755000004100000410000000000012600047642017206 5ustar www-datawww-datafog-1.34.0/tests/rage4/requests/dns/dns_tests.rb0000644000004100000410000001641012600047642021543 0ustar www-datawww-dataShindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do @domain = '' @domain_id = nil @record_id = nil @domain_count = 0 @created_domain_list = [] tests("success") do test("get current domain count") do pending if Fog.mocking? response = Fog::DNS[:rage4].list_domains() if response.status == 200 @domain_count = response.body.size end if response.status == 200 response.body = [] end response.status == 200 end test("create domain") do pending if Fog.mocking? domain = generate_unique_domain response = Fog::DNS[:rage4].create_domain(domain) if response.status == 200 @domain_id = response.body['id'] @domain = domain end if response.status == 200 && response.body['id'] != 0 @created_domain_list << response.body['id'] end response.status == 200 && response.body['error'] == "" && response.body['status'] && !@domain_id.nil? end test("create_domain_vanity") do pending if Fog.mocking? domain = generate_unique_domain response = Fog::DNS[:rage4].create_domain_vanity(domain, 'foo.com') if response.status == 200 && response.body['id'] != 0 @created_domain_list << response.body['id'] end response.status == 200 && response.body['error'] == "" && response.body['status'] end test("create_reverse_domain_4") do pending if Fog.mocking? response = Fog::DNS[:rage4].create_reverse_domain_4('192.168.1.1', 29) if response.status == 200 && response.body['id'] != 0 @created_domain_list << response.body['id'] end response.status == 200 && response.body['error'] == "" && response.body['status'] end test("get_domain") do pending if Fog.mocking? response = Fog::DNS[:rage4].get_domain(@domain_id) returns(200) {response.status} returns(@domain_id) {response.body['id']} returns(@domain) {response.body['name']} returns(Fog.credentials[:rage4_email]) {response.body['owner_email']} returns(0) {response.body['type']} returns(0) {response.body['subnet_mask']} end test("get_domain_by_name") do pending if Fog.mocking? response = Fog::DNS[:rage4].get_domain_by_name(@domain) returns(200) {response.status} returns(@domain_id) {response.body['id']} returns(@domain) {response.body['name']} returns(Fog.credentials[:rage4_email]) {response.body['owner_email']} returns(0) {response.body['type']} returns(0) {response.body['subnet_mask']} end test("update_domain") do pending if Fog.mocking? response = Fog::DNS[:rage4].update_domain(@domain_id, {:email => 'test@test.com'}) returns(200) { response.status } returns(true) {response.body['status']} returns(@domain_id) {response.body['id']} returns("") {response.body['error'] } end test("show_current_usage") do pending if Fog.mocking? response = Fog::DNS[:rage4].show_current_usage(@domain_id) returns(200) { response.status } returns([]) { response.body } end test("show_global_usage") do pending if Fog.mocking? response = Fog::DNS[:rage4].show_global_usage() returns(200) { response.status } returns([]) { response.body } end test("list_record_types") do pending if Fog.mocking? response = Fog::DNS[:rage4].list_record_types() response.body.each do |record_type| returns(true) { !record_type['name'].nil? } returns(true) { !record_type['value'].nil? } end returns(200) { response.status } returns(Array) { response.body.class } end test("list_geo_regions") do pending if Fog.mocking? response = Fog::DNS[:rage4].list_geo_regions() response.body.each do |record_type| returns(true) { !record_type['name'].nil? } returns(true) { !record_type['value'].nil? } end returns(200) { response.status } returns(Array) { response.body.class } end test("create_record") do pending if Fog.mocking? name = "www." + @domain type = 2 #"A" data = "1.2.3.4" response = Fog::DNS[:rage4].create_record(@domain_id, name , data, type) if response.status == 200 @record_id = response.body['id'] end response.status == 200 && response.body['error'] == "" && response.body['status'] && !@record_id.nil? end test("create_record with options") do pending if Fog.mocking? name = "www." + @domain type = 2 #"A" data = "1.2.3.5" options = { :udplimit => true } response = Fog::DNS[:rage4].create_record(@domain_id, name , data, type, options) if response.status == 200 @record_id = response.body['id'] end response.status == 200 && response.body['error'] == "" && response.body['status'] && !@record_id.nil? end test("update_record") do pending if Fog.mocking? name = "www." + @domain type = 2 #"A" data = "4.3.2.1" response = Fog::DNS[:rage4].update_record(@record_id, name, data, type) returns(@record_id) { response.body['id'] } response.status == 200 && response.body['error'] == "" && response.body['status'] end test("update_record with options") do pending if Fog.mocking? name = "www." + @domain type = 2 #"A" data = "4.3.2.1" options = { :udplimit => true } response = Fog::DNS[:rage4].update_record(@record_id, name, data, type, options) returns(@record_id) { response.body['id'] } response.status == 200 && response.body['error'] == "" && response.body['status'] end test("list_records") do pending if Fog.mocking? response = Fog::DNS[:rage4].list_records(@domain_id) # returns nameserver records as well, will only verify # the record we have tracked response.body.each do |record| if record['id'] == @record_id returns(@record_id) { record['id'] } returns("www." + @domain) { record['name'] } returns("A") { record['type'] } returns(3600) { record['ttl'] } returns(nil) { record['priority'] } returns(@domain_id) { record['domain_id'] } returns(0) { record['geo_region_id'] } returns(false) { record['failover_enabled'] } returns(nil) { record['failover_content'] } returns(true) { record['is_active'] } returns(false) { record['geo_lock'] } end end response.status == 200 end test("delete_record") do pending if Fog.mocking? response = Fog::DNS[:rage4].delete_record(@record_id) returns(@record_id) { response.body['id'] } response.status == 200 && response.body['error'] == "" && response.body['status'] end test("delete_domain") do pending if Fog.mocking? response = nil @created_domain_list.each do |domain_id| response = Fog::DNS[:rage4].delete_domain(domain_id) returns(true) {response.body['status']} returns(domain_id) {response.body['id']} returns("") {response.body['error'] } end response.status == 200 end end tests( 'failure') do end end fog-1.34.0/tests/linode/0000755000004100000410000000000012600047642015017 5ustar www-datawww-datafog-1.34.0/tests/linode/requests/0000755000004100000410000000000012600047642016672 5ustar www-datawww-datafog-1.34.0/tests/linode/requests/dns/0000755000004100000410000000000012600047642017456 5ustar www-datawww-datafog-1.34.0/tests/linode/requests/dns/dns_tests.rb0000644000004100000410000001524112600047642022014 0ustar www-datawww-dataShindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do @domain = '' @new_zones = [] @new_records =[] tests( 'success') do test('get current zone count') do pending if Fog.mocking? @org_zone_count= 0 response = Fog::DNS[:linode].domain_list() if response.status == 200 zones = response.body['DATA'] @org_zone_count = zones.count end response.status == 200 end test('create zone - simple') do pending if Fog.mocking? type = 'master' domain= generate_unique_domain options = { :SOA_email => "netops@#{domain}", :description => "Sample-Domain Inc", :status => 0} response = Fog::DNS[:linode].domain_create( domain, type, options) if response.status == 200 @master_zone_id = response.body['DATA']['DomainID'] @new_zones << @master_zone_id end response.status == 200 end test('create zone - set all parameters') do pending if Fog.mocking? type = 'slave' @domain= generate_unique_domain options = { :SOA_email => "netops@#{@domain}", :refresh_sec => 14400, :retry_sec => 3600, :expire_sec => 604800, :ttl_sec => 28800, :status => 0, :master_ips => '1.2.3.4;2.3.4.5' } response = Fog::DNS[:linode].domain_create( @domain, type, options) if response.status == 200 @slave_zone_id = response.body['DATA']['DomainID'] @new_zones << @slave_zone_id end response.status == 200 end test("get zone #{@slave_zone_id} - check all parameters for #{@domain}") do pending if Fog.mocking? result= false response = Fog::DNS[:linode].domain_list( @slave_zone_id) if response.status == 200 zones = response.body['DATA'] num_zones = zones.count if num_zones == 1 zone= zones[0] if (zone['SOA_EMAIL'] == "netops@#{@domain}") and (zone['REFRESH_SEC'] == 14400) and (zone['RETRY_SEC'] == 3600) and (zone['EXPIRE_SEC'] == 604800) and (zone['TTL_SEC'] == 28800) and (zone['STATUS'] == 0) and (zone['DOMAIN'] == @domain) and (zone['TYPE'] == 'slave') (zone['MASTER_IPS'] == '1.2.3.4;2.3.4.5') result= true end end end result end test("update zone #{@slave_zone_id}- update TTL parameter") do pending if Fog.mocking? result= false options = { :ttl_sec => 14400 } response = Fog::DNS[:linode].domain_update( @slave_zone_id, options) if response.status == 200 result= true end result end test("get zone #{@slave_zone_id} - check TTL parameters") do pending if Fog.mocking? result= false response = Fog::DNS[:linode].domain_list( @slave_zone_id) if response.status == 200 zones = response.body['DATA'] num_zones = zones.count if num_zones == 1 zone= zones[0] if (zone['TTL_SEC'] == 14400) result= true end end end result end test('create record - simple A record') do pending if Fog.mocking? host= 'www.' + @domain options = { :name => host, :target => '4.5.6.7', :ttl_sec => 3600 } response = Fog::DNS[:linode].domain_resource_create( @master_zone_id, 'A', options) if response.status == 200 record_id = response.body['DATA']['ResourceID'] @new_records << record_id end response.status == 200 end test('create record - CNAME record') do pending if Fog.mocking? host= 'mail' options = { :name => host, :target => 'www.' + @domain } response = Fog::DNS[:linode].domain_resource_create( @master_zone_id, 'CNAME', options) if response.status == 200 record_id = response.body['DATA']['ResourceID'] @new_records << record_id end response.status == 200 end test('create record - NS record') do pending if Fog.mocking? options = { :name => @domain, :target => 'ns.' + @domain} response = Fog::DNS[:linode].domain_resource_create( @master_zone_id, 'NS', options) if response.status == 200 record_id = response.body['DATA']['ResourceID'] @new_records << record_id end response.status == 200 end test('create record - MX record') do pending if Fog.mocking? options = { :target => 'mail.' + @domain, :ttl_sec => 7200, :priority => 5 } response = Fog::DNS[:linode].domain_resource_create( @master_zone_id, 'MX', options) if response.status == 200 @record_id = response.body['DATA']['ResourceID'] @new_records << @record_id end response.status == 200 end test("get record #{@record_id} - verify all parameters") do pending if Fog.mocking? result= false domain= 'mail.' + @domain response = Fog::DNS[:linode].domain_resource_list(@master_zone_id, @record_id) if response.status == 200 records= response.body['DATA'] if records.count == 1 record = records[0] if (record['TYPE'] == 'MX') and (record['PRIORITY'] == 5) and (record['TTL_SEC'] == 7200) and (record['TARGET'] == domain) result= true end end end result end test("update record #{@record_id} - change target") do pending if Fog.mocking? options = { :target => 'mail2.' + @domain } response = Fog::DNS[:linode].domain_resource_update( @master_zone_id, @record_id, options) response.status == 200 end test("get record #{@record_id} - verify target changed") do pending if Fog.mocking? result= false domain= 'mail2.' + @domain response = Fog::DNS[:linode].domain_resource_list(@master_zone_id, @record_id) if response.status == 200 records= response.body['DATA'] if records.count == 1 record = records[0] if record['TARGET'] == domain result= true end end end result end test("delete #{@new_records.count} records created") do pending if Fog.mocking? result= true @new_records.each { |record_id| response = Fog::DNS[:linode].domain_resource_delete( @master_zone_id, record_id) if response.status != 200 result= false; end } result end test("delete #{@new_zones.count} zones created") do pending if Fog.mocking? result= true @new_zones.each { |zone_id| response = Fog::DNS[:linode].domain_delete( zone_id) if response.status != 200 result= false; end } result end end tests( 'failure') do end end fog-1.34.0/tests/linode/requests/compute/0000755000004100000410000000000012600047642020346 5ustar www-datawww-datafog-1.34.0/tests/linode/requests/compute/datacenter_tests.rb0000644000004100000410000000065012600047642024230 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | datacenter requests', ['linode']) do @datacenters_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'DATACENTERID' => Integer, 'LOCATION' => String }] }) tests('success') do tests('#avail_datacenters').formats(@datacenters_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_datacenters.body end end end fog-1.34.0/tests/linode/requests/compute/kernel_tests.rb0000644000004100000410000000136012600047642023375 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | kernel requests', ['linode']) do @kernels_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'LABEL' => String, 'ISXEN' => Integer, 'ISPVOPS' => Integer, 'KERNELID' => Integer }] }) tests('success') do @kernel_id = nil tests('#avail_kernels').formats(@kernels_format) do pending if Fog.mocking? data = Fog::Compute[:linode].avail_kernels.body @kernel_id = data['DATA'].first['KERNELID'] data end tests("@avail_kernels(#{@kernel_id})").formats(@kernels_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_kernels(@kernel_id).body end end end fog-1.34.0/tests/linode/requests/compute/linode_tests.rb0000644000004100000410000001566212600047642023401 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | linode requests', ['linode']) do @linode_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'LinodeID' => Integer } }) @linodes_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'ALERT_BWIN_ENABLED' => Integer, 'ALERT_CPU_THRESHOLD' => Integer, 'ALERT_BWOUT_ENABLED' => Integer, 'ALERT_BWOUT_THRESHOLD' => Integer, 'ALERT_BWQUOTA_ENABLED' => Integer, 'ALERT_BWQUOTA_THRESHOLD' => Integer, 'ALERT_BWIN_THRESHOLD' => Integer, 'ALERT_CPU_ENABLED' => Integer, 'ALERT_DISKIO_ENABLED' => Integer, 'ALERT_DISKIO_THRESHOLD' => Integer, 'BACKUPSENABLED' => Integer, 'BACKUPWEEKLYDAY' => Integer, 'BACKUPWINDOW' => Integer, 'DATACENTERID' => Integer, 'LABEL' => String, 'LINODEID' => Integer, 'LPM_DISPLAYGROUP' => String, 'STATUS' => Integer, 'TOTALHD' => Integer, 'TOTALRAM' => Integer, 'TOTALXFER' => Integer, 'WATCHDOG' => Integer, }] }) @reboot_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JobID' => Integer } }) @ip_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'IPADDRESSID' => Integer, 'IPADDRESS' => String } }) @disks_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ "UPDATE_DT" => String, "DISKID" => Integer, "LABEL" => String, "TYPE" => String, "LINODEID" => Integer, "ISREADONLY" => Integer, "STATUS" => Integer, "CREATE_DT" => String, "SIZE" => Integer }] }) @images_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ "LAST_USED_DT" => String, "DESCRIPTION" => String, "LABEL" => String, "STATUS" => String, "TYPE" => String, "MINSIZE" => Integer, "ISPUBLIC" => Integer, "CREATE_DT" => String, "FS_TYPE" => String, "CREATOR" => String, "IMAGEID" => Integer }] }) @disk_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JobID' => Integer, 'DiskID' => Integer } }) @disk_createfromimage_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JOBID' => Integer, 'DISKID' => Integer } }) @disk_resize_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JobID' => Integer } }) @disk_imagize_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JobID' => Integer, 'ImageID' => Integer } }) @disk_update_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'DiskID' => Integer } }) tests('success') do @linode_id = nil # (2 => Dallas, TX, USA), (1 => 1 month), (1 => Linode 512) tests('#linode_create(2, 1, 1)').formats(@linode_format) do pending if Fog.mocking? data = Fog::Compute[:linode].linode_create(2, 1, 1).body @linode_id = data['DATA']['LinodeID'] data end tests("#linode_list(#{@linode_id})").formats(@linodes_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_list(@linode_id).body end tests('#linode_list').formats(@linodes_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_list.body end tests('#linode_update').formats(@linode_format) do pending if Fog.mocking? rand_label = 'testing' + Fog::Mock.random_letters(6) Fog::Compute[:linode].linode_update(@linode_id, :label => rand_label).body end tests('#linode_ip_addprivate').formats(@ip_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_ip_addprivate(@linode_id).body end tests('#linode_disk_create').formats(@disk_format) do pending if Fog.mocking? data = Fog::Compute[:linode].linode_disk_create(@linode_id, 'test1', 'ext3', 1).body @disk1_id = data['DATA']['DiskID'] data end tests('#linode_disk_update').formats(@disk_update_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_disk_update(@linode_id, @disk1_id, 'test1-updated', 1).body end tests('#linode_disk_duplicate').formats(@disk_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_disk_duplicate(@linode_id, @disk1_id).body end tests('#linode_disk_resize').formats(@disk_resize_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_disk_resize(@linode_id, @disk1_id, 2).body end tests('#linode_disk_imagize').formats(@disk_imagize_format) do pending if Fog.mocking? data = Fog::Compute[:linode].linode_disk_imagize(@linode_id, @disk1_id, 'test description imageid1', 'test label imageid1').body @image1_id = data['DATA']['ImageID'] data end tests('#linode_disk_createfromdistribution').formats(@disk_format) do pending if Fog.mocking? data = Fog::Compute[:linode].linode_disk_createfromdistribution(@linode_id, 124, 'test1', 750, 'P@SSW)RD').body @disk2_id = data['DATA']['DiskID'] data end tests('#linode_disk_createfromimage').formats(@disk_createfromimage_format) do pending if Fog.mocking? data = Fog::Compute[:linode].linode_disk_createfromimage(@linode_id, @image1_id, 'test1', 3, 'P@SSW)RD', '').body @disk3_id = data['DATA']['DISKID'] data end tests('#image_list').formats(@images_format) do pending if Fog.mocking? Fog::Compute[:linode].image_list(@image_id).body end tests('#linode_disk_list').formats(@disks_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_disk_list(@linode_id).body end # tests("#linode_reboot(#{@linode_id})").formats(@reboot_format) do # Fog::Compute[:linode].linode_reboot(@linode_id).body # end tests('#image_delete').formats(@images_format) do pending if Fog.mocking? Fog::Compute[:linode].image_delete(@image1_id).body end tests('#linode_disk_delete').formats(@disk_format) do pending if Fog.mocking? Fog::Compute[:linode].linode_disk_delete(@linode_id, @disk1_id).body Fog::Compute[:linode].linode_disk_delete(@linode_id, @disk2_id).body Fog::Compute[:linode].linode_disk_delete(@linode_id, @disk3_id).body end tests('#linode_delete(#{@linode_id})').succeeds do pending if Fog.mocking? sleep 1 until Fog::Compute[:linode].linode_disk_list(@linode_id).body['DATA'].size == 0 Fog::Compute[:linode].linode_delete(@linode_id) end end tests('failure') do tests('#linode_reboot(0)').raises(Fog::Compute::Linode::NotFound) do pending if Fog.mocking? Fog::Compute[:linode].linode_reboot(1) end tests('#linode_delete(0)').raises(Fog::Compute::Linode::NotFound) do pending if Fog.mocking? Fog::Compute[:linode].linode_delete(1) end end end fog-1.34.0/tests/linode/requests/compute/stackscripts_tests.rb0000644000004100000410000000210612600047642024631 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | stack_script requests', ['linode']) do @stack_scripts_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'STACKSCRIPTID' => Integer, 'SCRIPT' => String, 'DESCRIPTION' => String, 'DISTRIBUTIONIDLIST' => String, 'LABEL' => String, 'DEPLOYMENTSTOTAL' => Integer, 'LATESTREV' => Integer, 'CREATE_DT' => String, 'DEPLOYMENTSACTIVE' => Integer, 'REV_NOTE' => String, 'REV_DT' => String, 'ISPUBLIC' => Integer, 'USERID' => Integer }] }) tests('success') do tests('#avail_stackscripts').formats(@stack_scripts_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_stackscripts.body end tests('#stackscript_list').formats(@stack_scripts_format) do pending # TODO: REV_NOTE can be either string or float? pending if Fog.mocking? Fog::Compute[:linode].stackscript_list.body end end end fog-1.34.0/tests/linode/requests/compute/helper.rb0000644000004100000410000000023012600047642022145 0ustar www-datawww-dataclass Linode module Compute module Formats BASIC = { 'ERRORARRAY' => [], 'ACTION' => String } end end end fog-1.34.0/tests/linode/requests/compute/distribution_tests.rb0000644000004100000410000000162012600047642024633 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | distribution requests', ['linode']) do @distributions_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'CREATE_DT' => String, 'DISTRIBUTIONID' => Integer, 'IS64BIT' => Integer, 'LABEL' => String, 'MINIMAGESIZE' => Integer, 'REQUIRESPVOPSKERNEL' => Integer }] }) tests('success') do @distribution_id = nil tests('#avail_distributions').formats(@distributions_format) do pending if Fog.mocking? data = Fog::Compute[:linode].avail_distributions.body @distribution_id = data['DATA'].first['DISTRIBUTIONID'] data end tests("@avail_distributions(#{@distribution_id})").formats(@distributions_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_distributions(@distribution_id).body end end end fog-1.34.0/tests/linode/requests/compute/linodeplans_tests.rb0000644000004100000410000000176512600047642024436 0ustar www-datawww-dataShindo.tests('Fog::Compute[:linode] | linodeplans requests', ['linode']) do @linodeplans_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => [{ 'AVAIL' => { '2' => Integer, '3' => Integer, '4' => Integer, '6' => Integer, '7' => Integer, '8' => Integer }, 'DISK' => Integer, 'PLANID' => Integer, 'PRICE' => Float, 'RAM' => Integer, 'LABEL' => String, 'XFER' => Integer, 'CORES' => Integer }] }) tests('success') do @linodeplan_id = nil tests('#avail_linodeplans').formats(@linodeplans_format) do pending if Fog.mocking? data = Fog::Compute[:linode].avail_linodeplans.body @linodeplan_id = data['DATA'].first['PLANID'] data end tests("#avail_linodeplans(#{@linodeplan_id})").formats(@linodeplans_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_linodeplans(@linodeplan_id).body end end end fog-1.34.0/tests/hp/0000755000004100000410000000000012600047642014154 5ustar www-datawww-datafog-1.34.0/tests/hp/user_agent_tests.rb0000644000004100000410000000106612600047642020062 0ustar www-datawww-dataShindo.tests('Fog::Compute[:hp] | user agent', ['hp', 'user_agent']) do tests('default for HP providers').returns("hpfog/#{Fog::HP::VERSION}") do pending if Fog.mocking? conn = Fog::Compute[:hp] conn.instance_variable_get(:@connection_options)[:headers]['User-Agent'] end tests('overriden by clients').returns("hpfog/#{Fog::HP::VERSION} (TesterClient/1.0.0)") do pending if Fog.mocking? conn = Fog::Compute::HP.new(:user_agent => "TesterClient/1.0.0") conn.instance_variable_get(:@connection_options)[:headers]['User-Agent'] end end fog-1.34.0/tests/hp/requests/0000755000004100000410000000000012600047642016027 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/network/0000755000004100000410000000000012600047642017520 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/network/port_tests.rb0000644000004100000410000000423412600047642022256 0ustar www-datawww-dataShindo.tests('HP::Network | networking port requests', ['hp', 'networking', 'port']) do @port_format = { 'id' => String, 'name' => Fog::Nullable::String, 'network_id' => String, 'fixed_ips' => Array, 'mac_address' => String, 'status' => String, 'admin_state_up' => Fog::Boolean, 'binding:vif_type' => String, 'device_owner' => String, 'device_id' => String, 'security_groups' => Array, 'tenant_id' => String } n_data = HP[:network].create_network({:name => 'fog_network'}).body['network'] @network_id = n_data['id'] tests('success') do @port_id = nil tests('#create_port').formats(@port_format) do attributes = {:name => 'myport', :fixed_ips => [], :mac_address => 'fa:16:3e:71:26:c8', :admin_state_up => true, :device_owner => '2222222', :device_id => '3333333', :tenant_id => '111111111'} data = HP[:network].create_port(@network_id, attributes).body['port'] @port_id = data['id'] data end tests('#list_port').formats({'ports' => [@port_format]}) do HP[:network].list_ports.body end tests("#get_port(#{@port_id})").formats({'port' => @port_format}) do HP[:network].get_port(@port_id).body end tests("#update_port(#{@port_id})").formats({'port' => @port_format}) do attributes = {:name => 'myport_upd', :fixed_ips => [], :admin_state_up => true, :device_owner => 'device_owner', :device_id => 'device_id'} HP[:network].update_port(@port_id, attributes).body end tests("#delete_port(#{@port_id})").succeeds do HP[:network].delete_port(@port_id) end end tests('failure') do tests('#get_port(0)').raises(Fog::HP::Network::NotFound) do HP[:network].get_port(0) end tests('#update_port(0)').raises(Fog::HP::Network::NotFound) do HP[:network].update_port(0, {}) end tests('#delete_port(0)').raises(Fog::HP::Network::NotFound) do HP[:network].delete_port(0) end end # cleanup HP[:network].delete_network(@network_id) end fog-1.34.0/tests/hp/requests/network/security_group_tests.rb0000644000004100000410000000266212600047642024360 0ustar www-datawww-dataShindo.tests('HP::Network | networking security group requests', ['hp', 'networking', 'securitygroup']) do @security_group_format = { 'id' => String, 'name' => String, 'description' => String, 'tenant_id' => String, 'security_group_rules' => [Hash] } tests('success') do @sec_group_id = nil tests("#create_security_group('fog_security_group', 'tests group')").formats(@security_group_format) do attributes = {:name => 'fog_security_group', :description => 'tests group'} data = HP[:network].create_security_group(attributes).body['security_group'] @sec_group_id = data['id'] data end tests("#get_security_group('#{@sec_group_id}')").formats(@security_group_format) do HP[:network].get_security_group(@sec_group_id).body['security_group'] end tests("#list_security_groups").formats('security_groups' => [@security_group_format]) do HP[:network].list_security_groups.body end tests("#delete_security_group('#{@sec_group_id}')").succeeds do HP[:network].delete_security_group(@sec_group_id) end end tests('failure') do tests("#get_security_group(0)").raises(Fog::HP::Network::NotFound) do HP[:network].get_security_group(0) end tests("#delete_security_group(0)").raises(Fog::HP::Network::NotFound) do HP[:network].delete_security_group(0) end end end fog-1.34.0/tests/hp/requests/network/floating_ip_tests.rb0000644000004100000410000000451712600047642023571 0ustar www-datawww-dataShindo.tests('HP::Network | networking floating ip requests', ['hp', 'networking', 'floatingip']) do @floating_ip_format = { 'id' => String, 'tenant_id' => String, 'floating_network_id' => String, 'router_id' => Fog::Nullable::String, 'fixed_ip_address' => Fog::Nullable::String, 'floating_ip_address' => String, 'port_id' => Fog::Nullable::String } @ext_network_id = HP[:network].list_networks({'router:external'=>true}).body['networks'][0]['id'] s_data = HP[:network].create_port(@ext_network_id, {:name => 'fog_port'}).body['port'] @port_id = s_data['id'] tests('success') do @floating_ip_id = nil tests("#create_floating_ip(#{@ext_network_id})").formats(@floating_ip_format) do data = HP[:network].create_floating_ip(@ext_network_id).body['floatingip'] @floating_ip_id = data['id'] data end tests('#list_floating_ips').formats({'floatingips' => [@floating_ip_format]}) do HP[:network].list_floating_ips.body end tests("#get_floating_ip(#{@floating_ip_id})").formats({'floatingip' => @floating_ip_format}) do HP[:network].get_floating_ip(@floating_ip_id).body end tests("#associate_floating_ip(#{@floating_ip_id}, #{@port_id})").formats({'floatingip' => @floating_ip_format}) do HP[:network].associate_floating_ip(@floating_ip_id, @port_id).body end tests("#disassociate_floating_ip(#{@floating_ip_id}, nil)").formats({'floatingip' => @floating_ip_format}) do HP[:network].disassociate_floating_ip(@floating_ip_id, nil).body end tests("#delete_floating_ip(#{@floating_ip_id})").succeeds do HP[:network].delete_floating_ip(@floating_ip_id) end end tests('failure') do tests('#get_floating_ip("0")').raises(Fog::HP::Network::NotFound) do HP[:network].get_floating_ip(0) end tests("#associate_floating_ip('0', #{@port_id})").raises(Fog::HP::Network::NotFound) do HP[:network].associate_floating_ip('0', @port_id) end tests('#disassociate_floating_ip("0")').raises(Fog::HP::Network::NotFound) do HP[:network].disassociate_floating_ip("0") end tests('#delete_floating_ip("0")').raises(Fog::HP::Network::NotFound) do HP[:network].delete_floating_ip("0") end end # cleanup HP[:network].delete_port(@port_id) end fog-1.34.0/tests/hp/requests/network/subnet_tests.rb0000644000004100000410000000437312600047642022576 0ustar www-datawww-dataShindo.tests('HP::Network | networking subnet requests', ['hp', 'networking', 'subnet']) do @subnet_format = { 'id' => String, 'name' => Fog::Nullable::String, 'network_id' => String, 'cidr' => String, 'ip_version' => Integer, 'gateway_ip' => Fog::Nullable::String, 'allocation_pools' => Fog::Nullable::Array, 'dns_nameservers' => Fog::Nullable::Array, 'host_routes' => Fog::Nullable::Array, 'enable_dhcp' => Fog::Boolean, 'tenant_id' => String, } n_data = HP[:network].create_network({:name => 'fog_network'}).body['network'] @network_id = n_data['id'] tests('success') do @subnet_id = nil tests('#create_subnet').formats(@subnet_format) do attributes = {:name => 'mysubnet', :gateway_ip => '10.0.3.1', :allocation_pools => [], :dns_nameservers => [], :host_routes => [], :enable_dhcp => true, :tenant_id => '111111111'} data = HP[:network].create_subnet(@network_id, '10.0.3.0/24', 4, attributes).body['subnet'] @subnet_id = data['id'] data end tests('#list_subnets').formats({'subnets' => [@subnet_format]}) do HP[:network].list_subnets.body end tests("#get_subnet(#{@subnet_id})").formats({'subnet' => @subnet_format}) do HP[:network].get_subnet(@subnet_id).body end tests("#update_subnet(#{@subnet_id})").formats({'subnet' => @subnet_format}) do attributes = {:name => 'mysubnet_upd',:gateway_ip => '10.0.3.1', :dns_nameservers => [], :host_routes => [], :enable_dhcp => true} HP[:network].update_subnet(@subnet_id, attributes).body end tests("#delete_subnet(#{@subnet_id})").succeeds do HP[:network].delete_subnet(@subnet_id) end end tests('failure') do tests('#get_subnet(0)').raises(Fog::HP::Network::NotFound) do HP[:network].get_subnet(0) end tests('#update_subnet(0)').raises(Fog::HP::Network::NotFound) do HP[:network].update_subnet(0, {}) end tests('#delete_subnet(0)').raises(Fog::HP::Network::NotFound) do HP[:network].delete_subnet(0) end end # cleanup HP[:network].delete_network(@network_id) end fog-1.34.0/tests/hp/requests/network/router_tests.rb0000644000004100000410000000725412600047642022617 0ustar www-datawww-dataShindo.tests('HP::Network | networking router requests', ['hp', 'networking', 'router']) do @router_format = { 'id' => String, 'name' => String, 'tenant_id' => String, 'status' => String, 'admin_state_up' => Fog::Boolean, 'external_gateway_info' => Fog::Nullable::Hash } @router_interface_format = { 'subnet_id' => String, 'port_id' => String } n_data = HP[:network].create_network({:name => 'fog_network'}).body['network'] @network_id = n_data['id'] p_data = HP[:network].create_port(@network_id, {:name => 'fog_port'}).body['port'] @port_id = p_data['id'] tests('success') do @router_id = nil tests('#create_router').formats(@router_format) do attributes = {:name => 'my_router', :admin_state_up => true} data = HP[:network].create_router(attributes).body['router'] @router_id = data['id'] data end tests('#list_routers').formats({'routers' => [@router_format]}) do HP[:network].list_routers.body end tests("#get_router(#{@router_id})").formats({'router' => @router_format}) do HP[:network].get_router(@router_id).body end tests("#update_router(#{@router_id})").formats({'router' => @router_format}) do attributes = { :name => 'my_router_upd', :external_gateway_info => { :network_id => '11111111111' }, :admin_state_up => true } HP[:network].update_router(@router_id, attributes).body end tests("#add_router_interface(#{@router_id}, '1111111111', nil) - using subnet_id").formats(@router_interface_format) do HP[:network].add_router_interface(@router_id, '1111111111', nil).body end #tests("#remove_router_interface(#{@router_id}, '1111111111', nil) - using subnet_id").formats('') do # HP[:network].remove_router_interface(@router_id, '1111111111', nil).body #end tests("#add_router_interface(#{@router_id}, nil, #{@port_id}) - using port_id").formats(@router_interface_format) do HP[:network].add_router_interface(@router_id, nil, @port_id).body end tests("#add_router_interface(#{@router_id}, '1111111111', '2222222222') - using port_id and subnet_id").raises(ArgumentError) do HP[:network].add_router_interface(@router_id, '1111111111', '2222222222').body end tests("#remove_router_interface(#{@router_id}, nil, #{@port_id}) - using port_id").formats('') do HP[:network].remove_router_interface(@router_id, nil, @port_id).body end tests("#remove_router_interface(#{@router_id}, '1111111111', '2222222222') - using port_id and subnet_id").raises(ArgumentError) do HP[:network].remove_router_interface(@router_id, '1111111111', '2222222222').body end tests("#delete_router(#{@router_id})").succeeds do HP[:network].delete_router(@router_id) end end tests('failure') do tests('#get_router(0)').raises(Fog::HP::Network::NotFound) do HP[:network].get_router(0) end tests('#update_router(0)').raises(Fog::HP::Network::NotFound) do HP[:network].update_router(0, {}) end tests('#delete_router(0)').raises(Fog::HP::Network::NotFound) do HP[:network].delete_router(0) end tests("#add_router_interface(0, '1111111111')").raises(Fog::HP::Network::NotFound) do HP[:network].add_router_interface(0, '1111111111').body end tests("#remove_router_interface(0, '1111111111')").raises(Fog::HP::Network::NotFound) do HP[:network].remove_router_interface(0, '1111111111').body end end # cleanup # remove_router_interface method removes the port #HP[:network].delete_port(@port_id) HP[:network].delete_network(@network_id) end fog-1.34.0/tests/hp/requests/network/network_tests.rb0000644000004100000410000000331312600047642022760 0ustar www-datawww-dataShindo.tests('HP::Network | networking network requests', ['hp', 'networking', 'network']) do @network_format = { 'id' => String, 'name' => Fog::Nullable::String, 'tenant_id' => String, 'status' => String, 'subnets' => Array, 'router:external' => Fog::Boolean, 'admin_state_up' => Fog::Boolean, 'shared' => Fog::Boolean } tests('success') do @network_id = nil tests('#create_network').formats(@network_format) do attributes = {:name => 'my_network', :admin_state_up => true, :shared => false} data = HP[:network].create_network(attributes).body['network'] @network_id = data['id'] data end tests('#list_networks').formats({'networks' => [@network_format]}) do HP[:network].list_networks.body end tests("#get_network(#{@network_id})").formats({'network' => @network_format}) do HP[:network].get_network(@network_id).body end tests("#update_network(#{@network_id})").formats({'network' => @network_format}) do attributes = {:name => 'my_network_upd', :shared => false, :admin_state_up => true} HP[:network].update_network(@network_id, attributes).body end tests("#delete_network(#{@network_id})").succeeds do HP[:network].delete_network(@network_id) end end tests('failure') do tests('#get_network(0)').raises(Fog::HP::Network::NotFound) do HP[:network].get_network(0) end tests('#update_network(0)').raises(Fog::HP::Network::NotFound) do HP[:network].update_network(0, {}) end tests('#delete_network(0)').raises(Fog::HP::Network::NotFound) do HP[:network].delete_network(0) end end end fog-1.34.0/tests/hp/requests/network/security_group_rule_tests.rb0000644000004100000410000000417412600047642025407 0ustar www-datawww-dataShindo.tests('HP::Network | networking security group rule requests', ['hp', 'networking', 'securitygroup']) do @security_group_rule_format = { 'id' => String, 'remote_group_id' => Fog::Nullable::String, 'direction' => String, 'remote_ip_prefix' => Fog::Nullable::String, 'protocol' => Fog::Nullable::String, 'ethertype' => String, 'port_range_max' => Fog::Nullable::Integer, 'port_range_min' => Fog::Nullable::Integer, 'security_group_id' => String, 'tenant_id' => String } tests('success') do attributes = {:name => 'my_security_group', :description => 'tests group'} data = HP[:network].create_security_group(attributes).body['security_group'] @sec_group_id = data['id'] @sec_group_rule_id = nil tests("#create_security_group_rule(#{@sec_group_id}, 'ingress', attributes)").formats(@security_group_rule_format) do attributes = {:remote_ip_prefix => '0.0.0.0/0', :protocol => 'tcp', :port_range_min => 22, :port_range_max => 22} data = HP[:network].create_security_group_rule(@sec_group_id, 'ingress', attributes).body['security_group_rule'] @sec_group_rule_id = data['id'] data end tests("#get_security_group_rule('#{@sec_group_rule_id}')").formats(@security_group_rule_format) do HP[:network].get_security_group_rule(@sec_group_rule_id).body['security_group_rule'] end tests("#list_security_group_rules").formats('security_group_rules' => [@security_group_rule_format]) do HP[:network].list_security_group_rules.body end tests("#delete_security_group_rule('#{@sec_group_rule_id}')").succeeds do HP[:network].delete_security_group_rule(@sec_group_rule_id) end end tests('failure') do tests('#get_security_group_rule(0)').raises(Fog::HP::Network::NotFound) do HP[:network].get_security_group_rule(0) end tests('#delete_security_group_rule(0)').raises(Fog::HP::Network::NotFound) do HP[:network].delete_security_group_rule(0) end end HP[:network].delete_security_group(@sec_group_id) end fog-1.34.0/tests/hp/requests/storage/0000755000004100000410000000000012600047642017473 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/storage/object_tests.rb0000644000004100000410000001204012600047642022505 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | object requests", ['hp', 'storage']) do @directory = Fog::Storage[:hp].directories.create(:key => 'fogobjecttests') @dir_name = @directory.identity tests('success') do tests("#put_object('#{@dir_name}', 'fog_object')").succeeds do Fog::Storage[:hp].put_object(@dir_name, 'fog_object', lorem_file) end tests("#post_object('#{@dir_name}', 'fog_object', {'X-Object-Meta-Foo' => 'foometa'})").succeeds do Fog::Storage[:hp].post_object(@dir_name, 'fog_object', {'X-Object-Meta-Foo' => 'foometa'}) end tests("#get_object('#{@dir_name}', 'fog_object')").succeeds do Fog::Storage[:hp].get_object(@dir_name, 'fog_object') end tests("#get_object('#{@dir_name}', 'fog_object', &block)").returns(lorem_file.read) do data = '' Fog::Storage[:hp].get_object(@dir_name, 'fog_object') do |chunk, remaining_bytes, total_bytes| data << chunk end data end tests("#head_object('#{@dir_name}', 'fog_object')").succeeds do Fog::Storage[:hp].head_object(@dir_name, 'fog_object') end tests("#get_object_temp_url('#{@dir_name}', 'fog_object', 60, 'GET')").succeeds do Fog::Storage[:hp].get_object_temp_url(@dir_name, 'fog_object', 60, 'GET') end # copy a file within the same container tests("#put_object('#{@dir_name}', 'fog_other_object', nil, {'X-Copy-From' => '/#{@dir_name}/fog_object'})" ).succeeds do Fog::Storage[:hp].put_object(@dir_name, 'fog_other_object', nil, {'X-Copy-From' => "/#{@dir_name}/fog_object"}) end @directory.files.get('fog_other_object').destroy # copy a file from one container to another @another_dir = Fog::Storage[:hp].directories.create(:key => 'fogobjecttests2') tests("#put_object('#{@another_dir.identity}', 'fog_another_object', nil, {'X-Copy-From' => '/#{@dir_name}/fog_object'})" ).succeeds do Fog::Storage[:hp].put_object(@another_dir.identity, 'fog_another_object', nil, {'X-Copy-From' => "/#{@dir_name}/fog_object"}) end @another_dir.files.get('fog_another_object').destroy @another_dir.destroy tests("#post_object('#{@dir_name}', 'fog_delete_object', {'X-Delete-After' => 40})" ).succeeds do Fog::Storage[:hp].put_object(@dir_name, 'fog_delete_object', lorem_file) Fog::Storage[:hp].post_object(@dir_name, 'fog_delete_object', {'X-Delete-After' => 40}) end tests("#delete_object('#{@dir_name}', 'fog_object')").succeeds do Fog::Storage[:hp].delete_object(@dir_name, 'fog_object') Fog::Storage[:hp].delete_object(@dir_name, 'fog_delete_object') end tests("#get_object_http_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do object_url = Fog::Storage[:hp].get_object_http_url(@dir_name, 'fog_object', (Time.now + 60)) object_url.include? "fog_object" object_url.include? "&temp_url_expires=" object_url.include? "temp_url_sig=" object_url.include? @dir_name object_url.start_with? "http://" end tests("#get_object_https_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do object_url = Fog::Storage[:hp].get_object_https_url(@dir_name, 'fog_object', (Time.now + 60)) object_url.include? "fog_object" object_url.include? "&temp_url_expires=" object_url.include? "temp_url_sig=" object_url.include? @dir_name object_url.start_with? "https://" end end tests('failure') do tests("#put_object('fognoncontainer', 'fog_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].put_object('fognoncontainer', 'fog_object', lorem_file) end tests("#post_object('fognoncontainer', 'fog_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].post_object('fognoncontainer', 'fog_object') end tests("#get_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].get_object(@dir_name, 'fog_non_object') end tests("#get_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].get_object('fognoncontainer', 'fog_non_object') end tests("#get_object_temp_url('#{@dir_name}', 'fog_object', 60, 'POST')").raises(ArgumentError) do Fog::Storage[:hp].get_object_temp_url(@dir_name, 'fog_object', 60, 'POST') end tests("#head_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].head_object(@dir_name, 'fog_non_object') end tests("#head_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].head_object('fognoncontainer', 'fog_non_object') end tests("#delete_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].delete_object(@dir_name, 'fog_non_object') end tests("#delete_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].delete_object('fognoncontainer', 'fog_non_object') end end @directory.destroy end fog-1.34.0/tests/hp/requests/storage/container_tests.rb0000644000004100000410000000553512600047642023234 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | container requests", ['hp']) do @container_format = [String] @containers_format = [{ 'bytes' => Integer, 'count' => Integer, 'name' => String }] tests('success') do tests("#put_container('fogcontainertests')").succeeds do Fog::Storage[:hp].put_container('fogcontainertests') end tests("#post_container('fogcontainertests', {'X-Container-Meta-Foo' => 'foometa'})").succeeds do Fog::Storage[:hp].post_container('fogcontainertests', {'X-Container-Meta-Foo' => 'foometa'}) end tests("#get_container('fogcontainertests')").formats(@container_format) do Fog::Storage[:hp].get_container('fogcontainertests').body end tests("#get_containers").formats(@containers_format) do Fog::Storage[:hp].get_containers.body end tests("#head_container('fogcontainertests')").succeeds do Fog::Storage[:hp].head_container('fogcontainertests') end tests("#head_containers").succeeds do Fog::Storage[:hp].head_containers end tests("#delete_container('fogcontainertests')").succeeds do Fog::Storage[:hp].delete_container('fogcontainertests') end tests("#put_container('fogacltests', {'X-Container-Read' => 'private'})").succeeds do Fog::Storage[:hp].put_container('fogacltests', {'X-Container-Read' => 'private'}) end Fog::Storage[:hp].delete_container('fogacltests') tests("#put_container('fogacltests', {'X-Container-Read' => 'public-read'})").succeeds do Fog::Storage[:hp].put_container('fogacltests', {'X-Container-Read' => 'public-read'}) end Fog::Storage[:hp].delete_container('fogacltests') tests("#put_container('fogacltests', {'X-Container-Read' => 'invalid'})").succeeds do Fog::Storage[:hp].put_container('fogacltests', {'X-Container-Read' => 'invalid'}) end Fog::Storage[:hp].delete_container('fogacltests') end tests('failure') do tests("#get_container('fognoncontainer')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].get_container('fognoncontainer') end tests("#post_container('fognoncontainer', {})").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].post_container('fognoncontainer', {}) end tests("#head_container('fognoncontainer')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].head_container('fognoncontainer') end tests("#delete_container('fognoncontainer')").raises(Fog::Storage::HP::NotFound) do Fog::Storage[:hp].delete_container('fognoncontainer') end @container = Fog::Storage[:hp].directories.create(:key => 'fognonempty') @file = @container.files.create(:key => 'foo', :body => 'bar') tests("#delete_container('fognonempty')").raises(Excon::Errors::Conflict) do Fog::Storage[:hp].delete_container('fognonempty') end @file.destroy @container.destroy end end fog-1.34.0/tests/hp/requests/dns/0000755000004100000410000000000012600047642016613 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/dns/domain_tests.rb0000644000004100000410000000407012600047642021632 0ustar www-datawww-dataShindo.tests("HP::DNS | domain requests", ['hp', 'dns', 'domain']) do @domain_format = { 'id' => String, 'name' => String, 'description' => String, 'ttl' => Integer, 'serial' => Integer, 'email' => String, 'created_at' => String } @server_format = { 'id' => String, 'name' => String, 'created_at' => String, 'updated_at' => String } tests('success') do @domain_name = 'www.fogtest.com.' @email = 'test@fogtest.com' tests("#create_domain(#{@domain_name}, #{@email})").formats(@domain_format) do data = HP[:dns].create_domain(@domain_name, @email).body @domain_id = data['id'] data end tests('#list_domains').formats({'domains' => [@domain_format]}) do HP[:dns].list_domains.body end tests("#get_domain(#{@domain_id})").formats(@domain_format) do HP[:dns].get_domain(@domain_id).body end tests("#get_servers_hosting_domain(#{@domain_id})").formats('servers' => [@server_format]) do HP[:dns].get_servers_hosting_domain(@domain_id).body end tests("#update_domain(#{@domain_id}, {:email => 'updated@fogtest.com'})").formats(@domain_format) do HP[:dns].update_domain(@domain_id, {:email => 'updated@fogtest.com'}).body end tests("#delete_domain(#{@domain_id})").succeeds do HP[:dns].delete_domain(@domain_id) end end tests('failure') do tests("#get_domain('invalid_domain')").raises(Fog::HP::DNS::NotFound) do HP[:dns].get_domain('invalid_domain') end tests("#get_servers_hosting_domain('invalid_domain')").raises(Fog::HP::DNS::NotFound) do HP[:dns].get_servers_hosting_domain('invalid_domain') end tests("#update_domain('invalid_domain', {:email => 'updated@fogtest.com'})").raises(Fog::HP::DNS::NotFound) do HP[:dns].update_domain('invalid_domain', {:email => 'updated@fogtest.com'}) end tests("#delete_domain('invalid_domain')").raises(Fog::HP::DNS::NotFound) do HP[:dns].delete_domain('invalid_domain') end end end fog-1.34.0/tests/hp/requests/dns/records_tests.rb0000644000004100000410000000421512600047642022025 0ustar www-datawww-dataShindo.tests("HP::DNS | record requests", ['hp', 'dns', 'record']) do @record_format = { 'id' => String, 'name' => String, 'description' => String, 'type' => String, 'domain_id' => String, 'ttl' => Integer, 'data' => String, 'priority' => Fog::Nullable::Integer, 'created_at' => String, 'updated_at' => String } tests('success') do @domain_name = 'www.fogtest.com.' @email = 'test@fogtest.com' @domain_id = HP[:dns].create_domain(@domain_name, @email).body['id'] @record_name = 'www.fogtest.com.' @record_data = '15.185.172.152' tests("#create_record(#{@domain_id}, #{@record_name}, 'A', #{@record_data})").formats(@record_format) do data = HP[:dns].create_record(@domain_id, @record_name, 'A', @record_data).body @record_id = data['id'] data end tests("#list_records_in_a_domain(#{@domain_id})").formats({'records' => [@record_format]}) do HP[:dns].list_records_in_a_domain(@domain_id).body end tests("#get_record(#{@domain_id}, #{@record_id})").formats(@record_format) do HP[:dns].get_record(@domain_id, @record_id).body end tests("#update_record(#{@domain_id}, #{@record_id}, {:description => 'desc for record'})").formats(@record_format) do HP[:dns].update_record(@domain_id, @record_id, {:description => 'desc for record'}).body end tests("#delete_record(#{@domain_id}, #{@record_id})").succeeds do HP[:dns].delete_record(@domain_id, @record_id) end HP[:dns].delete_domain(@domain_id) end tests('failure') do tests("#get_record(#{@domain_id}, 'invalid_record')").raises(Fog::HP::DNS::NotFound) do HP[:dns].get_record(@domain_id, 'invalid_record') end tests("#update_record(#{@domain_id}, 'invalid_record', {:email => 'updated@fogtest.com'})").raises(Fog::HP::DNS::NotFound) do HP[:dns].update_record(@domain_id, 'invalid_record', {:email => 'updated@fogtest.com'}) end tests("#delete_record(#{@domain_id}, 'invalid_record')").raises(Fog::HP::DNS::NotFound) do HP[:dns].delete_record(@domain_id, 'invalid_record') end end end fog-1.34.0/tests/hp/requests/compute_v2/0000755000004100000410000000000012600047642020112 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/compute_v2/availability_zone_tests.rb0000644000004100000410000000066712600047642025377 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | availability_zone requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @zone_format = { 'zoneName' => String, 'zoneState' => Hash, 'hosts' => nil } tests('success') do tests('#list_availability_zones').formats([@zone_format]) do service.list_availability_zones.body['availabilityZoneInfo'] end end end fog-1.34.0/tests/hp/requests/compute_v2/metadata_tests.rb0000644000004100000410000000745512600047642023454 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | metadata requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @metadata_format = { 'metadata' => Fog::Nullable::Hash } @metaitem_format = { 'meta' => Fog::Nullable::Hash } @base_image_id = ENV["BASE_IMAGE_ID"] || "7f60b54c-cd15-433f-8bed-00acbcd25a17" tests('success') do @server_name = 'fogmetadatatest' @server_id = nil # check to see if there are any existing servers, otherwise create one if (data = service.list_servers(:status => 'ACTIVE').body['servers'][0]) @server_id = data['id'] else #@server = service.servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id, :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'} ) #@server.wait_for { ready? } data = service.create_server(@server_name, 100, @base_image_id, {'metadata' => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'} }).body['server'] @server_id = data['id'] end tests("#list_metadata('servers', #{@server_id})").formats(@metadata_format) do metadata = service.list_metadata('servers', @server_id).body test ("metadata exists") do metadata['metadata']['Meta1'] == "MetaValue1" end metadata end tests("#set_metadata('servers', #{@server_id}, {'MetaNew3' => 'MetaNewValue3'})").formats(@metadata_format) do data = service.set_metadata('servers', @server_id, {'MetaNew3' => 'MetaNewValue3'}).body test ("metadata set correctly") do metadata = service.list_metadata('servers', @server_id).body metadata['metadata']['MetaNew3'] == "MetaNewValue3" end data end tests("#update_metadata('servers', #{@server_id}, {'MetaUpd4' => 'MetaUpdValue4'})").formats(@metadata_format) do data = service.update_metadata('servers', @server_id, {'MetaUpd4' => 'MetaUpdValue4'}).body test ("metadata updated correctly") do metadata = service.list_metadata('servers', @server_id).body metadata['metadata']['MetaUpd4'] == "MetaUpdValue4" end data end tests("#get_meta('servers', #{@server_id}, 'MetaNew3')").formats(@metaitem_format) do mitem = service.get_meta('servers', @server_id, 'MetaNew3').body test ("metadata item exists") do mitem['meta']['MetaNew3'] == "MetaNewValue3" end mitem end tests("#update_meta('servers', #{@server_id}, 'MetaNew3', 'MetaUpdValue3')").formats(@metaitem_format) do mitem = service.update_meta('servers', @server_id, 'MetaNew3', 'MetaUpdValue3').body test ("metadata item updated correctly") do mitem['meta']['MetaNew3'] == "MetaUpdValue3" end mitem end tests("#delete_meta('servers', #{@server_id}, 'MetaNew3')").succeeds do data = service.delete_meta('servers', @server_id, 'MetaNew3').body test ("metadata item deleted correctly") do metadata = service.list_metadata('servers', @server_id).body metadata['metadata'].fetch('MetaNew3', nil) == nil end data end service.delete_server(@server_id) end tests('failure') do tests("#update_metadata('servers', 0, {'MetaUpd4' => 'MetaUpdValue4'})").raises(Fog::Compute::HPV2::NotFound) do service.update_metadata('servers', 0, {'MetaUpd4' => 'MetaUpdValue4'}) end tests("#get_meta('servers', 0, 'MetaNew3')").raises(Fog::Compute::HPV2::NotFound) do service.get_meta('servers', 0, 'MetaNew3') end tests("#update_meta('servers', 0, 'MetaNew3', 'MetaUpdValue3')").raises(Fog::Compute::HPV2::NotFound) do service.update_meta('servers', 0, 'MetaNew3', 'MetaUpdValue3') end tests("#delete_meta('servers', 0, 'MetaNew3')").raises(Fog::Compute::HPV2::NotFound) do service.delete_meta('servers', 0, 'MetaNew3') end end end fog-1.34.0/tests/hp/requests/compute_v2/flavor_tests.rb0000644000004100000410000000203612600047642023153 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | flavor requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @flavor_format = { 'id' => String, 'name' => String, 'vcpus' => Integer, 'disk' => Integer, 'ram' => Integer, 'OS-FLV-EXT-DATA:ephemeral' => Integer, 'links' => [Hash] } @list_flavors_format = { 'id' => String, 'name' => String, 'links' => [Hash] } tests('success') do tests('#list_flavors').formats({'flavors' => [@list_flavors_format]}) do service.list_flavors.body end tests('#get_flavor_details("1")').formats(@flavor_format) do service.get_flavor_details("1").body['flavor'] end tests('#list_flavors_detail').formats({'flavors' => [@flavor_format]}) do service.list_flavors_detail.body end end tests('failure') do tests('#get_flavor_details("9999")').raises(Fog::Compute::HPV2::NotFound) do service.get_flavor_details('9999') end end end fog-1.34.0/tests/hp/requests/compute_v2/image_tests.rb0000644000004100000410000000475212600047642022753 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | image requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @image_format = { 'id' => String, 'links' => [Hash], 'metadata' => Fog::Nullable::Hash, 'server' => Fog::Nullable::Hash, 'name' => String, 'progress' => Fog::Nullable::Integer, 'minDisk' => Fog::Nullable::Integer, 'minRam' => Fog::Nullable::Integer, 'status' => String, 'created' => Fog::Nullable::String, 'updated' => Fog::Nullable::String } @list_images_format = { 'id' => String, 'links' => Fog::Nullable::Array, 'name' => String } @base_image_id = ENV["BASE_IMAGE_ID"] || "7f60b54c-cd15-433f-8bed-00acbcd25a17" tests('success') do @server_name = 'fogservertest' @image_name = 'fogimagetest' @image_id = nil @server_id = nil # check to see if there are any existing servers, otherwise create one if (data = service.list_servers(:status => 'ACTIVE').body['servers'][0]) @server_id = data['id'] else #@server = service.servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id) #@server.wait_for { ready? } data = service.create_server(@server_name, 100, @base_image_id).body['server'] @server_id = data['id'] end tests("#create_image(#{@server_id}, #{@image_name})").formats({}) do response = service.create_image(@server_id, @image_name) # no data is returned for the call, so get id off the header @image_id = response.headers["Location"].split("/")[5] {} end #unless Fog.mocking? # service.images.get(@image_id).wait_for { ready? } #end tests("#get_image_details(#{@image_id})").formats(@image_format) do service.get_image_details(@image_id).body['image'] end tests('#list_images').formats({'images' => [@list_images_format]}) do service.list_images.body end tests('#list_images_detail').formats({'images' => [@image_format]}) do service.list_images_detail.body end tests("#delete_image(#{@image_id})").succeeds do service.delete_image(@image_id) end service.delete_server(@server_id) end tests('failure') do tests('#delete_image("0")').raises(Fog::Compute::HPV2::NotFound) do service.delete_image('0') end tests('#get_image_details("0")').raises(Fog::Compute::HPV2::NotFound) do service.get_image_details('0') end end end fog-1.34.0/tests/hp/requests/compute_v2/server_tests.rb0000644000004100000410000000637612600047642023203 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | server requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @server_format = { 'addresses' => Fog::Nullable::Hash, 'flavor' => Hash, 'id' => String, 'image' => Hash, 'links' => [Hash], 'hostId' => String, 'metadata' => Fog::Nullable::Hash, 'name' => String, 'accessIPv4' => Fog::Nullable::String, 'accessIPv6' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'created' => String, 'updated' => String, 'user_id' => String, 'tenant_id' => String, 'config_drive' => Fog::Nullable::String, 'security_groups' => [Hash], 'key_name' => Fog::Nullable::String } @list_servers_format = { 'links' => [Hash], 'name' => String, 'id' => String } @get_console_output_format = { 'output' => String } @base_image_id = ENV["BASE_IMAGE_ID"] || "7f60b54c-cd15-433f-8bed-00acbcd25a17" tests('success') do @server_id = nil @server_name = 'fogservertests' tests("#create_server(#{@server_name}, 100, #{@base_image_id})").formats(@server_format.merge('adminPass' => String)) do data = service.create_server(@server_name, 100, @base_image_id).body['server'] @server_id = data['id'] data end tests("#get_server_details(#{@server_id})").formats(@server_format) do service.get_server_details(@server_id).body['server'] end tests('#list_servers').formats({'servers' => [@list_servers_format]}) do service.list_servers.body end tests('#list_servers_detail').formats({'servers' => [@server_format]}) do service.list_servers_detail.body end tests("#update_server(#{@server_id}, :name => 'fogupdateserver')").succeeds do service.update_server(@server_id, :name => 'fogupdateserver') end tests("#reboot_server(#{@server_id}, 'SOFT')").succeeds do pending unless Fog.mocking? service.reboot_server(@server_id, 'SOFT') end tests("#get_console_output('#{@server_id}', 10)").formats(@get_console_output_format) do service.get_console_output(@server_id, 10).body end #tests("#get_vnc_console('#{@server_id}', 'novnc')").succeeds do # service.get_console_output(@server_id, 'novnc') #end tests("#delete_server(#{@server_id})").succeeds do service.delete_server(@server_id) end end tests('failure') do tests('#delete_server(0)').raises(Fog::Compute::HPV2::NotFound) do service.delete_server(0) end tests('#get_server_details(0)').raises(Fog::Compute::HPV2::NotFound) do service.get_server_details(0) end tests("#update_server(0, :name => 'fognonserver')").raises(Fog::Compute::HPV2::NotFound) do service.update_server(0, :name => 'fognonserver') end tests('#reboot_server(0)').raises(Fog::Compute::HPV2::NotFound) do service.reboot_server(0) end tests('#get_console_output(0, 10)').raises(Fog::Compute::HPV2::NotFound) do service.get_console_output(0, 10).body end #tests("#get_vnc_console(0, 'novnc')").raises(Fog::Compute::HPV2::NotFound) do # service.get_console_output(0, 'novnc') #end end end fog-1.34.0/tests/hp/requests/compute_v2/server_security_group_tests.rb0000644000004100000410000000233012600047642026330 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | server security group requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' tests('success') do @server_name = 'fogsecgrouptests' @server_id = nil # create a server without a sec group data = service.create_server(@server_name, 100, @base_image_id).body['server'] @server_id = data['id'] # now add the 'default' sec group to the server tests("#add_security_group(#{@server_id}, 'default')").succeeds do service.add_security_group(@server_id, 'default') end # now remove the 'default' sec group to the server tests("#remove_security_group(#{@server_id}, 'default')").succeeds do service.remove_security_group(@server_id, 'default') end service.delete_server(@server_id) end tests('failure') do tests("#add_security_group(0, 'default')").raises(Fog::Compute::HPV2::NotFound) do service.add_security_group(0, 'default') end tests("#remove_security_group(0, 'default')").raises(Fog::Compute::HPV2::NotFound) do service.remove_security_group(0, 'default') end end end fog-1.34.0/tests/hp/requests/compute_v2/server_volume_tests.rb0000644000004100000410000000520212600047642024555 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | volume requests", ['hp', 'v2', 'compute', 'volumes']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @list_volume_attachments_format = { 'volumeAttachments' => [{ 'device' => String, 'serverId' => String, 'id' => String, 'volumeId' => String }] } @volume_attachment_format = { 'volumeAttachment' => { 'device' => String, 'serverId' => String, 'id' => String, 'volumeId' => String } } @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = service.servers.create(:name => 'fogservoltests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests('success') do response = HP[:block_storage_v2].create_volume('display_name' => 'fogvoltest', 'display_description' => 'fogvoltest desc', 'size' => 1) @volume_id = response.body['volume']['id'] @device = "\/dev\/sdf" tests("#attach_volume(#{@server.id}, #{@volume_id}, #{@device}").formats(@volume_attachment_format) do service.attach_volume(@server.id, @volume_id, @device).body end tests("#list_server_volumes(#{@server.id})").formats(@list_volume_attachments_format) do service.list_server_volumes(@server.id).body end tests("#get_server_volume_details(#{@server.id}, #{@volume_id})").formats(@volume_attachment_format) do service.get_server_volume_details(@server.id, @volume_id).body end tests("#detach_volume(#{@server.id}, #{@volume_id}").succeeds do service.detach_volume(@server.id, @volume_id) end end tests('failure') do tests('#list_server_volumes(0)').raises(Fog::Compute::HPV2::NotFound) do service.list_server_volumes(0) end tests('#get_server_volume_details(0, 0)').raises(Fog::Compute::HPV2::NotFound) do service.get_server_volume_details(0, 0) end tests("#attach_volume(#{@server.id}, 0, #{@device})").raises(Fog::Compute::HPV2::NotFound) do pending if Fog.mocking? service.attach_volume(@server.id, 0, @device) end tests("#attach_volume(0, #{@volume_id}, #{@device})").raises(Fog::Compute::HPV2::NotFound) do service.attach_volume(0, @volume_id, @device) end tests("#detach_volume(#{@server.id}, 0)").raises(Fog::Compute::HPV2::NotFound) do pending if Fog.mocking? service.detach_volume(@server.id, 0) end tests("#detach_volume(0, #{@volume_id})").raises(Fog::Compute::HPV2::NotFound) do service.detach_volume(0, @volume_id) end end HP[:block_storage_v2].delete_volume(@volume_id) service.delete_server(@server.id) end fog-1.34.0/tests/hp/requests/compute_v2/persistent_server_tests.rb0000644000004100000410000000420412600047642025447 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | persistent server requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @server_format = { 'addresses' => Fog::Nullable::Hash, 'flavor' => Hash, 'id' => String, 'links' => [Hash], 'hostId' => String, 'metadata' => Fog::Nullable::Hash, 'name' => String, 'accessIPv4' => Fog::Nullable::String, 'accessIPv6' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'created' => String, 'updated' => String, 'user_id' => String, 'tenant_id' => String, 'config_drive' => Fog::Nullable::String, 'security_groups' => [Hash], 'key_name' => Fog::Nullable::String } @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvoltests', :description => 'fog vol test desc', :size => 1) @volume.wait_for { ready? } tests('success') do @server_id = nil @server_name = 'fogpersservertests' @block_device_mapping = [{ 'volume_size' => '', 'volume_id' => "#{@volume.id}", 'delete_on_termination' => '0', 'device_name' => 'vda' }] tests("#create_persistent_server(#{@server_name}, 101, #{@block_device_mapping})").formats(@server_format.merge('adminPass' => String)) do data = service.create_persistent_server(@server_name, 101, @block_device_mapping).body['server'] @server_id = data['id'] data end service.servers.get(@server_id).wait_for { ready? } tests("#get_server_details(#{@server_id})").formats(@server_format) do service.get_server_details(@server_id).body['server'] end tests("#delete_server(#{@server_id})").succeeds do service.delete_server(@server_id) end end tests('failure') do tests("#create_persistent_server(#{@server_name}, 101, nil)").raises(Excon::Errors::BadRequest) do service.create_persistent_server(@server_name, 101, nil) end end HP[:block_storage_v2].delete_volume(@volume.id) end fog-1.34.0/tests/hp/requests/compute_v2/key_pair_tests.rb0000644000004100000410000000456412600047642023475 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | key pair requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) tests('success') do @keypair_format = { 'public_key' => String, 'fingerprint' => String, 'name' => String } @keypairs_format = { 'keypairs' => [{ 'keypair' => { 'public_key' => String, 'fingerprint' => String, 'name' => Fog::Nullable::String } }] } @key_pair_name = 'fog_create_key_pair' @public_key_material = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1SL+kgze8tvSFW6Tyj3RyZc9iFVQDiCKzjgwn2tS7hyWxaiDhjfY2mBYSZwFdKN+ZdsXDJL4CPutUg4DKoQneVgIC1zuXrlpPbaT0Btu2aFd4qNfJ85PBrOtw2GrWZ1kcIgzZ1mMbQt6i1vhsySD2FEj+5kGHouNxQpI5dFR5K+nGgcTLFGnzb/MPRBk136GVnuuYfJ2I4va/chstThoP8UwnoapRHcBpwTIfbmmL91BsRVqjXZEUT73nxpxFeXXidYwhHio+5dXwE0aM/783B/3cPG6FVoxrBvjoNpQpAcEyjtRh9lpwHZtSEW47WNzpIW3PhbQ8j4MryznqF1Rhw==' tests("#create_key_pair('#{@key_pair_name}')").formats({'keypair' => @keypair_format.merge({'private_key' => String, 'user_id' => String})}) do body = service.create_key_pair(@key_pair_name).body tests("private_key").returns(OpenSSL::PKey::RSA, "is a valid private RSA key") do OpenSSL::PKey::RSA.new(body['keypair']['private_key']).class end body end tests('#list_key_pairs').formats(@keypairs_format) do service.list_key_pairs.body end tests("#get_key_pair(#{@key_pair_name})").formats({'keypair' => @keypair_format}) do service.get_key_pair(@key_pair_name).body end tests("#delete_key_pair('#{@key_pair_name}')").succeeds do service.delete_key_pair(@key_pair_name) end tests("#create_key_pair('fog_import_key_pair', '#{@public_key_material}')").formats({'keypair' => @keypair_format.merge({'user_id' => String})}) do service.create_key_pair('fog_import_key_pair', @public_key_material).body end tests("#delete_key_pair('fog_import_key_pair)").succeeds do service.delete_key_pair('fog_import_key_pair') end end tests('failure') do tests("#get_key_pair('not_a_key_name')").raises(Fog::Compute::HPV2::NotFound) do service.get_key_pair('not_a_key_name') end tests("#delete_key_pair('not_a_key_name')").raises(Fog::Compute::HPV2::NotFound) do service.delete_key_pair('not_a_key_name') end end end fog-1.34.0/tests/hp/requests/compute_v2/server_address_tests.rb0000644000004100000410000000310012600047642024666 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | server address requests", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' tests('success') do @server_name = 'fogaddresstests' @server_id = nil # check to see if there are any existing servers, otherwise create one if (data = service.list_servers(:status => 'ACTIVE').body['servers'][0]) @server_id = data['id'] else #@server = service.servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id) #@server.wait_for { ready? } data = service.create_server(@server_name, 100, @base_image_id).body['server'] @server_id = data['id'] end # the network name is currently named 'private' tests("#list_server_addresses(#{@server_id})").formats({'addresses' => {'hpcloud' => [{'version' => Integer, 'addr' => String}]}}) do service.list_server_addresses(@server_id).body end tests("#list_server_addresses_by_network(#{@server_id}, 'network_name')").succeeds do service.list_server_addresses_by_network(@server_id, 'network_name').body end service.delete_server(@server_id) end tests('failure') do tests('#list_server_addresses(0)').raises(Fog::Compute::HPV2::NotFound) do service.list_server_addresses(0) end tests("#list_server_addresses_by_network(0, 'network_name')").raises(Fog::Compute::HPV2::NotFound) do service.list_server_addresses_by_network(0, 'network_name') end end end fog-1.34.0/tests/hp/requests/compute_v2/address_tests.rb0000644000004100000410000000503412600047642023310 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | address requests", ['hp', 'v2', 'compute', 'address']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @floating_ips_format = { 'instance_id' => Fog::Nullable::String, 'ip' => Fog::Nullable::String, 'fixed_ip' => Fog::Nullable::String, 'id' => String } @base_image_id = ENV["BASE_IMAGE_ID"] || "7f60b54c-cd15-433f-8bed-00acbcd25a17" tests('success') do @server_name = 'fogservertest' @server_id = nil @server = service.servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } #data = service.create_server(@server_name, 100, @base_image_id).body['server'] #@server_id = data['id'] tests("#list_addresses").formats({'floating_ips' => [@floating_ips_format]}) do service.list_addresses.body end tests("#allocate_address").formats(@floating_ips_format) do data = service.allocate_address.body['floating_ip'] @address_id = data['id'] @ip_address = data['ip'] data end tests("#get_address('#{@address_id}')").formats(@floating_ips_format) do service.get_address(@address_id).body['floating_ip'] end tests("#associate_address('#{@server.id}', '#{@ip_address}')").succeeds do service.associate_address(@server.id, @ip_address) #tests("#get_address").returns(@ip_address, "server has associated ip address") do # @server.reload # @server.addresses['custom'][0]['addr'] #end end #tests("#disassociate_address('#{@server.id}', '#{@ip_address}')").succeeds do # service.disassociate_address(@server.id, @ip_address) #end tests("#release_address('#{@address_id}')").succeeds do service.release_address(@address_id) end @server.destroy #service.delete_server(@server_id) end tests('failure') do tests("#get_address('invalidaddress', 'invalidip')").raises(Fog::Compute::HPV2::NotFound) do service.get_address('invalidaddress') end tests("#associate_address('invalidserver', 'invalidip')").raises(Excon::Errors::InternalServerError) do service.associate_address('invalidserver', 'invalidip') end tests("#disassociate_address('invalidserver', 'invalidip')").raises(Excon::Errors::InternalServerError) do service.disassociate_address('invalidserver', 'invalidip') end tests("#release_address('invalidaddress')").raises(Fog::Compute::HPV2::NotFound) do service.release_address('invalidaddress') end end end fog-1.34.0/tests/hp/requests/cdn/0000755000004100000410000000000012600047642016573 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/cdn/container_tests.rb0000644000004100000410000000322212600047642022323 0ustar www-datawww-dataShindo.tests("Fog::CDN[:hp] | container requests", ['hp']) do @cdn_containers_format = [{ 'x-cdn-ssl-uri' => String, 'cdn_enabled' => Fog::Boolean, 'name' => String, 'x-cdn-uri' => String, 'ttl' => Integer, 'log_retention' => Fog::Boolean }] tests('success') do tests("#put_container('fogcdncontainertests')").succeeds do Fog::CDN[:hp].put_container('fogcdncontainertests') end tests("duplicate #put_container('fogcdncontainertests')").succeeds do Fog::CDN[:hp].put_container('fogcdncontainertests') end tests("#get_containers").formats(@cdn_containers_format) do Fog::CDN[:hp].get_containers.body end tests("#post_container('fogcdncontainertests', {'x-ttl' => 3200})").succeeds do Fog::CDN[:hp].post_container('fogcdncontainertests', {'x-ttl' => 3200}) end tests("#head_container('fogcdncontainertests')").succeeds do Fog::CDN[:hp].head_container('fogcdncontainertests') end tests("#delete_container('fogcdncontainertests')").succeeds do Fog::CDN[:hp].delete_container('fogcdncontainertests') end end tests('failure') do tests("#post_container('fognoncdncontainer', {'x-ttl' => 3200})").raises(Fog::CDN::HP::NotFound) do Fog::CDN[:hp].post_container('fogcdnnoncontainer', {'x-ttl' => 3200}) end tests("#head_container('fognoncdncontainer')").raises(Fog::CDN::HP::NotFound) do Fog::CDN[:hp].head_container('fognoncdncontainer') end tests("#delete_container('fognoncdncontainer')").raises(Fog::CDN::HP::NotFound) do Fog::CDN[:hp].delete_container('fognoncdncontainer') end end end fog-1.34.0/tests/hp/requests/compute/0000755000004100000410000000000012600047642017503 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/compute/security_group_tests.rb0000644000004100000410000000370712600047642024344 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | security group requests", ['hp']) do @security_groups_format = { 'security_groups' => [{ 'rules' => [Fog::Nullable::Hash], 'tenant_id' => String, 'id' => Integer, 'name' => String, 'description' => String }] } @security_group_format = { 'rules' => [Fog::Nullable::Hash], 'tenant_id' => String, 'id' => Integer, 'name' => String, 'description' => String } tests('success') do tests("#create_security_group('fog_security_group', 'tests group')").formats({'security_group' => @security_group_format}) do data = Fog::Compute[:hp].create_security_group('fog_security_group', 'tests group').body @sec_group_id = data['security_group']['id'] data end tests("#get_security_group('#{@sec_group_id}')").formats({'security_group' => @security_group_format}) do Fog::Compute[:hp].get_security_group(@sec_group_id).body end tests("#list_security_groups").formats(@security_groups_format) do Fog::Compute[:hp].list_security_groups.body end tests("#delete_security_group('#{@sec_group_id}')").succeeds do Fog::Compute[:hp].delete_security_group(@sec_group_id).body end end tests('failure') do @security_group = Fog::Compute[:hp].security_groups.create(:name => 'fog_security_group_fail', :description => 'tests group') tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Excon::Errors::BadRequest) do Fog::Compute[:hp].create_security_group(@security_group.name, @security_group.description) end tests("#get_security_group(0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].get_security_group(0) end tests("#delete_security_group(0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].delete_security_group(0) end @security_group.destroy end end fog-1.34.0/tests/hp/requests/compute/metadata_tests.rb0000644000004100000410000000523612600047642023040 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | metadata requests", ['hp']) do @metadata_format = { 'metadata' => Fog::Nullable::Hash } @metaitem_format = { 'meta' => Fog::Nullable::Hash } @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests('success') do @server_name = "fogmetadatatest" @server = Fog::Compute[:hp].servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id, :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'} ) @server.wait_for { ready? } tests("#list_metadata('servers', #{@server.id})").formats(@metadata_format) do metadata = Fog::Compute[:hp].list_metadata('servers', @server.id).body test ("metadata exists") do metadata['metadata']['Meta1'] == "MetaValue1" end metadata end tests("#set_metadata('servers', #{@server.id}, {'MetaNew3' => 'MetaNewValue3'})").formats(@metadata_format) do data = Fog::Compute[:hp].set_metadata('servers', @server.id, {'MetaNew3' => 'MetaNewValue3'}).body test ("metadata set correctly") do metadata = Fog::Compute[:hp].list_metadata('servers', @server.id).body metadata['metadata']['MetaNew3'] == "MetaNewValue3" end data end tests("#update_metadata('servers', #{@server.id}, {'MetaUpd4' => 'MetaUpdValue4'})").formats(@metadata_format) do data = Fog::Compute[:hp].update_metadata('servers', @server.id, {'MetaUpd4' => 'MetaUpdValue4'}).body test ("metadata updated correctly") do metadata = Fog::Compute[:hp].list_metadata('servers', @server.id).body metadata['metadata']['MetaUpd4'] == "MetaUpdValue4" end data end tests("#get_meta('servers', #{@server.id}, 'MetaNew3')").formats(@metaitem_format) do mitem = Fog::Compute[:hp].get_meta('servers', @server.id, 'MetaNew3').body test ("metadata item exists") do mitem['meta']['MetaNew3'] == "MetaNewValue3" end mitem end tests("#update_meta('servers', #{@server.id}, 'MetaNew3', 'MetaUpdValue3')").formats(@metaitem_format) do mitem = Fog::Compute[:hp].update_meta('servers', @server.id, 'MetaNew3', 'MetaUpdValue3').body test ("metadata item updated correctly") do mitem['meta']['MetaNew3'] == "MetaUpdValue3" end mitem end tests("#delete_meta('servers', #{@server.id}, 'MetaNew3')").succeeds do data = Fog::Compute[:hp].delete_meta('servers', @server.id, 'MetaNew3').body test ("metadata item deleted correctly") do metadata = Fog::Compute[:hp].list_metadata('servers', @server.id).body metadata['metadata'].fetch('MetaNew3', nil) == nil end data end @server.destroy end end fog-1.34.0/tests/hp/requests/compute/flavor_tests.rb0000644000004100000410000000202512600047642022542 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | flavor requests", ['hp']) do @flavor_format = { 'rxtx_quota' => Integer, 'rxtx_cap' => Integer, 'vcpus' => Integer, 'swap' => Integer, 'disk' => Integer, 'ram' => Integer, 'id' => Integer, 'links' => [Hash], 'name' => String } @list_flavors_format = { 'id' => Integer, 'name' => String, 'links' => [Hash] } tests('success') do tests('#list_flavors').formats({'flavors' => [@list_flavors_format]}) do Fog::Compute[:hp].list_flavors.body end tests('#get_flavor_details(1)').formats(@flavor_format) do Fog::Compute[:hp].get_flavor_details(1).body['flavor'] end tests('#list_flavors_detail').formats({'flavors' => [@flavor_format]}) do Fog::Compute[:hp].list_flavors_detail.body end end tests('failure') do tests('#get_flavor_details(9999)').raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].get_flavor_details(9999) end end end fog-1.34.0/tests/hp/requests/compute/image_tests.rb0000644000004100000410000000425012600047642022335 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | image requests", ['hp']) do @image_format = { 'id' => String, 'links' => [Hash], 'metadata' => Fog::Nullable::Hash, 'server' => Fog::Nullable::Hash, 'name' => String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'created' => Fog::Nullable::String, 'updated' => Fog::Nullable::String } @list_images_format = { 'id' => String, 'links' => Fog::Nullable::Array, 'name' => String } @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests('success') do @server_name = "fogservertest" @image_name = "fogimagetest" @server = Fog::Compute[:hp].servers.create(:name => @server_name, :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } @image_id = nil tests("#create_image(#{@server.id}, #{@image_name})").formats({}) do response = Fog::Compute[:hp].create_image(@server.id, @image_name) # no data is returned for the call, so get id off the header @image_id = response.headers["Location"].split("/")[5] {} end unless Fog.mocking? Fog::Compute[:hp].images.get(@image_id).wait_for { ready? } end tests("#get_image_details(#{@image_id})").formats(@image_format) do pending if Fog.mocking? Fog::Compute[:hp].get_image_details(@image_id).body['image'] end tests('#list_images').formats({'images' => [@list_images_format]}) do Fog::Compute[:hp].list_images.body end tests('#list_images_detail').formats({'images' => [@image_format]}) do Fog::Compute[:hp].list_images_detail.body end unless Fog.mocking? Fog::Compute[:hp].images.get(@image_id).wait_for { ready? } end tests("#delete_image(#{@image_id})").succeeds do pending if Fog.mocking? Fog::Compute[:hp].delete_image(@image_id) end @server.destroy end tests('failure') do tests('#delete_image(0)').raises(Excon::Errors::InternalServerError) do Fog::Compute[:hp].delete_image(0) end tests('#get_image_details(0)').raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].get_image_details(0) end end end fog-1.34.0/tests/hp/requests/compute/server_tests.rb0000644000004100000410000000746112600047642022570 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | server requests", ['hp']) do @server_format = { 'addresses' => Fog::Nullable::Hash, 'flavor' => Hash, 'id' => Integer, 'image' => Hash, 'links' => [Hash], 'hostId' => String, 'metadata' => Fog::Nullable::Hash, 'name' => String, 'accessIPv4' => Fog::Nullable::String, 'accessIPv6' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'created' => String, 'updated' => String, 'user_id' => String, 'tenant_id' => String, 'uuid' => String, 'config_drive' => Fog::Nullable::String, 'security_groups' => [Hash], 'key_name' => Fog::Nullable::String } @list_servers_format = { 'uuid' => Fog::Nullable::String, 'links' => [Hash], 'name' => String, 'id' => Integer } @get_console_output_format = { 'output' => String } @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests('success') do @server_id = nil @server_name = "fogservertests" tests("#create_server(#{@server_name}, 100, #{@base_image_id})").formats(@server_format.merge('adminPass' => String)) do data = Fog::Compute[:hp].create_server(@server_name, 100, @base_image_id).body['server'] @server_id = data['id'] data end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#get_server_details(#{@server_id})").formats(@server_format) do Fog::Compute[:hp].get_server_details(@server_id).body['server'] end tests('#list_servers').formats({'servers' => [@list_servers_format]}) do Fog::Compute[:hp].list_servers.body end tests('#list_servers_detail').formats({'servers' => [@server_format]}) do Fog::Compute[:hp].list_servers_detail.body end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#update_server(#{@server_id}, :name => 'fogupdateserver')").succeeds do Fog::Compute[:hp].update_server(@server_id, :name => 'fogupdateserver') end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#reboot_server(#{@server_id}, 'SOFT')").succeeds do Fog::Compute[:hp].reboot_server(@server_id, 'SOFT') end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#reboot_server(#{@server_id}, 'HARD')").succeeds do Fog::Compute[:hp].reboot_server(@server_id, 'HARD') end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#change_password_server(#{@server_id}, 'new_password')").succeeds do Fog::Compute[:hp].change_password_server(@server_id, 'new_password') end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#get_console_output('#{@server_id}', 10)").formats(@get_console_output_format) do Fog::Compute[:hp].get_console_output(@server_id, 10).body end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#delete_server(#{@server_id})").succeeds do Fog::Compute[:hp].delete_server(@server_id) end end tests('failure') do tests('#delete_server(0)').raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].delete_server(0) end tests('#get_server_details(0)').raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].get_server_details(0) end tests("#update_server(0, :name => 'fognonserver')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].update_server(0, :name => 'fognonserver') end tests('#reboot_server(0)').raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].reboot_server(0) end tests("#change_password_server(0}, 'new_password')").raises(Excon::Errors::InternalServerError) do Fog::Compute[:hp].change_password_server(0, 'new_password') end end end fog-1.34.0/tests/hp/requests/compute/server_volume_tests.rb0000644000004100000410000000463212600047642024154 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | volume requests", ['hp', 'compute', 'volumes']) do @list_volume_attachments_format = { 'volumeAttachments' => [{ 'device' => String, 'serverId' => Integer, 'id' => Integer, 'volumeId' => Integer }] } @volume_attachment_format = { 'volumeAttachment' => { "volumeId" => Integer, "id" => Integer } } @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 @server = Fog::Compute[:hp].servers.create(:name => 'fogservoltests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests('success') do response = HP[:block_storage].create_volume('fogvoltest', 'fogvoltest desc', 1) @volume_id = response.body['volume']['id'] @device = "\/dev\/sdf" HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#attach_volume(#{@server.id}, #{@volume_id}, #{@device}").formats(@volume_attachment_format) do Fog::Compute[:hp].attach_volume(@server.id, @volume_id, @device).body end HP[:block_storage].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? tests("#detach_volume(#{@server.id}, #{@volume_id}").succeeds do Fog::Compute[:hp].detach_volume(@server.id, @volume_id) end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#list_server_volumes(#{@server.id})").formats(@list_volume_attachments_format) do Fog::Compute[:hp].list_server_volumes(@server.id).body end end tests('failure') do tests("#list_server_volumes(0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].list_server_volumes(0) end tests("#attach_volume(#{@server.id}, 0, #{@device})").raises(Fog::Compute::HP::NotFound) do pending if Fog.mocking? Fog::Compute[:hp].attach_volume(@server.id, 0, @device) end tests("#attach_volume(0, #{@volume_id}, #{@device})").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].attach_volume(0, @volume_id, @device) end tests("#detach_volume(#{@server.id}, 0)").raises(Fog::Compute::HP::NotFound) do pending if Fog.mocking? Fog::Compute[:hp].detach_volume(@server.id, 0) end tests("#detach_volume(0, #{@volume_id})").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].detach_volume(0, @volume_id) end end HP[:block_storage].delete_volume(@volume_id) Fog::Compute[:hp].delete_server(@server.id) end fog-1.34.0/tests/hp/requests/compute/persistent_server_tests.rb0000644000004100000410000000420512600047642025041 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | persistent server requests", ['hp', 'compute']) do @server_format = { 'addresses' => Fog::Nullable::Hash, 'flavor' => Hash, 'id' => Integer, 'links' => [Hash], 'hostId' => String, 'metadata' => Fog::Nullable::Hash, 'name' => String, 'accessIPv4' => Fog::Nullable::String, 'accessIPv6' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'status' => String, 'created' => String, 'updated' => String, 'user_id' => String, 'tenant_id' => String, 'uuid' => String, 'config_drive' => Fog::Nullable::String, 'security_groups' => [Hash], 'key_name' => Fog::Nullable::String } @volume = HP[:block_storage].volumes.create(:name => 'fogvoltests', :description => 'fog vol test desc', :size => 1) @volume.wait_for { ready? } tests('success') do @server_id = nil @server_name = "fogpersservertests" @block_device_mapping = [{ 'volume_size' => '', 'volume_id' => "#{@volume.id}", 'delete_on_termination' => '0', 'device_name' => 'vda' }] tests("#create_persistent_server(#{@server_name}, 100, #{@block_device_mapping})").formats(@server_format.merge('adminPass' => String)) do data = Fog::Compute[:hp].create_persistent_server(@server_name, 100, @block_device_mapping).body['server'] @server_id = data['id'] data end Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? } tests("#get_server_details(#{@server_id})").formats(@server_format) do Fog::Compute[:hp].get_server_details(@server_id).body['server'] end tests("#delete_server(#{@server_id})").succeeds do Fog::Compute[:hp].delete_server(@server_id) end end tests('failure') do tests("#create_persistent_server(#{@server_name}, 100, nil)").raises(Excon::Errors::BadRequest) do Fog::Compute[:hp].create_persistent_server(@server_name, 100, nil) end end HP[:block_storage].delete_volume(@volume.id) end fog-1.34.0/tests/hp/requests/compute/key_pair_tests.rb0000644000004100000410000000450512600047642023061 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | key pair requests", ['hp']) do tests('success') do @keypair_format = { 'public_key' => String, 'fingerprint' => String, 'name' => String } @keypairs_format = { 'keypairs' => [{ 'keypair' => { 'public_key' => String, 'fingerprint' => String, 'name' => Fog::Nullable::String } }] } @key_pair_name = 'fog_create_key_pair' @public_key_material = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1SL+kgze8tvSFW6Tyj3RyZc9iFVQDiCKzjgwn2tS7hyWxaiDhjfY2mBYSZwFdKN+ZdsXDJL4CPutUg4DKoQneVgIC1zuXrlpPbaT0Btu2aFd4qNfJ85PBrOtw2GrWZ1kcIgzZ1mMbQt6i1vhsySD2FEj+5kGHouNxQpI5dFR5K+nGgcTLFGnzb/MPRBk136GVnuuYfJ2I4va/chstThoP8UwnoapRHcBpwTIfbmmL91BsRVqjXZEUT73nxpxFeXXidYwhHio+5dXwE0aM/783B/3cPG6FVoxrBvjoNpQpAcEyjtRh9lpwHZtSEW47WNzpIW3PhbQ8j4MryznqF1Rhw==' tests("#create_key_pair('#{@key_pair_name}')").formats({'keypair' => @keypair_format.merge({'private_key' => String, 'user_id' => String})}) do body = Fog::Compute[:hp].create_key_pair(@key_pair_name).body tests("private_key").returns(OpenSSL::PKey::RSA, "is a valid private RSA key") do OpenSSL::PKey::RSA.new(body['keypair']['private_key']).class end body end tests('#list_key_pairs').formats(@keypairs_format) do Fog::Compute[:hp].list_key_pairs.body end tests("#delete_key_pair('#{@key_pair_name}')").succeeds do Fog::Compute[:hp].delete_key_pair(@key_pair_name) end tests("#create_key_pair('fog_import_key_pair', '#{@public_key_material}')").formats({'keypair' => @keypair_format.merge({'user_id' => String})}) do Fog::Compute[:hp].create_key_pair('fog_import_key_pair', @public_key_material).body end tests("#delete_key_pair('fog_import_key_pair)").succeeds do Fog::Compute[:hp].delete_key_pair('fog_import_key_pair') end end tests('failure') do tests("#delete_key_pair('not_a_key_name')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].delete_key_pair('not_a_key_name') end @key_pair = Fog::Compute[:hp].key_pairs.create(:name => 'fog_key_pair') tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Excon::Errors::BadRequest) do Fog::Compute[:hp].create_key_pair(@key_pair.name) end @key_pair.destroy end end fog-1.34.0/tests/hp/requests/compute/server_address_tests.rb0000644000004100000410000000316712600047642024274 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | address requests", ['hp']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests('success') do @server = Fog::Compute[:hp].servers.create(:name => 'fogaddresstests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } @address = Fog::Compute[:hp].addresses.create @address.server = @server # the network name is currently named 'private' tests("#list_server_addresses(#{@server.id})").formats({'addresses' => {"private" => [{'version' => Integer, 'addr' => String}]}}) do Fog::Compute[:hp].list_server_addresses(@server.id).body end tests("#list_server_private_addresses(#{@server.id}, 'private')").formats({'private' => [{'version' => Integer, 'addr' => String}]}) do Fog::Compute[:hp].list_server_private_addresses(@server.id, 'private').body end tests("#list_server_public_addresses(#{@server.id}, 'private')").formats({'public' => [{'version' => Integer, 'addr' => String}]}) do Fog::Compute[:hp].list_server_public_addresses(@server.id, 'private').body end @address.destroy @server.destroy end tests('failure') do tests("#list_server_addresses(0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].list_server_addresses(0) end tests("#list_server_private_addresses(0, 'private')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].list_server_private_addresses(0, 'private') end tests("#list_server_public_addresses(0, 'private')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].list_server_public_addresses(0, 'private') end end end fog-1.34.0/tests/hp/requests/compute/address_tests.rb0000644000004100000410000000450012600047642022676 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | address requests", ['hp', 'address']) do @floating_ips_format = { 'instance_id' => Fog::Nullable::Integer, 'ip' => Fog::Nullable::String, 'fixed_ip' => Fog::Nullable::String, 'id' => Integer } @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests('success') do tests("#list_addresses").formats({'floating_ips' => [@floating_ips_format]}) do Fog::Compute[:hp].list_addresses.body end tests("#allocate_address").formats(@floating_ips_format) do data = Fog::Compute[:hp].allocate_address.body['floating_ip'] @address_id = data['id'] @ip_address = data['ip'] data end tests("#get_address('#{@address_id}')").formats(@floating_ips_format) do Fog::Compute[:hp].get_address(@address_id).body['floating_ip'] end @server = Fog::Compute[:hp].servers.create(:name => 'fogaddresstests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests("#associate_address('#{@server.id}', '#{@ip_address}')").succeeds do Fog::Compute[:hp].associate_address(@server.id, @ip_address) tests("#get_address").returns(@ip_address, "server has associated ip address") do @server.reload @server.addresses['private'][1]['addr'] end end tests("#disassociate_address('#{@server.id}', '#{@ip_address}')").succeeds do Fog::Compute[:hp].disassociate_address(@server.id, @ip_address) end @server.destroy tests("#release_address('#{@address_id}')").succeeds do Fog::Compute[:hp].release_address(@address_id) end end tests('failure') do tests("#get_address('invalidaddress', 'invalidip')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].get_address('invalidaddress') end tests("#associate_address('invalidserver', 'invalidip')").raises(Excon::Errors::InternalServerError) do Fog::Compute[:hp].associate_address('invalidserver', 'invalidip') end tests("#disassociate_address('invalidserver', 'invalidip')").raises(Excon::Errors::InternalServerError) do Fog::Compute[:hp].disassociate_address('invalidserver', 'invalidip') end tests("#release_address('invalidaddress')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].release_address('invalidaddress') end end end fog-1.34.0/tests/hp/requests/compute/security_group_rule_tests.rb0000644000004100000410000000377012600047642025373 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | security group requests", ['hp']) do @security_group_rule_format = { 'from_port' => Integer, 'group' => Fog::Nullable::Hash, 'ip_protocol' => String, 'to_port' => Integer, 'parent_group_id' => Integer, 'ip_range' => { 'cidr' => String }, 'id' => Integer } tests('success') do @security_group = Fog::Compute[:hp].security_groups.create(:name => 'fog_security_group', :description => 'tests group') tests("tcp #create_security_group_rule('#{@security_group.id}', 'tcp', '80', '80', '0.0.0.0/0'}')").formats({'security_group_rule' => @security_group_rule_format}) do data = Fog::Compute[:hp].create_security_group_rule(@security_group.id, 'tcp', '80', '80', '0.0.0.0/0').body @sec_group_rule_id_1 = data['security_group_rule']['id'] data end tests("icmp #create_security_group_rule('#{@security_group.id}', 'icmp', '-1', '-1', '0.0.0.0/0'}')").formats({'security_group_rule' => @security_group_rule_format}) do data = Fog::Compute[:hp].create_security_group_rule(@security_group.id, 'icmp', '-1', '-1', '0.0.0.0/0').body @sec_group_rule_id_2 = data['security_group_rule']['id'] data end tests("tcp #delete_security_group_rule('#{@sec_group_rule_id_1}')").succeeds do Fog::Compute[:hp].delete_security_group_rule(@sec_group_rule_id_1).body end tests("icmp #delete_security_group_rule('#{@sec_group_rule_id_2}')").succeeds do Fog::Compute[:hp].delete_security_group_rule(@sec_group_rule_id_2).body end @security_group.destroy end tests('failure') do tests("#create_security_group_rule(0, 'tcp', '80', '80', '0.0.0.0/0'}')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].create_security_group_rule(0, 'tcp', '80', '80', '0.0.0.0/0') end tests("#delete_security_group_rule(0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].delete_security_group_rule(0) end end end fog-1.34.0/tests/hp/requests/lb/0000755000004100000410000000000012600047642016424 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/lb/versions_tests.rb0000644000004100000410000000054312600047642022045 0ustar www-datawww-dataShindo.tests("HP::LB | versions requests", ['hp', 'lb', 'versions']) do @version_format = { 'id' => String, 'links' => [Hash], 'status' => String, 'updated' => String } tests('success') do tests('#list_versions').formats({'versions' => [@version_format]}) do HP[:lb].list_versions.body end end end fog-1.34.0/tests/hp/requests/lb/virtual_ips_tests.rb0000644000004100000410000000177412600047642022545 0ustar www-datawww-dataShindo.tests("HP::LB | virtual ips requests", ['hp', 'lb', 'virtual_ips']) do @virtual_ips_format = { 'id' => String, 'address' => String, 'type' => String, 'ipVersion' => String } tests('success') do @nodes = [{'address' => '15.185.1.1', 'port' => '80'}] @virtual_ip = [{ 'ipVersion' => 'IPV4', 'type' => 'PUBLIC', 'id' => '11111111', 'address' => '15.185.3.3' }] data = HP[:lb].create_load_balancer('rg-fog-lb3', @nodes, {'virtualIps' => @virtual_ip}).body @lb_id = data['id'] tests('#list_load_balancer_virtual_ips').formats({'virtualIps' => [@virtual_ips_format]}) do HP[:lb].list_load_balancer_virtual_ips(@lb_id).body end HP[:lb].delete_load_balancer(@lb_id) end tests('failure') do tests('#list_load_balancer_virtual_ips(0)').raises(Fog::HP::LB::NotFound) do HP[:lb].list_load_balancer_virtual_ips('0') end end end fog-1.34.0/tests/hp/requests/lb/algorithms_tests.rb0000644000004100000410000000041112600047642022340 0ustar www-datawww-dataShindo.tests("HP::LB | algorithms", ['hp', 'lb', 'algorithms']) do @algo_format = { 'name' => String } tests('success') do tests('#list_algorithms').formats({'algorithms' => [@algo_format]}) do HP[:lb].list_algorithms.body end end end fog-1.34.0/tests/hp/requests/lb/load_balancer_nodes_tests.rb0000644000004100000410000000271012600047642024131 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer nodes', ['hp', 'lb', 'nodes']) do @node_format = { 'id' => String, 'address' => String, 'port' => String, 'condition' => String, 'status' => String } tests('successs') do data = HP[:lb].create_load_balancer('rg-fog-lb2', [{'address' => '15.185.1.1', 'port' => '80'}]).body @lb_id = data['id'] tests("#create_load_balancer_node(#{@lb_id}, '15.185.2.2', '88')").formats({'nodes' => [@node_format]}) do data = HP[:lb].create_load_balancer_node(@lb_id, '15.185.2.2', '88').body @lb_node_id = data['nodes'][0]['id'] data end tests("#list_load_balancer_nodes(#{@lb_id})").formats({'nodes' => [@node_format]}) do HP[:lb].list_load_balancer_nodes(@lb_id).body end tests("#get_load_balancer_node(#{@lb_id}, #{@lb_node_id})").formats(@node_format) do HP[:lb].get_load_balancer_node(@lb_id, @lb_node_id).body end tests("#update_load_balancer_node(#{@lb_id}, #{@lb_node_id}, 'DISABLED')").succeeds do HP[:lb].update_load_balancer_node(@lb_id, @lb_node_id, 'DISABLED') end tests("#delete_load_balancer_node(#{@lb_id}, #{@lb_node_id})").succeeds do HP[:lb].delete_load_balancer_node(@lb_id, @lb_node_id) end HP[:lb].delete_load_balancer(@lb_id) end tests('failure') do tests('#list_node_balancer_nodes(0)').raises(Fog::HP::LB::NotFound) do HP[:lb].list_load_balancer_nodes('0') end end end fog-1.34.0/tests/hp/requests/lb/protocols_tests.rb0000644000004100000410000000046112600047642022220 0ustar www-datawww-dataShindo.tests("HP::LB | protocols requests", ['hp', 'lb', 'protocols']) do @protocol_format = { 'name' => String, 'port' => Integer } tests('success') do tests('#list_protocols').formats({'protocols' => [@protocol_format]}) do HP[:lb].list_protocols.body end end end fog-1.34.0/tests/hp/requests/lb/load_balancer_tests.rb0000644000004100000410000000314212600047642022741 0ustar www-datawww-dataShindo.tests("HP::LB | load balancers requests", ['hp', 'lb', 'load_balancer']) do @lb_format = { 'id' => String, 'name' => String, 'protocol' => String, 'port' => String, 'algorithm' => String, 'status' => String, 'created' => String, 'updated' => String, 'nodes' => Array } tests('success') do @lb_name = 'fog-lb' @nodes = [{'address' => '15.185.1.1', 'port' => '80'}] tests("#create_load_balancer(#{@lb_name}, #{@nodes})").formats(@lb_format) do data = HP[:lb].create_load_balancer(@lb_name, @nodes).body @lb_id = data['id'] data end tests('#list_load_balancers').formats({'loadBalancers' => [@lb_format]}) do HP[:lb].list_load_balancers.body end tests("#get_load_balancer(#{@lb_id})").formats(@lb_format) do HP[:lb].get_load_balancer(@lb_id).body end tests("#update_load_balancer(#{@lb_id}, {'name' => 'updated-fog-lb'})").returns('') do HP[:lb].update_load_balancer(@lb_id, {'name' => 'updated-fog-lb'}).body end tests("#delete_load_balancer(#{@lb_id})").succeeds do HP[:lb].delete_load_balancer(@lb_id) end end tests('failure') do tests("#get_load_balancer(0)").raises(Fog::HP::LB::NotFound) do HP[:lb].get_load_balancer('0') end tests("#update_load_balancer(0, {'name' => 'updated-fog-lb'})").raises(Fog::HP::LB::NotFound) do HP[:lb].update_load_balancer('0', {'name' => 'updated-fog-lb'}) end tests("#delete_load_balancer(0)").raises(Fog::HP::LB::NotFound) do HP[:lb].delete_load_balancer('0') end end end fog-1.34.0/tests/hp/requests/lb/limits_tests.rb0000644000004100000410000000065312600047642021500 0ustar www-datawww-dataShindo.tests("HP::LB | limits requests", ['hp', 'lb', 'limits']) do @limits_format = { 'maxLoadBalancerNameLength' => Integer, 'maxLoadBalancers' => Integer, 'maxNodesPerLoadBalancer' => Integer, 'maxVIPsPerLoadBalancer' => Integer, } tests('success') do tests('#list_limits').formats({'limits' => [{'values' => @limits_format }]}) do HP[:lb].list_limits.body end end end fog-1.34.0/tests/hp/requests/block_storage_v2/0000755000004100000410000000000012600047642021254 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/block_storage_v2/snapshot_tests.rb0000644000004100000410000000453712600047642024673 0ustar www-datawww-dataShindo.tests('HP::BlockStorageV2 | snapshot requests', ['hp', 'v2', 'block_storage', 'snapshots']) do @snapshot_format = { 'status' => String, 'display_description' => Fog::Nullable::String, 'display_name' => Fog::Nullable::String, 'volume_id' => String, 'size' => Integer, 'id' => String, 'created_at' => String, 'metadata' => Fog::Nullable::Hash } tests('success') do @snapshot_id = nil @snapshot_name = 'fogsnapshot2tests' @snapshot_desc = @snapshot_name + ' desc' @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvol2forsnap', :size => 1) @volume.wait_for { ready? } tests("#create_snapshot(#{@volume.id}, {'display_name' => #{@snapshot_name}, 'display_description' => #{@snapshot_desc} })").formats(@snapshot_format) do data = HP[:block_storage_v2].create_snapshot(@volume.id, {'display_name' => @snapshot_name, 'display_description' => @snapshot_desc} ).body['snapshot'] @snapshot_id = data['id'] data end tests("#get_snapshot_details(#{@snapshot_id})").formats(@snapshot_format) do HP[:block_storage_v2].get_snapshot_details(@snapshot_id).body['snapshot'] end tests("#update_snapshot(#{@snapshot_id}, 'display_name' => '#{@snapshot_name} Updated')").formats(@snapshot_format) do HP[:block_storage_v2].update_snapshot(@snapshot_id, 'display_name' => "#{@snapshot_name} Updated").body['snapshot'] end tests('#list_snapshots').formats({'snapshots' => [@snapshot_format]}) do HP[:block_storage_v2].list_snapshots.body end tests('#list_snapshots_detail').formats({'snapshots' => [@snapshot_format]}) do HP[:block_storage_v2].list_snapshots_detail.body end tests("#delete_snapshot(#{@snapshot_id})").succeeds do HP[:block_storage_v2].delete_snapshot(@snapshot_id) end end tests('failure') do tests('#get_snapshot_details(0)').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].get_snapshot_details(0) end tests('#update_snapshot(0)').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].update_snapshot(0) end tests('#delete_snapshot(0)').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].delete_snapshot(0) end end @volume.destroy end fog-1.34.0/tests/hp/requests/block_storage_v2/volume_backup_tests.rb0000644000004100000410000001060312600047642025657 0ustar www-datawww-dataShindo.tests("Fog::HP::BlockStorageV2 | volume backup requests", ['hp', 'v2', 'block_storage', 'volume_backup']) do @backup_details_format = { 'id' => String, 'status' => String, 'name' => Fog::Nullable::String, 'description' => Fog::Nullable::String, 'container' => String, 'availability_zone' => String, 'created_at' => String, 'volume_id' => String, 'size' => Integer, 'links' => [Fog::Nullable::Hash], 'fail_reason' => Fog::Nullable::String, 'object_count' => Integer } @backup_format = { 'id' => String, 'name' => Fog::Nullable::String, 'links' => [Fog::Nullable::Hash] } @restore_format = { 'backup_id' => String, 'volume_id' => String } tests('success') do @backup_id = nil @backup_name = 'fogvolbackup2tests' @backup_desc = @backup_name + ' desc' @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvol2forbackup', :size => 1) @volume.wait_for { ready? } @target_volume = HP[:block_storage_v2].volumes.create(:name => 'fogtargetvolume', :size => 2) @target_volume.wait_for { ready? } tests("#create_volume_backup(#{@volume.id}, {'name' => #{@backup_name}, 'description' => #{@backup_desc}, 'container' => 'my_backups')").formats(@backup_format) do data = HP[:block_storage_v2].create_volume_backup(@volume.id, {'name' => @backup_name, 'description' => @backup_desc, 'container' => 'my_backups'}).body['backup'] @backup_id = data['id'] data end tests("#get_volume_backup_details(#{@backup_id})").formats(@backup_details_format) do HP[:block_storage_v2].get_volume_backup_details(@backup_id).body['backup'] end tests('#list_volume_backups').formats({'backups' => [@backup_format]}) do HP[:block_storage_v2].list_volume_backups.body end tests('#list_volume_backups_detail').formats({'backups' => [@backup_details_format]}) do HP[:block_storage_v2].list_volume_backups_detail.body end # restore into new volume tests("#restore_volume_backup(#{@backup_id}").formats(@restore_format) do data = HP[:block_storage_v2].restore_volume_backup(@backup_id).body['restore'] restored_volume_id = data['volume_id'] restored_volume = HP[:block_storage_v2].get_volume_details(restored_volume_id).body['volume'] test ('should create a new volume with backup restored') do restored_volume['display_name'] == @volume.name restored_volume['display_description'] == @volume.description restored_volume['availability_zone'] == @volume.availability_zone restored_volume['size'] == @volume.size end data end ## restore into existing volume tests("#restore_volume_backup(#{@backup_id}, {'volume_id' => #{@target_volume.id}}").formats(@restore_format) do data = HP[:block_storage_v2].restore_volume_backup(@backup_id, {'volume_id' => @target_volume.id}).body['restore'] restored_volume_id = data['volume_id'] restored_volume = HP[:block_storage_v2].get_volume_details(restored_volume_id).body['volume'] test ('should overwrite the existing volume with backup restored') do restored_volume['id'] == @target_volume.id restored_volume['display_name'] == @volume.name restored_volume['display_description'] == @volume.description restored_volume['availability_zone'] == @volume.availability_zone restored_volume['size'] == @volume.size end data end # tests("#delete_volume_backup(#{@backup_id})").succeeds do HP[:block_storage_v2].delete_volume_backup(@backup_id) end end tests('failure') do tests('#get_volume_backup_details("0")').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].get_volume_backup_details('0') end tests('#restore_volume_backup("0")').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].restore_volume_backup('0') end tests("#restore_volume_backup(#{@backup_id}, '0')").raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].restore_volume_backup(@backup_id, '0') end tests('#delete_volume_backup("0")').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].delete_volume_backup('0') end end @target_volume.destroy @volume.destroy end fog-1.34.0/tests/hp/requests/block_storage_v2/volume_tests.rb0000644000004100000410000000730712600047642024341 0ustar www-datawww-dataShindo.tests("Fog::HP::BlockStorageV2 | volume requests", ['hp', 'v2', 'block_storage', 'volumes']) do compute_service = Fog::Compute.new(:provider => 'HP', :version => :v2) @volume_format = { 'id' => String, 'display_name' => Fog::Nullable::String, 'display_description' => Fog::Nullable::String, 'size' => Integer, 'status' => String, 'volume_type' => Fog::Nullable::String, 'snapshot_id' => Fog::Nullable::String, 'source_volid' => Fog::Nullable::String, 'bootable' => Fog::Boolean, 'created_at' => String, 'availability_zone' => String, 'attachments' => [Fog::Nullable::Hash], 'metadata' => Fog::Nullable::Hash } @volume_attach_format = { 'device' => String, 'serverId' => String, 'volumeId' => String, 'id' => String } tests('success') do @volume_id = nil @volume_name = 'fogvolume2tests' @volume_desc = @volume_name + ' desc' @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = compute_service.servers.create(:name => 'fogvoltests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests("#create_volume('display_name' => #{@volume_name}, 'display_description' => #{@volume_desc}, 'size' => 1)").formats(@volume_format) do data = HP[:block_storage_v2].create_volume('display_name' => @volume_name, 'display_description' => @volume_desc, 'size' => 1).body['volume'] @volume_id = data['id'] data end tests("#get_volume_details(#{@volume_id})").formats(@volume_format) do HP[:block_storage_v2].get_volume_details(@volume_id).body['volume'] end tests("#update_volume(#{@volume_id}, 'display_name' => #{@volume_name}+' Upd'").formats(@volume_format) do data = HP[:block_storage_v2].update_volume(@volume_id, 'display_name' => @volume_name).body['volume'] @volume_id = data['id'] data end tests('#list_volumes').formats({'volumes' => [@volume_format]}) do HP[:block_storage_v2].list_volumes.body end tests('#list_volumes_detail').formats({'volumes' => [@volume_format]}) do HP[:block_storage_v2].list_volumes_detail.body end tests("#attach_volume(#{@server.id}, #{@volume_id}, '/dev/sdg')").formats(@volume_attach_format) do compute_service.attach_volume(@server.id, @volume_id, "/dev/sdg").body['volumeAttachment'] end tests("#detach_volume(#{@server.id}, #{@volume_id})").succeeds do compute_service.detach_volume(@server.id, @volume_id) end tests("#delete_volume(#{@volume_id})").succeeds do HP[:block_storage_v2].delete_volume(@volume_id) end end tests('failure') do tests('#get_volume_details(0)').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].get_volume_details(0) end tests("#attach_volume(0, 0, '/dev/sdg')").raises(Fog::Compute::HPV2::NotFound) do compute_service.attach_volume(0, 0, "/dev/sdg") end tests("#attach_volume(#{@server.id}, 0, '/dev/sdg')").raises(Fog::HP::BlockStorageV2::NotFound) do pending if Fog.mocking? compute_service.attach_volume(@server.id, 0, "/dev/sdg") end tests('#detach_volume(0, 0)').raises(Fog::Compute::HPV2::NotFound) do compute_service.detach_volume(0, 0) end tests("#detach_volume(#{@server.id}, 0)").raises(Fog::HP::BlockStorageV2::NotFound) do pending if Fog.mocking? compute_service.detach_volume(@server.id, 0) end tests('#delete_volume(0)').raises(Fog::HP::BlockStorageV2::NotFound) do HP[:block_storage_v2].delete_volume(0) end end @server.destroy end fog-1.34.0/tests/hp/requests/block_storage/0000755000004100000410000000000012600047642020645 5ustar www-datawww-datafog-1.34.0/tests/hp/requests/block_storage/bootable_volume_tests.rb0000644000004100000410000000512012600047642025570 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | bootable volume requests", ['hp', 'block_storage', 'volumes']) do @volume_format = { 'status' => String, 'displayDescription' => Fog::Nullable::String, 'availabilityZone' => String, 'displayName' => Fog::Nullable::String, 'attachments' => [Fog::Nullable::Hash], 'volumeType' => Fog::Nullable::String, 'snapshotId' => Fog::Nullable::String, 'size' => Integer, 'id' => Integer, 'createdAt' => String, 'metadata' => Fog::Nullable::Hash } @boot_volume_format = { 'status' => String, 'displayDescription' => Fog::Nullable::String, 'availabilityZone' => String, 'displayName' => Fog::Nullable::String, 'attachments' => [Fog::Nullable::Hash], 'volumeType' => Fog::Nullable::String, 'snapshotId' => Fog::Nullable::String, 'source_image_id' => Fog::Nullable::String, 'size' => Integer, 'id' => Integer, 'createdAt' => String, 'metadata' => Fog::Nullable::Hash } @volume_attach_format = { "volumeId" => Integer, "id" => Integer } tests('success') do @volume_id = nil @volume_name = "fogbvolumetests" @volume_desc = @volume_name + " desc" @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests("#create_volume(#{@volume_name}, #{@volume_desc}, 10, {'imageRef' => '#{@base_image_id}'})").formats(@volume_format) do data = HP[:block_storage].create_volume(@volume_name, @volume_desc, 10, {'imageRef' => "#{@base_image_id}"}).body['volume'] @volume_id = data['id'] data end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#get_bootable_volume_details(#{@volume_id})").formats(@boot_volume_format) do HP[:block_storage].get_bootable_volume_details(@volume_id).body['volume'] end tests("#list_bootable_volumes").formats({'volumes' => [@boot_volume_format]}) do HP[:block_storage].list_bootable_volumes.body end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#delete_volume(#{@volume_id})").succeeds do HP[:block_storage].delete_volume(@volume_id) end end tests('failure') do tests("#get_bootable_volume_details(0)").raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].get_bootable_volume_details(0) end tests("#delete_volume(0)").raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].delete_volume(0) end end end fog-1.34.0/tests/hp/requests/block_storage/snapshot_tests.rb0000644000004100000410000000322112600047642024251 0ustar www-datawww-dataShindo.tests('HP::BlockStorage | snapshot requests', ['hp', 'block_storage', 'snapshots']) do @snapshot_format = { 'status' => String, 'displayDescription' => Fog::Nullable::String, 'displayName' => Fog::Nullable::String, 'volumeId' => Integer, 'size' => Integer, 'id' => Integer, 'createdAt' => String } tests('success') do @snapshot_id = nil @snapshot_name = "fogsnapshottests" @snapshot_desc = @snapshot_name + " desc" @volume = HP[:block_storage].volumes.create(:name => 'fogvolforsnap', :size => 1) @volume.wait_for { ready? } tests("#create_snapshot(#{@snapshot_name}, #{@snapshot_desc}, #{@volume.id})").formats(@snapshot_format) do data = HP[:block_storage].create_snapshot(@snapshot_name, @snapshot_desc, @volume.id).body['snapshot'] @snapshot_id = data['id'] data end tests("#get_snapshot_details(#{@snapshot_id})").formats(@snapshot_format) do HP[:block_storage].get_snapshot_details(@snapshot_id).body['snapshot'] end tests('#list_snapshots').formats({'snapshots' => [@snapshot_format]}) do HP[:block_storage].list_snapshots.body end tests("#delete_snapshot(#{@snapshot_id})").succeeds do HP[:block_storage].delete_snapshot(@snapshot_id) end end tests('failure') do tests('#get_snapshot_details(0)').raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].get_snapshot_details(0) end tests("#delete_snapshot(0)").raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].delete_snapshot(0) end end @volume.destroy end fog-1.34.0/tests/hp/requests/block_storage/volume_tests.rb0000644000004100000410000000627412600047642023734 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | volume requests", ['hp', 'block_storage', 'volumes']) do @volume_format = { 'status' => String, 'displayDescription' => Fog::Nullable::String, 'availabilityZone' => String, 'displayName' => Fog::Nullable::String, 'attachments' => [Fog::Nullable::Hash], 'volumeType' => Fog::Nullable::String, 'snapshotId' => Fog::Nullable::String, 'size' => Integer, 'id' => Integer, 'createdAt' => String, 'metadata' => Fog::Nullable::Hash } @volume_attach_format = { "volumeId" => Integer, "id" => Integer } tests('success') do @volume_id = nil @volume_name = "fogvolumetests" @volume_desc = @volume_name + " desc" @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 @server = Fog::Compute[:hp].servers.create(:name => 'fogvoltests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests("#create_volume(#{@volume_name}, #{@volume_desc}, 1)").formats(@volume_format) do data = HP[:block_storage].create_volume(@volume_name, @volume_desc, 1).body['volume'] @volume_id = data['id'] data end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#get_volume_details(#{@volume_id})").formats(@volume_format) do HP[:block_storage].get_volume_details(@volume_id).body['volume'] end tests('#list_volumes').formats({'volumes' => [@volume_format]}) do HP[:block_storage].list_volumes.body end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#attach_volume(#{@server.id}, #{@volume_id}, '/dev/sdg')").formats(@volume_attach_format) do Fog::Compute[:hp].attach_volume(@server.id, @volume_id, "/dev/sdg").body['volumeAttachment'] end HP[:block_storage].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? tests("#detach_volume(#{@server.id}, #{@volume_id})").succeeds do Fog::Compute[:hp].detach_volume(@server.id, @volume_id) end HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#delete_volume(#{@volume_id})").succeeds do HP[:block_storage].delete_volume(@volume_id) end end tests('failure') do tests('#get_volume_details(0)').raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].get_volume_details(0) end tests("#attach_volume(0, 0, '/dev/sdg')").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].attach_volume(0, 0, "/dev/sdg") end tests("#attach_volume(#{@server.id}, 0, '/dev/sdg')").raises(Fog::HP::BlockStorage::NotFound) do pending if Fog.mocking? Fog::Compute[:hp].attach_volume(@server.id, 0, "/dev/sdg") end tests("#detach_volume(0, 0)").raises(Fog::Compute::HP::NotFound) do Fog::Compute[:hp].detach_volume(0, 0) end tests("#detach_volume(#{@server.id}, 0)").raises(Fog::HP::BlockStorage::NotFound) do pending if Fog.mocking? Fog::Compute[:hp].detach_volume(@server.id, 0) end tests("#delete_volume(0)").raises(Fog::HP::BlockStorage::NotFound) do HP[:block_storage].delete_volume(0) end end @server.destroy end fog-1.34.0/tests/hp/cdn_tests.rb0000644000004100000410000000133312600047642016467 0ustar www-datawww-dataShindo.tests('Fog::CDN::HP', ['hp', 'cdn']) do credentials = { :auth_token => 'auth_token', :endpoint_url => 'http://127.0.0.1/cdnpath/', :cdn_endpoint_url => 'http://127.0.0.1/cdnpath/', :service_catalog => { :"CDN" => { :zone => 'http://127.0.0.1/cdnpath/'}}, :expires => (DateTime.now + 1).to_s } options = { :hp_access_key => 'key', :hp_secret_key => 'secret', :hp_tenant_id => 'tenant', :hp_avl_zone => 'zone', :hp_auth_uri => 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens', :credentials => credentials } tests('Test cached CDN credentials').returns(credentials) do conn = Fog::CDN::HP::Real.new(options) conn.credentials end end fog-1.34.0/tests/hp/block_storage_tests.rb0000644000004100000410000000315612600047642020546 0ustar www-datawww-datarequire 'date' Shindo.tests('Fog::HP::BlockStorage', ['hp', 'blockstorage']) do credentials = { :auth_token => 'auth_token', :endpoint_url => 'http://127.0.0.1/bpath/', :service_catalog => { :"Block Storage" => { :zone => 'http://127.0.0.1/bpath/'}}, :expires => (DateTime.now + 1).to_s } options = { :hp_access_key => 'key', :hp_secret_key => 'secret', :hp_tenant_id => 'tenant', :hp_avl_zone => 'zone', :hp_auth_uri => 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens', :credentials => credentials } tests('Test good credentials').returns(credentials) do conn = Fog::HP::BlockStorage::Real.new(options) conn.credentials end tests('Test expired credentials') do credentials[:expires] = (DateTime.now - 1).to_s raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) } end tests('Test no expires') do credentials[:expires] = nil raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) } end tests('Test no creds') do options[:credentials] = nil raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) } end tests('Test no service') do options[:credentials] = credentials options[:credentials][:service_catalog] = { :"CDN" => { :zone => 'http://127.0.0.1/bpath/'}}, raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) } end tests('Test no creds') do options[:credentials][:service_catalog] = nil raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) } end end fog-1.34.0/tests/hp/compute_tests.rb0000644000004100000410000000130112600047642017372 0ustar www-datawww-dataShindo.tests('Fog::Compute::HP', ['hp', 'compute']) do credentials = { :auth_token => 'auth_token', :endpoint_url => 'http://127.0.0.1/computepath/', :service_catalog => { :"Compute" => { :zone => 'http://127.0.0.1/computepath/'}}, :expires => (DateTime.now + 1).to_s } options = { :hp_access_key => 'key', :hp_secret_key => 'secret', :hp_tenant_id => 'tenant', :hp_avl_zone => 'zone', :hp_auth_uri => 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens', :credentials => credentials } tests('Test cached Compute credentials').returns(credentials) do conn = Fog::Compute::HP::Real.new(options) conn.credentials end end fog-1.34.0/tests/hp/models/0000755000004100000410000000000012600047642015437 5ustar www-datawww-datafog-1.34.0/tests/hp/models/network/0000755000004100000410000000000012600047642017130 5ustar www-datawww-datafog-1.34.0/tests/hp/models/network/port_tests.rb0000644000004100000410000000130712600047642021664 0ustar www-datawww-dataShindo.tests('HP::Network | networking port model', ['hp', 'networking', 'port']) do @network = HP[:network].networks.create(:name => 'my_network') attributes = {:name => 'fogport', :network_id => @network.id} model_tests(HP[:network].ports, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'my_port', :network_id => @network.id} @port = HP[:network].ports.create(attributes) @port.wait_for { ready? } unless Fog.mocking? !@port.id.nil? end tests('#save').succeeds do @port.name = 'my_port_upd' @port.save end tests('#destroy').succeeds do @port.destroy end end @network.destroy end fog-1.34.0/tests/hp/models/network/security_group_tests.rb0000644000004100000410000000105112600047642023757 0ustar www-datawww-dataShindo.tests('HP::Network | networking security group model', ['hp', 'networking', 'securitygroup']) do model_tests(HP[:network].security_groups, {:name => 'fogsecgroup'}, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'my_secgroup', :description => 'my sec group desc'} @secgroup = HP[:network].security_groups.create(attributes) @secgroup.wait_for { ready? } unless Fog.mocking? !@secgroup.id.nil? end tests('#destroy').succeeds do @secgroup.destroy end end end fog-1.34.0/tests/hp/models/network/routers_tests.rb0000644000004100000410000000104112600047642022376 0ustar www-datawww-dataShindo.tests('HP::Network | networking routers collection', ['hp', 'networking', 'router']) do attributes = {:name => 'my_router', :admin_state_up => true} collection_tests(HP[:network].routers, attributes, true) tests('success') do attributes = {:name => 'fogrouter', :admin_state_up => true} @router = HP[:network].routers.create(attributes) tests('#all(filter)').succeeds do routers = HP[:network].routers.all({:name => 'fogrouter'}) routers.first.name == 'fogrouter' end @router.destroy end end fog-1.34.0/tests/hp/models/network/networks_tests.rb0000644000004100000410000000066512600047642022562 0ustar www-datawww-dataShindo.tests('HP::Network | networking networks collection', ['hp', 'networking', 'network']) do attributes = {:name => 'my_network', :admin_state_up => true, :shared => false} collection_tests(HP[:network].networks, attributes, true) tests('success') do tests('#all(filter)').succeeds do networks = HP[:network].networks.all({'router:external'=>true}) networks.first.router_external == true end end end fog-1.34.0/tests/hp/models/network/floating_ip_tests.rb0000644000004100000410000000202512600047642023171 0ustar www-datawww-dataShindo.tests('HP::Network | networking floating ip model', ['hp', 'networking', 'floatingip']) do @ext_network = HP[:network].networks.all({'router:external'=>true}).first attributes = {:floating_network_id => @ext_network.id} model_tests(HP[:network].floating_ips, attributes, true) tests('success') do @network = HP[:network].networks.create(:name => 'my_network') attributes = {:name => 'port1', :network_id => @network.id} @port = HP[:network].ports.create(attributes) tests('#create').succeeds do attributes = {:floating_network_id => @ext_network.id} @fip = HP[:network].floating_ips.create(attributes) @fip.wait_for { ready? } unless Fog.mocking? !@fip.id.nil? end tests("#associate_port(#{@port.id})").succeeds do @fip.associate_port(@port.id) end # this will delete the port as well tests('#disassociate_port').succeeds do @fip.disassociate_port end tests('#destroy').succeeds do @fip.destroy end @network.destroy end end fog-1.34.0/tests/hp/models/network/security_groups_tests.rb0000644000004100000410000000116012600047642024143 0ustar www-datawww-dataShindo.tests('HP::Network | networking security groups collection', ['hp', 'networking', 'securitygroup']) do attributes = {:name => 'my_secgroup', :description => 'my sec group desc'} collection_tests(HP[:network].security_groups, attributes, true) tests('success') do attributes = {:name => 'fogsecgroup', :description => 'fog sec group desc'} @secgroup = HP[:network].security_groups.create(attributes) tests('#all(filter)').succeeds do secgroup = HP[:network].security_groups.all({:name => 'fogsecgroup'}) secgroup.first.name == 'fogsecgroup' end @secgroup.destroy end end fog-1.34.0/tests/hp/models/network/floating_ips_tests.rb0000644000004100000410000000046412600047642023361 0ustar www-datawww-dataShindo.tests('HP::Network | networking floating ips collection', ['hp', 'networking', 'floatingip']) do @ext_network = HP[:network].networks.all({'router:external'=>true}).first attributes = {:floating_network_id => @ext_network.id} collection_tests(HP[:network].floating_ips, attributes, true) end fog-1.34.0/tests/hp/models/network/subnet_tests.rb0000644000004100000410000000147312600047642022204 0ustar www-datawww-dataShindo.tests('HP::Network | networking subnet model', ['hp', 'networking', 'subnet']) do @network = HP[:network].networks.create(:name => 'my_network') attributes = {:name => 'fogsubnet', :network_id => @network.id, :cidr => '11.11.11.11/11', :ip_version => 4} model_tests(HP[:network].subnets, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'my_subnet', :network_id => @network.id, :cidr => '12.12.12.12/12', :ip_version => 4} @subnet = HP[:network].subnets.create(attributes) @subnet.wait_for { ready? } unless Fog.mocking? !@subnet.id.nil? end tests('#save').succeeds do @subnet.name = 'my_subnet_upd' @subnet.save end tests('#destroy').succeeds do @subnet.destroy end end @network.destroy end fog-1.34.0/tests/hp/models/network/router_tests.rb0000644000004100000410000000346612600047642022230 0ustar www-datawww-dataShindo.tests('HP::Network | networking router model', ['hp', 'networking', 'router']) do # needed to test router_interface calls @network = HP[:network].networks.create(:name => 'fognetwork') @subnet = HP[:network].subnets.create({:name => 'fogsubnet', :network_id => @network.id, :cidr => '13.13.13.13/13', :ip_version => 4}) @port = HP[:network].ports.create({:name => 'fogport', :network_id => @network.id}) attributes = {:name => 'fogrouter', :admin_state_up => true} model_tests(HP[:network].routers, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'my_router', :admin_state_up => true} @router = HP[:network].routers.create(attributes) @router.wait_for { ready? } unless Fog.mocking? !@router.id.nil? end tests('#save').succeeds do @router.name = 'my_router_upd' @router.save end tests("#add_interface(#{@subnet.id}, nil) - with subnet").succeeds do @router.add_interface(@subnet.id) end #tests("#remove_interface(#{@subnet.id}, nil) - with subnet").succeeds do # @router.remove_interface(@subnet.id) #end tests("#add_interface(nil, #{@port.id}) - with port").succeeds do @router.add_interface(nil, @port.id) end ## deletes the port as well tests("#remove_interface(nil, #{@port.id}) - with port").succeeds do @router.remove_interface(nil, @port.id) end tests("#add_interface(#{@subnet.id}, #{@port.id}) - with both").succeeds do @router.add_interface(@subnet.id, @port.id) == false end tests("#add_interface(#{@subnet.id}, #{@port.id}) - with both").succeeds do @router.remove_interface(@subnet.id, @port.id) == false end tests('#destroy').succeeds do @router.destroy end end @subnet.destroy @network.destroy end fog-1.34.0/tests/hp/models/network/security_group_rules_tests.rb0000644000004100000410000000153712600047642025202 0ustar www-datawww-dataShindo.tests('HP::Network | networking security group rules collection', ['hp', 'networking', 'securitygroup']) do @secgroup = HP[:network].security_groups.create({:name => 'my_secgroup'}) attributes = {:security_group_id => @secgroup.id, :direction => 'ingress'} collection_tests(HP[:network].security_group_rules, attributes, true) tests('success') do attributes = {:security_group_id => @secgroup.id, :direction => 'ingress', :protocol => 'tcp', :port_range_min => 22, :port_range_max => 22, :remote_ip_prefix => '0.0.0.0/0'} @secgrouprule = HP[:network].security_group_rules.create(attributes) tests('#all(filter)').succeeds do secgrouprule = HP[:network].security_group_rules.all({:direction => 'ingress'}) secgrouprule.first.direction == 'ingress' end @secgrouprule.destroy end @secgroup.destroy end fog-1.34.0/tests/hp/models/network/network_tests.rb0000644000004100000410000000116112600047642022367 0ustar www-datawww-dataShindo.tests('HP::Network | networking network model', ['hp', 'networking', 'network']) do model_tests(HP[:network].networks, {:name => 'fognetwork'}, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'my_network', :admin_state_up => true, :shared => false} @network = HP[:network].networks.create(attributes) @network.wait_for { ready? } unless Fog.mocking? !@network.id.nil? end tests('#save').succeeds do @network.name = 'my_network_upd' @network.save end tests('#destroy').succeeds do @network.destroy end end end fog-1.34.0/tests/hp/models/network/subnets_tests.rb0000644000004100000410000000134012600047642022360 0ustar www-datawww-dataShindo.tests('HP::Network | networking subnets collection', ['hp', 'networking', 'subnet']) do @network = HP[:network].networks.create(:name => 'my_network') attributes = {:name => 'my_subnet', :network_id => @network.id, :cidr => '11.11.11.11/11', :ip_version => 4} collection_tests(HP[:network].subnets, attributes, true) tests('success') do attributes = {:name => 'fogsubnet', :network_id => @network.id, :cidr => '12.12.12.12/12', :ip_version => 4} @subnet = HP[:network].subnets.create(attributes) tests('#all(filter)').succeeds do subnets = HP[:network].subnets.all({:cidr => '12.12.12.12/12'}) subnets.first.cidr == '12.12.12.12/12' end @subnet.destroy end @network.destroy end fog-1.34.0/tests/hp/models/network/security_group_rule_tests.rb0000644000004100000410000000152412600047642025013 0ustar www-datawww-dataShindo.tests('HP::Network | networking security group rule model', ['hp', 'networking', 'securitygroup']) do @secgroup = HP[:network].security_groups.create({:name => 'fogsecgroup'}) attributes = {:security_group_id => @secgroup.id, :direction => 'ingress'} model_tests(HP[:network].security_group_rules, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:security_group_id => @secgroup.id, :direction => 'ingress', :protocol => 'tcp', :port_range_min => 22, :port_range_max => 22, :remote_ip_prefix => '0.0.0.0/0'} @secgrouprule = HP[:network].security_group_rules.create(attributes) @secgrouprule.wait_for { ready? } unless Fog.mocking? !@secgrouprule.id.nil? end tests('#destroy').succeeds do @secgrouprule.destroy end end @secgroup.destroy end fog-1.34.0/tests/hp/models/network/ports_tests.rb0000644000004100000410000000106612600047642022051 0ustar www-datawww-dataShindo.tests('HP::Network | networking ports collection', ['hp', 'networking', 'port']) do @network = HP[:network].networks.create(:name => 'my_network') attributes = {:name => 'my_port', :network_id => @network.id} collection_tests(HP[:network].ports, attributes, true) tests('success') do attributes = {:name => 'fogport', :network_id => @network.id} @port = HP[:network].ports.create(attributes) tests('#all(filter)').succeeds do HP[:network].ports.all({:name => 'fogport'}) end @port.destroy end @network.destroy end fog-1.34.0/tests/hp/models/storage/0000755000004100000410000000000012600047642017103 5ustar www-datawww-datafog-1.34.0/tests/hp/models/storage/file_tests.rb0000644000004100000410000000163012600047642021571 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | directory", ['hp', 'storage']) do file_attributes = { :key => 'fog_file_tests', :body => lorem_file, :public => true } directory_attributes = { :key => 'fogfilestests' } @directory = Fog::Storage[:hp].directories.create(directory_attributes) model_tests(@directory.files, file_attributes, true) do @file = @directory.files.get('fog_file_tests') tests('success') do tests("#directory").returns(@directory.key) do @file.directory.key end tests("#cdn_public_url").succeeds do pending if Fog.mocking? @file.cdn_public_url end tests("#cdn_public_ssl_url").succeeds do pending if Fog.mocking? @file.cdn_public_ssl_url end tests("#temp_signed_url(60, 'GET')").succeeds do @file.temp_signed_url(60, 'GET') end end end @directory.destroy end fog-1.34.0/tests/hp/models/storage/directory_tests.rb0000644000004100000410000000650412600047642022663 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | directory", ['hp', 'storage']) do model_tests(Fog::Storage[:hp].directories, {:key => "fogdirtests"}, true) do tests('success') do tests("#grant('pr')").succeeds do @instance.grant('pr') tests("public?").returns(true) do @instance.public? end end tests("#revoke('pr')").succeeds do @instance.revoke('pr') tests("public?").returns(false) do @instance.public? end end @instance.files.create(:key => 'sample.txt', :body => lorem_file) tests("#files").succeeds do @instance.files end @instance.files.get('sample.txt').destroy tests("#cdn_enable=(true)").succeeds do pending if Fog.mocking? @instance.cdn_enable=(true) tests("cdn_enabled?").returns(true) do pending if Fog.mocking? @instance.cdn_enable? end end tests("#cdn_public_url").succeeds do pending if Fog.mocking? @instance.cdn_public_url end tests("#cdn_public_ssl_url").succeeds do pending if Fog.mocking? @instance.cdn_public_ssl_url end # metadata tests tests('#metadata.all').succeeds do @instance.metadata.all end tests('#metadata.set').succeeds do @instance.metadata.set('X-Container-Meta-One' => 'One') end tests('#metadata.get set meta').succeeds do meta = @instance.metadata.get('X-Container-Meta-One') tests('gets correct value') do meta.value == 'One' end meta end tests('#metadata.update').succeeds do @instance.metadata.update('X-Container-Meta-One' => 'One Updated') end tests('#metadata.get updated meta').succeeds do meta = @instance.metadata.get('X-Container-Meta-One') tests('gets correct value') do meta.value == 'One Updated' end meta end # metadata set via setter tests('#metadata=').succeeds do @instance.metadata = {'X-Container-Meta-Two' => 'Two'} @instance.save end tests('#metadata.get set meta via setter').succeeds do meta = @instance.metadata.get('X-Container-Meta-Two') tests('gets correct value') do meta.value == 'Two' end meta end #metadata set via Meta object tests('metadata set via Meta object').succeeds do m = Fog::Storage::HP::Meta.new m.key = 'X-Container-Meta-Three' m.value = 'Three' @instance.metadata << m @instance.save end tests('#metadata.get set via Meta object').succeeds do meta = @instance.metadata.get('X-Container-Meta-Three') tests('gets correct value') do meta.value == 'Three' end meta end # invalid metadata tests("#metadata.get('invalid-meta')").succeeds do meta = @instance.metadata.get('X-Container-Meta-InValidMeta') tests('gets nil') do meta == nil end meta end end tests('failure') do tests("#grant('invalid-acl')").raises(ArgumentError) do @instance.grant('invalid-acl') end tests("#revoke('invalid-acl')").raises(ArgumentError) do @instance.revoke('invalid-acl') end end end end fog-1.34.0/tests/hp/models/storage/files_tests.rb0000644000004100000410000000164312600047642021760 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | files", ['hp', 'storage']) do file_attributes = { :key => 'fog_files_tests', :body => lorem_file } directory_attributes = { :key => 'fogfilestests' } collection_tests(Fog::Storage[:hp].directories.create(directory_attributes).files, file_attributes, true) @directory = Fog::Storage[:hp].directories.create(directory_attributes) @file = @directory.files.create(file_attributes) tests('success') do tests("#get_url('#{@directory.key}')").succeeds do @directory.files.get_url(@directory.key) end tests("#get_cdn_url('#{@directory.key}')").succeeds do pending if Fog.mocking? @directory.files.get_cdn_url(@directory.key) end tests("#get_cdn_ssl_url('#{@directory.key}')").succeeds do pending if Fog.mocking? @directory.files.get_cdn_ssl_url(@directory.key) end end @file.destroy @directory.destroy end fog-1.34.0/tests/hp/models/storage/directories_tests.rb0000644000004100000410000000106712600047642023172 0ustar www-datawww-dataShindo.tests("Fog::Storage[:hp] | directories", ['hp', 'storage']) do collection_tests(Fog::Storage[:hp].directories, {:key => "fogdirtests"}, true) tests('success') do tests("#create('fogdirtests')").succeeds do Fog::Storage[:hp].directories.create(:key => 'fogdirtests') end tests("#head('fogdirtests')").succeeds do Fog::Storage[:hp].directories.head('fogdirtests') end tests("#get('fogdirtests')").succeeds do @directory = Fog::Storage[:hp].directories.get('fogdirtests') end @directory.destroy end end fog-1.34.0/tests/hp/models/dns/0000755000004100000410000000000012600047642016223 5ustar www-datawww-datafog-1.34.0/tests/hp/models/dns/domains_tests.rb0000644000004100000410000000050012600047642021417 0ustar www-datawww-dataShindo.tests('HP::DNS | domains collection', ['hp', 'dns', 'domains']) do attributes = {:name => 'www.fogtest.com.', :email => 'test@fogtest.com', :ttl => 3600} collection_tests(HP[:dns].domains, attributes, true) tests('success') do tests('#all').succeeds do HP[:dns].domains.all end end end fog-1.34.0/tests/hp/models/dns/domain_tests.rb0000644000004100000410000000115012600047642021236 0ustar www-datawww-dataShindo.tests('HP::DNS | domain model', ['hp', 'dns', 'domain']) do attributes = {:name => 'www.fogtest.com.', :email => 'test@fogtest.com'} model_tests(HP[:dns].domains, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:name => 'www.fogtest.com.', :email => 'test@fogtest.com', :ttl => 3600} @domain = HP[:dns].domains.create(attributes) !@domain.id.nil? end tests('Update via #save').succeeds do @domain.email = 'update@fogtest.com' @domain.save end tests('#destroy').succeeds do @domain.destroy end end end fog-1.34.0/tests/hp/models/dns/records_tests.rb0000644000004100000410000000055212600047642021435 0ustar www-datawww-dataShindo.tests('HP::DNS | records collection', ['hp', 'dns', 'records']) do @domain = HP[:dns].domains.create({:name => 'www.fogtest.com.', :email => 'test@fogtest.com'}) attributes = {:domain_id => @domain.id, :name => 'www.fogtest.com.', :type => 'A', :data => '15.185.172.152'} collection_tests(@domain.records, attributes, true) @domain.destroy end fog-1.34.0/tests/hp/models/dns/record_tests.rb0000644000004100000410000000154312600047642021253 0ustar www-datawww-dataShindo.tests('HP::DNS | record model', ['hp', 'dns', 'record']) do @domain = HP[:dns].domains.create({:name => 'www.fogtest.com.', :email => 'test@fogtest.com'}) attributes = {:domain_id => @domain.id, :name => 'www.fogtest.com.', :type => 'A', :data => '15.185.100.152'} model_tests(@domain.records, attributes, true) tests('success') do tests('#create').succeeds do attributes = {:domain_id => @domain.id, :name => 'www.fogtest.com.', :type => 'A', :data => '15.185.200.152', :description => 'test record'} @record = HP[:dns].records.create(attributes) !@record.id.nil? end tests('Update via #save').succeeds do @record.name = 'www.fogupdate.com.' @record.description = 'desc for record' @record.save end tests('#destroy').succeeds do @record.destroy end end @domain.destroy end fog-1.34.0/tests/hp/models/compute_v2/0000755000004100000410000000000012600047642017522 5ustar www-datawww-datafog-1.34.0/tests/hp/models/compute_v2/availability_zone_tests.rb0000644000004100000410000000043412600047642024777 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | availability zone model", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @zones = service.availability_zones tests('#available?').succeeds do @zones.first.respond_to?('available?') end end fog-1.34.0/tests/hp/models/compute_v2/server_tests.rb0000644000004100000410000000235712600047642022606 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | server model", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' model_tests(service.servers, {:name => 'fogservertest', :flavor_id => 100, :image_id => @base_image_id}, true) do @server = service.servers.create(:name => 'fogservertest', :flavor_id => 100, :image_id => @base_image_id) tests('#console_output(10)').succeeds do @server.console_output(10) end tests('#vnc_console_url').succeeds do @server.vnc_console_url end tests("#create_image('fogimgfromserver')").succeeds do @server.create_image('fogimgfromserver') end tests("#reboot('SOFT')").succeeds do pending unless Fog.mocking? @server.reboot('SOFT') end tests("#rebuild(#{@base_image_id}, 'fogrebuildserver')").succeeds do pending @server.rebuild(@base_image_id, 'fogrebuildserver') end tests('#add_security_group("default")').succeeds do @server.add_security_group('default') end tests('#remove_security_group("default")').succeeds do @server.remove_security_group('default') end @server.destroy end end fog-1.34.0/tests/hp/models/compute_v2/metadata_image_tests.rb0000644000004100000410000000332112600047642024212 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | metadata for images", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = service.servers.create(:name => 'fogsermdtests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } @image = @server.create_image('fogimgmetadatatests', :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'}) @image.wait_for { ready? } @image.reload tests('success') do tests('#all').succeeds do @image.metadata.all end tests("#get('Meta1')").succeeds do pending if Fog.mocking? @image.metadata.get('Meta1') end tests("#update({'Meta3' => 'MetaValue3'})").succeeds do @data = @image.metadata.update({'Meta3' => 'MetaValue3'}) test('metadata has updated correctly') do @image.metadata.get('Meta3').value == 'MetaValue3' end end tests("#set({'Meta4' => 'MetaValue4'})").succeeds do @data = @image.metadata.set({'Meta4' => 'MetaValue4'}) test('metadata has set correctly') do @image.metadata.get('Meta4').value == 'MetaValue4' end end tests("#save").succeeds do m = @image.metadata.new(:key => 'Meta5', :value => 'MetaValue5') @data = m.save test('metadata has saved correctly') do @image.metadata.get('Meta5').value == 'MetaValue5' end end tests("#destroy('Meta5')").succeeds do @image.metadata.destroy('Meta5') test('metadata has been destroyed') do @image.metadata.get('Meta5') == nil end end end unless Fog.mocking? @image.destroy end @server.destroy end fog-1.34.0/tests/hp/models/compute_v2/servers_tests.rb0000644000004100000410000000055112600047642022763 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | servers collection", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' collection_tests(service.servers, {:name => 'fogservercolltest', :flavor_id => 100, :image_id => @base_image_id}, true) end fog-1.34.0/tests/hp/models/compute_v2/volume_attachment_tests.rb0000644000004100000410000000243712600047642025016 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | volume_attachment model", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = service.servers.create(:name => 'fogserattachtests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvolumetest', :size => 1) @volume.wait_for { ready? } tests('success') do tests('#create').succeeds do volume_attachment = @server.volume_attachments.create(:server_id => @server.id, :volume_id => @volume.id, :device => '/dev/sdf') test('volume attached to server') do volume_attachment.server_id == @server.id end end tests('#get').succeeds do volume_attachment = @server.volume_attachments.get(@volume.id) test('get server in volume attachment') do volume_attachment.server_id == @server.id end test('get volume in volume attachment') do volume_attachment.id == @volume.id end end tests('#detach').succeeds do volume_attachment = @server.volume_attachments.get(@volume.id) volume_attachment.detach end end @volume.destroy @server.destroy end fog-1.34.0/tests/hp/models/compute_v2/key_pair_tests.rb0000644000004100000410000000116312600047642023075 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | key_pair model", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) model_tests(service.key_pairs, {:name => 'fogkeyname'}, true) after do @keypair.destroy end tests('new keypair') do @keypair = service.key_pairs.create(:name => 'fogtestkey') test('writable?') do @keypair.writable? == true end end tests('existing keypair') do service.key_pairs.create(:name => 'fogtestkey') @keypair = service.key_pairs.get('fogtestkey') test('writable?') do @keypair.writable? == false end end end fog-1.34.0/tests/hp/models/compute_v2/metadata_server_tests.rb0000644000004100000410000000323412600047642024441 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | metadata for servers", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = service.servers.create(:name => 'fogsermetadatatests', :flavor_id => 100, :image_id => @base_image_id, :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'}) @server.wait_for { ready? } tests('success') do tests('#all').succeeds do @server.metadata.all end tests("#get('Meta1')").succeeds do @data = @server.metadata.get('Meta1') test('metadata gets correct value') do @data.value == 'MetaValue1' end end tests("#update({'Meta3' => 'MetaValue3'})").succeeds do @data = @server.metadata.update({'Meta3' => 'MetaValue3'}) test('metadata has updated correctly') do @server.metadata.get('Meta3').value == 'MetaValue3' end end tests("#set({'Meta4' => 'MetaValue4'})").succeeds do @data = @server.metadata.set({'Meta4' => 'MetaValue4'}) test('metadata has set correctly') do @server.metadata.get('Meta4').value == 'MetaValue4' end end tests('#save').succeeds do m = @server.metadata.new(:key => 'Meta5', :value => 'MetaValue5') @data = m.save test('metadata has saved correctly') do @server.metadata.get('Meta5').value == 'MetaValue5' end end tests("#destroy('Meta5')").succeeds do @data = @server.metadata.destroy('Meta5') test('metadata has been destroyed') do @server.metadata.get('Meta5') == nil end end end @server.destroy end fog-1.34.0/tests/hp/models/compute_v2/key_pairs_tests.rb0000644000004100000410000000034312600047642023257 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | key pairs collection", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) collection_tests(service.key_pairs, {:name => 'fogkeyname'}, true) end fog-1.34.0/tests/hp/models/compute_v2/availability_zones_tests.rb0000644000004100000410000000047012600047642025162 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | availability zones collection", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) tests('#all').succeeds do @zones = service.availability_zones end tests('#get').succeeds do @zones.get('az1').name == 'az1' end end fog-1.34.0/tests/hp/models/compute_v2/addresses_tests.rb0000644000004100000410000000031612600047642023246 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | addresses collection", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) collection_tests(service.addresses, {}, true) end fog-1.34.0/tests/hp/models/compute_v2/address_tests.rb0000644000004100000410000000115012600047642022713 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | address model", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' model_tests(service.addresses, {}, true) do @server = service.servers.create(:name => 'fogseraddtests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests('#server=').succeeds do @instance.server = @server test('server attached') do @instance.instance_id == @server.id end end @server.destroy end end fog-1.34.0/tests/hp/models/compute_v2/volume_attachments_tests.rb0000644000004100000410000000125012600047642025171 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | volume attachments collection", ['hp', 'v2', 'compute']) do service = Fog::Compute.new(:provider => 'HP', :version => :v2) @base_image_id = ENV['BASE_IMAGE_ID'] || '7f60b54c-cd15-433f-8bed-00acbcd25a17' @server = service.servers.create(:name => 'fogserverattachtest', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvolumetest', :size => 1) @volume.wait_for { ready? } collection_tests(@server.volume_attachments, {:server_id => @server.id, :volume_id => @volume.id, :device => '/dev/sdf'}, true) @volume.destroy @server.destroy end fog-1.34.0/tests/hp/models/compute/0000755000004100000410000000000012600047642017113 5ustar www-datawww-datafog-1.34.0/tests/hp/models/compute/security_group_tests.rb0000644000004100000410000000253412600047642023751 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | security_group", ['hp']) do # Disabled due to https://github.com/fog/fog/1546 pending model_tests(Fog::Compute[:hp].security_groups, {:name => 'foggroupname', :description => 'foggroupdescription'}, true) tests("a group with trailing whitespace") do @group = Fog::Compute[:hp].security_groups.create(:name => " foggroup with spaces ", :description => " fog group desc ") test("all spaces are removed from name") do @group.name == " foggroup with spaces ".strip! end test("all spaces are removed from description") do @group.description == " fog group desc ".strip! end @other_group = Fog::Compute[:hp].security_groups.create(:name => 'other group', :description => 'another group') test("authorize access by another security group") do sgrule = @group.create_rule(80..80, "tcp", nil, @other_group.id) @sg_rule_id = sgrule.body['security_group_rule']['id'] @group.reload s = @group.rules.select {|r| r['id'] == @sg_rule_id unless r.nil?} s[0]['id'] == @sg_rule_id end test("revoke access from another security group") do @group.delete_rule(@sg_rule_id) @group.reload s = @group.rules.select {|r| r['id'] == @sg_rule_id unless r.nil?} s.empty? end @other_group.destroy @group.destroy end end fog-1.34.0/tests/hp/models/compute/security_groups_tests.rb0000644000004100000410000000030312600047642024124 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | security_groups", ['hp']) do collection_tests(Fog::Compute[:hp].security_groups, {:name => 'foggroupname', :description => 'foggroupdescription'}, true) end fog-1.34.0/tests/hp/models/compute/metadata_image_tests.rb0000644000004100000410000000332512600047642023607 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | metadata for images", ['hp']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 @server = Fog::Compute[:hp].servers.create(:name => "fogsermdtests", :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } response = @server.create_image("fogimgmetadatatests", :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'}) unless Fog.mocking? sleep(10) end new_image_id = response.headers["Location"].split("/")[5] @image = Fog::Compute[:hp].images.get(new_image_id) tests('success') do tests("#all").succeeds do @image.metadata.all end tests("#get('Meta1')").succeeds do pending if Fog.mocking? @image.metadata.get('Meta1') end tests("#update({'Meta3' => 'MetaValue3'})").succeeds do @data = @image.metadata.update({'Meta3' => 'MetaValue3'}) test("metadata has updated correctly") do @image.metadata.get('Meta3').value == "MetaValue3" end end tests("#set({'Meta4' => 'MetaValue4'})").succeeds do @data = @image.metadata.set({'Meta4' => 'MetaValue4'}) test("metadata has set correctly") do @image.metadata.get('Meta4').value == "MetaValue4" end end tests("#save").succeeds do m = @image.metadata.new(:key => 'Meta5', :value => 'MetaValue5') @data = m.save test("metadata has saved correctly") do @image.metadata.get('Meta5').value == "MetaValue5" end end tests("#destroy('Meta5')").succeeds do @image.metadata.destroy('Meta5') test("metadata has been destroyed") do @image.metadata.get('Meta5') == nil end end end unless Fog.mocking? @image.destroy end @server.destroy end fog-1.34.0/tests/hp/models/compute/key_pair_tests.rb0000644000004100000410000000107112600047642022464 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | key_pair", ['hp']) do model_tests(Fog::Compute[:hp].key_pairs, {:name => 'fogkeyname'}, true) after do @keypair.destroy end tests("new keypair") do @keypair = Fog::Compute[:hp].key_pairs.create(:name => 'testkey') test ("writable?") do @keypair.writable? == true end end tests("existing keypair") do Fog::Compute[:hp].key_pairs.create(:name => 'testkey') @keypair = Fog::Compute[:hp].key_pairs.get('testkey') test("writable?") do @keypair.writable? == false end end end fog-1.34.0/tests/hp/models/compute/metadata_server_tests.rb0000644000004100000410000000306012600047642024027 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | metadata for servers", ['hp']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 @server = Fog::Compute[:hp].servers.create(:name => "fogsermetadatatests", :flavor_id => 100, :image_id => @base_image_id, :metadata => {'Meta1' => 'MetaValue1', 'Meta2' => 'MetaValue2'}) @server.wait_for { ready? } tests('success') do tests("#all").succeeds do @server.metadata.all end tests("#get('Meta1')").succeeds do @data = @server.metadata.get('Meta1') test("metadata gets correct value") do @data.value == "MetaValue1" end end tests("#update({'Meta3' => 'MetaValue3'})").succeeds do @data = @server.metadata.update({'Meta3' => 'MetaValue3'}) test("metadata has updated correctly") do @server.metadata.get('Meta3').value == "MetaValue3" end end tests("#set({'Meta4' => 'MetaValue4'})").succeeds do @data = @server.metadata.set({'Meta4' => 'MetaValue4'}) test("metadata has set correctly") do @server.metadata.get('Meta4').value == "MetaValue4" end end tests("#save").succeeds do m = @server.metadata.new(:key => 'Meta5', :value => 'MetaValue5') @data = m.save test("metadata has saved correctly") do @server.metadata.get('Meta5').value == "MetaValue5" end end tests("#destroy('Meta5')").succeeds do @data = @server.metadata.destroy('Meta5') test("metadata has been destroyed") do @server.metadata.get('Meta5') == nil end end end @server.destroy end fog-1.34.0/tests/hp/models/compute/key_pairs_tests.rb0000644000004100000410000000021612600047642022647 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | key_pairs", ['hp']) do collection_tests(Fog::Compute[:hp].key_pairs, {:name => 'fogkeyname'}, true) end fog-1.34.0/tests/hp/models/compute/addresses_tests.rb0000644000004100000410000000017112600047642022636 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | addresses", ['hp']) do collection_tests(Fog::Compute[:hp].addresses, {}, true) end fog-1.34.0/tests/hp/models/compute/address_tests.rb0000644000004100000410000000065112600047642022311 0ustar www-datawww-dataShindo.tests("Fog::Compute[:hp] | address", ['hp']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 model_tests(Fog::Compute[:hp].addresses, {}, true) do @server = Fog::Compute[:hp].servers.create(:name => "fogservertests", :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests('#server=').succeeds do @instance.server = @server end @server.destroy end end fog-1.34.0/tests/hp/models/lb/0000755000004100000410000000000012600047642016034 5ustar www-datawww-datafog-1.34.0/tests/hp/models/lb/algorithms_tests.rb0000644000004100000410000000042312600047642021753 0ustar www-datawww-dataShindo.tests('HP::LB | algorithms collection', ['hp', 'lb', 'algorithms']) do tests('success') do tests('#all').succeeds do HP[:lb].algorithms end tests('#get("ROUND_ROBIN")').succeeds do HP[:lb].algorithms.get("ROUND_ROBIN") end end end fog-1.34.0/tests/hp/models/lb/load_balancers_tests.rb0000644000004100000410000000112712600047642022535 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer collection', ['hp', 'lb', 'load_balancer']) do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} collection_tests(HP[:lb].load_balancers, attributes, true) tests('success') do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} @lb = HP[:lb].load_balancers.create(attributes) tests('#all').succeeds do HP[:lb].load_balancers.all end tests("#get(#{@lb.id})").succeeds do HP[:lb].load_balancers.get(@lb.id) end @lb.destroy end end fog-1.34.0/tests/hp/models/lb/load_balancer_virtual_ips_tests.rb0000644000004100000410000000105412600047642024772 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer virtual ips collection', ['hp', 'lb', 'virtual_ip']) do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} @lb = HP[:lb].load_balancers.create(attributes) tests('success') do @vip = HP[:lb].virtual_ips(:load_balancer => @lb).all.first tests('#all').succeeds do HP[:lb].virtual_ips(:load_balancer => @lb).all end tests("#get(#{@vip.id})").succeeds do HP[:lb].virtual_ips(:load_balancer => @lb).get(@vip.id) end end @lb.destroy end fog-1.34.0/tests/hp/models/lb/load_balancer_nodes_tests.rb0000644000004100000410000000120012600047642023532 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer nodes collection', ['hp', 'lb', 'node']) do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} @lb = HP[:lb].load_balancers.create(attributes) attributes = {:address => '15.185.1.1', :port => '80'} collection_tests(@lb.nodes, attributes, true) tests('success') do attributes = {:address => '15.185.1.1', :port => '80'} @node = @lb.nodes.create(attributes) tests('#all').succeeds do @lb.nodes.all end tests("#get(#{@node.id})").succeeds do @lb.nodes.get(@node.id) end @node.destroy end @lb.destroy end fog-1.34.0/tests/hp/models/lb/protocols_tests.rb0000644000004100000410000000037712600047642021636 0ustar www-datawww-dataShindo.tests('HP::LB | protocol collection', ['hp', 'lb', 'protocol']) do tests('success') do tests('#all').succeeds do HP[:lb].protocols end tests('#get("HTTP")').succeeds do HP[:lb].protocols.get('HTTP') end end end fog-1.34.0/tests/hp/models/lb/load_balancer_tests.rb0000644000004100000410000000035112600047642022350 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer model', ['hp', 'lb', 'load_balancer']) do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} model_tests(HP[:lb].load_balancers, attributes, true) end fog-1.34.0/tests/hp/models/lb/load_balancer_node_tests.rb0000644000004100000410000000050412600047642023355 0ustar www-datawww-dataShindo.tests('HP::LB | load balancer node model', ['hp', 'lb', 'node']) do attributes = {:name => 'fog-lb', :nodes => [{'address' => '15.185.1.1', 'port' => '80'}]} @lb = HP[:lb].load_balancers.create(attributes) attributes = {:address => '15.185.1.1', :port => '80'} model_tests(@lb.nodes, attributes, true) end fog-1.34.0/tests/hp/models/block_storage_v2/0000755000004100000410000000000012600047642020664 5ustar www-datawww-datafog-1.34.0/tests/hp/models/block_storage_v2/snapshots_tests.rb0000644000004100000410000000064012600047642024455 0ustar www-datawww-dataShindo.tests("HP::BlockStorageV2 | snapshots collection", ['hp', 'v2', 'block_storage', 'snapshots']) do @volume = HP[:block_storage_v2].volumes.create(:name => 'testsnap2vol', :size => 1) @volume.wait_for { ready? } unless Fog.mocking? collection_tests(HP[:block_storage_v2].snapshots, {:name => 'fogsnap2tests', :description => 'fogsnaptests-desc', :volume_id => @volume.id}, true) @volume.destroy end fog-1.34.0/tests/hp/models/block_storage_v2/snapshot_tests.rb0000644000004100000410000000125112600047642024271 0ustar www-datawww-dataShindo.tests("HP::BlockStorageV2 | snapshot model", ['hp', 'v2', 'block_storage', 'snapshots']) do @volume = HP[:block_storage_v2].volumes.create(:name => 'testsnap2vol', :size => 1) @volume.wait_for { ready? } unless Fog.mocking? model_tests(HP[:block_storage_v2].snapshots, {:name => 'fogsnap2tests', :description => 'fogsnaptests-desc', :volume_id => @volume.id}, true) do test("get(#{@instance.id})") do HP[:block_storage_v2].snapshots.get(@instance.id) != nil? end test("update(#{@instance.id}") do @instance.name = 'Updated' @instance.save @instance.reload @instance.name == 'Updated' end end @volume.destroy end fog-1.34.0/tests/hp/models/block_storage_v2/volumes_tests.rb0000644000004100000410000000035512600047642024130 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | volumes collection", ['hp', 'v2', 'block_storage', 'volumes']) do collection_tests(HP[:block_storage_v2].volumes, {:name => 'fogvol2tests', :description => 'fogvol2tests-desc', :size => 1}, true) end fog-1.34.0/tests/hp/models/block_storage_v2/volume_backups_tests.rb0000644000004100000410000000072012600047642025451 0ustar www-datawww-dataShindo.tests("Fog::Compute::HPV2 | volume backups collection", ['hp', 'v2', 'block_storage', 'backup']) do @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvolbkp2tests', :description => 'fogvolbkp2tests-desc', :size => 1) @volume.wait_for { ready? } unless Fog.mocking? collection_tests(HP[:block_storage_v2].volume_backups, {:name => 'fogbkp2tests', :description => 'fogbkp2tests-desc', :volume_id => @volume.id}, true) @volume.destroy end fog-1.34.0/tests/hp/models/block_storage_v2/volume_backup_tests.rb0000644000004100000410000000125512600047642025272 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | volume backup model", ['hp', 'v2', 'block_storage', 'backup']) do @volume = HP[:block_storage_v2].volumes.create(:name => 'fogvolbkp2tests', :description => 'fogvolbkp2tests-desc', :size => 1) @volume.wait_for { ready? } unless Fog.mocking? model_tests(HP[:block_storage_v2].volume_backups, {:name => 'fogbkp2tests', :description => 'fogbkp2tests-desc', :volume_id => @volume.id}, true) do # restore to new volume tests('restore()').succeeds do @instance.restore end # restore to specified volume tests("restore(#{@volume.id})").succeeds do @instance.restore(@volume.id) end end @volume.destroy end fog-1.34.0/tests/hp/models/block_storage_v2/volume_tests.rb0000644000004100000410000000114312600047642023741 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | volume model", ['hp', 'v2', 'block_storage', 'volumes']) do model_tests(HP[:block_storage_v2].volumes, {:name => 'fogvol2tests', :description => 'fogvol2tests-desc', :size => 1}, true) do test("get(#{@instance.id})") do HP[:block_storage_v2].volumes.get(@instance.id) != nil? end test("update(#{@instance.id})") do @instance.name = 'fogvol2tests Updated' @instance.save @instance.reload @instance.name == 'fogvol2tests Updated' end test("has_attachments?") do @instance.has_attachments? == false end end end fog-1.34.0/tests/hp/models/block_storage/0000755000004100000410000000000012600047642020255 5ustar www-datawww-datafog-1.34.0/tests/hp/models/block_storage/bootable_volume_tests.rb0000644000004100000410000000135212600047642025203 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | bootable volumes", ['hp', 'block_storage', 'volumes']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 model_tests(HP[:block_storage].bootable_volumes, {:name => "fogbvoltests", :description => "fogbvoltests-desc", :size => 10, :image_id => @base_image_id}, true) tests("new volume") do @volume = HP[:block_storage].bootable_volumes.create(:name => "testbvol", :size => 10, :image_id => @base_image_id) @volume.wait_for { ready? } unless Fog.mocking? test("get(#{@volume.id})") do HP[:block_storage].bootable_volumes.get(@volume.id) != nil? end test("has_attachments?") do @volume.has_attachments? == false end after do @volume.destroy end end end fog-1.34.0/tests/hp/models/block_storage/snapshot_tests.rb0000644000004100000410000000132212600047642023661 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | snapshots", ['hp', 'block_storage', 'snapshots']) do @volume = HP[:block_storage].volumes.create(:name => "testsnapvol", :size => 1) @volume.wait_for { ready? } unless Fog.mocking? model_tests(HP[:block_storage].snapshots, {:name => "fogsnaptests", :description => "fogsnaptests-desc", :volume_id => @volume.id}, true) tests("new snapshot") do @snapshot = HP[:block_storage].snapshots.create(:name => "testvol", :volume_id => @volume.id) @snapshot.wait_for { ready? } unless Fog.mocking? test("get(#{@snapshot.id})") do HP[:block_storage].snapshots.get(@snapshot.id) != nil? end after do @snapshot.destroy end end @volume.destroy end fog-1.34.0/tests/hp/models/block_storage/volume_tests.rb0000644000004100000410000000112612600047642023333 0ustar www-datawww-dataShindo.tests("HP::BlockStorage | volumes", ['hp', 'block_storage', 'volumes']) do model_tests(HP[:block_storage].volumes, {:name => "fogvoltests", :description => "fogvoltests-desc", :size => 1}, true) tests("new volume") do @volume = HP[:block_storage].volumes.create(:name => "testvol", :size => 1) @volume.wait_for { ready? } unless Fog.mocking? test("get(#{@volume.id})") do HP[:block_storage].volumes.get(@volume.id) != nil? end test("has_attachments?") do @volume.has_attachments? == false end after do @volume.destroy end end end fog-1.34.0/tests/hp/storage_tests.rb0000644000004100000410000000166512600047642017377 0ustar www-datawww-dataunless ENV["FOG_MOCK"] == "true" Shindo.tests('Fog::Storage::HP', ['hp', 'storage']) do credentials = { :auth_token => 'auth_token', :endpoint_url => 'http://127.0.0.1/path/', :cdn_endpoint_url => 'http://127.0.0.1/cdnpath/', :service_catalog => { :"Object Storage" => { :zone => 'http://127.0.0.1/path/'}, :"CDN" => { :zone => 'http://127.0.0.1/cdnpath/'}}, :expires => (DateTime.now + 1).to_s } options = { :hp_access_key => 'key', :hp_secret_key => 'secret', :hp_tenant_id => 'tenant', :hp_avl_zone => 'zone', :hp_auth_uri => 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens', :credentials => credentials } tests('Test cached Storage credentials').returns(credentials) do conn = Fog::Storage::HP::Real.new(options) conn.credentials end end end fog-1.34.0/tests/fogdocker/0000755000004100000410000000000012600047642015510 5ustar www-datawww-datafog-1.34.0/tests/fogdocker/requests/0000755000004100000410000000000012600047642017363 5ustar www-datawww-datafog-1.34.0/tests/fogdocker/requests/compute/0000755000004100000410000000000012600047642021037 5ustar www-datawww-datafog-1.34.0/tests/fogdocker/requests/compute/image_delete_tests.rb0000644000004100000410000000135212600047642025213 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | image_delete request", 'fogdocker') do compute = Fog::Compute[:fogdocker] image_hash = compute.image_create({'fromImage' => 'mattdm/fedora', 'repo'=>'test', 'tag'=>'delete_image'}) tests("Delete image") do begin response = compute.image_delete(:id => image_hash['id']) test("should be success") { response ? true : false } #mock doesn't throw errors rescue => e #should raise image not found test("error should be a kind of Docker::Error::NotFoundError") { e.kind_of? Docker::Error::NotFoundError} end end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.container_delete } end end fog-1.34.0/tests/fogdocker/requests/compute/container_delete_tests.rb0000644000004100000410000000106412600047642026113 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | container_delete request', ['fogdocker']) do compute = Fog::Compute[:fogdocker] container = compute.servers.create({'Image' => 'mattdm/fedora:f19', 'Cmd' => ['/bin/bash']}) tests('The response should') do response = compute.container_delete(:id => container.id) test('be a success') { response ? true: false } end tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.container_delete } end end fog-1.34.0/tests/fogdocker/requests/compute/container_action_tests.rb0000644000004100000410000000247512600047642026135 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | container_action request", 'fogdocker') do compute = Fog::Compute[:fogdocker] name = "fog-#{Time.now.to_i}" response = compute.container_create(:name => name, 'image' => 'mattdm/fedora:f19','Cmd' => ['date']) id = response['id'] tests("Start Container") do response = compute.container_action(:id => id, :action => :start) test("should be a kind of Hash") { response.kind_of? Hash } test("should be running") { response['state_running'] == true } end tests("Stop Container") do response = compute.container_action(:id => id, :action => :stop) test("should be a kind of Hash") { response.kind_of? Hash } end tests("Kill Container") do response = compute.container_action(:id => id, :action => :kill) test("should be a kind of Hash") { response.kind_of? Hash } test("should be stopped") { response['state_running'] == false } end tests("Top Container") do response = compute.container_action(:id => id, :action => :top) test("should be an Array") { response.kind_of? Array } test("should be an array of processes") { !!(response.first['PID'] =~ /^\d+$/) } end tests("Logs Container") do response = compute.container_action(:id => id, :action => :logs) test("should be a String") { response.kind_of? String } end end fog-1.34.0/tests/fogdocker/requests/compute/image_search_tests.rb0000644000004100000410000000073612600047642025223 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | image_search request", 'fogdocker') do compute = Fog::Compute[:fogdocker] tests("Search images") do response = compute.image_search('term' => 'test') test("should be a kind of Array") { response.kind_of? Array} test("Array elements should be a kind of Hash") { response.first.kind_of? Hash} test("response elemetns should have a name") { !response.first['name'].nil? && !response.first['name'].empty? } end end fog-1.34.0/tests/fogdocker/requests/compute/container_create_tests.rb0000644000004100000410000000146212600047642026116 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | container_create request", 'fogdocker') do compute = Fog::Compute[:fogdocker] name_base = Time.now.to_i tests("Create Container") do response = compute.container_create(:name => 'fog-'+name_base.to_s, 'image' => 'mattdm/fedora:f19','Cmd' => ['date'] ) test("should be a kind of Hash") { response.kind_of? Hash} end tests("Fail Creating Container") do begin response = compute.container_create(:name => 'fog-'+name_base.to_s, 'image' => 'mattdm/fedora:f19') test("should be a kind of Hash") { response.kind_of? Hash} #mock never raise exceptions rescue => e #should raise missing command in the create attributes. test("error should be a kind of Docker::Error") { e.kind_of? Docker::Error::ServerError} end end end fog-1.34.0/tests/fogdocker/requests/compute/image_create_tests.rb0000644000004100000410000000144612600047642025220 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | image_create request", 'fogdocker') do compute = Fog::Compute[:fogdocker] tests("Create image") do response = compute.image_create({'fromImage' => 'mattdm/fedora', 'repo'=>'test', 'tag'=>'create_image'}) test("should be a kind of Hash") { response.kind_of? Hash} test("should have an id") { !response['id'].nil? && !response['id'].empty? } end tests("Fail Creating image") do begin response = compute.image_create('fromImage' => 'not/exists') test("should be a kind of Hash") { response.kind_of? Hash} #mock never raise exceptions rescue => e #should raise missing command in the create attributes. test("error should be a kind of Docker::Error") { e.kind_of? Docker::Error::ServerError} end end end fog-1.34.0/tests/fogdocker/requests/compute/api_version_tests.rb0000644000004100000410000000037212600047642025126 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | api_version request', ['fogdocker']) do compute = Fog::Compute[:fogdocker] tests('The response should') do response = compute.api_version() test('be a Hash') { response.kind_of? Hash} end end fog-1.34.0/tests/fogdocker/requests/compute/container_commit_tests.rb0000644000004100000410000000114312600047642026137 0ustar www-datawww-dataShindo.tests("Fog::Compute[:fogdocker] | container_create request", 'fogdocker') do compute = Fog::Compute[:fogdocker] name_base = Time.now.to_i hash = compute.container_create(:name => 'fog-'+name_base.to_s, 'image' => 'mattdm/fedora:f19','Cmd' => ['date'] ) response = {} tests("Commit Container") do response = compute.container_commit(:id=>hash['id']) test("should have Image id") { response.include? 'id'} end test("Delete Commited Image") do result = compute.image_delete(:id=>response['id']) test("should have a deleted message") {result.include?('Deleted')} end end fog-1.34.0/tests/fogdocker/compute_tests.rb0000644000004100000410000000112712600047642020734 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker]', ['fogdocker']) do compute = Fog::Compute[:fogdocker] tests("Compute collections") do %w{ servers images }.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end tests("Compute requests") do %w{ api_version container_all container_create container_delete container_get container_action image_all image_create image_delete image_get image_search }.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end end fog-1.34.0/tests/fogdocker/models/0000755000004100000410000000000012600047642016773 5ustar www-datawww-datafog-1.34.0/tests/fogdocker/models/compute/0000755000004100000410000000000012600047642020447 5ustar www-datawww-datafog-1.34.0/tests/fogdocker/models/compute/image_tests.rb0000644000004100000410000000174212600047642023304 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | image model', ['fogdocker']) do images = Fog::Compute[:fogdocker].images image = images.last.reload tests('The image model should') do tests('have the action') do test('reload') { image.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = image.attributes attributes = [ :id, :repo_tags, :created, :size ] tests("The image model should respond to") do attributes.each do |attribute| test("#{attribute}") { image.respond_to? attribute } end end tests("The attributes hash should have key") do (attributes-[:repo_tags]).each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Fogdocker::image') { image.kind_of? Fog::Compute::Fogdocker::Image } end end fog-1.34.0/tests/fogdocker/models/compute/server_tests.rb0000644000004100000410000000367012600047642023532 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | server model', ['fogdocker']) do compute = Fog::Compute[:fogdocker] server = compute.servers.create(:name => "fog-#{Time.now.to_i}", 'image' => 'mattdm/fedora:f19','Cmd' => ['date']) tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ start restart stop commit destroy}.each do |action| test(action) { server.respond_to? action } end %w{ start restart stop commit destroy}.each do |action| test("#{action} returns successfully") { server.send(action.to_sym) ? true : false } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :id, :name, :created, :ipaddress, :state_running, :memory, :cores, :cpu_shares, :hostname, :image, :attach_stdin, :attach_stdout, :attach_stderr, :state_exit_code, :state_pid, :port_bindings, :links, :privileged, :tty, :exposed_ports, :volumes, :environment_variables ] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end tests("The attributes hash should have key") do attributes.each do |attribute| test("#{attribute}") { model_attribute_hash.key? attribute } end end end test('be a kind of Fog::Compute::Fogdocker::Server') { server.kind_of? Fog::Compute::Fogdocker::Server } end end fog-1.34.0/tests/fogdocker/models/compute/servers_tests.rb0000644000004100000410000000104712600047642023711 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | servers collection', ['fogdocker']) do servers = Fog::Compute[:fogdocker].servers tests('The servers collection') do test('should not be empty') { not servers.empty? } test('should be a kind of Fog::Compute::Fogdocker::Servers') { servers.kind_of? Fog::Compute::Fogdocker::Servers } tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do tests('by instance uuid').succeeds { servers.get(servers.first.id) } end end end fog-1.34.0/tests/fogdocker/models/compute/images_tests.rb0000644000004100000410000000043712600047642023467 0ustar www-datawww-dataShindo.tests('Fog::Compute[:fogdocker] | images collection', ['fogdocker']) do images = Fog::Compute[:fogdocker].images tests('The images collection') do test('should be a kind of Fog::Compute::Fogdocker::images') { images.kind_of? Fog::Compute::Fogdocker::Images } end end fog-1.34.0/tests/rackspace/0000755000004100000410000000000012600047642015501 5ustar www-datawww-datafog-1.34.0/tests/rackspace/auto_scale_tests.rb0000644000004100000410000001024412600047642021370 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::AutoScale.new :rackspace_region => :dfw assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('current authentation') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::AutoScale.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true}, :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_groups end tests('dfw region').succeeds do @service = Fog::Rackspace::AutoScale.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_groups end tests('ord region').succeeds do @service = Fog::Rackspace::AutoScale.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.list_groups end tests('custom endpoint') do @service = Fog::Rackspace::AutoScale.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_auto_scale_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('specify region').succeeds do @service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.list_groups end tests('custom endpoint') do @service = Fog::Rackspace::AutoScale.new :rackspace_auto_scale_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? @service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(true) { [200, 203].include? @service.list_groups.status } end end fog-1.34.0/tests/rackspace/queues_tests.rb0000644000004100000410000001115712600047642020564 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::Queues.new assert_method nil, :authenticate_v2 assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('authentication v1') do raises(Fog::Errors::NotImplemented) do @service = Fog::Rackspace::Queues.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' end end tests('authentication v2') do tests('variables populated').succeeds do @service = Fog::Rackspace::Queues.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.queues end tests('dfw region').succeeds do #We consistently use DFW as our default but queues doesn't have a DFW default region yet. # We can enable this test once they have a DFW region (which they will) pending @service = Fog::Rackspace::Queues.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.queues end tests('ord region').succeeds do @service = Fog::Rackspace::Queues.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.queues end end tests('default auth') do tests('no params').succeeds do #We consistently use DFW as our default but queues doesn't have a DFW default region yet. # We can enable this test once they have a DFW region (which they will) pending @service = Fog::Rackspace::Queues.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.queues end tests('specify region').succeeds do @service = Fog::Rackspace::Queues.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.queues end end tests('reauthentication') do @service = Fog::Rackspace::Queues.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(true, 'list queues call succeeds') { [200, 204].include?(@service.list_queues.status) } end @service = Fog::Rackspace::Queues.new tests('#queues').succeeds do data = @service.queues returns(true) { data.is_a? Array } end tests('client_id') do tests('should generate uuid if a client id is not provided').succeeds do pending unless Fog::UUID.supported? service = Fog::Rackspace::Queues.new service.client_id =~ /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ end tests('should use specified uuid').succeeds do pending unless Fog::UUID.supported? my_uuid = Fog::UUID.uuid service = Fog::Rackspace::Queues.new :rackspace_queues_client_id => my_uuid service.client_id == my_uuid end end end fog-1.34.0/tests/rackspace/identity_tests.rb0000644000004100000410000000223212600047642021100 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity', ['rackspace']) do tests('current authentication') do tests('variables populated').returns(200) do @service = Fog::Rackspace::Identity.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true} returns(true, "auth token populated") { !@service.auth_token.nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } returns(false, "service catalog populated") { @service.service_catalog.nil? } @service.list_tenants.status end end tests('reauthentication') do tests('should reauth with valid credentials') do @service = Fog::Rackspace::Identity.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.auth_token.nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(true) { [200, 203].include? @service.list_tenants.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Rackspace::Identity.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/helper.rb0000644000004100000410000000643012600047642017310 0ustar www-datawww-dataLINKS_FORMAT = [{ 'href' => String, 'rel' => String }] module Shindo class Tests def given_a_load_balancer_service(&block) @service = Fog::Rackspace::LoadBalancers.new instance_eval(&block) end def given_a_load_balancer(&block) @lb = @service.load_balancers.create({ :name => ('fog' + Time.now.to_i.to_s), :protocol => 'HTTP', :port => 80, :virtual_ips => [{ :type => 'PUBLIC'}], :nodes => [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}] }) @lb.wait_for { ready? } begin instance_eval(&block) ensure @lb.wait_for { ready? } @lb.destroy end end def wait_for_request(description = "waiting", &block) return if Fog.mocking? tests(description) do Fog.wait_for &block end end def wait_for_server_deletion(server) return if Fog.mocking? begin @instance.wait_for { state = 'DELETED' } rescue Fog::Compute::RackspaceV2::NotFound => e # do nothing end end def wait_for_server_state(service, server_id, state, error_states=nil) current_state = nil until current_state == state current_state = service.get_server(server_id).body['server']['status'] if error_states error_states = Array(error_states) if error_states.include?(current_state) Fog::Logger.warning caller Fog::Logger.warning "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'" return end end sleep 10 unless Fog.mocking? end sleep 30 unless Fog.mocking? end def wait_for_volume_state(service, volume_id, state) current_state = nil until current_state == state current_state = service.get_volume(volume_id).body['volume']['status'] if current_state == 'error' Fog::Logger.warning caller Fog::Logger.warning "Volume is in an error state!" return end sleep 10 unless Fog.mocking? end end def rackspace_test_image_id(service) image_id = Fog.credentials[:rackspace_image_id] # I chose to use the first Ubuntu because it will work with the smallest flavor and it doesn't require a license image_id ||= Fog.mocking? ? service.images.first.id : service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image end def rackspace_test_flavor_id(service) @flavor_id ||= Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id end # After a server has been successfully deleted they are still being reported as attached to a cloud network # causing delete calls to fail. This method attempts to address that. def delete_test_network(network) return false if Fog.mocking? || network.nil? attempt = 0 begin network.destroy rescue Fog::Compute::RackspaceV2::ServiceError => e if attempt == 3 Fog::Logger.warning "Unable to delete #{network.label}" return false end Fog::Logger.warning "Network #{network.label} Delete Fail Attempt #{attempt}- #{e.inspect}" attempt += 1 sleep 60 retry end return true end end end fog-1.34.0/tests/rackspace/url_encoding_tests.rb0000644000004100000410000000043312600047642021720 0ustar www-datawww-dataShindo.tests('Rackspace | url_encoding', ['rackspace']) do returns("is%20this%20my%20file%3F.jpg") { Fog::Rackspace.escape("is this my file?.jpg") } returns("foo/bar") { Fog::Rackspace.escape("foo/bar", "/") } returns("foo%2Fbar") { Fog::Rackspace.escape("foo/bar", "0") } end fog-1.34.0/tests/rackspace/service_tests.rb0000644000004100000410000000456512600047642020722 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Service', ['rackspace']) do tests('process_response') do @service = Fog::Rackspace::Service.new tests('nil').returns(nil) do @service.send(:process_response, nil) end tests('response missing body').returns(nil) do response = Excon::Response.new response.body = nil @service.send(:process_response, response) end tests('processes body').returns({'a'=>2, 'b'=>3}) do response = Excon::Response.new response.headers['Content-Type'] = "application/json" response.body = "{\"a\":2,\"b\":3}" @service.send(:process_response, response) response.body end tests('process body with hash').returns({:a=>2, :b=>3}) do response = Excon::Response.new response.headers['Content-Type'] = "application/json" response.body = {:a=>2, :b=>3} @service.send(:process_response, response) response.body end tests('handles malformed json').returns({}) do response = Excon::Response.new response.headers['Content-Type'] = "application/json" response.body = "I am totally not json" @service.send(:process_response, response) response.body end end tests('headers') do # adding an implementation for auth_token to service instance. Normally this would come from a subclass. def @service.auth_token "my_auth_token" end HEADER_HASH = { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @service.auth_token }.freeze tests('without options').returns(HEADER_HASH) do @service.send(:headers) end tests('with options not containing :header key').returns(HEADER_HASH) do @service.send(:headers, {:a => 3}) end tests('with options containing :header key').returns(HEADER_HASH.merge(:a => 3)) do @service.send(:headers, :headers => {:a => 3}) end end tests('request_params') do REQUEST_HASH = { :path=>"/endpoint/my_service", :headers=>{"Content-Type"=>"application/json", "Accept"=>"application/json", "X-Auth-Token"=>"my_auth_token"}, }.freeze uri = URI.parse("http://fog.io/endpoint") @service.instance_variable_set("@uri", uri) params = {:path => 'my_service'} tests('returns request hash').returns(REQUEST_HASH) do @service.send(:request_params, params) end end end fog-1.34.0/tests/rackspace/dns_tests.rb0000644000004100000410000001272712600047642020045 0ustar www-datawww-dataShindo.tests('Fog::DNS::Rackspace', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::DNS::Rackspace.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('legacy authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "contains tenant id") { (@service.instance_variable_get("@uri").path =~ /\/v1\.0\/\d+$/) != nil} #dns does not error if tenant id is missing returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_domains end tests('custom endpoint') do @service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_dns_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('current authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } returns(true, "contains tenant id") { (@service.instance_variable_get("@uri").path =~ /\/v1\.0\/\d+$/) != nil} #dns does not error if tenant id is missing identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_domains end tests('custom endpoint') do @service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_dns_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::DNS::Rackspace.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } returns(true, "contains tenant id") { (@service.instance_variable_get("@uri").path =~ /\/v1\.0\/\d+$/) != nil} #dns does not error if tenant id is missing @service.list_domains end tests('custom endpoint') do @service = Fog::DNS::Rackspace.new :rackspace_dns_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::DNS::Rackspace.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(200) { @service.list_domains.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::DNS::Rackspace.new :rackspace_api_key => 'bad_key' } end end tests('array_to_query_string') do pending if Fog.mocking? @service = Fog::DNS::Rackspace.new returns("") { @service.send(:array_to_query_string, nil) } returns("param1=1") { @service.send(:array_to_query_string, {:param1 => [1]}) } returns("param1=1") { @service.send(:array_to_query_string, {:param1 => 1}) } returns("param1=1,2") { @service.send(:array_to_query_string, {:param1 => [1,2]}) } returns("param1=1¶m2=2") { @service.send(:array_to_query_string, {:param1 => [1], :param2 => [2]}) } end end fog-1.34.0/tests/rackspace/databases_tests.rb0000644000004100000410000001441112600047642021200 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases', ['rackspace']) do |variable| pending if Fog.mocking? def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::Databases.new assert_method nil, :authenticate_v2 assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('authentication v1') do pending if Fog.mocking? tests('variables populated') do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.flavors end tests('custom endpoint') do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_database_url => 'https://my-custom-endpoint.com' returns(false, "auth token populated") { @service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('authentication v2') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.flavors end tests('dfw region').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.flavors end tests('ord region').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.flavors end tests('custom endpoint') do @service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_database_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.flavors end tests('specify old contstant style service endoint').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_endpoint => Fog::Rackspace::Databases::ORD_ENDPOINT returns(true) { (@service.instance_variable_get("@uri").to_s =~ /#{Fog::Rackspace::Databases::ORD_ENDPOINT}/ ) != nil } @service.flavors end tests('specify region').succeeds do @service = Fog::Rackspace::Databases.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.flavors end tests('custom endpoint') do @service = Fog::Rackspace::Databases.new :rackspace_database_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Rackspace::Databases.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(200) { @service.list_flavors.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Rackspace::Databases.new :rackspace_api_key => 'bad_key' } end end @service = Fog::Rackspace::Databases.new tests('#flavors').succeeds do data = @service.flavors returns(true) { data.is_a? Array } end tests('#instances').succeeds do data = @service.instances returns(true) { data.is_a? Array } end tests('#databases').succeeds do data = @service.databases returns(true) { data.is_a? Array } end tests('#users').succeeds do data = @service.users returns(true) { data.is_a? Array } end end fog-1.34.0/tests/rackspace/requests/0000755000004100000410000000000012600047642017354 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/databases/0000755000004100000410000000000012600047642021303 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/databases/helper.rb0000644000004100000410000000226712600047642023116 0ustar www-datawww-dataFLAVOR_FORMAT = { 'id' => Integer, 'name' => String, 'ram' => Integer, 'links' => LINKS_FORMAT } GET_FLAVOR_FORMAT = { 'flavor' => FLAVOR_FORMAT } LIST_FLAVORS_FORMAT = { 'flavors' => [FLAVOR_FORMAT] } INSTANCE_FORMAT = { 'id' => String, 'name' => String, 'status' => String, 'links' => LINKS_FORMAT, 'flavor' => { 'id' => String, 'links' => LINKS_FORMAT }, 'volume' => { 'size' => Integer } } INSTANCE_DETAILS_FORMAT = INSTANCE_FORMAT.merge({ 'created' => String, 'updated' => String, 'hostname' => String, }) CREATE_INSTANCE_FORMAT = { 'instance' => INSTANCE_DETAILS_FORMAT } GET_INSTANCE_FORMAT = { 'instance' => INSTANCE_DETAILS_FORMAT.merge({ 'volume' => { 'size' => Integer, 'used' => Float } }) } LIST_INSTANCES_FORMAT = { 'instances' => [ INSTANCE_FORMAT ] } CHECK_ROOT_USER_FORMAT = { 'rootEnabled' => Fog::Boolean } ENABLE_ROOT_USER_FORMAT = { 'user' => { 'name' => String, 'password' => String } } LIST_DATABASES_FORMAT = { 'databases' => [{ 'name' => String }] } LIST_USERS_FORMAT = { 'users' => [{ 'name' => String, 'databases' => [{ 'name' => String }] }] } fog-1.34.0/tests/rackspace/requests/databases/flavor_tests.rb0000644000004100000410000000060212600047642024341 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Database | flavor_tests', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new tests('success') do tests('#list_flavors_details').formats(LIST_FLAVORS_FORMAT) do service.list_flavors().body end tests('#get_flavor(1)').formats(GET_FLAVOR_FORMAT) do service.get_flavor(1).body end end end fog-1.34.0/tests/rackspace/requests/databases/database_tests.rb0000644000004100000410000000241112600047642024614 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Database | database_tests', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance_name = 'fog' + Time.now.to_i.to_s begin @instance_id = service.create_instance(instance_name, 1, 1).body['instance']['id'] wait_for_request("waiting for database to be created") do service.get_instance(@instance_id).body["instance"]["status"] == 'ACTIVE' end tests('success') do database_name = 'fogdb' + Time.now.to_i.to_s tests("#create_database(#{@instance_id}, #{database_name})").returns(202) do service.create_database(@instance_id, database_name).status end tests("#list_databases{#{@instance_id})").formats(LIST_DATABASES_FORMAT) do service.list_databases(@instance_id).body end tests("#delete_database(#{@instance_id}, #{database_name})").returns(202) do service.delete_database(@instance_id, database_name).status end end tests('failure') do tests("#create_database(#{@instance_id}, '') => Invalid Create Critera").raises(Fog::Rackspace::Databases::BadRequest) do service.create_database(@instance_id, '') end end ensure service.delete_instance(@instance_id) if @instance_id end end fog-1.34.0/tests/rackspace/requests/databases/instance_tests.rb0000644000004100000410000000423312600047642024660 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Database | instance_tests', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new tests('success') do instance_id = nil instance_name = 'fog' + Time.now.to_i.to_s tests("#list_instances").formats(LIST_INSTANCES_FORMAT) do service.list_instances.body end tests("#create_instance(#{instance_name}, 1, 1)").formats(CREATE_INSTANCE_FORMAT) do data = service.create_instance(instance_name, 1, 1).body instance_id = data['instance']['id'] data end until service.get_instance(instance_id).body["instance"]["status"] == 'ACTIVE' sleep 10 end tests("#get_instance(#{instance_id})").formats(GET_INSTANCE_FORMAT) do service.get_instance(instance_id).body end tests("#check_root_user(#{instance_id})").formats(CHECK_ROOT_USER_FORMAT) do service.check_root_user(instance_id).body end tests("#enable_root_user(#{instance_id})").formats(ENABLE_ROOT_USER_FORMAT) do service.enable_root_user(instance_id).body end tests("#restart_instance(#{instance_id})").succeeds do service.restart_instance(instance_id) end until service.get_instance(instance_id).body["instance"]["status"] == 'ACTIVE' sleep 10 end tests("#resize_instance(#{instance_id}, 2)").succeeds do service.resize_instance(instance_id, 2) end until service.get_instance(instance_id).body["instance"]["status"] == 'ACTIVE' sleep 10 end tests("#resize_instance_volume(#{instance_id}, 2)").succeeds do service.resize_instance_volume(instance_id, 2) end until service.get_instance(instance_id).body["instance"]["status"] == 'ACTIVE' sleep 10 end tests("#delete_instance(#{instance_id})").succeeds do service.delete_instance(instance_id) end end tests('failure') do tests("#create_instance('', 0, 0) => Invalid Create Critera").raises(Fog::Rackspace::Databases::BadRequest) do service.create_instance('', 0, 0) end tests("#get_instance('') => Does not exist").raises(Fog::Rackspace::Databases::NotFound) do service.get_instance('') end end end fog-1.34.0/tests/rackspace/requests/databases/user_tests.rb0000644000004100000410000000224612600047642024034 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Database | user_tests', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance_name = 'fog' + Time.now.to_i.to_s instance_id = service.create_instance(instance_name, 1, 1).body['instance']['id'] wait_for_request("Waiting for database to be created") do service.get_instance(instance_id).body["instance"]["status"] == 'ACTIVE' end tests('success') do user_name = 'fog' + Time.now.to_i.to_s password = 'password1' tests("#create_user(#{instance_id}, #{user_name}, #{password})").returns(202) do service.create_user(instance_id, user_name, password).status end tests("#list_users{#{instance_id})").formats(LIST_USERS_FORMAT) do service.list_users(instance_id).body end tests("#delete_user(#{instance_id}, #{user_name})").returns(202) do service.delete_user(instance_id, user_name).status end end tests('failure') do tests("#create_user(#{instance_id}, '', '') => Invalid Create Critera").raises(Fog::Rackspace::Databases::BadRequest) do service.create_user(instance_id, '', '') end end service.delete_instance(instance_id) end fog-1.34.0/tests/rackspace/requests/storage/0000755000004100000410000000000012600047642021020 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/storage/object_tests.rb0000644000004100000410000002152012600047642024035 0ustar www-datawww-datarequire 'uri' require 'cgi' Shindo.tests('Fog::Storage[:rackspace] | object requests', ["rackspace"]) do @directory = Fog::Storage[:rackspace].directories.create(:key => 'fogobjecttests') module RackspaceStorageHelpers def override_path(path) @uri.path = path end end def parse_url(url_string) uri = URI.parse(url_string) query_hash = CGI.parse(uri.query) query_hash.each do |k, v| query_hash[k] = v[0] if query_hash[k].is_a?(Array) and query_hash[k].count == 1 end { :scheme => uri.scheme, :host => uri.host, :port => uri.port, :path => uri.path, :query => query_hash } end tests('success') do tests("#put_object('fogobjecttests', 'fog_object')").succeeds do Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_object', lorem_file) end tests("#get_object('fogobjectests', 'fog_object')").succeeds do Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_object').body == lorem_file.read end tests("#get_object('fogobjecttests', 'fog_object', &block)").succeeds do data = '' Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_object') do |chunk, remaining_bytes, total_bytes| data << chunk end data == lorem_file.read end tests("#head_object('fogobjectests', 'fog_object')").succeeds do Fog::Storage[:rackspace].head_object('fogobjecttests', 'fog_object') end tests("#delete_object('fogobjecttests', 'fog_object')").succeeds do Fog::Storage[:rackspace].delete_object('fogobjecttests', 'fog_object') end # an object key with no special characters tests("#get_object_http_url('fogobjecttests', 'fog_object','expiration timestamp')").succeeds do expires_at = 1344149532 # 2012-08-05 16:52:12 +1000 storage = Fog::Storage::Rackspace.new(:rackspace_temp_url_key => "super_secret") storage.extend RackspaceStorageHelpers storage.override_path('/fake_version/fake_tenant') object_url = storage.get_object_http_url('fogobjecttests', 'fog_object', expires_at) url = parse_url(object_url) [ url[:host] =~ /.*clouddrive\.com$/, url[:path] =~ /\/fogobjecttests\/fog_object$/, url[:query]['temp_url_sig'] == '7e69a73092e333095a70b3be826a7350fcbede86', url[:query]['temp_url_expires'] == '1344149532' ].all? end # an object key with no special characters tests("#get_object_https_url('fogobjecttests', 'fog_object','expiration timestamp')").succeeds do expires_at = 1344149532 # 2012-08-05 16:52:12 +1000 storage = Fog::Storage::Rackspace.new(:rackspace_temp_url_key => "super_secret") storage.extend RackspaceStorageHelpers storage.override_path('/fake_version/fake_tenant') object_url = storage.get_object_https_url('fogobjecttests', 'fog_object', expires_at) url = parse_url(object_url) [ url[:host] =~ /.*clouddrive\.com$/, url[:path] =~ /\/fogobjecttests\/fog_object$/, url[:query]['temp_url_sig'] == '7e69a73092e333095a70b3be826a7350fcbede86', url[:query]['temp_url_expires'] == '1344149532' ].all? end # an object key nested under a / tests("#get_object_https_url('fogobjecttests', 'fog/object','expiration timestamp')").succeeds do expires_at = 1344149532 # 2012-08-05 16:52:12 +1000 storage = Fog::Storage::Rackspace.new(:rackspace_temp_url_key => "super_secret") storage.extend RackspaceStorageHelpers storage.override_path('/fake_version/fake_tenant') object_url = storage.get_object_https_url('fogobjecttests', 'fog/object', expires_at) url = parse_url(object_url) [ url[:host] =~ /.*clouddrive\.com$/, url[:path] =~ /\/fogobjecttests\/fog\/object$/, url[:query]['temp_url_sig'] == '3e99892828804e3d0fdadd18c543b688591ca8b8', url[:query]['temp_url_expires'] == '1344149532' ].all? end # an object key containing a - tests("#get_object_https_url('fogobjecttests', 'fog-object','expiration timestamp')").succeeds do expires_at = 1344149532 # 2012-08-05 16:52:12 +1000 storage = Fog::Storage::Rackspace.new(:rackspace_temp_url_key => "super_secret") storage.extend RackspaceStorageHelpers storage.override_path('/fake_version/fake_tenant') object_url = storage.get_object_https_url('fogobjecttests', 'fog-object', expires_at) url = parse_url(object_url) [ url[:host] =~ /.*clouddrive\.com$/, url[:path] =~ /\/fogobjecttests\/fog-object$/, url[:query]['temp_url_sig'] == 'a24dd5fc955a57adce7d1b5bc4ec2c7660ab8396', url[:query]['temp_url_expires'] == '1344149532' ].all? end tests("put_object with block") do tests("#put_object('fogobjecttests', 'fog_object', &block)").succeeds do begin file = lorem_file buffer_size = file.stat.size / 2 # chop it up into two buffers Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_block_object', nil) do file.read(buffer_size).to_s end ensure file.close end end tests('#get_object').succeeds do Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_block_object').body == lorem_file.read end tests('#delete_object').succeeds do Fog::Storage[:rackspace].delete_object('fogobjecttests', 'fog_block_object') end end tests('#delete_multiple_objects') do Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_object', lorem_file) Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_object2', lorem_file) Fog::Storage[:rackspace].directories.create(:key => 'fogobjecttests2') Fog::Storage[:rackspace].put_object('fogobjecttests2', 'fog_object', lorem_file) expected = { "Number Not Found" => 0, "Response Status" => "200 OK", "Errors" => [], "Number Deleted" => 2, "Response Body" => "" } returns(expected, 'deletes multiple objects') do Fog::Storage[:rackspace].delete_multiple_objects('fogobjecttests', ['fog_object', 'fog_object2']).body end returns(expected, 'deletes object and container') do Fog::Storage[:rackspace].delete_multiple_objects(nil, ['fogobjecttests2/fog_object', 'fogobjecttests2']).body end end end tests('failure') do tests("#get_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_non_object') end tests("#get_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].get_object('fognoncontainer', 'fog_non_object') end tests("#head_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].head_object('fogobjecttests', 'fog_non_object') end tests("#head_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].head_object('fognoncontainer', 'fog_non_object') end tests("#delete_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].delete_object('fogobjecttests', 'fog_non_object') end tests("#delete_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].delete_object('fognoncontainer', 'fog_non_object') end tests('#delete_multiple_objects') do expected = { "Number Not Found" => 2, "Response Status" => "200 OK", "Errors" => [], "Number Deleted" => 0, "Response Body" => "" } returns(expected, 'reports missing objects') do Fog::Storage[:rackspace].delete_multiple_objects('fogobjecttests', ['fog_non_object', 'fog_non_object2']).body end returns(expected, 'reports missing container') do Fog::Storage[:rackspace].delete_multiple_objects('fognoncontainer', ['fog_non_object', 'fog_non_object2']).body end tests('deleting non-empty container') do Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_object', lorem_file) expected = { "Number Not Found" => 0, "Response Status" => "400 Bad Request", "Errors" => [['fogobjecttests', '409 Conflict']], "Number Deleted" => 1, "Response Body" => "" } body = Fog::Storage[:rackspace].delete_multiple_objects(nil, ['fogobjecttests', 'fogobjecttests/fog_object']).body expected['Errors'][0][0] = body['Errors'][0][0] rescue nil returns(expected, 'deletes object but not container') { body } end end end @directory.destroy end fog-1.34.0/tests/rackspace/requests/storage/large_object_tests.rb0000644000004100000410000003363712600047642025223 0ustar www-datawww-dataShindo.tests('Fog::Storage[:rackspace] | large object requests', ['rackspace']) do @directory = Fog::Storage[:rackspace].directories.create(:key => 'foglargeobjecttests') @directory2 = Fog::Storage[:rackspace].directories.create(:key => 'foglargeobjecttests2') @segments = { :a => { :container => @directory.identity, :name => 'fog_large_object/a', :data => 'a' * (1024**2 + 10), :size => 1024**2 + 10, :etag => 'c2e97007d59f0c19b850debdcb80cca5' }, :b => { :container => @directory.identity, :name => 'fog_large_object/b', :data => 'b' * (1024**2 + 20), :size => 1024**2 + 20, :etag => 'd35f50622a1259daad75ff7d5512c7ef' }, :c => { :container => @directory.identity, :name => 'fog_large_object2/a', :data => 'c' * (1024**2 + 30), :size => 1024**2 + 30, :etag => '901d3531a87d188041d4d5b43cb464c1' }, :d => { :container => @directory2.identity, :name => 'fog_large_object2/b', :data => 'd' * (1024**2 + 40), :size => 1024**2 + 40, :etag => '350c0e00525198813920a157df185c8d' } } tests('success') do tests('upload test segments').succeeds do @segments.each_value do |segment| Fog::Storage[:rackspace].put_object(segment[:container], segment[:name], segment[:data]) end end tests('dynamic large object requests') do tests('#put_object_manifest alias').succeeds do Fog::Storage[:rackspace].put_object_manifest(@directory.identity, 'fog_large_object') end tests('using default X-Object-Manifest header') do tests('#put_dynamic_obj_manifest').succeeds do Fog::Storage[:rackspace].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object') end tests('#get_object streams all segments matching the default prefix').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] + @segments[:c][:data] Fog::Storage[:rackspace].get_object(@directory.identity, 'fog_large_object').body == expected end # When the manifest object name is equal to the segment prefix, OpenStack treats it as if it's the first segment. # So you must prepend the manifest object's Etag - Digest::MD5.hexdigest('') tests('#head_object returns Etag that includes manifest object in calculation').succeeds do etags = ['d41d8cd98f00b204e9800998ecf8427e', @segments[:a][:etag], @segments[:b][:etag], @segments[:c][:etag]] expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"2577f38428e895c50de6ea78ccc7da2a"\" Fog::Storage[:rackspace].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected end end tests('specifying X-Object-Manifest segment prefix') do tests('#put_dynamic_obj_manifest').succeeds do options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" } Fog::Storage[:rackspace].put_dynamic_obj_manifest(@directory.identity, 'fog_large_object', options) end tests('#get_object streams segments only matching the specified prefix').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] Fog::Storage[:rackspace].get_object(@directory.identity, 'fog_large_object').body == expected end tests('#head_object returns Etag that does not include manifest object in calculation').succeeds do etags = [@segments[:a][:etag], @segments[:b][:etag]] expected = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # returned in quotes "\"0f035ed3cc38aa0ef46dda3478fad44d"\" Fog::Storage[:rackspace].head_object(@directory.identity, 'fog_large_object').headers['Etag'] == expected end end tests('storing manifest in a different container than the segments') do tests('#put_dynamic_obj_manifest').succeeds do options = { 'X-Object-Manifest' => "#{ @directory.identity }/fog_large_object/" } Fog::Storage[:rackspace].put_dynamic_obj_manifest(@directory2.identity, 'fog_large_object', options) end tests('#get_object').succeeds do expected = @segments[:a][:data] + @segments[:b][:data] Fog::Storage[:rackspace].get_object(@directory2.identity, 'fog_large_object').body == expected end end end tests('static large object requests') do tests('single container') do tests('#put_static_obj_manifest').succeeds do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:a][:size] }, { :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }", :etag => @segments[:c][:etag], :size_bytes => @segments[:c][:size] } ] Fog::Storage[:rackspace].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) end tests('#head_object') do etags = [@segments[:a][:etag], @segments[:c][:etag]] etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"ad7e633a12e8a4915b45e6dd1d4b0b4b\"" content_length = (@segments[:a][:size] + @segments[:c][:size]).to_s response = Fog::Storage[:rackspace].head_object(@directory.identity, 'fog_large_object') returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] } returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] } returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] } end tests('#get_object').succeeds do expected = @segments[:a][:data] + @segments[:c][:data] Fog::Storage[:rackspace].get_object(@directory.identity, 'fog_large_object').body == expected end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 0, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 3, 'Response Body' => '' } returns(expected, 'deletes manifest and segments') do Fog::Storage[:rackspace].delete_static_large_object(@directory.identity, 'fog_large_object').body end end end tests('multiple containers') do tests('#put_static_obj_manifest').succeeds do segments = [ { :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:b][:size] }, { :path => "#{ @segments[:d][:container] }/#{ @segments[:d][:name] }", :etag => @segments[:d][:etag], :size_bytes => @segments[:d][:size] } ] Fog::Storage[:rackspace].put_static_obj_manifest(@directory2.identity, 'fog_large_object', segments) end tests('#head_object') do etags = [@segments[:b][:etag], @segments[:d][:etag]] etag = "\"#{ Digest::MD5.hexdigest(etags.join) }\"" # "\"9801a4cc4472896a1e975d03f0d2c3f8\"" content_length = (@segments[:b][:size] + @segments[:d][:size]).to_s response = Fog::Storage[:rackspace].head_object(@directory2.identity, 'fog_large_object') returns(etag, 'returns ETag computed from segments') { response.headers['Etag'] } returns(content_length , 'returns Content-Length for all segments') { response.headers['Content-Length'] } returns('True', 'returns X-Static-Large-Object header') { response.headers['X-Static-Large-Object'] } end tests('#get_object').succeeds do expected = @segments[:b][:data] + @segments[:d][:data] Fog::Storage[:rackspace].get_object(@directory2.identity, 'fog_large_object').body == expected end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 0, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 3, 'Response Body' => '' } returns(expected, 'deletes manifest and segments') do Fog::Storage[:rackspace].delete_static_large_object(@directory2.identity, 'fog_large_object').body end end end end end tests('failure') do tests('dynamic large object requests') do tests('#put_dynamic_obj_manifest with missing container').raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].put_dynamic_obj_manifest('fognoncontainer', 'fog_large_object') end end tests('static large object requests') do tests('upload test segments').succeeds do Fog::Storage[:rackspace].put_object(@segments[:a][:container], @segments[:a][:name], @segments[:a][:data]) Fog::Storage[:rackspace].put_object(@segments[:b][:container], @segments[:b][:name], @segments[:b][:data]) end tests('#put_static_obj_manifest with missing container').raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].put_static_obj_manifest('fognoncontainer', 'fog_large_object', []) end tests('#put_static_obj_manifest with missing object') do segments = [ { :path => "#{ @segments[:c][:container] }/#{ @segments[:c][:name] }", :etag => @segments[:c][:etag], :size_bytes => @segments[:c][:size] } ] expected = { 'Errors' => [[segments[0][:path], '404 Not Found']] } error = nil begin Fog::Storage[:rackspace].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Fog::Storage::Rackspace::BadRequest) do raise error if error end expected['Errors'][0][0] = error.response_data['Errors'][0][0] rescue nil returns(expected, 'returns error information') do error.response_data end end tests('#put_static_obj_manifest with invalid etag') do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:a][:size] } ] expected = { 'Errors' => [[segments[0][:path], 'Etag Mismatch']] } error = nil begin Fog::Storage[:rackspace].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Fog::Storage::Rackspace::BadRequest) do raise error if error end expected['Errors'][0][0] = error.response_data['Errors'][0][0] rescue nil returns(expected, 'returns error information') do error.response_data end end tests('#put_static_obj_manifest with invalid byte_size') do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:b][:size] } ] expected = { 'Errors' => [[segments[0][:path], 'Size Mismatch']] } error = nil begin Fog::Storage[:rackspace].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) rescue => err error = err end raises(Fog::Storage::Rackspace::BadRequest) do raise error if error end expected['Errors'][0][0] = error.response_data['Errors'][0][0] rescue nil returns(expected, 'returns error information') do error.response_data end end tests('#delete_static_large_object with missing container') do response = Fog::Storage[:rackspace].delete_static_large_object('fognoncontainer', 'fog_large_object') returns(200) { response.status } returns(1) { response.body["Number Not Found"] } returns("200 OK") { response.body["Response Status"]} returns("") { response.body["Response Body"]} end tests('#delete_static_large_object with missing manifest') do response = Fog::Storage[:rackspace].delete_static_large_object(@directory.identity, 'fog_non_object') returns(200) { response.status } returns(1) { response.body["Number Not Found"] } returns("200 OK") { response.body["Response Status"]} returns("") { response.body["Response Body"]} end tests('#delete_static_large_object with missing segment') do tests('#put_static_obj_manifest for segments :a and :b').succeeds do segments = [ { :path => "#{ @segments[:a][:container] }/#{ @segments[:a][:name] }", :etag => @segments[:a][:etag], :size_bytes => @segments[:a][:size] }, { :path => "#{ @segments[:b][:container] }/#{ @segments[:b][:name] }", :etag => @segments[:b][:etag], :size_bytes => @segments[:b][:size] } ] Fog::Storage[:rackspace].put_static_obj_manifest(@directory.identity, 'fog_large_object', segments) end tests('#delete_object segment :b').succeeds do Fog::Storage[:rackspace].delete_object(@segments[:b][:container], @segments[:b][:name]) end tests('#delete_static_large_object') do expected = { 'Number Not Found' => 1, 'Response Status' => '200 OK', 'Errors' => [], 'Number Deleted' => 2, 'Response Body' => '' } returns(expected, 'deletes manifest and segment :a, and reports missing segment :b') do Fog::Storage[:rackspace].delete_static_large_object(@directory.identity, 'fog_large_object').body end end end end end @directory.destroy @directory2.destroy end fog-1.34.0/tests/rackspace/requests/storage/container_tests.rb0000644000004100000410000000401412600047642024550 0ustar www-datawww-dataShindo.tests('Fog::Storage[:rackspace] | container requests', ["rackspace"]) do @container_format = [{ 'hash' => String, 'last_modified' => String, 'bytes' => Integer, 'name' => String, 'content_type' => String }] @containers_format = [{ 'bytes' => Integer, 'count' => Integer, 'name' => String }] tests('success') do tests("#put_container('fogcontainertests', {})").succeeds do Fog::Storage[:rackspace].put_container('fogcontainertests') end tests("#put_container('fogcontainertests', 'X-Container-Meta-Color'=>'green')").succeeds do Fog::Storage[:rackspace].put_container('fogcontainertests', 'X-Container-Meta-Color'=>'green') response = Fog::Storage[:rackspace].head_container('fogcontainertests') returns('green') { response.headers['X-Container-Meta-Color'] } end tests("#get_container('fogcontainertests')").formats(@container_format) do Fog::Storage[:rackspace].get_container('fogcontainertests').body end tests("#get_containers").formats(@containers_format) do Fog::Storage[:rackspace].get_containers.body end tests("#head_container('fogcontainertests')").succeeds do Fog::Storage[:rackspace].head_container('fogcontainertests') end tests("#head_containers").succeeds do Fog::Storage[:rackspace].head_containers end tests("#delete_container('fogcontainertests')").succeeds do Fog::Storage[:rackspace].delete_container('fogcontainertests') end end tests('failure') do tests("#get_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].get_container('fognoncontainer') end tests("#head_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].head_container('fognoncontainer') end tests("#delete_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do Fog::Storage[:rackspace].delete_container('fognoncontainer') end end end fog-1.34.0/tests/rackspace/requests/storage/account_tests.rb0000644000004100000410000000045712600047642024231 0ustar www-datawww-dataShindo.tests('Fog::Storage[:rackspace] | account requests', ["rackspace"]) do tests('success') do tests("#post_set_meta_temp_url_key('super_secret_key')").succeeds do Fog::Storage[:rackspace].post_set_meta_temp_url_key('super_secret_key') end end tests('failure') do end end fog-1.34.0/tests/rackspace/requests/networking/0000755000004100000410000000000012600047642021543 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/networking/network_tests.rb0000644000004100000410000000223312600047642025003 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | network_tests', ['rackspace']) do service = Fog::Rackspace::Networking.new network_format = { 'id' => String, 'label' => String, 'cidr' => Fog::Nullable::String } get_network_format = { 'network' => network_format } list_networks_format = { 'networks' => [network_format] } tests('success') do network_id = nil tests('#create_network').formats(get_network_format) do service.create_network("fog_#{Time.now.to_i.to_s}", '192.168.0.0/24').body.tap do |r| network_id = r['network']['id'] end end tests('#list_networks').formats(list_networks_format) do service.list_networks.body end tests('#get_network').formats(get_network_format) do service.get_network(network_id).body end tests('#delete_network').succeeds do service.delete_network(network_id) end end test('failure') do tests('#get_network').raises(Fog::Rackspace::Networking::NotFound) do service.get_network(0) end tests('#delete_network').raises(Fog::Rackspace::Networking::NotFound) do service.delete_network(0) end end end fog-1.34.0/tests/rackspace/requests/networking/virtual_interface_tests.rb0000644000004100000410000000311312600047642027016 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | virtual_interface_tests', ['rackspace']) do @service = Fog::Rackspace::Networking.new virtual_interface_format = { "virtual_interfaces"=> [{ "ip_addresses"=> [{ "network_id"=> String, "network_label"=> String, "address"=> String }], "id"=> String, "mac_address"=> String }] } begin unless Fog.mocking? network_id = nil @server = @service.servers.create(:name => "fog_virtual_interface_test_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(@service), :image_id => rackspace_test_image_id(@service)) @server.wait_for { ready? } @network = @service.networks.create(:label => "fog_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24') end tests('success') do pending if Fog.mocking? tests('#create_virtual_interface').formats(virtual_interface_format) do response = @service.create_virtual_interface @server.id, @network.id body = response.body @virtual_network_interface_id = body["virtual_interfaces"].first["id"] body end tests('#list_virtual_interfaces').formats(virtual_interface_format) do @service.list_virtual_interfaces(@server.id).body end tests('#delete_virtual_interfaces').succeeds do @service.delete_virtual_interface(@server.id, @virtual_network_interface_id) end end ensure @server.destroy if @server delete_test_network @network end end fog-1.34.0/tests/rackspace/requests/auto_scale/0000755000004100000410000000000012600047642021473 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/auto_scale/config_tests.rb0000644000004100000410000000616212600047642024514 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | config_tests', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord begin @group = service.create_group(LAUNCH_CONFIG_OPTIONS, GROUP_CONFIG_OPTIONS, POLICIES_OPTIONS).body['group'] @group_id = @group['id'] tests('success') do tests('#get_group_config').formats({"groupConfiguration" => GROUP_CONFIG_FORMAT}) do service.get_group_config(@group_id).body end tests('#update_group_config').returns(204) do data = service.update_group_config(@group_id, { 'maxEntities' => 0, 'minEntities' => 0, 'metadata' => {}, 'name' => 'foo', 'cooldown' => 20}) data.status end tests('#get_launch_config').formats(LAUNCH_CONFIG_FORMAT) do service.get_launch_config(@group_id).body["launchConfiguration"] end tests('#update_launch_config').returns(204) do data = service.update_launch_config(@group_id, { "args" => { "loadBalancers" => [ { "port" => 8000, "loadBalancerId" => 9099 } ], "server" => { "name" => "autoscale_server", "imageRef" => "0d589460-f177-4b0f-81c1-8ab8903ac7d8", "flavorRef" => "2", "OS-DCF =>diskConfig" => "AUTO", "metadata" => { "build_config" => "core", "meta_key_1" => "meta_value_1", "meta_key_2" => "meta_value_2" }, "networks" => [ { "uuid" => "11111111-1111-1111-1111-111111111111" }, { "uuid" => "00000000-0000-0000-0000-000000000000" } ], "personality" => [ { "path" => "/root/.csivh", "contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4=" } ] } }, "type" => "launch_server" }) data.status end end ensure service.delete_group(@group_id) end tests('failure') do tests('#update group config').raises(Fog::Rackspace::AutoScale::BadRequest) do service.update_group_config(@group_id, {}) end tests('#delete group config').raises(NoMethodError) do service.delete_group_config(123) end tests('#create group config').raises(NoMethodError) do service.create_group_config({}) end tests('#update launch config').raises(Fog::Rackspace::AutoScale::BadRequest) do service.update_launch_config(@group_id, {}) end tests('#delete launch config').raises(NoMethodError) do service.delete_launch_config(123) end tests('#create launch config').raises(NoMethodError) do service.create_launch_config({}) end end # @group['scalingPolicies'].each do |p| # service.delete_policy(@group_id, p['id']) # end # service.delete_group(@group_id) end fog-1.34.0/tests/rackspace/requests/auto_scale/helper.rb0000644000004100000410000001052412600047642023301 0ustar www-datawww-data### FORMATS LIST_GROUPS_FORMAT = { "groups_links"=>[], "groups"=> [ { "state" => { "paused"=> Fog::Boolean, "desiredCapacity"=> Integer, "active"=>[], "pendingCapacity"=> Integer, "activeCapacity"=> Integer, "name"=> String } } ] } GROUP_STATE_FORMAT = { "group" => { "paused"=> Fog::Boolean, "desiredCapacity" => Integer, "active"=>[], "pendingCapacity" => Integer, "activeCapacity" => Integer, "name"=> String } } GET_GROUP_HEADERS_FORMAT = { "Content-Type"=>String, "Via"=>String, "x-response-id"=>String, "Date"=>String, "Transfer-Encoding"=>String, "Server"=>String } GROUP_DELETE_DATA_FORMAT = { :headers=> { "Content-Type"=>String, "Via"=>String, "x-response-id"=>String, "Date"=>String, "Server"=>String }, :status=>Integer, :remote_ip=>String } LAUNCH_CONFIG_FORMAT = { "args" => { "loadBalancers" => [ { "port" => Integer, "loadBalancerId" => Integer } ], "server" => { "name" => String, "imageRef" => String, "flavorRef" => String, "OS-DCF =>diskConfig" => String, "metadata" => { "build_config" => String, "meta_key_1" => String, "meta_key_2" => String }, "networks" => [ { "uuid" => String }, { "uuid" => String } ], "personality" => [ { "path" => String, "contents" => String } ] } }, "type" => String } GROUP_CONFIG_FORMAT = { "maxEntities" => Integer, "cooldown" => Integer, "name" => String, "minEntities" => Integer, "metadata" => { "gc_meta_key_2" => String, "gc_meta_key_1" => String } } POLICY_FORMAT = { "name"=> String, "links"=> Array, "cooldown"=>Integer, "type"=>String, "id"=>String, "change"=>Integer } POLICIES_FORMAT = [POLICY_FORMAT] GROUP_FORMAT = { "group" => { "launchConfiguration" => LAUNCH_CONFIG_FORMAT, "groupConfiguration" => GROUP_CONFIG_FORMAT, "scalingPolicies" => POLICIES_FORMAT, "links" => [ { "href" => String, "rel" => String } ], "id" => String } } WEBHOOK_FORMAT = { "id" => String, "name" => String, "metadata" => Hash, "links" => Array } LIST_WEBHOOKS_FORMAT = [ { "id" => String, "name" => String, "links"=>[{"href" => String, "rel" => String }], "metadata"=>{} } ] ### OPTIONS LAUNCH_CONFIG_OPTIONS = { "args" => { "loadBalancers" => [ { "port" => 8080, "loadBalancerId" => 9099 } ], "server" => { "name" => "autoscale_server", "imageRef" => "0d589460-f177-4b0f-81c1-8ab8903ac7d8", "flavorRef" => "2", "OS-DCF =>diskConfig" => "AUTO", "metadata" => { "build_config" => "core", "meta_key_1" => "meta_value_1", "meta_key_2" => "meta_value_2" }, "networks" => [ { "uuid" => "11111111-1111-1111-1111-111111111111" }, { "uuid" => "00000000-0000-0000-0000-000000000000" } ], "personality" => [ { "path" => "/root/.csivh", "contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4=" } ] } }, "type" => "launch_server" } GROUP_CONFIG_OPTIONS = { "maxEntities" => 3, "cooldown" => 360, "name" => "testscalinggroup198547", "minEntities" => 0, "metadata" => { "gc_meta_key_2" => "gc_meta_value_2", "gc_meta_key_1" => "gc_meta_value_1" } } POLICIES_OPTIONS = [ { "cooldown" => 0, "type" => "webhook", "name" => "scale up by 1", "change" => 1 } ] POLICY_OPTIONS = { "cooldown" => 0, "type" => "webhook", "name" => "FOOBAR", "change" => 1 } GROUP_OPTIONS = { "launchConfiguration" => LAUNCH_CONFIG_OPTIONS, "groupConfiguration" => GROUP_CONFIG_OPTIONS, "scalingPolicies" => POLICIES_OPTIONS } WEBHOOK_OPTIONS = { "name" => "webhook name", "metadata" => {'foo' => 'bar'} } def deactive_auto_scale_group(group) return unless group config = group.group_config config.min_entities = 0 config.max_entities = 0 config.save end fog-1.34.0/tests/rackspace/requests/auto_scale/webhook_tests.rb0000644000004100000410000000405212600047642024701 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | webhook_tests', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord begin @group_id = service.create_group(LAUNCH_CONFIG_OPTIONS, GROUP_CONFIG_OPTIONS, POLICIES_OPTIONS).body['group']['id'] @policy_id = service.create_policy(@group_id, POLICY_OPTIONS).body['policies'][0]['id'] tests('success') do tests('#create_webhook').formats(201) do response = service.create_webhook(@group_id, @policy_id, WEBHOOK_OPTIONS) @webhook_id = response.body['webhooks'][0]['id'] response.data[:status] end tests('#list_webhooks').formats(LIST_WEBHOOKS_FORMAT, false) do response = service.list_webhooks(@group_id, @policy_id).body["webhooks"] end tests('#get_webhook').formats(WEBHOOK_FORMAT) do response = service.get_webhook(@group_id, @policy_id, @webhook_id) response.body['webhook'] end tests('#update_webhook').formats(204) do response = service.update_webhook(@group_id, @policy_id, @webhook_id, {'name' => 'new', 'metadata' => {}} ) response.data[:status] end tests('#delete_webhook').formats(204) do response = service.delete_webhook(@group_id, @policy_id, @webhook_id) response.data[:status] end end ensure service.delete_policy @group_id, @policy_id service.delete_group @group_id end tests('failure') do tests('#create_webhook').raises(Fog::Rackspace::AutoScale::BadRequest) do service.create_webhook(@group_id, @policy_id, {}) end tests('#get_webhook').raises(Fog::Rackspace::AutoScale::NotFound) do service.get_webhook(@group_id, @policy_id, 123) end tests('#update_webhook').raises(Fog::Rackspace::AutoScale::BadRequest) do service.update_webhook(@group_id, @policy_id, @webhook_id, {}) end tests('#delete_webhook').raises(Fog::Rackspace::AutoScale::NotFound) do service.delete_webhook(@group_id, @policy_id, 123) end end end fog-1.34.0/tests/rackspace/requests/auto_scale/policy_tests.rb0000644000004100000410000000417212600047642024545 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | policy_tests', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord begin @group_id = service.create_group(LAUNCH_CONFIG_OPTIONS, GROUP_CONFIG_OPTIONS, POLICIES_OPTIONS).body['group']['id'] tests('success') do tests('#list policies').formats(POLICIES_FORMAT) do service.list_policies(@group_id).body['policies'] end tests('#create_policy').returns(201) do response = service.create_policy(@group_id, POLICY_OPTIONS) @policy_id = response.body['policies'][0]['id'] response.status end tests('#get_policy').formats(POLICY_FORMAT) do response = service.get_policy(@group_id, @policy_id) response.body['policy'] end tests('#execute_policy').returns(202) do service.execute_policy(@group_id, @policy_id).status end tests('#update_policy').returns(204) do response = service.update_policy(@group_id, @policy_id, { 'name' => 'foo', 'changePercent' => 1, 'type' => 'webhook', 'cooldown' => 100 }) response.status end tests('#delete_policy').returns(204) do response = service.delete_policy(@group_id, @policy_id) response.status end end ensure group = service.groups.get(@group_id) deactive_auto_scale_group(group) group.destroy end tests('failure') do tests('#create policy').raises(Fog::Rackspace::AutoScale::BadRequest) do service.create_policy(@group_id, {}) end tests('#get policy').raises(Fog::Rackspace::AutoScale::NotFound) do service.get_policy(@group_id, 123) end tests('#update policy').raises(Fog::Rackspace::AutoScale::BadRequest) do service.update_policy(@group_id, 123, {}) end tests('#execute policy').raises(Fog::Rackspace::AutoScale::NotFound) do service.execute_policy(@group_id, 123) end tests('#delete policy').raises(Fog::Rackspace::AutoScale::NotFound) do service.delete_policy(@group_id, 123) end end end fog-1.34.0/tests/rackspace/requests/auto_scale/group_tests.rb0000644000004100000410000000306012600047642024375 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | group_tests', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord tests('success') do tests('#create new group').formats(GROUP_FORMAT) do response = service.create_group(LAUNCH_CONFIG_OPTIONS, GROUP_CONFIG_OPTIONS, POLICIES_OPTIONS).body @group_id = response['group']['id'] response end tests('#list_groups').formats(LIST_GROUPS_FORMAT) do service.list_groups.body end tests('#get group').succeeds do [200, 204].include? service.get_group(@group_id).status end tests('#get group - body').formats(GROUP_FORMAT) do service.get_group(@group_id).body end tests('#get_group_state').formats(GROUP_STATE_FORMAT) do service.get_group_state(@group_id).body end tests('#pause_group_state') do pending end tests('#resume_group_state') do pending end tests('#delete group').returns(204) do service.delete_group(@group_id).status end end tests('failure') do tests('#fail to create group(-1)').raises(Fog::Rackspace::AutoScale::BadRequest) do service.create_group(@launch_config, @group_config, {}) end tests('#fail to get group(-1)').raises(Fog::Rackspace::AutoScale::NotFound) do service.get_group(-1) end tests('#update group').raises(NoMethodError) do service.update_group end tests('#fail to delete group(-1)').raises(Fog::Rackspace::AutoScale::NotFound) do service.delete_group(-1) end end end fog-1.34.0/tests/rackspace/requests/identity/0000755000004100000410000000000012600047642021205 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/identity/tenants_tests.rb0000644000004100000410000000070512600047642024432 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | tenants', ['rackspace']) do pending if Fog.mock? TENANTS_FORMATS = { 'tenants' => [{ 'id' => String, 'name' => String, 'description' => Fog::Nullable::String, 'enabled' => Fog::Nullable::Boolean }] } service = Fog::Rackspace::Identity.new tests('success') do tests('#list_tenants').formats(TENANTS_FORMATS) do service.list_tenants().body end end end fog-1.34.0/tests/rackspace/requests/identity/token_tests.rb0000644000004100000410000000347312600047642024103 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | tokens', ['rackspace']) do ROLE_FORMAT = { 'id' => String, 'name' => String, 'description' => String } ENDPOINT_FORMAT = { 'tenantId' => String, 'publicURL' => Fog::Nullable::String, 'internalURL' => Fog::Nullable::String, 'region' => Fog::Nullable::String, 'versionId' => Fog::Nullable::String, 'versionInfo' => Fog::Nullable::String, 'versionList' => Fog::Nullable::String } SERVICE_FORMAT = { 'name' => String, 'type' => String, 'endpoints' => [ENDPOINT_FORMAT] } ACCESS_FORMAT = { 'access' => { 'token' => { 'id' => String, 'expires' => String, 'tenant' => { 'id' => String, 'name' => String } }, 'user' => { 'id' => String, 'name' => String, 'roles' => [ROLE_FORMAT] }, 'serviceCatalog' => [SERVICE_FORMAT] } } service = Fog::Rackspace::Identity.new tests('success') do credentials = Fog.credentials username = credentials[:rackspace_username] api_key = credentials[:rackspace_api_key] tests('#create_token').formats(ACCESS_FORMAT) do service.create_token(username, api_key).body end tests('uses connection options').returns(true) do pending if Fog.mocking? identity_service = Fog::Rackspace::Identity.new(:connection_options => { :ssl_verify_peer => true }) connection = identity_service.instance_variable_get("@connection") excon = connection.instance_variable_get("@excon") data = excon.instance_variable_get("@data") data.key?(:ssl_verify_peer) end end tests('failure') do tests('#create_token(invalidname, invalidkey').raises(Excon::Errors::HTTPStatusError) do service.create_token('baduser', 'badkey') end end end fog-1.34.0/tests/rackspace/requests/identity/user_tests.rb0000644000004100000410000000526312600047642023740 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | users', ['rackspace']) do pending if Fog.mock? USER_INFO = { 'id' => String, 'username' => String, 'email' => Fog::Nullable::String, 'enabled' => Fog::Boolean, 'OS-KSADM:password' => Fog::Nullable::String, 'created' => Fog::Nullable::String, 'updated' => Fog::Nullable::String } USER_FORMAT = { 'user' => USER_INFO } USERS_FORMAT = { 'users' => [USER_INFO] } CREDENTIAL_FORMAT = { 'RAX-KSKEY:apiKeyCredentials' => { 'username' => String, 'apiKey' => String } } CREDENTIALS_FORMAT = { 'credentials' => [CREDENTIAL_FORMAT] } ROLES_FORMAT = { 'roles' => [{ 'id' => String, 'name' => String, 'description' => String }] } service = Fog::Rackspace::Identity.new id = nil username = "fog#{Time.now.to_i.to_s}" email = 'fog_user@example.com' enabled = true password = 'Fog_password1' tests('success') do tests('#create_user').formats(USER_FORMAT) do data = service.create_user(username, email, enabled).body id = data['user']['id'] data end tests('#delete_user').succeeds do service.delete_user(id) end # there appears to be a werid caching issue. It's just easier to create a new username and continue on username = "fog#{Time.now.to_i.to_s}" tests('#create_user with password').succeeds do data = service.create_user(username, email, enabled, :password => password ).body id = data['user']['id'] data end tests('#get_user_by_name').formats(USER_FORMAT) do data = service.get_user_by_name(username).body id = data['user']['id'] data end tests('#get_user_by_id').formats(USER_FORMAT) do service.get_user_by_id(id).body end tests('#list_users').formats(USERS_FORMAT) do service.list_users().body end tests('#update_user').formats(USER_FORMAT) do service.update_user(id, username, 'updated_user@example.com', enabled).body end tests('#update_user with password').succeeds do service.update_user(id, username, email, enabled, :password => password).body end tests('#list_user_roles').formats(ROLES_FORMAT) do service.list_user_roles(id).body end service.delete_user(id) # Users are only authorized to request their own credentials, # so perform credential tests with the ID of the user running tests. credential_username = Fog.credentials[:rackspace_username] credential_id = service.get_user_by_name(credential_username).body['user']['id'] tests('#list_credentials').formats(CREDENTIALS_FORMAT) do service.list_credentials(credential_id).body end end end fog-1.34.0/tests/rackspace/requests/load_balancers/0000755000004100000410000000000012600047642022305 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/load_balancers/algorithm_tests.rb0000644000004100000410000000060312600047642026041 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | algorithm_tests', ['rackspace']) do pending if Fog.mocking? ALGORITHMS_FORMAT = { 'algorithms' => [ { 'name' => String } ]} @service = Fog::Rackspace::LoadBalancers.new tests('success') do tests('#list_algorithms').formats(ALGORITHMS_FORMAT) do @service.list_algorithms.body end end end fog-1.34.0/tests/rackspace/requests/load_balancers/error_page_tests.rb0000644000004100000410000000163112600047642026202 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | error_page', ['rackspace', 'loadbalancers']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#get_error_page(#{@lb.id})").formats(ERROR_PAGE_FORMAT) do @service.get_error_page(@lb.id).body end @lb.wait_for { ready? } tests("#set_error_page(#{@lb.id}, 'hi!')").succeeds do @service.set_error_page(@lb.id, 'hi!') end @lb.wait_for { ready? } tests("#get_error_page(#{@lb.id})").formats(ERROR_PAGE_FORMAT) do @service.get_error_page(@lb.id).body end @lb.wait_for { ready? } tests("#remove_error_page()").succeeds do @service.remove_error_page(@lb.id) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/helper.rb0000644000004100000410000001754012600047642024120 0ustar www-datawww-dataSINGLE_NODE_FORMAT = {'address' => String, 'id' => Integer, 'status' => String, 'weight' => Fog::Nullable::Integer, 'port' => Integer, 'condition' => String, 'type' => String} NODE_FORMAT = {'node' => SINGLE_NODE_FORMAT.merge({ 'metadata' => []})} NODES_FORMAT = {'nodes' => [SINGLE_NODE_FORMAT]} VIRTUAL_IP_FORMAT = {'type' => String, 'id' => Integer, 'type' => String, 'ipVersion' => String, 'address' => String} VIRTUAL_IPS_FORMAT = { 'virtualIps' => [VIRTUAL_IP_FORMAT] } SOURCE_ADDRESSES = { 'ipv4Servicenet' => String, 'ipv4Public' => String, 'ipv6Public' => String, } LOAD_BALANCER_USAGE_FORMAT = { 'links' => [ { 'otherAttributes' => [], 'href' => Fog::Nullable::String, 'rel' => Fog::Nullable::String } ], 'loadBalancerUsageRecords' => [ { 'id' => Fog::Nullable::Integer, 'eventType' => Fog::Nullable::String, 'averageNumConnections' => Fog::Nullable::Float, 'incomingTransfer' => Fog::Nullable::Integer, 'outgoingTransfer' => Fog::Nullable::Integer, 'numVips' => Fog::Nullable::Integer, 'numPolls' => Fog::Nullable::Integer, 'startTime' => Fog::Nullable::String, 'endTime' => Fog::Nullable::String, 'vipType' => Fog::Nullable::String, } ] } LOAD_BALANCER_STATS_FORMAT = { 'connectTimeOut' => Integer, 'connectError' => Integer, 'connectFailure' => Integer, 'dataTimedOut' => Integer, 'keepAliveTimedOut' => Integer, 'maxConn' => Integer } SSL_TERMINATION_FORMAT = { 'sslTermination' => { 'certificate' => String, 'privatekey' => String, 'enabled' => Fog::Boolean, 'securePort' => Integer, 'secureTrafficOnly' => Fog::Boolean, 'intermediateCertificate' => Fog::Nullable::String } } USAGE_FORMAT = { 'accountId' => Integer, 'loadBalancerUsages' => [ { 'loadBalancerId' => Fog::Nullable::Integer, 'loadBalancerName' => Fog::Nullable::String }.merge(LOAD_BALANCER_USAGE_FORMAT) ], 'accountUsage' => [ { 'startTime' => Fog::Nullable::String, 'numLoadBalancers' => Fog::Nullable::Integer, 'numPublicVips' => Fog::Nullable::Integer, 'numServicenetVips' => Fog::Nullable::Integer } ] } CONNECTION_LOGGING_FORMAT = { 'connectionLogging' => { 'enabled' => Fog::Boolean } } CONNECTION_THROTTLING_FORMAT = { 'connectionThrottle' => { 'maxConnections' => Fog::Nullable::Integer, 'minConnections' => Fog::Nullable::Integer, 'maxConnectionRate' => Fog::Nullable::Integer, 'rateInterval' => Fog::Nullable::Integer } } SESSION_PERSISTENCE_FORMAT = { 'sessionPersistence' => { 'persistenceType' => Fog::Nullable::String } } CONTENT_CACHING_FORMAT = { 'contentCaching' => { 'enabled' => Fog::Boolean } } ACCESS_LIST_FORMAT = { 'accessList' => [ { 'address' => String, 'id' => Integer, 'type' => String } ] } HEALTH_MONITOR_FORMAT = { 'healthMonitor' => { 'type' => Fog::Nullable::String, 'delay' => Fog::Nullable::Integer, 'timeout' => Fog::Nullable::Integer, 'attemptsBeforeDeactivation' => Fog::Nullable::Integer, 'path' => Fog::Nullable::String, 'bodyRegex' => Fog::Nullable::String, 'statusRegex' => Fog::Nullable::String } } STATUS_ACTIVE = 'ACTIVE' LOAD_BALANCERS_FORMAT = { 'loadBalancers' => [ { 'name' => String, 'id' => Integer, 'port' => Integer, 'protocol' => String, 'algorithm' => String, 'status' => String, 'virtualIps' => [VIRTUAL_IP_FORMAT], 'created' => { 'time' => String }, 'updated' => { 'time' => String }, 'nodeCount' => Integer }] } LOAD_BALANCERS_DETAIL_FORMAT = { 'loadBalancers' => [ { 'name' => String, 'id' => Integer, 'port' => Integer, 'protocol' => String, 'algorithm' => String, 'sourceAddresses' => SOURCE_ADDRESSES, 'status' => String, 'timeout' => Integer, 'virtualIps' => [VIRTUAL_IP_FORMAT], 'nodes' => [SINGLE_NODE_FORMAT], 'created' => { 'time' => String }, 'updated' => { 'time' => String } }] } LOAD_BALANCER_FORMAT = { 'loadBalancer' => { 'name' => String, 'id' => Integer, 'port' => Integer, 'protocol' => String, 'algorithm' => String, 'sourceAddresses' => SOURCE_ADDRESSES, 'status' => String, 'timeout' => Integer, 'cluster' => { 'name' => String }, 'virtualIps' => [VIRTUAL_IP_FORMAT], 'nodes' => Fog::Nullable::Array, 'created' => { 'time' => String }, 'updated' => { 'time' => String }, 'contentCaching' => { 'enabled' => Fog::Boolean } }.merge(CONNECTION_LOGGING_FORMAT) } ERROR_PAGE_FORMAT = { 'errorpage' => { 'content' => String } } PRIVATE_KEY = '-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAqSXePu8qLmniU7jNxoWq3SLkR8txMsl1gFYftpq7NIFaGfzV f4ZswYdEYDVWWRepQjS0TvsB0d5+usEUy/pcdZAlQLnn+540iLkvxKPVMzojUbG6 yOAmjC/xAZuExJHtfCrRHUQ4WQCwqyqANfP81y1inAb0zJGbtWUreV+nv8Ue77qX 77fOuqI6zOHinGZU7l25XGLcVUphgt8UtHZBzz2ahoftZ97DhUyQiSJQCaHXJd3Q eIHAq9qc7hu+usiYZWz34A0lw/gAl+RYcdvVc8kIwWxpiSieqqBPOwNzN5B0+9uu 5sDzMGMFnnSWcNKIPumX0rke3xFUl3UD6GJwvwIDAQABAoIBABQ7alT+yH3avm6j OUHYtTJUPRf1VqnrfPmH061E3sWN/1gCbQse6h1P77bOSnDHqsA3i6Wy0mnnAiOW esVXQf3x6vLOCdiH+OKtu+/6ZMMG3jikWKI0ZYf5KAu4LW5RwiVK/c5RXagPtBIV OFa7w299h0EAeAGMHSLaYhPXhDokyJa6yDkAQL3n+9L3V8kNWeCELfrqXnXF4X0K CJp622tS/fW6kzppJyLJ4GPkK9HNMpu02/n2Z7swWypfF+7set+9/aNTooDYWzCu dbnRgqEIG1IP8+t6HG6x9VujJVJLIW/WLITnQ/WTRXOQHBGhazgmwe1GPdxsQgXu /wIcsIkCgYEA8Si0q+QhmJyoAm8vTHjo6+DD06YYTvSODLJOpOqr1ncGGDJ/evBw x+9QsK3veXMbAK5G7Xss32IuXbBfjqQ89+/q/YT4BnS3T0OQa2WlR8tURNphCDr5 B3yD212kJTTehC+p7BI9zhnWXD9kImh4vm4XcOsC9iqOSCZkGfvRPRsCgYEAs46t Y85v2Pk235r1BPbgKwqYR+jElH4VWKu+EguUeQ4BlS47KktlLhvHtwrTv/UZ+lPx 8gSJTgyy7iEmzcGwPf1/MI5xg+DPgGhbr2G8EvrThmdHy+rPF2YSp1iBmJ4xq/1r 6XYKvf6ST3iujxTPU5xPEDUSLsH2ejJD/ddqSS0CgYEAkIdxyDa//8ObWWIjObSY +4zIMBcyKFeernNKeMH/3FeW+neBOT/Sh7CgblK/28ylWUIZVghlOzePTC0BB+7c b0eFUQ0YzF204rc+XW8coCt2xJEQaCtXxinUqGq1jmriFNyv/MBt9BA+DSkcrRZp js9SEyV1r+yPOyRvB7eIjhMCgYEAkd5yG+fkU1c6bfNb4/mPaUgFKD4AHUZEnzF+ ivhfWOy4+nGBXT285/VnjNs95O8AeK3jmyJ2TTLh1bSW6obUX7flsRO3QlTLHd0p xtPWT3D3kHOtDwslzDN/KfYr6klxvvB0z0e3OFxsjiVTYiecuqb8UAVdTSED1Ier Vre+v80CgYB86OqcAlR3diNaIwHgwK5kP2NAH1DaSwZXoobYpdkjsUQfJN5jwJbD 4/6HVydoc5xe0z8B+O1VUzC+QA0gdXgHbmLZBIUeQU8sE4hGELoe/eWULXGwI91M FyEWg03jZj8FkFh2954zwU6BOcbeL+9GrTdTPu1vuHoTitmNEye4iw== -----END RSA PRIVATE KEY-----' CERTIFICATE = '-----BEGIN CERTIFICATE----- MIIEWjCCA0KgAwIBAgIGATTTGu/tMA0GCSqGSIb3DQEBBQUAMHkxCzAJBgNVBAYT AlVTMQ4wDAYDVQQIEwVUZXhhczEOMAwGA1UEBxMFVGV4YXMxGjAYBgNVBAoTEVJh Y2tTcGFjZSBIb3N0aW5nMRQwEgYDVQQLEwtSYWNrRXhwIENBNTEYMBYGA1UEAxMP Y2E1LnJhY2tleHAub3JnMB4XDTEyMDExMjE4MDgwNVoXDTM5MDUzMDE4MDgwNVow gZcxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVUZXhhczEUMBIGA1UEBxMLU2FuIEFu dG9uaW8xEDAOBgNVBAoTB1JhY2tFeHAxEDAOBgNVBAsTB1JhY2tEZXYxPjA8BgNV BAMMNW15c2l0ZS5jb20vZW1haWxBZGRyZXNzPXBoaWxsaXAudG9vaGlsbEByYWNr c3BhY2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqSXePu8q LmniU7jNxoWq3SLkR8txMsl1gFYftpq7NIFaGfzVf4ZswYdEYDVWWRepQjS0TvsB 0d5+usEUy/pcdZAlQLnn+540iLkvxKPVMzojUbG6yOAmjC/xAZuExJHtfCrRHUQ4 WQCwqyqANfP81y1inAb0zJGbtWUreV+nv8Ue77qX77fOuqI6zOHinGZU7l25XGLc VUphgt8UtHZBzz2ahoftZ97DhUyQiSJQCaHXJd3QeIHAq9qc7hu+usiYZWz34A0l w/gAl+RYcdvVc8kIwWxpiSieqqBPOwNzN5B0+9uu5sDzMGMFnnSWcNKIPumX0rke 3xFUl3UD6GJwvwIDAQABo4HIMIHFMIGjBgNVHSMEgZswgZiAFIkXQizRaftxVDaL P/Fb/F2ht017oX2kezB5MQswCQYDVQQGEwJVUzEOMAwGA1UECBMFVGV4YXMxDjAM BgNVBAcTBVRleGFzMRowGAYDVQQKExFSYWNrU3BhY2UgSG9zdGluZzEUMBIGA1UE CxMLUmFja0V4cCBDQTQxGDAWBgNVBAMTD2NhNC5yYWNrZXhwLm9yZ4IBAjAdBgNV HQ4EFgQUQUXHjce1JhjJDA4nhYcbebMrIGYwDQYJKoZIhvcNAQEFBQADggEBACLe vxcDSx91uQoc1uancb+vfkaNpvfAxOkUtrdRSHGXxvUkf/EJpIyG/M0jt5CLmEpE UedeCFlRN+Qnsqt589ZemWWJwth/Jbu0wQodfSo1cP0J2GFZDyTd5cWgm0IxD8A/ ZRGzNnTx3xskv6/lOh7so9ULppEbOsZTNqQ4ahbxbiaR2iDTQGF3XKSHha8O93RB YlnFahKZ2j0CpYvg0lJjfN0Lvj7Sm6GBA74n2OrGuB14H27wklD+PtIEFniyxKbq 5TDO0l4yDgkR7PsckmZqK22GP9c3fQkmXodtpV1wRjcSAxxVWYm+S24XvMFERs3j yXEf+VJ0H+voAvxgbAk= -----END CERTIFICATE-----' fog-1.34.0/tests/rackspace/requests/load_balancers/protocol_tests.rb0000644000004100000410000000063112600047642025715 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | protocol_tests', ['rackspace']) do pending if Fog.mocking? PROTOCOLS_FORMAT = { 'protocols' => [ { 'name' => String, 'port' => Integer } ]} @service = Fog::Rackspace::LoadBalancers.new tests('success') do tests('#list_protocols').formats(PROTOCOLS_FORMAT) do @service.list_protocols.body end end end fog-1.34.0/tests/rackspace/requests/load_balancers/connection_logging_tests.rb0000644000004100000410000000142212600047642027720 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | connection_logging', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do tests("#get_connection_logging(#{@lb.id})").formats(CONNECTION_LOGGING_FORMAT) do @service.get_connection_logging(@lb.id).body end @lb.wait_for { ready? } tests("#set_connection_logging(#{@lb.id}, true)").succeeds do @service.set_connection_logging(@lb.id, true) end end tests('failure') do tests("#set_connection_logging(#{@lb.id}, 'aaa')").raises(Fog::Rackspace::LoadBalancers::InternalServerError) do @service.set_connection_logging(@lb.id, 'aaa') end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/ssl_termination_tests.rb0000644000004100000410000000231412600047642027266 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | ssl_termination', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#set_ssl_termination(#{@lb.id}, 443, PRIVATE_KEY, CERTIFICATE)").succeeds do @service.set_ssl_termination(@lb.id, 443, PRIVATE_KEY, CERTIFICATE) end @lb.wait_for { ready? } tests("#get_ssl_termination(#{@lb.id})").formats(SSL_TERMINATION_FORMAT) do @service.get_ssl_termination(@lb.id).body end @lb.wait_for { ready? } tests("#remove_ssl_termination(#{@lb.id})").succeeds do @service.remove_ssl_termination(@lb.id).body end end tests('failure') do @lb.wait_for { ready? } tests("#get_ssl_termination(#{@lb.id})").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.get_ssl_termination(@lb.id).body end tests("#set_ssl_termination(#{@lb.id}, 443, '', CERTIFICATE)").raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.set_ssl_termination(@lb.id, 443, '', CERTIFICATE) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/node_tests.rb0000644000004100000410000000637212600047642025011 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | node_tests', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do @nodes_created = [] tests('success') do @lb.wait_for { ready? } tests("#create_node(#{@lb.id}, '1.1.1.2', 80, 'ENABLED')").formats(NODES_FORMAT) do data = @service.create_node(@lb.id, '1.1.1.2', 80, 'ENABLED').body @nodes_created << data['nodes'][0]['id'] data end @lb.wait_for { ready? } tests('#create_node with weight').formats(NODES_FORMAT) do data = @service.create_node(@lb.id, '1.1.1.3', 80, 'ENABLED', { :weight => 10 }).body @nodes_created << data['nodes'][0]['id'] data end @lb.wait_for { ready? } tests("#list_nodes(#{@lb.id})").formats(NODES_FORMAT) do @service.list_nodes(@lb.id).body end @lb.wait_for { ready? } tests("#get_node(#{@lb.id})").formats(NODE_FORMAT) do @service.get_node(@lb.id, @nodes_created[0]).body end @lb.wait_for { ready? } tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :condition => 'DISABLED' })").succeeds do @service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED' }) end @lb.wait_for { ready? } tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :weight => 20})").succeeds do @service.update_node(@lb.id, @nodes_created[0], { :weight => 20 }) end @lb.wait_for { ready? } tests("#update_node(#{@lb.id}, #{@nodes_created[0]}, { :condition => 'DISABLED', :weight => 20 })").succeeds do @service.update_node(@lb.id, @nodes_created[0], { :condition => 'DISABLED', :weight => 20 }) end end tests('failure') do tests('#create_node(invalid ip)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.create_node(@lb.id, '', 80, 'ENABLED') end tests('#create_node(invalid condition)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.create_node(@lb.id, '1.1.1.2', 80, 'EABLED') end tests("#get_node(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.get_node(@lb.id, 0) end tests("#delete_node(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.delete_node(@lb.id, 0) end tests("#delete_nodes('a', 'b')").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.delete_nodes(@lb.id, 'a', 'b') end tests("#update_node(#{@lb.id}, 0, { :weight => 20 })").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.update_node(@lb.id, 0, { :weight => 20 }) end end tests('success') do @lb.wait_for { ready? } tests("#delete_nodes(multiple node)").succeeds do @service.delete_nodes(@lb.id, *@nodes_created) end @lb.wait_for { ready? } tests("#delete_node()").succeeds do node_id = @service.create_node(@lb.id, '1.1.1.3', 80, 'ENABLED').body['nodes'][0]['id'] @lb.wait_for { ready? } @service.delete_node(@lb.id, node_id) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/get_stats_tests.rb0000644000004100000410000000056512600047642026057 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_get_stats', ['rackspace']) do given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#get_stats(#{@lb.id})").formats(LOAD_BALANCER_STATS_FORMAT) do @service.get_stats(@lb.id).body end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/load_balancer_usage_tests.rb0000644000004100000410000000122212600047642030003 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_usage', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#get_usage(#{@lb.id})").formats(LOAD_BALANCER_USAGE_FORMAT) do @service.get_load_balancer_usage(@lb.id).body end tests("#get_usage(:start_time => '2010-05-10', :end_time => '2010-05-11')").formats(LOAD_BALANCER_USAGE_FORMAT) do @service.get_load_balancer_usage(@lb.id, :start_time => '2010-05-10', :end_time => '2010-05-11').body end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/content_caching_tests.rb0000644000004100000410000000137212600047642027205 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | content_caching', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do tests("#get_content_caching(#{@lb.id})").formats(CONTENT_CACHING_FORMAT) do @service.get_content_caching(@lb.id).body end @lb.wait_for { ready? } tests("#set_content_caching(#{@lb.id}, true)").succeeds do @service.set_content_caching(@lb.id, true) end end tests('failure') do tests("#set_content_caching(#{@lb.id}, 'aaa')").raises(Fog::Rackspace::LoadBalancers::InternalServerError) do @service.set_content_caching(@lb.id, 'aaa') end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/usage_tests.rb0000644000004100000410000000100312600047642025152 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | usage', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do tests('success') do tests("#get_usage()").formats(USAGE_FORMAT) do pending # @service.get_usage.body end tests("#get_usage(:start_time => '2010-05-10', :end_time => '2010-05-11')").formats(USAGE_FORMAT) do pending # @service.get_usage(:start_time => '2010-05-10', :end_time => '2010-05-11').body end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/virtual_ip_tests.rb0000644000004100000410000000240512600047642026233 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | virtual_ip_tests', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests('#create_virtual_ip').formats(VIRTUAL_IP_FORMAT) do data = @service.create_virtual_ip(@lb.id, 'PUBLIC').body @virtual_ip_id = data['id'] data end @lb.wait_for { ready? } tests("list_virtual_ips").formats(VIRTUAL_IPS_FORMAT) do @service.list_virtual_ips(@lb.id).body end end tests('failure') do #TODO - I feel like this should really be a BadRequest, need to dig in tests('create_virtual_ip(invalid type)').raises(Fog::Rackspace::LoadBalancers::InternalServerError) do @service.create_virtual_ip(@lb.id, 'badtype') end tests('delete_virtual_ip(0)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.delete_virtual_ip(@lb.id, 0) end end tests('success') do @lb.wait_for { ready? } tests("#delete_virtual_ip(#{@lb.id}, #{@virtual_ip_id})").succeeds do @service.delete_virtual_ip(@lb.id, @virtual_ip_id) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/monitor_tests.rb0000644000004100000410000000302212600047642025540 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | monitor', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#get_monitor(#{@lb.id})").formats(HEALTH_MONITOR_FORMAT) do @service.get_monitor(@lb.id).body end @lb.wait_for { ready? } tests("#set_monitor(#{@lb.id}, 'CONNECT', 5, 5, 5)").succeeds do @service.set_monitor(@lb.id, 'CONNECT', 5, 5, 5) end @lb.wait_for { ready? } tests("#set_monitor(#{@lb.id}, 'HTTP', 5, 5, 5, :path => '/', :body_regex => '^200$', :status_regex => '^2[0-9][0-9]$')").succeeds do @service.set_monitor(@lb.id, 'HTTP', 5, 5, 5, :path => '/', :body_regex => '^200$', :status_regex => '2[0-9][0-9]$') end @lb.wait_for { ready? } tests("#get_monitor(#{@lb.id})").formats(HEALTH_MONITOR_FORMAT) do @service.get_monitor(@lb.id).body end @lb.wait_for { ready? } tests("#remove_monitor()").succeeds do @service.remove_monitor(@lb.id) end end tests('failure') do tests("#set_monitor(#{@lb.id}, 'HTP', 5, 5, 5, 5)").raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.set_monitor(@lb.id, 5, 5, 5, 5) end tests("#remove_monitor(#{@lb.id}) => No Monitor").raises(Fog::Rackspace::LoadBalancers::ServiceError) do @service.remove_monitor(@lb.id) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/connection_throttling_tests.rb0000644000004100000410000000232112600047642030467 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | connection_throttling', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#get_connection_throttling(#{@lb.id})").formats(CONNECTION_THROTTLING_FORMAT) do @service.get_connection_throttling(@lb.id).body end @lb.wait_for { ready? } tests("#set_connection_throttling(#{@lb.id}, 10, 10, 10, 30)").succeeds do @service.set_connection_throttling(@lb.id, 10, 10, 10, 30) end @lb.wait_for { ready? } tests("#get_connection_throttling(#{@lb.id})").formats(CONNECTION_THROTTLING_FORMAT) do @service.get_connection_throttling(@lb.id).body end @lb.wait_for { ready? } tests("#remove_connection_throttling()").succeeds do @service.remove_connection_throttling(@lb.id) end end tests('failure') do tests("#set_connection_throttling(#{@lb.id}, -1, -1, -1, -1)").raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.set_connection_throttling(@lb.id, -1, -1, -1, -1) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/access_list_tests.rb0000644000004100000410000000405412600047642026353 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | access_lists_tests', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#create_access_rule(#{@lb.id}, '67.0.0.1','ALLOW')").succeeds do @service.create_access_rule(@lb.id, '67.0.0.1', 'ALLOW').body end @lb.wait_for { ready? } tests("list_access_rules").formats(ACCESS_LIST_FORMAT) do data = @service.list_access_rules(@lb.id).body returns(1) { data.size } @access_list_id = data['accessList'].first['id'] data end @lb.wait_for {ready? } tests("delete_access_rule(#{@lb.id}, #{@access_list_id}").succeeds do @service.delete_access_rule(@lb.id, @access_list_id) end @lb.wait_for {ready? } tests("delete_all_access_rules(#{@lb.id})").succeeds do #This could be refactored once we can add multiple access rules at once @service.create_access_rule(@lb.id, '67.0.0.2', 'ALLOW') @lb.wait_for {ready? } @service.create_access_rule(@lb.id, '67.0.0.3', 'ALLOW') @lb.wait_for {ready? } returns(2) { @service.list_access_rules(@lb.id).body['accessList'].size } @service.delete_all_access_rules(@lb.id) @lb.wait_for {ready? } returns(0) { @service.list_access_rules(@lb.id).body['accessList'].size } end end tests('failure') do tests('create_access_rule(invalid ip)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.create_access_rule(@lb.id, '', 'ALLOW') end tests('create_access_rule(invalid type)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.create_access_rule(@lb.id, '10.10.10.10', 'ENABLED') end tests("delete_access_rule(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.delete_access_rule(@lb.id, 0) end end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/load_balancer_tests.rb0000644000004100000410000000653512600047642026633 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do tests('success') do @lb_id = nil @lb_ids = [] @lb_name = 'fog' + Time.now.to_i.to_s tests("#create_load_balancer(#{@lb_name}, 'HTTP')").formats(LOAD_BALANCER_FORMAT) do data = @service.create_load_balancer(@lb_name, 'HTTP').body @lb_id = data['loadBalancer']['id'] @lb_ids << @lb_id data end tests("#create_load_balancer(#{@lb_name}, 'HTTP', 80,...)").formats(LOAD_BALANCER_FORMAT) do data = @service.create_load_balancer(@lb_name, 'HTTP', 80, [{ :type => 'PUBLIC' }], [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED' }]).body @lb_ids << data['loadBalancer']['id'] data end tests("#create_load_balancer(#{@lb_name}, 'HTTP', 80,...with algorithm)").formats(LOAD_BALANCER_FORMAT) do data = @service.create_load_balancer(@lb_name, 'HTTP', 80, [{ :type => 'PUBLIC'}], [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}], { :algorithm => 'LEAST_CONNECTIONS', :timeout => 30 }).body @lb_ids << data['loadBalancer']['id'] returns('LEAST_CONNECTIONS') { data['loadBalancer']['algorithm'] } returns(30) { data['loadBalancer']['timeout'] } data end tests("#update_load_balancer(#{@lb_id}) while immutable").raises(Fog::Rackspace::LoadBalancers::ServiceError) do @service.update_load_balancer(@lb_id, { :port => 80 }).body end tests("#get_load_balancer(#{@lb_id})").formats(LOAD_BALANCER_FORMAT) do @service.get_load_balancer(@lb_id).body end tests("#list_load_balancers()").formats(LOAD_BALANCERS_FORMAT) do @service.list_load_balancers.body end until @service.get_load_balancer(@lb_id).body["loadBalancer"]["status"] == STATUS_ACTIVE sleep 10 end tests("#list_load_balancers({:node_address => '1.1.1.1'})").formats(LOAD_BALANCERS_FORMAT) do @service.list_load_balancers({:node_address => '1.1.1.1'}).body end tests("#update_load_balancer(#{@lb_id}, { :port => 80 })").succeeds do @service.update_load_balancer(@lb_id, { :port => 80 }).body end until @service.get_load_balancer(@lb_id).body["loadBalancer"]["status"] == STATUS_ACTIVE sleep 10 end @lb_ids.each do |id| tests("#delete_load_balancer(#{id})").succeeds do @service.delete_load_balancer(id).body end end end tests('failure') do tests('#create_load_balancer(invalid name)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.create_load_balancer('', 'HTTP', 80, [{ :type => 'PUBLIC'}], [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}]) end tests('#get_load_balancer(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.get_load_balancer(0) end tests('#delete_load_balancer(0)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.delete_load_balancer(0) end tests('#update_load_balancer(0)').raises(Fog::Rackspace::LoadBalancers::NotFound) do @service.update_load_balancer(0, { :name => 'newname' }) end end end end fog-1.34.0/tests/rackspace/requests/load_balancers/session_persistence_tests.rb0000644000004100000410000000211012600047642030135 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | session_persistence', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do tests('success') do @lb.wait_for { ready? } tests("#set_session_persistence(#{@lb.id}, 'HTTP_COOKIE')").succeeds do @service.set_session_persistence(@lb.id, 'HTTP_COOKIE') end @lb.wait_for { ready? } tests("#get_session_persistence{@lb.id})").formats(SESSION_PERSISTENCE_FORMAT) do data = @service.get_session_persistence(@lb.id).body returns('HTTP_COOKIE') { data['sessionPersistence']['persistenceType'] } data end @lb.wait_for { ready? } tests("#remove_session_persistence()").succeeds do @service.remove_session_persistence(@lb.id) end end tests('failure') do tests("#set_session_persistence(#{@lb.id}, 'aaa')").raises(Fog::Rackspace::LoadBalancers::BadRequest) do @service.set_session_persistence(@lb.id, 'aaa') end end end end end fog-1.34.0/tests/rackspace/requests/dns/0000755000004100000410000000000012600047642020140 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/dns/helper.rb0000644000004100000410000000562012600047642021747 0ustar www-datawww-dataSUBDOMAIN_FORMAT = { 'name' => String, 'id' => Integer, 'created' => String, 'updated' => String, 'emailAddress' => String } DOMAIN_FORMAT = SUBDOMAIN_FORMAT.merge({ 'accountId' => Integer }) LIST_SUBDOMAINS_FORMAT = { 'domains' => [SUBDOMAIN_FORMAT], 'totalEntries' => Integer } LIST_DOMAIN_FORMAT = { 'domains' => [DOMAIN_FORMAT], 'totalEntries' => Integer, 'links' => [ { 'rel' => String, 'href' => String } ] } RECORD_FORMAT = { 'name' => String, 'id' => String, 'type' => String, 'data' => String, 'updated' => String, 'created' => String, 'ttl' => Integer, 'priority' => Fog::Nullable::Integer } RECORD_LIST_FORMAT = { 'records' => [RECORD_FORMAT], #In some cases this is returned (domain details) and in some cases it isn't (create domain). Marking as nullable. 'totalEntries' => Fog::Nullable::Integer } NAME_SERVERS_FORMAT = [{ 'name' => String }] BASIC_DOMAIN_DETAIL_FORMAT = DOMAIN_FORMAT.merge({ 'nameservers' => NAME_SERVERS_FORMAT, 'ttl' => Integer }) LIST_DOMAIN_DETAILS_WITH_RECORDS = BASIC_DOMAIN_DETAIL_FORMAT.merge({ 'recordsList' => RECORD_LIST_FORMAT }) LIST_DOMAIN_DETAILS_WITH_RECORDS_AND_SUBDOMAINS_FORMAT = BASIC_DOMAIN_DETAIL_FORMAT.merge({ 'recordsList' => RECORD_LIST_FORMAT, 'subdomains' => { 'domains' => [SUBDOMAIN_FORMAT], 'totalEntries' => Integer } }) LIST_DOMAIN_DETAILS_WITHOUT_RECORDS_AND_SUBDOMAINS_FORMAT = BASIC_DOMAIN_DETAIL_FORMAT CREATE_DOMAINS_FORMAT = { 'domains' => [ BASIC_DOMAIN_DETAIL_FORMAT.merge({ 'recordsList' => RECORD_LIST_FORMAT }) ] } def wait_for(service, response) job_id = response.body['jobId'] Fog.wait_for do response = service.callback(job_id) response.body['status'] != 'RUNNING' end response end def domain_tests(service, domain_attributes) tests("create_domains([#{domain_attributes}])").formats(CREATE_DOMAINS_FORMAT) do response = wait_for service, service.create_domains([domain_attributes]) @domain_details = response.body['response']['domains'] @domain_id = @domain_details[0]['id'] response.body['response'] end begin if block_given? yield end ensure tests("remove_domain('#{@domain_id}')").succeeds do wait_for service, service.remove_domain(@domain_id) end end end def domains_tests(service, domains_attributes, custom_delete = false) tests("create_domains(#{domains_attributes})").formats(CREATE_DOMAINS_FORMAT) do response = wait_for service, service.create_domains(domains_attributes) @domain_details = response.body['response']['domains'] @domain_ids = @domain_details.map { |domain| domain['id'] } response.body['response'] end begin if block_given? yield end ensure if !custom_delete tests("remove_domains(#{@domain_ids})").succeeds do wait_for service, service.remove_domains(@domain_ids) end end end end fog-1.34.0/tests/rackspace/requests/dns/dns_tests.rb0000644000004100000410000001256412600047642022503 0ustar www-datawww-dataShindo.tests('Fog::DNS[:rackspace] | DNS requests', ['rackspace', 'dns']) do pending if Fog.mocking? domain_name = uniq_id + '.com' tests('success on simple domain') do domain_tests(Fog::DNS[:rackspace], {:name => domain_name, :email => 'hostmaster@' + domain_name, :records => [{:ttl => 300, :name => domain_name, :type => 'A', :data => '192.168.1.1'}]}) do tests('list_domains').formats(LIST_DOMAIN_FORMAT.reject {|key,value| key == 'links'}) do Fog::DNS[:rackspace].list_domains.body end tests("list_domains :limit => 5, :offset => 10, :domain => #{@domain_details.first['name']} --> All possible attributes").formats(LIST_DOMAIN_FORMAT) do Fog::DNS[:rackspace].list_domains(:limit => 5, :offset => 10, :domain => @domain_details.first['name']).body end tests("list_domain_details('#{@domain_id}')").formats(LIST_DOMAIN_DETAILS_WITH_RECORDS) do Fog::DNS[:rackspace].list_domain_details(@domain_id).body end tests("modify_domain('#{@domain_id}', :ttl => 500, :comment => 'woot', :email => 'randomemail@randomhost.com')").succeeds do response = Fog::DNS[:rackspace].modify_domain @domain_id, :ttl => 500, :comment => 'woot', :email => 'randomemail@randomhost.com' wait_for Fog::DNS[:rackspace], response end end end tests('success for domain with multiple records') do domain_tests(Fog::DNS[:rackspace], { :name => domain_name, :email => 'hostmaster@' + domain_name, :records => [ { :ttl => 300, :name => domain_name, :type => 'A', :data => '192.168.1.1' }, { :ttl => 3600, :name => domain_name, :type => 'MX', :data => 'mx.' + domain_name, :priority => 10 } ] }) end tests('success for multiple domains') do domain1_name = uniq_id + '-1.com' domain2_name = uniq_id + '-2.com' domains_tests(Fog::DNS[:rackspace], [ {:name => domain1_name, :email => 'hostmaster@' + domain1_name, :records => [{:ttl => 300, :name => domain1_name, :type => 'A', :data => '192.168.1.1'}]}, {:name => domain2_name, :email => 'hostmaster@' + domain2_name, :records => [{:ttl => 300, :name => domain2_name, :type => 'A', :data => '192.168.1.1'}]} ]) end tests('success for domain with subdomain') do domains_tests(Fog::DNS[:rackspace], [ {:name => domain_name, :email => 'hostmaster@' + domain_name, :records => [{:ttl => 300, :name => domain_name, :type => 'A', :data => '192.168.1.1'}]}, {:name => 'subdomain.' + domain_name, :email => 'hostmaster@subdomain.' + domain_name, :records => [{:ttl => 300, :name =>'subdomain.' + domain_name, :type => 'A', :data => '192.168.1.1'}]} ], true) do @root_domain_id = @domain_details.find { |domain| domain['name'] == domain_name }['id'] tests("list_domain_details('#{@root_domain_id}', :show_records => false, :show_subdomains => false)") do response = Fog::DNS[:rackspace].list_domain_details(@root_domain_id, :show_records => false, :show_subdomains => false) formats(LIST_DOMAIN_DETAILS_WITHOUT_RECORDS_AND_SUBDOMAINS_FORMAT) { response.body } returns(nil) { response.body['recordsList'] } returns(nil) { response.body['subdomains'] } end tests("list_domain_details('#{@root_domain_id}', :show_records => true, :show_subdomains => true)") do response = Fog::DNS[:rackspace].list_domain_details(@root_domain_id, :show_records => true, :show_subdomains => true) formats(LIST_DOMAIN_DETAILS_WITH_RECORDS_AND_SUBDOMAINS_FORMAT) { response.body } returns(false) { response.body['recordsList'].nil? } returns(false) { response.body['subdomains'].nil? } end tests("list_subdomains('#{@root_domain_id}')").formats(LIST_SUBDOMAINS_FORMAT) do Fog::DNS[:rackspace].list_subdomains(@root_domain_id).body end tests("remove_domain('#{@root_domain_id}', :delete_subdomains => true)") do wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].remove_domain(@root_domain_id, :delete_subdomains => true) test('domain and subdomains were really deleted') do (Fog::DNS[:rackspace].list_domains.body['domains'].map { |domain| domain['name'] } & [domain_name, 'subdomain.' + domain_name]).empty? end end end end tests( 'failure') do tests('create_domain(invalid)').returns('ERROR') do response = wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].create_domains([{:name => 'badtestdomain.com', :email => '', :records => [{:ttl => 300, :name => 'badtestdomain.com', :type => 'A', :data => '192.168.1.1'}]}]) response.body['status'] end tests('list_domains :limit => 5, :offset => 8').raises(Fog::Rackspace::Errors::BadRequest) do Fog::DNS[:rackspace].list_domains :limit => 5, :offset => 8 end tests('list_domain_details 34335353').raises(Fog::DNS::Rackspace::NotFound) do Fog::DNS[:rackspace].list_domain_details 34335353 end #tests('create_domains(#{domains})').raises(Fog::Rackspace::Errors::Conflict) do # wait_for Fog::DNS[:rackspace].create_domains(domains) #end #tests('remove_domain(34343435)').raises(Fog::DNS::Rackspace::DeleteFault) do # Fog::DNS[:rackspace].remove_domain 34343435 #end end end fog-1.34.0/tests/rackspace/requests/dns/records_tests.rb0000644000004100000410000000712012600047642023350 0ustar www-datawww-dataShindo.tests('Fog::DNS[:rackspace] | dns records requests', ['rackspace', 'dns']) do pending if Fog.mocking? domain_name = uniq_id + '.com' domain_tests(Fog::DNS[:rackspace], {:name => domain_name, :email => 'hostmaster@' + domain_name, :records => [{:ttl => 300, :name => domain_name, :type => 'A', :data => '192.168.1.1'}]}) do tests('success on single record') do tests("list_records(#{@domain_id})").formats(RECORD_LIST_FORMAT) do Fog::DNS[:rackspace].list_records(@domain_id).body end tests("add_records(#{@domain_id}, [{ :name => 'test1.#{domain_name}', :type => 'A', :data => '192.168.2.1', :ttl => 550}])").formats(RECORD_LIST_FORMAT) do response = wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].add_records(@domain_id, [{ :name => 'test1.' + domain_name, :type => 'A', :data => '192.168.2.1', :ttl => 550}]) @record_id = response.body['response']['records'].first['id'] response.body['response'] end tests("list_record_details(#{@domain_id}, #{@record_id})").formats(RECORD_FORMAT) do Fog::DNS[:rackspace].list_record_details(@domain_id, @record_id).body end tests("modify_record(#{@domain_id}, #{@record_id}, { :ttl => 500, :name => 'test2.#{domain_name}', :data => '192.168.3.1' })").succeeds do wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].modify_record(@domain_id, @record_id, { :ttl => 500, :name => 'test2.' + domain_name, :data => '192.168.3.1' }) end tests("remove_record(#{@domain_id}, #{@record_id})").succeeds do wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].remove_record(@domain_id, @record_id) end end tests('success on multiple records') do records_attributes = [ { :name => 'test1.' + domain_name, :type => 'A', :data => '192.168.2.1'}, { :name => domain_name, :type => 'MX', :priority => 10, :data => 'mx.' + domain_name} ] tests("add_records(#{@domain_id}, #{records_attributes})").formats(RECORD_LIST_FORMAT) do response = wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].add_records(@domain_id, records_attributes) @record_ids = response.body['response']['records'].map { |record| record['id'] } response.body['response'] end tests("remove_records(#{@domain_id}, #{@record_ids})").succeeds do wait_for Fog::DNS[:rackspace], Fog::DNS[:rackspace].remove_records(@domain_id, @record_ids) end end tests( 'failure') do tests("list_records('')").raises(ArgumentError) do Fog::DNS[:rackspace].list_records('') end tests("list_records('abc')").raises(Fog::DNS::Rackspace::NotFound) do Fog::DNS[:rackspace].list_records('abc') end tests("list_record_details(#{@domain_id}, '')").raises(ArgumentError) do Fog::DNS[:rackspace].list_record_details(@domain_id, '') end tests("list_record_details(#{@domain_id}, 'abc')").raises(Fog::DNS::Rackspace::NotFound) do Fog::DNS[:rackspace].list_record_details(@domain_id, 'abc') end tests("remove_record(#{@domain_id}, '')").raises(ArgumentError) do Fog::DNS[:rackspace].remove_record(@domain_id, '') end tests("remove_record(#{@domain_id}, 'abc')").raises(Fog::DNS::Rackspace::NotFound) do Fog::DNS[:rackspace].remove_record(@domain_id, 'abc') end tests("add_record(#{@domain_id}, [{ :name => '', :type => '', :data => ''}])").raises(Fog::Rackspace::Errors::BadRequest) do Fog::DNS[:rackspace].add_records(@domain_id, [{ :name => '', :type => '', :data => ''}]) end end end end fog-1.34.0/tests/rackspace/requests/compute_v2/0000755000004100000410000000000012600047642021437 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/compute_v2/metadata_tests.rb0000644000004100000410000001114712600047642024772 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do @service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') image_id = rackspace_test_image_id(@service) flavor_id = rackspace_test_flavor_id(@service) tests('success') do begin metadata = {"tag" => "database"} unless Fog.mocking? name = "fog-server-metadata-#{Time.now.to_i}" @server = @service.servers.create(:name => name, :flavor_id => flavor_id, :image_id => image_id, :metadata => metadata) @server.wait_for { ready? } @server_id = @server.id @image = @server.create_image(name, :metadata => metadata) @image_id = @image.id else @image_id = 1 @server_id = 1 end tests("servers") do tests('list_metadata').returns("metadata" => metadata) do @service.list_metadata("servers", @server_id).body end tests('set_metadata').returns("metadata" => {"environment" => "dev"}) do @service.set_metadata("servers", @server_id, {"environment" => "dev"}).body end tests('update_metadata').returns("metadata" => {"environment" => "dev", "tag" => "database"}) do @service.update_metadata("servers", @server_id, {"environment" => "dev", "tag" => "database"}).body end tests('get_metadata_item').returns("meta" => {"environment" => "dev"}) do @service.get_metadata_item("servers", @server_id, "environment").body end tests('set_metadata_item').returns("meta" => {"environment" => "test"}) do @service.set_metadata_item("servers", @server_id, "environment", "test").body end tests('delete_metadata_item').succeeds do @service.delete_metadata_item("servers", @server_id, "environment") end end tests("images") do @image.wait_for { ready? } unless Fog.mocking? tests('list_metadata').returns(metadata) do h = @service.list_metadata("images", @image_id).body h["metadata"].reject {|k,v| k.downcase != "tag"} #only look at the metadata we created end tests('set_metadata').returns({"environment" => "dev"}) do h = @service.set_metadata("images", @image_id, {"environment" => "dev"}).body h["metadata"].reject {|k,v| k.downcase != "environment"} #only look at the metadata we created end tests('update_metadata').returns({"environment" => "dev", "tag" => "database"}) do h = @service.update_metadata("images", @image_id, {"environment" => "dev", "tag" => "database"}).body h["metadata"].reject {|k,v| !['environment', 'tag'].include?(k.downcase)} #only look at the metadata we created end tests('get_metadata_item').returns("meta" => {"environment" => "dev"}) do @service.get_metadata_item("images", @image_id, "environment").body end tests('set_metadata_item').returns("meta" => {"environment" => "test"}) do @service.set_metadata_item("images", @image_id, "environment", "test").body end tests('delete_metadata_item').succeeds do @service.delete_metadata_item("images", @image_id, "environment") end end ensure @image.destroy if @image @server.destroy if @server end end tests('failure') do ['server', 'image'].each do |collection| tests(collection) do tests('list_metadata').raises(Fog::Compute::RackspaceV2::NotFound) do @service.list_metadata(collection, 0) end tests('set_server_metadata').raises(Fog::Compute::RackspaceV2::NotFound) do @service.set_metadata(collection, 0, {"environment" => "dev"}) end tests('update_server_metadata').raises(Fog::Compute::RackspaceV2::NotFound) do @service.update_metadata(collection, 0, {"environment" => "dev", "tag" => "database"}) end tests('get_server_metadata_item').raises(Fog::Compute::RackspaceV2::NotFound) do @service.get_metadata_item(collection, 0, "environment") end tests('set_server_metadata_item').raises(Fog::Compute::RackspaceV2::NotFound) do @service.set_metadata_item(collection, 0, "environment", "test") end tests('delete_server_metadata_item').raises(Fog::Compute::RackspaceV2::NotFound) do @service.delete_metadata_item(collection, 0, "environment") end end end end end fog-1.34.0/tests/rackspace/requests/compute_v2/flavor_tests.rb0000644000004100000410000000214712600047642024503 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | flavor_tests', ['rackspace']) do flavor_format = { 'id' => String, 'name' => String, 'ram' => Fog::Nullable::Integer, 'disk' => Fog::Nullable::Integer, 'vcpus' => Fog::Nullable::Integer, 'links' => [{ 'rel' => String, 'href' => String }] } list_flavor_format = { 'flavors' => [flavor_format] } get_flavor_format = { 'flavor' => flavor_format.merge({ 'OS-FLV-EXT-DATA:ephemeral' => Integer, 'rxtx_factor' => Float, 'swap' => Integer }) } service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') flavor_id = nil tests('success') do tests('#list_flavors').formats(list_flavor_format) do body = service.list_flavors.body flavor_id = body['flavors'][0]['id'] body end tests('#list_flavors_detail').formats(list_flavor_format) do body = service.list_flavors_detail.body flavor_id = body['flavors'][0]['id'] body end tests('#get_flavor').formats(get_flavor_format) do service.get_flavor(flavor_id).body end end end fog-1.34.0/tests/rackspace/requests/compute_v2/image_tests.rb0000644000004100000410000000431212600047642024270 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') image_format = { 'id' => String, 'name' => String, 'created' => Fog::Nullable::String, 'updated' => Fog::Nullable::String, 'status' => Fog::Nullable::String, 'user_id' => Fog::Nullable::String, 'tenant_id' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'minDisk' => Fog::Nullable::Integer, 'minRam' => Fog::Nullable::Integer, 'metadata' => Fog::Nullable::Hash, 'OS-DCF:diskConfig' => Fog::Nullable::String, 'links' => [{ 'rel' => String, 'href' => String, 'type' => Fog::Nullable::String }] } list_image_format = { 'images' => [image_format] } get_image_format = { 'image' => image_format } begin test_time = Time.now.to_i.to_s @server = service.servers.create(:name => "fog-image-tests_#{test_time}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service)) @server.wait_for { ready? } @image_id = nil tests('success') do tests("#create_image(#{@server.id}, 'fog-test-image')").succeeds do response = service.create_image(@server.id, "fog-test-image_#{test_time}") @image_id = response.headers["Location"].match(/\/([^\/]+$)/)[1] end tests('#list_images').formats(list_image_format) do service.list_images.body end tests('#list_images_detail').formats(list_image_format) do service.list_images_detail.body end tests('#get_image').formats(get_image_format, false) do service.get_image(@image_id).body end tests('#delete_image').succeeds do service.delete_image(@image_id) end end tests('failure') do tests('#delete_image').raises(Fog::Compute::RackspaceV2::NotFound) do service.delete_image(Fog::Rackspace::MockData::NOT_FOUND_ID) end tests('#get_image').raises(Fog::Compute::RackspaceV2::NotFound) do service.get_image(Fog::Rackspace::MockData::NOT_FOUND_ID) end end ensure @image.destroy if @image @server.destroy if @server end end fog-1.34.0/tests/rackspace/requests/compute_v2/server_tests.rb0000644000004100000410000001313512600047642024517 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') link_format = { 'href' => String, 'rel' => String } server_format = { 'id' => String, 'name' => String, 'hostId' => Fog::Nullable::String, 'created' => Fog::Nullable::String, 'updated' => Fog::Nullable::String, 'status' => Fog::Nullable::String, 'progress' => Fog::Nullable::Integer, 'user_id' => Fog::Nullable::String, 'tenant_id' => Fog::Nullable::String, 'links' => [link_format], 'metadata' => Fog::Nullable::Hash } list_servers_format = { 'servers' => [server_format] } get_server_format = { 'server' => server_format.merge({ 'accessIPv4' => String, 'accessIPv6' => String, 'OS-DCF:diskConfig' => String, 'rax-bandwidth:bandwidth' => Fog::Nullable::Array, 'addresses' => Fog::Nullable::Hash, 'flavor' => { 'id' => String, 'links' => [link_format] }, 'image' => { 'id' => String, 'links' => [link_format] } }) } create_server_format = { 'server' => { 'id' => String, 'adminPass' => String, 'links' => [link_format], 'OS-DCF:diskConfig' => String } } rescue_server_format = { 'adminPass' => Fog::Nullable::String } tests('success') do server_id = nil server_name = "fog#{Time.now.to_i.to_s}" image_id = rackspace_test_image_id(service) flavor_id = rackspace_test_flavor_id(service) bootable_flavor_id = if Fog.mocking? flavor_id else service.flavors.find { |f| f.name =~ /Performance/ }.id end tests("#create_server(#{server_name}, #{image_id}, #{flavor_id}, 1, 1)").formats(create_server_format) do body = service.create_server(server_name, image_id, flavor_id, 1, 1).body server_id = body['server']['id'] body end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') tests("#create_server(#{server_name}_bfv_1, '', #{flavor_id}, 1, 1, :boot_volume_id => bootable_volume_id)").succeeds do # First, create a bootable volume. volume_service = Fog::Rackspace::BlockStorage.new bootable_volume_id = volume_service.create_volume(100, :image_id => image_id).body['volume']['id'] wait_for_volume_state(volume_service, bootable_volume_id, 'available') body = service.create_server(server_name + "_bfv_1", '', bootable_flavor_id, 1, 1, :boot_volume_id => bootable_volume_id).body bfv_server_id = body['server']['id'] wait_for_server_state(service, bfv_server_id, 'ACTIVE', 'ERROR') service.delete_server(bfv_server_id) wait_for_volume_state(volume_service, bootable_volume_id, 'available') volume_service.delete_volume(bootable_volume_id) end tests("#create_server(#{server_name}_bfv_2, '', #{flavor_id}, 1, 1, :boot_image_id => #{image_id})").succeeds do body = service.create_server(server_name + "_bfv_2", '', bootable_flavor_id, 1, 1, :boot_image_id => image_id).body bfv_server_id = body['server']['id'] wait_for_server_state(service, bfv_server_id, 'ACTIVE', 'ERROR') service.delete_server(bfv_server_id) end tests('#list_servers').formats(list_servers_format, false) do service.list_servers.body end tests('#get_server').formats(get_server_format, false) do service.get_server(server_id).body end tests("#update_server(#{server_id}, #{server_name}_update) LEGACY").formats(get_server_format) do service.update_server(server_id, "#{server_name}_update").body end tests("#update_server(#{server_id}, { 'name' => #{server_name}_update)} ").formats(get_server_format) do service.update_server(server_id, 'name' => "#{server_name}_update").body end tests('#change_server_password').succeeds do service.change_server_password(server_id, 'some_server_password') end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') tests('#reboot_server').succeeds do service.reboot_server(server_id, 'SOFT') end wait_for_server_state(service, server_id, 'ACTIVE') tests('#rebuild_server').succeeds do rebuild_image_id = image_id service.rebuild_server(server_id, rebuild_image_id) end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') sleep 120 unless Fog.mocking? tests('#resize_server').succeeds do resize_flavor_id = Fog.mocking? ? flavor_id : service.flavors[1].id service.resize_server(server_id, resize_flavor_id) end wait_for_server_state(service, server_id, 'VERIFY_RESIZE', 'ACTIVE') tests('#confirm_resize_server').succeeds do service.confirm_resize_server(server_id) end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') tests('#resize_server').succeeds do resize_flavor_id = Fog.mocking? ? flavor_id : service.flavors[2].id service.resize_server(server_id, resize_flavor_id) end wait_for_server_state(service, server_id, 'VERIFY_RESIZE', 'ACTIVE') tests('#revert_resize_server').succeeds do service.revert_resize_server(server_id) end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') tests('#rescue_server').formats(rescue_server_format, false) do service.rescue_server(server_id) end wait_for_server_state(service, server_id, 'RESCUE', 'ACTIVE') tests('#unrescue_server').succeeds do service.unrescue_server(server_id) end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') tests('#delete_server').succeeds do service.delete_server(server_id) end end end fog-1.34.0/tests/rackspace/requests/compute_v2/keypair_tests.rb0000644000004100000410000000262112600047642024653 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | keypair_tests', ['rackspace']) do keypair_format = { 'name' => String, 'public_key' => String, 'fingerprint' => String, } create_keypair_format = { 'keypair' => keypair_format.merge({ 'user_id' => String, 'private_key' => String }) } list_keypair_format = { 'keypairs' => [ 'keypair' => keypair_format ] } get_keypair_format = { 'keypair' => keypair_format } service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') keypair_name = Fog::Mock.random_letters(32) tests('success') do tests('#create_keypair').formats(create_keypair_format) do service.create_keypair(keypair_name).body end tests('#list_keypairs').formats(list_keypair_format) do service.list_keypairs.body end tests('#get_keypair').formats(get_keypair_format) do service.get_keypair(keypair_name).body end tests('#delete_keypair') do service.delete_keypair(keypair_name).body end end unknown_keypair_name = Fog::Mock.random_letters(32) tests('failure') do tests('#get_unknown_keypair').raises(Fog::Compute::RackspaceV2::NotFound) do service.get_keypair(unknown_keypair_name).body end tests('#delete_unknown_keypair').raises(Fog::Compute::RackspaceV2::NotFound) do service.delete_keypair(unknown_keypair_name).body end end end fog-1.34.0/tests/rackspace/requests/compute_v2/attachment_tests.rb0000644000004100000410000000452412600047642025343 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | attachment_tests', ['rackspace']) do compute_service = Fog::Compute::RackspaceV2.new block_storage_service = Fog::Rackspace::BlockStorage.new image_id = rackspace_test_image_id(compute_service) flavor_id = rackspace_test_flavor_id(compute_service) attachment_format = { 'volumeAttachment' => { 'id' => String, 'serverId' => String, 'volumeId' => String, 'device' => Fog::Nullable::String } } list_attachments_format = { 'volumeAttachments' => [attachment_format['volumeAttachment']] } name = 'fog' + Time.now.to_i.to_s image_id = image_id flavor_id = flavor_id server_id = compute_service.create_server(name, image_id, flavor_id, 1, 1).body['server']['id'] volume_id = block_storage_service.create_volume(100).body['volume']['id'] device_id = '/dev/xvde' tests('success') do wait_for_request("Waiting for server to become ready") do compute_service.get_server(server_id).body['server']['status'] == 'ACTIVE' end wait_for_request("Waiting for Volume to be ready") do block_storage_service.get_volume(volume_id).body['volume']['status'] == 'available' end tests("#attach_volume(#{server_id}, #{volume_id}, #{device_id})").formats(attachment_format) do compute_service.attach_volume(server_id, volume_id, device_id).body end tests("#list_attachments(#{server_id})").formats(list_attachments_format) do compute_service.list_attachments(server_id).body end wait_for_request("Waiting for Volume to be ready") do block_storage_service.get_volume(volume_id).body['volume']['status'] == 'in-use' end tests("#get_attachment(#{server_id}, #{volume_id})").formats(attachment_format) do compute_service.get_attachment(server_id, volume_id).body end tests("#delete_attachment(#{server_id}, #{volume_id})").succeeds do compute_service.delete_attachment(server_id, volume_id) end end tests('failure') do tests("#attach_volume('', #{volume_id}, #{device_id})").raises(Fog::Compute::RackspaceV2::NotFound) do compute_service.attach_volume('', volume_id, device_id) end tests("#delete_attachment('', #{volume_id})").raises(Fog::Compute::RackspaceV2::NotFound) do compute_service.delete_attachment('', volume_id) end end end fog-1.34.0/tests/rackspace/requests/compute_v2/network_tests.rb0000644000004100000410000000227012600047642024700 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | network_tests', ['rackspace']) do service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') network_format = { 'id' => String, 'label' => String, 'cidr' => Fog::Nullable::String } get_network_format = { 'network' => network_format } list_networks_format = { 'networks' => [network_format] } tests('success') do network_id = nil tests('#create_network').formats(get_network_format) do service.create_network("fog_#{Time.now.to_i.to_s}", '192.168.0.0/24').body.tap do |r| network_id = r['network']['id'] end end tests('#list_networks').formats(list_networks_format) do service.list_networks.body end tests('#get_network').formats(get_network_format) do service.get_network(network_id).body end tests('#delete_network').succeeds do service.delete_network(network_id) end end test('failure') do tests('#get_network').raises(Fog::Compute::RackspaceV2::NotFound) do service.get_network(0) end tests('#delete_network').raises(Fog::Compute::RackspaceV2::NotFound) do service.delete_network(0) end end end fog-1.34.0/tests/rackspace/requests/compute_v2/address_tests.rb0000644000004100000410000000272112600047642024635 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | address requests', ['rackspace']) do @service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') image_id = rackspace_test_image_id(@service) flavor_id = rackspace_test_flavor_id(@service) tests('success') do unless Fog.mocking? @server = @service.servers.create(:flavor_id => flavor_id, :image_id => image_id, :name => "address-tests-#{Time.now.to_i}") @server.wait_for { ready? } @server_id = @server.id else @server_id = 42 end address_format = { "addresses"=> { "private" => [{"addr" => String, "version" => Integer}], "public" => [{"addr" => String, "version" => Integer }, {"addr"=> String, "version" => Integer}]} } begin tests("#list_addresses(#{@server_id})").formats(address_format) do @service.list_addresses(@server_id).body end tests("#list_addresses_by_network(#{@server_id}, 'private')").formats(address_format["addresses"].reject {|k,v| k != "private"}) do @service.list_addresses_by_network(@server_id, "private").body end ensure @server.destroy if @server end end tests('failure') do tests('#list_addresses(0)').raises(Fog::Compute::RackspaceV2::NotFound) do @service.list_addresses(0) end tests("#list_addresses_by_network(0, 'private')").raises(Fog::Compute::RackspaceV2::NotFound) do @service.list_addresses_by_network(0, 'private') end end end fog-1.34.0/tests/rackspace/requests/compute_v2/virtual_interface_tests.rb0000644000004100000410000000315212600047642026715 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | virtual_interface_tests', ['rackspace']) do @service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') virtual_interface_format = { "virtual_interfaces"=> [{ "ip_addresses"=> [{ "network_id"=> String, "network_label"=> String, "address"=> String }], "id"=> String, "mac_address"=> String }] } begin unless Fog.mocking? network_id = nil @server = @service.servers.create(:name => "fog_virtual_interface_test_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(@service), :image_id => rackspace_test_image_id(@service)) @server.wait_for { ready? } @network = @service.networks.create(:label => "fog_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24') end tests('success') do pending if Fog.mocking? tests('#create_virtual_interface').formats(virtual_interface_format) do response = @service.create_virtual_interface @server.id, @network.id body = response.body @virtual_network_interface_id = body["virtual_interfaces"].first["id"] body end tests('#list_virtual_interfaces').formats(virtual_interface_format) do @service.list_virtual_interfaces(@server.id).body end tests('#delete_virtual_interfaces').succeeds do @service.delete_virtual_interface(@server.id, @virtual_network_interface_id) end end ensure @server.destroy if @server delete_test_network @network end end fog-1.34.0/tests/rackspace/requests/cdn/0000755000004100000410000000000012600047642020120 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/cdn/cdn_tests.rb0000644000004100000410000000436412600047642022442 0ustar www-datawww-dataShindo.tests('Fog::CDN[:rackspace] | CDN requests', ['rackspace']) do @container_format = [String] @containers_format = [{ "cdn_ios_uri" => String, "log_retention" => Fog::Boolean, "ttl" => Fixnum, "cdn_streaming_uri" => String, "cdn_enabled" => Fog::Boolean, "name" => String, "cdn_ssl_uri" => String, "cdn_uri" => String }] @container_headers = { "Content-Length" => String, "X-Cdn-Enabled" => String, "X-Log-Retention" => String, "X-Cdn-Ios-Uri" => String, "X-Ttl" => String, "X-Cdn-Uri" => String, "X-Cdn-Ssl-Uri" => String, "X-Cdn-Streaming-Uri" => String, "X-Trans-Id" => String, "Date" => String } begin unless Fog.mocking? @directory = Fog::Storage[:rackspace].directories.create(:key => 'fogcontainertests') @file = @directory.files.create(:key => 'fog_object', :body => lorem_file) end tests('success') do tests("#put_container('fogcontainertests')").succeeds do Fog::CDN[:rackspace].put_container('fogcontainertests', {'X-CDN-Enabled' => true }) end tests("#get_containers").formats(@containers_format) do Fog::CDN[:rackspace].get_containers.body end tests("#head_container('fogcontainertests')").formats(@container_headers) do Fog::CDN[:rackspace].head_container('fogcontainertests').headers end tests("#post_container('fogcontainertests')").succeeds do Fog::CDN[:rackspace].post_container('fogcontainertests', 'X-TTL' => 5000) end #NOTE: you are only allow 25 object purges per day. If this fails, you may be over the limit tests("#delete_object('fog_object')").succeeds do Fog::CDN[:rackspace].delete_object('fogcontainertests', 'fog_object') end end ensure unless Fog.mocking? @file.destroy if @file @directory.destroy if @directory end end tests('failure') do tests("#head_container('missing_container')").raises(Fog::Storage::Rackspace::NotFound) do Fog::CDN[:rackspace].head_container('missing_container') end tests("#post_container('missing_container')").raises(Fog::Storage::Rackspace::NotFound) do Fog::CDN[:rackspace].post_container('missing_container', 'X-TTL' => 5000) end end end fog-1.34.0/tests/rackspace/requests/compute/0000755000004100000410000000000012600047642021030 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/compute/resize_tests.rb0000644000004100000410000000226412600047642024104 0ustar www-datawww-dataShindo.tests('Fog::Compute[:rackspace] | resize request', ['rackspace']) do @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) @confirm_server = @service.servers.create(:flavor_id => 1, :image_id => 19) @revert_server = @service.servers.create(:flavor_id => 1, :image_id => 19) @confirm_server.wait_for { ready? } tests("#resize_server(#{@confirm_server.id}, 2) # to confirm").succeeds do @service.resize_server(@confirm_server.id, 2) end @revert_server.wait_for { ready? } tests("#resize_server(#{@revert_server.id}, 2) # to revert").succeeds do @service.resize_server(@revert_server.id, 2) end @confirm_server.wait_for { state == 'VERIFY_RESIZE' } tests("#confirm_resized_server(#{@confirm_server.id})").succeeds do @service.confirm_resized_server(@confirm_server.id) end @revert_server.wait_for { state == 'VERIFY_RESIZE' } tests("#revert_resized_server(#{@revert_server.id})").succeeds do @service.revert_resized_server(@revert_server.id) end @confirm_server.wait_for { ready? } @confirm_server.destroy @revert_server.wait_for { ready? } @revert_server.destroy end fog-1.34.0/tests/rackspace/requests/compute/helper.rb0000644000004100000410000000022612600047642022634 0ustar www-datawww-dataclass Rackspace module Compute module Formats SUMMARY = { 'id' => Integer, 'name' => String } end end end fog-1.34.0/tests/rackspace/requests/compute/flavor_tests.rb0000644000004100000410000000171312600047642024072 0ustar www-datawww-dataShindo.tests('Fog::Compute[:rackspace] | flavor requests', ['rackspace']) do @flavor_format = { 'disk' => Integer, 'id' => Integer, 'name' => String, 'ram' => Integer } @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do tests('#get_flavor_details(1)').formats(@flavor_format) do pending if Fog.mocking? @service.get_flavor_details(1).body['flavor'] end tests('#list_flavors').formats({'flavors' => [Rackspace::Compute::Formats::SUMMARY]}) do pending if Fog.mocking? @service.list_flavors.body end tests('#list_flavors_detail').formats({'flavors' => [@flavor_format]}) do pending if Fog.mocking? @service.list_flavors_detail.body end end tests('failure') do tests('#get_flavor_details(0)').raises(Fog::Compute::Rackspace::NotFound) do pending if Fog.mocking? @service.get_flavor_details(0) end end end fog-1.34.0/tests/rackspace/requests/compute/image_tests.rb0000644000004100000410000000365212600047642023667 0ustar www-datawww-dataShindo.tests('Fog::Compute[:rackspace] | image requests', ['rackspace']) do @image_format = { 'created' => Fog::Nullable::String, 'id' => Integer, 'name' => String, 'progress' => Fog::Nullable::Integer, 'serverId' => Fog::Nullable::Integer, 'status' => String, 'updated' => String } @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do @server = @service.servers.create(:flavor_id => 1, :image_id => 19) @server.wait_for { ready? } @image_id = nil tests("#create_image(#{@server.id})").formats(@image_format) do data = @service.create_image(@server.id).body['image'] @image_id = data['id'] data end unless Fog.mocking? @service.images.get(@image_id).wait_for { ready? } end tests("#get_image_details(#{@image_id})").formats(@image_format) do pending if Fog.mocking? @service.get_image_details(@image_id).body['image'] end tests('#list_images').formats({'images' => [Rackspace::Compute::Formats::SUMMARY]}) do @service.list_images.body end tests('#list_images_detail').formats({'images' => [@image_format]}) do @service.list_images_detail.body end unless Fog.mocking? @service.images.get(@image_id).wait_for { ready? } end tests("#delete_image(#{@image_id})").succeeds do pending if Fog.mocking? # because it will fail without the wait just above here, which won't work @service.delete_image(@image_id) end @server.destroy end tests('failure') do tests('#delete_image(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.delete_image(Fog::Rackspace::MockData::NOT_FOUND_ID) end tests('#get_image_details(0)').raises(Fog::Compute::Rackspace::NotFound) do pending if Fog.mocking? @service.get_image_details(Fog::Rackspace::MockData::NOT_FOUND_ID) end end end fog-1.34.0/tests/rackspace/requests/compute/server_tests.rb0000644000004100000410000000533512600047642024113 0ustar www-datawww-dataShindo.tests('Fog::Compute[:rackspace] | server requests', ['rackspace']) do @server_format = { 'addresses' => { 'private' => [String], 'public' => [String] }, 'flavorId' => Integer, 'hostId' => String, 'id' => Integer, 'imageId' => Integer, 'metadata' => {}, 'name' => String, 'progress' => Integer, 'status' => String } @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do @server_id = nil tests('#create_server(1, 19)').formats(@server_format.merge('adminPass' => String)) do # 1 => 256MB, 19 => Gentoo data = @service.create_server(1, 19).body['server'] @server_id = data['id'] data end @service.servers.get(@server_id).wait_for { ready? } tests("#get_server_details(#{@server_id})").formats(@server_format) do @service.get_server_details(@server_id).body['server'] end tests('#list_servers').formats({'servers' => [Rackspace::Compute::Formats::SUMMARY]}) do @service.list_servers.body end tests('#list_servers_detail').formats({'servers' => [@server_format]}) do @service.list_servers_detail.body end @service.servers.get(@server_id).wait_for { ready? } tests("#update_server(#{@server_id}, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").succeeds do @service.update_server(@server_id, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver') end @service.servers.get(@server_id).wait_for { ready? } tests("#reboot_server(#{@server_id}, 'HARD')").succeeds do pending if Fog.mocking? @service.reboot_server(@server_id, 'HARD') end @service.servers.get(@server_id).wait_for { ready? } tests("#reboot_server(#{@server_id}, 'SOFT')").succeeds do pending if Fog.mocking? @service.reboot_server(@server_id, 'SOFT') end @service.servers.get(@server_id).wait_for { ready? } tests("#delete_server(#{@server_id})").succeeds do @service.delete_server(@server_id) end end tests('failure') do tests('#delete_server(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.delete_server(0) end tests('#get_server_details(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.get_server_details(0) end tests("#update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").raises(Fog::Compute::Rackspace::NotFound) do @service.update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver') end tests('#reboot_server(0)').raises(Fog::Compute::Rackspace::NotFound) do pending if Fog.mocking? @service.reboot_server(0) end end end fog-1.34.0/tests/rackspace/requests/compute/address_tests.rb0000644000004100000410000000226512600047642024231 0ustar www-datawww-dataShindo.tests('Fog::Compute[:rackspace] | address requests', ['rackspace']) do @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do @server = @service.servers.create(:flavor_id => 1, :image_id => 19) tests("#list_addresses(#{@server.id})").formats({'addresses' => {'private' => [String], 'public' => [String]}}) do @service.list_addresses(@server.id).body end tests("#list_private_addresses(#{@server.id})").formats({'private' => [String]}) do @service.list_private_addresses(@server.id).body end tests("#list_public_addresses(#{@server.id})").formats({'public' => [String]}) do @service.list_public_addresses(@server.id).body end @server.wait_for { ready? } @server.destroy end tests('failure') do tests('#list_addresses(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.list_addresses(0) end tests('#list_private_addresses(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.list_private_addresses(0) end tests('#list_public_addresses(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.list_public_addresses(0) end end end fog-1.34.0/tests/rackspace/requests/queues/0000755000004100000410000000000012600047642020663 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/queues/queues_tests.rb0000644000004100000410000000211012600047642023733 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | queue_tests', ['rackspace']) do service = Fog::Rackspace::Queues.new tests('success') do queue_name = 'fog' + Time.now.to_i.to_s tests("#create_queue(#{queue_name})").succeeds do service.create_queue(queue_name) end tests("#list_queues").formats(LIST_QUEUES_FORMAT) do response = service.list_queues response.body end tests("#get_queue(#{queue_name})").formats(QUEUE_FORMAT) do service.get_queue(queue_name).body end tests("#get_queue_stats(#{queue_name})").formats(QUEUE_STATS_FORMAT) do service.get_queue_stats(queue_name).body end tests("#delete_queue(#{queue_name})").succeeds do service.delete_queue(queue_name) end end tests('failure') do tests("#create_queue('') => Invalid Create Critera").raises(Fog::Rackspace::Queues::MethodNotAllowed) do service.create_queue('') end tests("#get_queue('nonexistentqueue') => Does not exist").raises(Fog::Rackspace::Queues::NotFound) do service.get_queue('nonexistentqueue') end end end fog-1.34.0/tests/rackspace/requests/queues/helper.rb0000644000004100000410000000126012600047642022466 0ustar www-datawww-dataVALID_TTL = 300 VALID_GRACE = 300 METADATA_FORMAT = { } QUEUE_FORMAT = { 'metadata' => METADATA_FORMAT } LIST_QUEUES_FORMAT = { 'queues' => [ QUEUE_FORMAT.merge({ 'name' => String, 'href' => String, }) ], 'links' => LINKS_FORMAT } MESSAGE_FORMAT = { 'href' => String, 'ttl' => Integer, 'age' => Integer, 'body' => Hash } LIST_MESSAGES_FORMAT = { 'messages' => [MESSAGE_FORMAT], 'links' => LINKS_FORMAT } CREATE_CLAIM_FORMAT = [ MESSAGE_FORMAT ] CLAIM_FORMAT = { 'ttl' => Integer, 'age' => Integer, 'messages' => [ MESSAGE_FORMAT ] } QUEUE_STATS_FORMAT = { 'messages' => { 'free' => Integer, 'claimed' => Integer } } fog-1.34.0/tests/rackspace/requests/queues/claim_tests.rb0000644000004100000410000000360412600047642023522 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | claim_tests', ['rackspace']) do service = Fog::Rackspace::Queues.new queue_name = 'fog' + Time.now.to_i.to_s client_id = service.client_id claim_id = nil service.create_queue(queue_name) tests('success') do tests("#create_claim(#{queue_name}, #{VALID_TTL}, #{VALID_GRACE}) => No Messages").returns(204) do service.create_claim(queue_name, VALID_TTL, VALID_GRACE).status end tests('with messages in the queue') do before do service.create_message(client_id, queue_name, { :message => "message-body"}, 300) end #TODO - Fix it so simple text bodies pass validation tests("#create_claim(#{queue_name}, #{VALID_TTL}, #{VALID_GRACE})").formats(CREATE_CLAIM_FORMAT) do response = service.create_claim(queue_name, VALID_TTL, VALID_GRACE) claim_id = response.headers['Location'].split('/').last response.body end tests("#get_claim(#{queue_name}, #{claim_id})").formats(CLAIM_FORMAT) do service.get_claim(queue_name, claim_id).body end tests("#update_claim(#{queue_name}, #{claim_id}, 500)").succeeds do service.update_claim(queue_name, claim_id, 500) end tests("#delete_claim(#{queue_name}, #{claim_id})").succeeds do service.delete_claim(queue_name, claim_id) end tests("#create_claim(#{queue_name}, #{VALID_TTL}, #{VALID_GRACE}, { :limit => 1})") do response = service.create_claim(queue_name, VALID_TTL, VALID_GRACE, { :limit => 1}) formats(CREATE_CLAIM_FORMAT) { response.body } returns(1) { response.body.length } end end end tests('failure') do tests("#get_claim('queue_name', 'nonexistentclaim') => Does not exist").raises(Fog::Rackspace::Queues::NotFound) do service.get_claim(queue_name, 'nonexistentclaim') end end service.delete_queue(queue_name) end fog-1.34.0/tests/rackspace/requests/queues/messages_tests.rb0000644000004100000410000000376612600047642024255 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | messages_tests', ['rackspace']) do service = Fog::Rackspace::Queues.new queue_name = 'fog' + Time.now.to_i.to_s client_id = service.client_id message_id = nil service.create_queue(queue_name) begin tests('success') do tests("#list_message(#{client_id}, #{queue_name}, {:echo => true}) => No Content").returns(204) do service.list_messages(client_id, queue_name, {:echo => true}).status end tests("#create_message(#{client_id}, #{queue_name}, '{ :blah => 'blah' }', 300)").succeeds do response = service.create_message(client_id, queue_name, { :blah => 'blah' }, 300) message_id = response.body['resources'][0].split('/').last end tests("#list_message(#{client_id}, #{queue_name}, {:echo => true}) => With Content").formats(LIST_MESSAGES_FORMAT) do service.list_messages(client_id, queue_name, {:echo => true}).body end tests("#get_message(#{client_id}, #{queue_name}, #{message_id})").formats(MESSAGE_FORMAT) do service.get_message(client_id, queue_name, message_id).body end tests("#delete_message(#{queue_name}, #{message_id}, { :claim_id => '10' })").raises(Fog::Rackspace::Queues::ServiceError) do #API team should be changing this pending service.delete_message(queue_name, message_id, { :claim_id => '10' }) end tests("#delete_message(#{queue_name}, #{message_id})").succeeds do service.delete_message(queue_name, message_id) end end tests('failure') do tests("#create_message('') => Invalid Create Critera").raises(Fog::Rackspace::Queues::BadRequest) do service.create_message(client_id, queue_name, '', 0) end tests("#get_message('queue_name', 'nonexistentmessage') => Does not exist").raises(Fog::Rackspace::Queues::NotFound) do service.get_message(client_id, queue_name, 'nonexistentmessage') end end ensure service.delete_queue(queue_name) end end fog-1.34.0/tests/rackspace/requests/block_storage/0000755000004100000410000000000012600047642022172 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/block_storage/volume_type_tests.rb0000644000004100000410000000112412600047642026307 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | volume_type_tests', ['rackspace']) do volume_type_format = { 'name' => String, 'extra_specs' => Hash, 'id' => String } service = Fog::Rackspace::BlockStorage.new tests('success') do volume_type_id = service.volume_types.first.id tests("#list_volume_types").formats('volume_types' => [volume_type_format]) do service.list_volume_types.body end tests("#get_volume_type(#{volume_type_id})").formats('volume_type' => volume_type_format) do service.get_volume_type(volume_type_id).body end end end fog-1.34.0/tests/rackspace/requests/block_storage/snapshot_tests.rb0000644000004100000410000000373312600047642025606 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | snapshot_tests', ['rackspace']) do timeout = Fog.mocking? ? 1 : 10 snapshot_format = { 'id' => String, 'status' => String, 'display_name' => Fog::Nullable::String, 'display_description' => Fog::Nullable::String, 'volume_id' => String, 'size' => Integer, 'created_at' => String } get_snapshot_format = { 'snapshot' => snapshot_format } list_snapshot_format = { 'snapshots' => [snapshot_format] } def snapshot_deleted?(service, snapshot_id) begin service.get_snapshot(snapshot_id) false rescue true end end service = Fog::Rackspace::BlockStorage.new tests('success') do volume = service.create_volume(100).body['volume'] volume_id = volume['id'] snapshot_id = nil until service.get_volume(volume_id).body['volume']['status'] == 'available' sleep timeout end tests("#create_snapshot(#{volume_id})").formats(get_snapshot_format) do service.create_snapshot(volume_id).body.tap do |b| snapshot_id = b['snapshot']['id'] end end tests("#list_snapshots").formats(list_snapshot_format) do service.list_snapshots.body end tests("#get_snapshot(#{snapshot_id})").formats(get_snapshot_format) do service.get_snapshot(snapshot_id).body end until service.get_snapshot(snapshot_id).body['snapshot']['status'] == 'available' do sleep timeout end tests("#delete_snapshot(#{snapshot_id})").succeeds do service.delete_snapshot(snapshot_id) end until snapshot_deleted?(service, snapshot_id) sleep timeout end service.delete_volume(volume_id) end tests('failure') do tests("#create_snapshot('invalid')").raises(Fog::Rackspace::BlockStorage::NotFound) do service.create_snapshot('invalid') end tests("#get_snapshot('invalid')").raises(Fog::Rackspace::BlockStorage::NotFound) do service.get_snapshot('invalid') end end end fog-1.34.0/tests/rackspace/requests/block_storage/volume_tests.rb0000644000004100000410000000367412600047642025262 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do volume_format = { 'id' => String, 'status' => String, 'display_name' => Fog::Nullable::String, 'display_description' => Fog::Nullable::String, 'size' => Integer, 'created_at' => String, 'volume_type' => String, 'availability_zone' => String, 'snapshot_id' => Fog::Nullable::String, 'image_id' => Fog::Nullable::String, 'attachments' => Array, 'metadata' => Hash } get_volume_format = { 'volume' => volume_format } list_volume_format = { 'volumes' => [volume_format] } service = Fog::Rackspace::BlockStorage.new tests('success') do ids = [] size = 100 tests("#create_volume(#{size})").formats(get_volume_format) do data = service.create_volume(size).body ids << data['volume']['id'] data end tests("#create_volume for a bootable volume").formats(get_volume_format) do # Find a suitable image. image_id = rackspace_test_image_id(Fog::Compute.new(:provider => 'rackspace')) data = service.create_volume(size, :image_id => image_id).body tests("assigned an image id").returns(image_id) do data['volume']['image_id'] end ids << data['volume']['id'] data end tests("#list_volumes").formats(list_volume_format) do service.list_volumes.body end tests("#get_volume(#{ids.first})").formats(get_volume_format) do service.get_volume(ids.first).body end ids.each do |id| tests("#delete_volume(#{id})").succeeds do wait_for_volume_state(service, id, 'available') service.delete_volume(id) end end end tests('failure') do tests("#create_volume(-1)").raises(Fog::Rackspace::BlockStorage::BadRequest) do service.create_volume(-1) end tests("#get_volume(-1)").raises(Fog::Rackspace::BlockStorage::NotFound) do service.get_volume(-1) end end end fog-1.34.0/tests/rackspace/requests/monitoring/0000755000004100000410000000000012600047642021541 5ustar www-datawww-datafog-1.34.0/tests/rackspace/requests/monitoring/alarm_example_tests.rb0000644000004100000410000000225512600047642026123 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarm_example_tests', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? account = Fog::Rackspace::Monitoring.new example_id = "remote.http_body_match_1" tests('success') do tests('#list alarm examples').formats(LIST_HEADERS_FORMAT) do account.list_alarm_examples().data[:headers] end tests('#get alarm example').formats(LIST_HEADERS_FORMAT) do account.get_alarm_example(example_id).data[:headers] end tests('#evaluate alarm example').formats(LIST_HEADERS_FORMAT) do options = { :string => "Foo"} account.evaluate_alarm_example(example_id,options).data[:headers] end end tests('failure') do tests('#fail to list alarm examples(-1)').raises(ArgumentError) do account.list_alarm_examples(-1).data[:headers] end tests('#fail to get alarm example(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_alarm_example(-1).data[:headers] end tests('#fail to evaluate alarm example').raises(Fog::Rackspace::Monitoring::BadRequest) do options = { } account.evaluate_alarm_example(example_id,options).data[:headers] end end end fog-1.34.0/tests/rackspace/requests/monitoring/helper.rb0000644000004100000410000000606512600047642023354 0ustar www-datawww-dataMINIMAL_HEADERS_FORMAT = { 'X-RateLimit-Window' => String, 'X-RateLimit-Limit' => String, 'X-RateLimit-Type' => String, 'Content-Type' => String, 'Date' => String, } DELETE_HEADERS_FORMAT = MINIMAL_HEADERS_FORMAT.merge({ 'Content-Length' => String }) HEADERS_FORMAT = MINIMAL_HEADERS_FORMAT.merge({ 'Content-Length' => String, 'X-Object-ID' => String, 'Location' => String }) LIST_HEADERS_FORMAT = MINIMAL_HEADERS_FORMAT.merge({ 'X-RateLimit-Remaining' => String, 'X-Response-Id' => String, 'Transfer-Encoding' => String, 'X-LB' => String, 'Vary' => String }) DATA_FORMAT = { :status => Integer, :body => String, :headers => HEADERS_FORMAT, :remote_ip => String } DELETE_DATA_FORMAT = { :status => Integer, :body => String, :headers => DELETE_HEADERS_FORMAT, :remote_ip => String } LIST_MONITORING_ZONE = { "values"=> [{"id"=>String, "label"=> Fog::Nullable::String, "country_code"=> String, "source_ips"=>[String, String]}], "metadata"=> {"count"=>Integer, "limit"=>Integer, "marker"=>Fog::Nullable::String, "next_marker"=>Fog::Nullable::String, "next_href"=>Fog::Nullable::String } } GET_MONITORING_ZONE = { "id" => String, "label" => String, "country_code" => String, "source_ips" => [String] } # {"values"=> # [{"id"=>"ch4GimHQsQ", # "label"=>nil, # "type"=>"remote.http", # "details"=> # {"url"=>"http://www.rackspace.com", # "method"=>"GET", # "follow_redirects"=>true, # "include_body"=>false}, # "monitoring_zones_poll"=>["mzdfw"], # "timeout"=>30, # "period"=>100, # "target_alias"=>nil, # "target_hostname"=>"rackspace.com", # "target_resolver"=>"IPv4", # "disabled"=>false, # "collectors"=>["coeT7x1iF3"], # "metadata"=>nil, # "created_at"=>1377803830760, # "updated_at"=>1377803830760}], # "metadata"=> # {"count"=>1, # "limit"=>100, # "marker"=>nil, # "next_marker"=>nil, # "next_href"=>nil}} # {"values"=> # [{"id"=>String, # "label"=>String, # "country_code"=>String, # "source_ips"=>[String, String]}], # "metadata"=> # {"count"=>Integer, # "limit"=>Integer, # "marker"=>nil, # "next_marker"=>nil, # "next_href"=>nil}} CHECK_CREATE_OPTIONS = { :details => { :url => 'http://www.rackspace.com', :method => 'GET', }, :type => 'remote.http', :monitoring_zones_poll => ['mzdfw'], :target_hostname => 'rackspace.com', :timeout => 30, :period => 100 } OVERVIEW_FORMAT = { :status => Integer, :body=> { :values => [ { :entity => { :id => String, :label => String, :ip_addresses => { }, :metadata => String }, :checks => [ ], :alarms => [ ], :latest_alarm_states => [ ] } ], :metadata => { :count => Integer, :limit => Integer, :marker => String, :next_marker => String, :next_href => String } }, :headers => LIST_HEADERS_FORMAT, :remote_ip => String } fog-1.34.0/tests/rackspace/requests/monitoring/entity_tests.rb0000644000004100000410000000254212600047642024627 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | entity_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new entity_id = nil tests('success') do tests('#create new entity').formats(DATA_FORMAT) do response = account.create_entity(:label => "Foo").data @entity_id = response[:headers]["X-Object-ID"] response end tests('#get entity').formats(LIST_HEADERS_FORMAT) do account.get_entity(@entity_id).data[:headers] end tests('#update entity').formats(DATA_FORMAT) do options = { :metadata => {:testing => "Bar" }} account.update_entity(@entity_id,options).data end tests('#delete entity').formats(DELETE_DATA_FORMAT) do account.delete_entity(@entity_id).data end end tests('failure') do tests('#create new entity(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do account.create_entity(:label => "") end tests('#get entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_entity(-1) end tests('#update invalid entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do options = { :metadata => {:testing => "Bar" }} response = account.update_entity(-1,options) end tests('#delete entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.delete_entity(-1) end end end fog-1.34.0/tests/rackspace/requests/monitoring/check_tests.rb0000644000004100000410000000274312600047642024373 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | check_tests', ['rackspace', 'rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] check_id = nil tests('success') do tests('#create new check').formats(DATA_FORMAT) do response = account.create_check(entity_id, CHECK_CREATE_OPTIONS).data check_id = response[:headers]['X-Object-ID'] response end tests('#get check').formats(LIST_HEADERS_FORMAT) do account.get_check(entity_id,check_id).data[:headers] end tests('#update check').formats(DATA_FORMAT) do options = { :label => "Bar"} account.update_check(entity_id,check_id,options).data end tests('#delete check').formats(DELETE_DATA_FORMAT) do account.delete_check(entity_id,check_id).data end end tests('failure') do tests('#create new check(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do account.create_check(entity_id, {:type => ""}) end tests('#get check(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_check(-1, -1) end tests('#update invalid check(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do options = { :testing => "Bar" } response = account.update_check(-1,-1,options) end tests('#delete check(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.delete_check(-1,-1) end end account.delete_entity(entity_id) end fog-1.34.0/tests/rackspace/requests/monitoring/alarm_tests.rb0000644000004100000410000000424312600047642024407 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] check_id = account.create_check(entity_id, CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"] alarm_id = nil np = "npTechnicalContactsEmail" tests('success') do tests('#create new alarm').formats(DATA_FORMAT) do alarm_criteria = "if (metric['code'] == '404') { return new AlarmStatus(CRITICAL, 'Page not found');}" options = { :check_id => check_id, :notification_plan_id => np, :criteria => alarm_criteria } response = account.create_alarm(entity_id,options).data alarm_id = response[:headers]["X-Object-ID"] response end tests('#update alarm').formats(DATA_FORMAT) do options = { :label => "Bar"} account.update_alarm(entity_id,alarm_id,options).data end tests('#list alarms').formats(LIST_HEADERS_FORMAT) do account.list_alarms(entity_id).data[:headers] end tests('#get alarm').formats(LIST_HEADERS_FORMAT) do account.get_alarm(entity_id,alarm_id).data[:headers] end tests('#delete alarm').formats(DELETE_DATA_FORMAT) do account.delete_alarm(entity_id,alarm_id).data end end tests('failure') do tests('#fail to create new alarm(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do account.create_alarm(entity_id, {:type => ""}) end tests('#fail to update invalid alarm(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do options = { :testing => "Bar" } response = account.update_alarm(-1,-1,options) end tests('#fail to list alarms').raises(Fog::Rackspace::Monitoring::NotFound) do account.list_alarms(-1) end tests('#fail to get alarm').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_alarm(-1,-1) end tests('#fail to delete alarm(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.delete_alarm(-1,-1) end end account.delete_check(entity_id,check_id) unless Fog.mocking? account.delete_entity(entity_id) unless Fog.mocking? end fog-1.34.0/tests/rackspace/requests/monitoring/notification_tests.rb0000644000004100000410000000332412600047642026000 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | notification_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new notification_id = nil tests('success') do tests('#create new notification').formats(DATA_FORMAT) do pending if Fog.mocking? response = account.create_notification(:label => "Foo", :type => "email", :details => {:address => "test@test.com"}).data notification_id = response[:headers]["X-Object-ID"] response end tests('#get notification').formats(LIST_HEADERS_FORMAT) do account.get_notification(notification_id).data[:headers] end tests('#update notification').formats(DATA_FORMAT) do pending if Fog.mocking? options = {:testing => "Bar"} account.update_notification(notification_id,options).data end tests('#delete notification').formats(DELETE_DATA_FORMAT) do pending if Fog.mocking? account.delete_notification(notification_id).data end end tests('failure') do tests('#create new notification(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do pending if Fog.mocking? account.create_notification(:label => "") end tests('#get notification(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do pending if Fog.mocking? account.get_notification(-1) end tests('#update invalid notification(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do pending if Fog.mocking? options = { :testing => "Bar" } response = account.update_notification(-1,options) end tests('#delete notification(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do pending if Fog.mocking? account.delete_notification(-1) end end end fog-1.34.0/tests/rackspace/requests/monitoring/list_tests.rb0000644000004100000410000000611612600047642024267 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new if Fog.mocking? entity_id = "peoigne93" check_id = "2090wgn93" else entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] check_id = account.create_check(entity_id,CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"] end metric_name = "idle_percent_average" now = Time.now.to_i SLEEP_TIME= 2 sleep(SLEEP_TIME) unless Fog.mocking? tests('success') do tests('#get list of monitoring zones').formats(LIST_MONITORING_ZONE) do pending if Fog.mocking? account.list_monitoring_zones.body end tests('#get a monitoring zone').formats(GET_MONITORING_ZONE) do pending if Fog.mocking? account.get_monitoring_zone('mzdfw').body end tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do account.list_checks(entity_id).data[:headers] end tests('#get list of check types').formats(LIST_HEADERS_FORMAT) do account.list_check_types().data[:headers] end tests('#get list of entities').formats(LIST_HEADERS_FORMAT) do account.list_entities().data[:headers] end tests('#get list of metrics').formats(LIST_HEADERS_FORMAT) do account.list_metrics(entity_id,check_id).data[:headers] end tests('#get overview list').formats(LIST_HEADERS_FORMAT) do account.list_overview().data[:headers] end tests('#list notification plans').formats(LIST_HEADERS_FORMAT) do account.list_notification_plans().data[:headers] end tests('#list notifications').formats(LIST_HEADERS_FORMAT) do account.list_notifications().data[:headers] end tests('#get list of data points').formats(LIST_HEADERS_FORMAT) do options = { :points => 1, :from => now * 1000, :to => (now+SLEEP_TIME) * 1000 } account.list_data_points(entity_id,check_id,metric_name,options).data[:headers] end end tests('failure') do tests('#fail to list checks').raises(Fog::Rackspace::Monitoring::NotFound) do account.list_checks(-1) end tests('#fail to list check types').raises(ArgumentError) do account.list_check_types(-1) end # This test has been put on hold due to a bug that incorrectly returns 200 OK to this request # tests('#fail to list notifications').raises(ArgumentError) do # account.list_notifications(-1) # end # This test has been put on hold due to a bug that incorrectly returns 200 OK to this request #tests('#fail to list metrics').raises(Fog::Rackspace::Monitoring::NotFound) do #account.list_metrics(-1,-1) #end tests('#fail: 1 argument instead of 0 for list_notification_plans').raises(ArgumentError) do account.list_notification_plans('fail') end tests('#fail to get list of data points').raises(Fog::Rackspace::Monitoring::BadRequest) do account.list_data_points(-1,-1,-1,-1).data end end account.delete_check(entity_id,check_id) unless Fog.mocking? account.delete_entity(entity_id) unless Fog.mocking? end fog-1.34.0/tests/rackspace/requests/monitoring/agent_tests.rb0000644000004100000410000000574212600047642024416 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new agent_token = nil options = { "label" => "Bar" } values_format = Hash tests('success') do tests('#create new agent token').formats(DATA_FORMAT) do response = account.create_agent_token(options).data agent_token = response[:headers]["X-Object-ID"] response end tests('#list agent tokens').formats(LIST_HEADERS_FORMAT) do account.list_agent_tokens().data[:headers] end tests("#list_agents") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.list_agents.body } end tests("#get_agent") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_agent("agent_id").body } end tests('#get agent token').formats(LIST_HEADERS_FORMAT) do account.get_agent_token(agent_token).data[:headers] end tests('#delete agent token').formats(DELETE_HEADERS_FORMAT) do account.delete_agent_token(agent_token).data[:headers] end tests("#get_cpus_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_cpus_info("agent_id").body } end tests("#get_disks_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_disks_info("agent_id").body } end tests("#get_filesystems_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_filesystems_info("agent_id").body } end tests("#get_logged_in_user_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_logged_in_user_info("agent_id").body } end tests("#get_memory_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_memory_info("agent_id").body } end tests("#get_network_interfaces_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_network_interfaces_info("agent_id").body } end tests("#get_processes_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_processes_info("agent_id").body } end tests("#get_system_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_system_info("agent_id").body } end end tests('failure') do tests('#fail to create agent token(-1)').raises(TypeError) do account.create_agent_token(-1) end tests('#fail to get agent token(-1)').raises(TypeError) do account.create_agent_token(-1) end tests('#fail to delete agent token(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.delete_agent_token(-1) end tests('#fail to connect to agent(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do account.get_cpus_info(-1) end tests('#fail to get agent (-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_agent(-1) end end end fog-1.34.0/tests/rackspace/cdn_tests.rb0000644000004100000410000002052612600047642020021 0ustar www-datawww-dataShindo.tests('Fog::CDN::Rackspace', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::CDN::Rackspace.new assert_method nil, :authenticate_v2 assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('authentication v1') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.get_containers end tests('custom endpoint') do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil } end end tests('authentication v2') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.get_containers end tests('dfw region').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /cdn1/) != nil } @service.get_containers end tests('ord region').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /cdn2/) != nil } @service.get_containers end tests('custom endpoint') do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses DFW") { (@service.instance_variable_get("@uri").host =~ /cdn1/) != nil } @service.get_containers end tests('specify region').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /cdn2/) != nil } @service.get_containers end tests('custom endpoint') do @service = Fog::CDN::Rackspace.new :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::CDN::Rackspace.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(true) { [200, 204].include? @service.get_containers.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::CDN::Rackspace.new :rackspace_api_key => 'bad_key' } end end pending if Fog.mocking? def container_meta_attributes @cdn.head_container(@directory.key).headers end def clear_metadata @instance.metadata.tap do |metadata| metadata.each_pair {|k, v| metadata[k] = nil } end end directory_attributes = { # Add a random suffix to prevent collision :key => "fogfilestests-#{rand(65536)}" } @directory = Fog::Storage[:rackspace].directories.create(directory_attributes) @cdn = @directory.service.cdn begin tests('publish_container').succeeds do returns("False", "CDN is not enabled") { container_meta_attributes['X-CDN-Enabled'] } urls = @cdn.publish_container @directory returns(true, "hash contains expected urls") { Fog::CDN::Rackspace::Base::URI_HEADERS.values.all? { |url_type| urls[url_type] } } returns("True", "CDN is enabled") { container_meta_attributes['X-Cdn-Enabled'] } end tests('urls') do tests('CDN enabled container').returns(false) do @cdn.publish_container @directory @cdn.urls(@directory).empty? end tests('Non-CDN enabled container').returns(true) do @cdn.publish_container @directory, false @cdn.urls(@directory).empty? end tests('Non-existent container').returns(true) do non_existent_container = Fog::Storage::Rackspace::Directory.new :key => "non-existent" @cdn.urls(non_existent_container).empty? end end tests('urls_from_headers') do headers = { "X-Cdn-Streaming-Uri"=>"http://168e307d41afe64f1a62-d1e9259b2132e81da48ed3e1e802ef22.r2.stream.cf1.rackcdn.com", "X-Cdn-Uri"=>"http://6e8f4bf5125c9c2e4e3a-d1e9259b2132e81da48ed3e1e802ef22.r2.cf1.rackcdn.com", "Date"=>"Fri, 15 Feb 2013 18:36:41 GMT", "Content-Length"=>"0", "X-Trans-Id"=>"tx424df53b79bc43fe994d3cec0c4d2d8a", "X-Ttl"=>"3600", "X-Cdn-Ssl-Uri"=>"https://f83cb7d39e0b9ff9581b-d1e9259b2132e81da48ed3e1e802ef22.ssl.cf1.rackcdn.com", "X-Cdn-Ios-Uri"=>"http://a590286a323fec6aed22-d1e9259b2132e81da48ed3e1e802ef22.iosr.cf1.rackcdn.com", "X-Cdn-Enabled"=>"True", "Content-Type"=>"text/html; charset=UTF-8", "X-Log-Retention"=>"False" } urls = @cdn.send(:urls_from_headers, headers) returns(4) { urls.size } returns("http://168e307d41afe64f1a62-d1e9259b2132e81da48ed3e1e802ef22.r2.stream.cf1.rackcdn.com") { urls[:streaming_uri] } returns("http://6e8f4bf5125c9c2e4e3a-d1e9259b2132e81da48ed3e1e802ef22.r2.cf1.rackcdn.com") { urls[:uri] } returns("https://f83cb7d39e0b9ff9581b-d1e9259b2132e81da48ed3e1e802ef22.ssl.cf1.rackcdn.com") { urls[:ssl_uri] } returns("http://a590286a323fec6aed22-d1e9259b2132e81da48ed3e1e802ef22.iosr.cf1.rackcdn.com") { urls[:ios_uri] } end tests('purge') do pending end ensure @directory.destroy if @directory end end fog-1.34.0/tests/rackspace/monitoring_tests.rb0000644000004100000410000000716112600047642021442 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring', ['rackspace','rackspace_monitoring']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::Monitoring.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('current authentation') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::Monitoring.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true} returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_entities end tests('custom endpoint') do @service = Fog::Rackspace::Monitoring.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_monitoring_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Rackspace::Monitoring.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /monitoring.api.rackspacecloud.com/) != nil } @service.list_entities end tests('custom endpoint') do @service = Fog::Rackspace::Monitoring.new :rackspace_monitoring_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Rackspace::Monitoring.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(true) { [200, 203].include? @service.list_entities.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Rackspace::Monitoring.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/block_storage_tests.rb0000644000004100000410000001377712600047642022105 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::BlockStorage.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('legacy authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_volumes end tests('custom endpoint') do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_block_storage_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('current authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true} returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_volumes end tests('dfw region').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_volumes end tests('ord region').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.list_volumes end tests('custom endpoint') do @service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_block_storage_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_volumes end tests('specify old contstant style service endoint').succeeds do @service = Fog::Rackspace::BlockStorage.new :rackspace_endpoint => Fog::Rackspace::BlockStorage::ORD_ENDPOINT returns(true) { (@service.instance_variable_get("@uri").to_s =~ /#{Fog::Rackspace::BlockStorage::ORD_ENDPOINT}/ ) != nil } @service.list_volumes end tests('specify region') do @service = Fog::Rackspace::BlockStorage.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.list_volumes end tests('custom endpoint') do @service = Fog::Rackspace::BlockStorage.new :rackspace_block_storage_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Rackspace::BlockStorage.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(200) { @service.list_volumes.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) {Fog::Rackspace::BlockStorage.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/compute_tests.rb0000644000004100000410000001146712600047642020735 0ustar www-datawww-dataShindo.tests('Rackspace | Compute', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Compute::Rackspace.new assert_method nil, :authenticate_v2 assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('authentication v1') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_compute_v1_url => 'https://my-custom-endpoint.com' returns(false, "auth token populated") { @service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('authentication v2') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host == 'servers.api.rackspacecloud.com') != nil } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_compute_v1_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Compute::Rackspace.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host == 'servers.api.rackspacecloud.com') != nil } @service.list_flavors end tests('specify region').succeeds do @service = Fog::Compute::Rackspace.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host == 'servers.api.rackspacecloud.com') != nil } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::Rackspace.new :rackspace_compute_v1_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Compute::Rackspace.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(true) { [200, 203].include?(@service.list_flavors.status) } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Compute::Rackspace.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/rackspace_tests.rb0000644000004100000410000000417612600047642021214 0ustar www-datawww-dataShindo.tests('Fog::Rackspace', ['rackspace']) do tests('normalize_url') do tests('should return nil if endpoint is nil').returns(nil) do Fog::Rackspace.normalize_url nil end tests('should remove trailing spaces').returns("https://dfw.blockstorage.api.rackspacecloud.com/v1") do Fog::Rackspace.normalize_url "https://dfw.blockstorage.api.rackspacecloud.com/v1 " end tests('should remove trailing /').returns("https://dfw.blockstorage.api.rackspacecloud.com/v1") do Fog::Rackspace.normalize_url "https://dfw.blockstorage.api.rackspacecloud.com/v1/" end tests('should downcase url').returns("https://dfw.blockstorage.api.rackspacecloud.com/v1") do Fog::Rackspace.normalize_url "HTTPS://DFW.BLOCKSTORAGE.API.RACKSPACECLOUD.COM/V1" end tests('show do all three').returns("https://dfw.blockstorage.api.rackspacecloud.com/v1") do Fog::Rackspace.normalize_url "HTTPS://DFW.BLOCKSTORAGE.API.RACKSPACECLOUD.COM/V1/ " end end tests('json_response?') do returns(false, "nil") { Fog::Rackspace.json_response?(nil) } tests('missing header').returns(false) do response = Excon::Response.new response.headers = nil #maybe this is a forced case returns(true) { response.headers.nil? } Fog::Rackspace.json_response?(response) end tests('nil Content-Type header').returns(false) do response = Excon::Response.new response.headers['Content-Type'] = nil Fog::Rackspace.json_response?(response) end tests('text/html Content-Type header').returns(false) do response = Excon::Response.new response.headers['Content-Type'] = 'text/html' Fog::Rackspace.json_response?(response) end tests('application/json Content-Type header').returns(true) do response = Excon::Response.new response.headers['Content-Type'] = 'application/json' Fog::Rackspace.json_response?(response) end tests('APPLICATION/JSON Content-Type header').returns(true) do response = Excon::Response.new response.headers['Content-Type'] = 'APPLICATION/JSON' Fog::Rackspace.json_response?(response) end end end fog-1.34.0/tests/rackspace/models/0000755000004100000410000000000012600047642016764 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/databases/0000755000004100000410000000000012600047642020713 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/databases/flavors_tests.rb0000644000004100000410000000061312600047642024136 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | flavors', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new tests("success") do tests("#all").succeeds do service.flavors.all end tests("#get").succeeds do service.flavors.get(1) end end tests("failure").returns(nil) do service.flavors.get('some_random_identity') end end fog-1.34.0/tests/rackspace/models/databases/instances_tests.rb0000644000004100000410000000054312600047642024453 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | instances', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new options = { :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 } collection_tests(service.instances, options, false) do @instance.wait_for { ready? } end end fog-1.34.0/tests/rackspace/models/databases/databases_tests.rb0000644000004100000410000000065112600047642024413 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | databases', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance = service.instances.create({ :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 }) instance.wait_for { ready? } collection_tests(instance.databases, { :name => "db_#{Time.now.to_i.to_s}" }, false) instance.destroy end fog-1.34.0/tests/rackspace/models/databases/users_tests.rb0000644000004100000410000000073212600047642023625 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | users', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance = service.instances.create({ :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 }) instance.wait_for { ready? } options = { :name => "user_#{Time.now.to_i.to_s}", :password => "fog_user" } collection_tests(instance.users, options, false) instance.destroy end fog-1.34.0/tests/rackspace/models/databases/database_tests.rb0000644000004100000410000000147312600047642024233 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | database', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance = service.instances.create({ :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 }) instance.wait_for { ready? } model_tests(instance.databases, { :name => "db_#{Time.now.to_i.to_s}" }, false) user_no_host = instance.users.create(:name => "foo", :password => "foo") user_with_host = instance.users.create(:name => "bar", :host => "10.20.30.40", :password => "bar") db = instance.databases.create(:name => "Test_#{Time.now.to_i}") db.grant_access_for(user_no_host) db.grant_access_for(user_with_host) db.revoke_access_for(user_no_host) db.revoke_access_for(user_with_host) instance.destroy end fog-1.34.0/tests/rackspace/models/databases/instance_tests.rb0000644000004100000410000000224312600047642024267 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | instance', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new options = { :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 } model_tests(service.instances, options, false) do @instance.wait_for { ready? } tests('root_user_enabled before user is enabled').returns(false) do @instance.root_user_enabled? end @instance.wait_for { ready? } tests('enable_root_user sets root user and password').succeeds do @instance.enable_root_user returns(false) { @instance.root_user.nil? } returns(false) { @instance.root_password.nil? } end @instance.wait_for { ready? } tests('restarts instance').succeeds do @instance.restart returns('REBOOT') { @instance.state } end @instance.wait_for { ready? } tests('resizes instance').succeeds do @instance.resize(2) returns('RESIZE') { @instance.state } end @instance.wait_for { ready? } tests('restarts instance').succeeds do @instance.resize_volume(2) returns('RESIZE') { @instance.state } end end end fog-1.34.0/tests/rackspace/models/databases/user_tests.rb0000644000004100000410000000072412600047642023443 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Databases | user', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Databases.new instance = service.instances.create({ :name => "fog_instance_#{Time.now.to_i.to_s}", :flavor_id => 1, :volume_size => 1 }) instance.wait_for { ready? } options = { :name => "user_#{Time.now.to_i.to_s}", :password => "fog_user" } model_tests(instance.users, options, false) instance.destroy end fog-1.34.0/tests/rackspace/models/storage/0000755000004100000410000000000012600047642020430 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/storage/metadata_tests.rb0000644000004100000410000001614612600047642023767 0ustar www-datawww-datarequire 'fog/rackspace/models/storage/metadata' require 'fog/rackspace/models/storage/directory' require 'fog/rackspace/models/storage/directories' require 'fog/rackspace/models/storage/file' Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do def assert_directory(obj, assert_value) metadata = Fog::Storage::Rackspace::Metadata.new obj returns(assert_value) { metadata.send :directory? } end def assert_file(obj, assert_value) metadata = Fog::Storage::Rackspace::Metadata.new obj returns(assert_value) { metadata.send :file? } end tests('Directory') do @directory = Fog::Storage::Rackspace::Directory.new tests('#to_key') do tests('valid key').returns(:image_size) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata.send(:to_key, "X-Container-Meta-Image-Size") end tests('invalid key').returns(nil) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata.send(:to_key, "bad-key") end end tests('#[]') do tests('[:symbol_test]=42') do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata[:symbol_test] = 42 returns(42) { metadata[:symbol_test] } returns(42) { metadata['symbol_test'] } returns(nil) { metadata[:nil_test] } end tests('[\'string_test\']=55') do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata['string_test'] = 55 returns(55) { metadata[:string_test] } returns(55) { metadata['string_test'] } returns(nil) { metadata['nil_test'] } end tests('set string and symbol') do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata[:key_test] = 55 metadata['key_test'] = 55 returns(1) { metadata.size } end tests('key to remove').returns("X-Remove-Container-Meta-Thumbnail-Image") do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata.send(:to_header_key, :thumbnail_image, nil) end end tests('#to_header_key') do metadata = Fog::Storage::Rackspace::Metadata.new @directory tests('key to add').returns("X-Container-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, true) end tests('key to remove').returns("X-Remove-Container-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, nil) end end tests('#to_headers').returns({"X-Container-Meta-Preview"=>true, "X-Remove-Container-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata[:preview] = true metadata[:delete_me] = nil metadata.to_headers end tests("#from_headers").returns({:my_boolean=>"true", :my_integer=>"42", :my_string=>"I am a string"}) do headers = { "X-Container-Meta-My-Integer"=> "42", "X-Container-Meta-My-Boolean"=> "true", "X-Container-Meta-My-String"=> "I am a string" } metadata = Fog::Storage::Rackspace::Metadata.from_headers @directory, headers metadata.data end tests("#delete").returns({"X-Remove-Container-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata.delete(:delete_me) metadata.to_headers end end tests('File') do @file = Fog::Storage::Rackspace::File.new tests('#to_key') do tests('valid key').returns(:image_size) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata.send(:to_key, "X-Object-Meta-Image-Size") end tests('invalid key').returns(nil) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata.send(:to_key, "bad-key") end end tests('#to_header_key') do metadata = Fog::Storage::Rackspace::Metadata.new @file tests('key to add').returns("X-Object-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, true) end tests('key to remove').returns("X-Remove-Object-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, nil) end end tests('#to_headers').returns({"X-Object-Meta-Preview"=>true, "X-Remove-Object-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata[:preview] = true metadata[:delete_me] = nil metadata.to_headers end tests("#from_headers").returns({:my_boolean=>"true", :my_integer=>"42", :my_string=>"I am a string"}) do headers = { "X-Object-Meta-My-Integer"=> "42", "X-Object-Meta-My-Boolean"=> "true", "X-Object-Meta-My-String"=> "I am a string" } metadata = Fog::Storage::Rackspace::Metadata.from_headers @file, headers metadata.data end tests("#delete").returns({"X-Remove-Object-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata.delete(:delete_me) metadata.to_headers end end tests("#respond_to?") do tests('Should respond to all of the methods in Hash class').returns(true) do metadata = Fog::Storage::Rackspace::Metadata.new @file Hash.instance_methods.all? {|method| metadata.respond_to?(method)} end tests('Should respond to all of the methods in the Metadata class').returns(true) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata.methods.all? {|method| metadata.respond_to?(method)} end end tests("#method_missing").returns(true) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata[:test] = true metadata[:test] end tests('#directory?') do assert_directory Fog::Storage::Rackspace::Directories, true assert_directory Fog::Storage::Rackspace::Directory, true assert_directory Fog::Storage::Rackspace::Directory.new, true assert_directory nil, false assert_directory Fog::Storage::Rackspace::Files, false assert_directory Fog::Storage::Rackspace::File, false assert_directory Fog::Storage::Rackspace::File.new, false assert_directory "I am a string!", false end tests('#file?') do assert_file Fog::Storage::Rackspace::Directories, false assert_file Fog::Storage::Rackspace::Directory, false assert_file Fog::Storage::Rackspace::Directory.new, false assert_file nil, false assert_file Fog::Storage::Rackspace::Files, true assert_file Fog::Storage::Rackspace::File, true assert_file Fog::Storage::Rackspace::File.new, true assert_file "I am a string!", false end tests('#parent_class') do tests('Fog::Storage::Rackspace::Directory object') do metadata = Fog::Storage::Rackspace::Metadata.new Fog::Storage::Rackspace::Directory.new returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } end tests('Fog::Storage::Rackspace::Directory class') do metadata = Fog::Storage::Rackspace::Metadata.new Fog::Storage::Rackspace::Directory returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } end end end fog-1.34.0/tests/rackspace/models/storage/file_tests.rb0000644000004100000410000002742012600047642023123 0ustar www-datawww-datarequire 'fog/rackspace/models/storage/file' Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do tests("last_modified=") do tests("no timezone") do file = Fog::Storage::Rackspace::File.new file.last_modified = "2013-05-09T22:20:59.287990" returns(Fog::Time.utc(2013, 5, 9, 22, 20, 59, 287990, nil) == file.last_modified) { true } end tests("with timezone") do file = Fog::Storage::Rackspace::File.new file.last_modified = "Thu, 09 May 2015 22:20:59 GMT" returns(Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil).to_i == file.last_modified.to_i) { true } end tests("with time") do file = Fog::Storage::Rackspace::File.new file.last_modified = Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil) returns(Fog::Time.utc(2015, 5, 9, 22, 20, 59, 0, nil) == file.last_modified) { true } end tests("nil") do file = Fog::Storage::Rackspace::File.new file.last_modified = nil returns(nil) { file.last_modified } end tests("empty string") do file = Fog::Storage::Rackspace::File.new file.last_modified = "" returns("") { file.last_modified } end end def object_attributes(file=@instance) @instance.service.head_object(@directory.key, file.key).headers end def object_meta_attributes(file=@instance) object_attributes(file).reject {|k, v| !(k =~ /X-Object-Meta-/)} end def clear_metadata @instance.metadata.tap do |metadata| metadata.each_pair {|k, v| metadata[k] = nil } end end file_attributes = { :key => 'fog_file_tests', :body => lorem_file } directory_attributes = { # Add a random suffix to prevent collision :key => "fogfilestests-#{rand(65536)}" } @service = Fog::Storage.new :provider => 'rackspace', :rackspace_temp_url_key => "my_secret" @directory = @service.directories.create(directory_attributes) model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("#metadata should load empty metadata").returns({}) do @instance.metadata.data end tests('#save') do tests('#metadata') do before do @instance.metadata[:foo] = 'bar' @instance.save end after do clear_metadata @instance.save end tests("should update metadata").returns('bar') do object_meta_attributes['X-Object-Meta-Foo'] end tests('should cache metadata').returns('bar') do @instance.metadata[:foo] end tests('should remove empty metadata').returns({}) do @instance.metadata[:foo] = nil @instance.save object_meta_attributes end tests("removes one key while leaving the other") do @instance.metadata[:color] = "green" @instance.save returns({"X-Object-Meta-Foo"=>"bar", "X-Object-Meta-Color"=>"green"}) { object_meta_attributes } tests("set metadata[:color] = nil").returns({"X-Object-Meta-Foo"=>"bar"}) do @instance.metadata[:color] = nil @instance.save object_meta_attributes end end end begin tests("sets metadata on create").returns("true") do @file = @directory.files.create :key => 'meta-test', :body => lorem_file, :metadata => {:works => true } object_meta_attributes(@file)["X-Object-Meta-Works"] end tests("sets Content-Disposition on create").returns("ho-ho-ho") do @file = @directory.files.create :key => 'meta-test', :body => lorem_file, :content_disposition => 'ho-ho-ho' object_attributes(@file)["Content-Disposition"] end ensure @file.destroy if @file end tests('urls') do tests('no CDN') do tests('url') do tests('http').succeeds do expire_time = Time.now + 3600 url = @instance.url(expire_time) url =~ /^http:/ end tests('https').succeeds do @directory.service.instance_variable_set "@rackspace_cdn_ssl", true expire_time = Time.now + 3600 url = @instance.url(expire_time) url =~ /^https:/ end @directory.service.instance_variable_set "@rackspace_cdn_ssl", false end tests('#public_url') do tests('http').returns(nil) do @instance.public_url end @directory.cdn_cname = "my_cname.com" tests('cdn_cname').returns(nil) do @instance.public_url end @directory.cdn_cname = nil @directory.service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(nil) do @instance.public_url end @directory.service.instance_variable_set "@rackspace_cdn_ssl", nil end tests('#ios_url').returns(nil) do @instance.ios_url end tests('#streaming_url').returns(nil) do @instance.streaming_url end end tests('With CDN') do tests('#public_url') do @directory.public = true @directory.save tests('http').returns(0) do @instance.public_url =~ /http:\/\/.*#{@instance.key}/ end @directory.cdn_cname = "my_cname.com" tests('cdn_cname').returns(0) do @instance.public_url =~ /my_cname\.com.*#{@instance.key}/ end @directory.cdn_cname = nil @directory.service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(0) do @instance.public_url =~ /https:\/\/.+\.ssl\..*#{@instance.key}/ end @directory.service.instance_variable_set "@rackspace_cdn_ssl", nil end tests('#ios_url').returns(0) do @instance.ios_url =~ /http:\/\/.+\.iosr\..*#{@instance.key}/ end tests('#streaming_url').returns(0) do @instance.streaming_url =~ /http:\/\/.+\.stream\..*#{@instance.key}/ end end tests('etags') do text = lorem_file.read md5 = Digest::MD5.new md5 << text etag = md5.hexdigest begin tests('valid tag').returns(true) do @file = @directory.files.create :key => 'valid-etag.txt', :body => text, :etag => etag @file.reload @file.etag == etag end ensure @file.destroy if @file end tests('invalid tag').raises(Fog::Storage::Rackspace::ServiceError) do @directory.files.create :key => 'invalid-etag.txt', :body => text, :etag => "bad-bad-tag" end end end tests('#metadata keys') do after do clear_metadata @instance.save end @instance.metadata[:foo_bar] = 'baz' tests("should support compound key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end @instance.metadata['foo'] = 'bar' tests("should support string keys").returns('bar') do @instance.save object_meta_attributes['X-Object-Meta-Foo'] end @instance.metadata['foo_bar'] = 'baz' tests("should support compound string key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end @instance.metadata['foo-bar'] = 'baz' tests("should support hyphenated keys").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end end end tests("#access_control_allow_origin") do tests("#access_control_allow_origin should default to nil").returns(nil) do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'http://example.com' @instance.save tests("#access_control_allow_origin should return access control attribute").returns('http://example.com') do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'foo' @instance.save tests("#access_control_allow_origin= should update access_control_allow_origin").returns('bar') do @instance.access_control_allow_origin = 'bar' @instance.save @instance.access_control_allow_origin end tests("#access_control_allow_origin= should not blow up on nil") do @instance.access_control_allow_origin = nil @instance.save end end tests("#delete_at") do @delete_at_time = (Time.now + 300).to_i tests("#delete_at should default to nil").returns(nil) do @instance.delete_at end @instance.delete_at = @delete_at_time @instance.save tests("#delete_at should return delete_at attribute").returns(@delete_at_time) do @instance.delete_at end @instance.delete_at = @delete_at_time @instance.save tests("#delete_at= should update delete_at").returns(@delete_at_time + 100) do @instance.delete_at = @delete_at_time + 100 @instance.save @instance.delete_at end tests("#delete_at= should not blow up on nil") do @instance.delete_at = nil @instance.save end end tests("#delete_after") do @delete_after_time = (Time.now + 300).to_i tests("#delete_after should default to nil").returns(nil) do @instance.delete_after end @instance.delete_after = @delete_after_time @instance.save tests("#delete_after should return delete_after attribute").returns(@delete_after_time) do @instance.delete_after end @instance.delete_after = @delete_after_time @instance.save tests("#delete_after= should update delete_after").returns(@delete_after_time + 100) do @instance.delete_after = @delete_after_time + 100 @instance.save @instance.delete_after end tests("#delete_after= should not blow up on nil") do @instance.delete_after = nil @instance.save end end end model_tests(@directory.files, file_attributes, Fog.mocking?) do tests("#origin") do tests("#origin should default to nil").returns(nil) do @instance.save @instance.origin end @instance.origin = 'http://example.com' @instance.save tests("#origin should return access control attributes").returns('http://example.com') do @instance.origin end @instance.attributes.delete('Origin') @instance.origin = 'foo' @instance.save tests("#origin= should update origin").returns('bar') do @instance.origin = 'bar' @instance.save @instance.origin end tests("#origin= should not blow up on nil") do @instance.origin = nil @instance.save end end tests("#content_encoding") do tests("#content_encoding should default to nil").returns(nil) do @instance.save @instance.content_encoding end @instance.content_encoding = 'gzip' @instance.save tests("#content_encoding should return the content encoding").returns('gzip') do @instance.content_encoding end @instance.attributes.delete('content_encoding') @instance.content_encoding = 'foo' @instance.save tests("#content_encoding= should update content_encoding").returns('bar') do @instance.content_encoding = 'bar' @instance.save @instance.content_encoding end tests("#content_encoding= should not blow up on nil") do @instance.content_encoding = nil @instance.save end end end @directory.destroy end fog-1.34.0/tests/rackspace/models/storage/directory_tests.rb0000644000004100000410000001007212600047642024203 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do @service = Fog::Storage[:rackspace] def container_meta_attributes @service.head_container(@instance.key).headers.reject {|k, v| !(k =~ /X-Container-Meta-/)} end directory_attributes = { # Add a random suffix to prevent collision :key => "fog-directory-tests-#{rand(65536)}" } model_tests(@service.directories, directory_attributes, Fog.mocking?) do tests('#public?').returns(false) do @instance.public? end tests('#public_url') do tests('http').returns(nil) do @instance.public_url end @instance.cdn_cname = "my_cname.com" tests('cdn_cname').returns(nil) do @instance.public_url end @instance.cdn_cname = nil @service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(nil) do @instance.public_url end @service.instance_variable_set "@rackspace_cdn_ssl", nil end tests('#ios_url').returns(nil) do @instance.ios_url end tests('#streaming_url').returns(nil) do @instance.streaming_url end tests('cdn') do @instance.public = true @instance.save tests('#public?').returns(true) do @instance.public? end tests('#public_url') do tests('http').returns(0) do @instance.public_url =~ /http:\/\// end @instance.cdn_cname = "my_cname.com" tests('cdn_cname').returns(0) do @instance.public_url =~ /my_cname\.com/ end @instance.cdn_cname = nil @service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(0) do @instance.public_url =~ /https:\/\/.+\.ssl\./ end @service.instance_variable_set "@rackspace_cdn_ssl", nil end tests('#ios_url').returns(0) do @instance.ios_url =~ /http:\/\/.+\.iosr\./ end tests('#streaming_url').returns(0) do @instance.streaming_url =~ /http:\/\/.+\.stream\./ end end tests("reload") do @instance.reload returns(nil) { @instance.instance_variable_get("@urls") } returns(nil) { @instance.instance_variable_get("@files") } returns(nil) { @instance.instance_variable_get("@public") } end end directory_attributes[:metadata] = {:draft => 'true'} tests('metadata') do model_tests(@service.directories, directory_attributes, Fog.mocking?) do tests('sets metadata on create').returns('true') do @instance.metadata.data container_meta_attributes["X-Container-Meta-Draft"] end tests('update metadata').returns({"X-Container-Meta-Draft"=>"true", "X-Container-Meta-Color"=>"green"}) do @instance.metadata[:color] = 'green' @instance.save container_meta_attributes end tests('set metadata to nil').returns({"X-Container-Meta-Draft"=>"true"}) do @instance.metadata[:color] = nil @instance.save container_meta_attributes end tests('delete metadata').returns({}) do @instance.metadata.delete(:draft) @instance.save container_meta_attributes end tests('should retrieve metadata when necessary') do @service.put_container(@instance.key, {"X-Container-Meta-List-Test"=>"true"} ) dir = @service.directories.find {|d| d.key == @instance.key } returns(nil) { dir.instance_variable_get("@metadata") } returns('true') { dir.metadata[:list_test] } end tests("should reload metadata after calling reload").returns("42") do @service.put_container @instance.key, "X-Container-Meta-Answer" => 42 @instance.reload @instance.metadata[:answer] end tests("should reload metadata after calling reload").returns("42") do @service.put_container @instance.key, "X-Container-Meta-Answer" => 42 @instance.reload @instance.metadata[:answer] end end end end fog-1.34.0/tests/rackspace/models/storage/files_tests.rb0000644000004100000410000000213712600047642023304 0ustar www-datawww-dataShindo.tests("Fog::Rackspace::Storage | files", ['rackspace', 'storage']) do file_attributes = { :key => 'fog_files_tests', :body => lorem_file } directory_attributes = { :key => 'fogfilestests', :public => true } tests('success') do collection_tests(Fog::Storage[:rackspace].directories.create(directory_attributes).files, file_attributes, Fog.mocking?) @service = Fog::Storage.new :provider => 'rackspace', :rackspace_temp_url_key => "my_secret" @directory = @service.directories.create(directory_attributes) @file = @directory.files.create(file_attributes) tests("#get_url('#{@directory.key}')").succeeds do @directory.files.get_url(@directory.key) end tests("#get_http_url('#{@directory.key}')").succeeds do expire_time = Time.now + 3600 @directory.files.get_http_url(@file.key, expire_time) end tests("#get_https_url('#{@directory.key}', '#{@file.key}')").succeeds do expire_time = Time.now + 3600 @directory.files.get_https_url(@file.key, expire_time) end @file.destroy @directory.destroy end end fog-1.34.0/tests/rackspace/models/storage/directories_tests.rb0000644000004100000410000000146012600047642024514 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Storage | directories', ['rackspace']) do @service = Fog::Storage[:rackspace] begin @name = "fog-directories-test-#{Time.now.to_i.to_s}" @filename = 'lorem.txt' @dir = @service.directories.create :key => @name, :metadata => {:fog_test => true} @file = @dir.files.create :key => @filename, :body => lorem_file tests('#get').succeeds do instance = @service.directories.get @name returns(false) { instance.nil? } returns('true') { instance.metadata[:fog_test] } returns(@name) { instance.key } returns(1) { instance.count } returns( Fog::Storage.get_body_size(lorem_file)) {instance.bytes } returns(@filename) { instance.files.first.key } end ensure @file.destroy if @file @dir.destroy if @dir end end fog-1.34.0/tests/rackspace/models/storage/account_tests.rb0000644000004100000410000000150712600047642023636 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Storage | account', ['rackspace']) do @account = Fog::Storage[:rackspace].account tests('load') do headers = @account.service.head_containers.headers returns(headers['X-Account-Meta-Temp-Url-Key']) { @account.meta_temp_url_key } returns(headers['X-Account-Container-Count'].to_i) { @account.container_count } returns(headers['X-Account-Bytes-Used'].to_i) { @account.bytes_used } returns(headers['X-Account-Object-Count'].to_i) { @account.object_count } end tests('reload') do @account.reload end tests('save') do key = "testing-update-#{Time.now.to_i}" @account.meta_temp_url_key = "testing-update-#{Time.now.to_i}" @account.save headers = @account.service.head_containers.headers returns(key) { headers['X-Account-Meta-Temp-Url-Key'] } end end fog-1.34.0/tests/rackspace/models/networking/0000755000004100000410000000000012600047642021153 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/networking/networks_tests.rb0000644000004100000410000000042012600047642024572 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | networks', ['rackspace']) do service = Fog::Rackspace::Networking.new options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } collection_tests(service.networks, options, true) end fog-1.34.0/tests/rackspace/models/networking/network_tests.rb0000644000004100000410000000041212600047642024410 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | network', ['rackspace']) do service = Fog::Rackspace::Networking.new options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } model_tests(service.networks, options, true) end fog-1.34.0/tests/rackspace/models/networking/virtual_interfaces_tests.rb0000644000004100000410000000114112600047642026610 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | virtual_interfaces', ['rackspace']) do service = Fog::Rackspace::Networking.new options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } tests('virtual_interfaces') do pending if Fog.mocking? begin @server = service.servers.create options @server.wait_for { ready? } tests('#virtual_interfaces').succeeds do @server.virtual_interfaces.all end ensure @server.destroy if @server end end end fog-1.34.0/tests/rackspace/models/networking/virtual_interface_tests.rb0000644000004100000410000000156312600047642026435 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking | virtual_interface', ['rackspace']) do service = Fog::Rackspace::Networking.new net_options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } server_options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } tests('virtual_interface') do pending if Fog.mocking? begin @server = service.servers.create server_options @network = service.networks.create net_options @server.wait_for { ready? } model_tests(@server.virtual_interfaces, {:network => @network}, false) ensure if @server @server.destroy # wait_for_server_deletion(@server) if @server delete_test_network(@network) if @network end end end end fog-1.34.0/tests/rackspace/models/auto_scale/0000755000004100000410000000000012600047642021103 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/auto_scale/webhook_tests.rb0000644000004100000410000000171312600047642024312 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | webhook', ['rackspace', 'rackspace_autoscale']) do service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord pending if Fog.mocking? begin group = service.groups.create({ :policies => POLICIES_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS }) policy = group.policies.create({ :name => "set group to 5 servers", :desired_capacity => 5, :cooldown => 1800, :type => "webhook", :group => group }) options = { :name => 'webhook name', :metadata => { 'owner' => 'me' }, :group => group, :policy => policy } model_tests(policy.webhooks, options, false) do tests('#execution_url').succeeds do @instance.execution_url end end ensure policy.destroy if policy deactive_auto_scale_group(group) group.destroy if group end end fog-1.34.0/tests/rackspace/models/auto_scale/groups_tests.rb0000644000004100000410000000075412600047642024177 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | groups', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord options = { :policies => POLICIES_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS } collection_tests(service.groups, options, false) do tests('deactive scaling group').succeeds do deactive_auto_scale_group(@instance) end end end fog-1.34.0/tests/rackspace/models/auto_scale/policy_tests.rb0000644000004100000410000000144012600047642024150 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | policy', ['rackspace', 'rackspace_autoscale']) do service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord pending if Fog.mocking? begin group = service.groups.create({ :policies => POLICIES_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS }) options = { :name => "policy 2", :change => 1, :cooldown => 100, :type => 'webhook', :group => group } model_tests(group.policies, options, false) do tests('#execute').succeeds do @instance.execute end tests('#webhooks').succeeds do @instance.webhooks end end ensure deactive_auto_scale_group(group) group.destroy if group end end fog-1.34.0/tests/rackspace/models/auto_scale/group_tests.rb0000644000004100000410000000143312600047642024007 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | group', ['rackspace', 'rackspace_autoscale']) do service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord options = { :name => "fog_#{Time.now.to_i.to_s}", :policies => POLICIES_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS } model_tests(service.groups, options, false) do pending if Fog.mocking? tests('#policies').succeeds do @instance.policies end tests('#launch_config').succeeds do @instance.launch_config end tests('#group_config').succeeds do @instance.group_config end tests('#state').succeeds do @instance.state end tests('deactive scaling group').succeeds do deactive_auto_scale_group(@instance) end end end fog-1.34.0/tests/rackspace/models/auto_scale/policies_tests.rb0000644000004100000410000000116012600047642024457 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | policies', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord begin group = service.groups.create({ :policies => POLICIES_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS }) options = { :name => "policy 2", :change => 5, :cooldown => 100, :type => 'webhook' } collection_tests(group.policies, options, false) ensure deactive_auto_scale_group(group) group.destroy if group end end fog-1.34.0/tests/rackspace/models/auto_scale/webhooks_tests.rb0000644000004100000410000000141012600047642024467 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::AutoScale | webhooks', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord begin group = service.groups.create({ :policies => POLICIES_OPTIONS, :group_config => GROUP_CONFIG_OPTIONS, :launch_config => LAUNCH_CONFIG_OPTIONS }) policy = group.policies.create({ :name => "policy 2", :change => 5, :cooldown => 100, :type => 'webhook', :group => group }) options = {:name => 'New webhook', :group => group, :policy => policy } collection_tests(policy.webhooks, options, false) ensure policy.destroy if policy deactive_auto_scale_group(group) group.destroy if group end end fog-1.34.0/tests/rackspace/models/auto_scale/group_builder_tests.rb0000644000004100000410000001172312600047642025520 0ustar www-datawww-datarequire 'fog/rackspace/models/auto_scale/group_builder' require 'fog/rackspace/models/auto_scale/group' require 'fog/rackspace/models/compute_v2/flavor' require 'fog/rackspace/models/load_balancers/load_balancer' Shindo.tests('Fog::Rackspace::AutoScale | group builder', ['rackspace', 'rackspace_autoscale']) do builder = Fog::Rackspace::AutoScale::GroupBuilder tests('#get_id') do tests('widget_id').returns(5) do builder.send(:get_id, 'widget', {:widget_id => 5, :noise => 3}) end tests('widget').returns(5) do Fog::Rackspace::AutoScale::GroupBuilder.send(:get_id, 'widget', {:widget => 5, :noise => 3}) end tests('Flavor object').returns(2) do flavor = Fog::Compute::RackspaceV2::Flavor.new(:id => 2) builder.send(:get_id, 'flavor', {:flavor => flavor, :noise => 3}) end end tests('networks_to_hash').returns([{"uuid" => '00000000-0000-0000-0000-000000000000'}]) do builder.send(:networks_to_hash, ['00000000-0000-0000-0000-000000000000']) end tests('#build_server_template').returns(LAUNCH_CONFIG_OPTIONS["args"]["server"]) do attributes = { :server_name => "autoscale_server", :image => "0d589460-f177-4b0f-81c1-8ab8903ac7d8", :flavor => "2", :disk_config => "AUTO", :server_metadata => { "build_config" => "core", "meta_key_1" => "meta_value_1", "meta_key_2" => "meta_value_2" }, :networks => ["11111111-1111-1111-1111-111111111111", "00000000-0000-0000-0000-000000000000"], :personality => [ { "path" => "/root/.csivh", "contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4=" } ] } builder.send(:build_server_template, attributes) end tests('#load_balancer_to_hash') do lb_test_hash = { "port" => 80, "loadBalancerId" => 1234 } tests('hash').raises(ArgumentError, "Expected LoadBalancer") do builder.send(:load_balancer_to_hash, lb_test_hash) end tests('LoadBalancer').returns(lb_test_hash) do lb = Fog::Rackspace::LoadBalancers::LoadBalancer.new :port => 80, :id => 1234 builder.send(:load_balancer_to_hash, lb) end end tests('build_load_balancers') do lb_test_hash = { "port" => 80, "loadBalancerId" => 1234 } tests('nil').returns(nil) do builder.send(:build_load_balancers, {}) end tests('hash').returns([lb_test_hash]) do builder.send(:build_load_balancers, :load_balancers => [lb_test_hash]) end tests('LoadBalancer').returns([lb_test_hash]) do lb = Fog::Rackspace::LoadBalancers::LoadBalancer.new :port => 80, :id => 1234 builder.send(:build_load_balancers, :load_balancers => [lb]) end tests('multiple lbs').returns([lb_test_hash, lb_test_hash]) do lb = Fog::Rackspace::LoadBalancers::LoadBalancer.new :port => 80, :id => 1234 builder.send(:build_load_balancers, :load_balancers => [lb, lb]) end end tests('build_server_launch_config') do tests('no launch_config_type').returns(nil) do builder.build_server_launch_config({:pancakes => true}) end tests('wrong launch_config_type').returns(nil) do builder.build_server_launch_config({:launch_config_type => :something_else}) end tests('valid launch config').returns(LAUNCH_CONFIG_OPTIONS["args"]) do attributes = { :server_name => "autoscale_server", :image => "0d589460-f177-4b0f-81c1-8ab8903ac7d8", :flavor => "2", :disk_config => "AUTO", :server_metadata => { "build_config" => "core", "meta_key_1" => "meta_value_1", "meta_key_2" => "meta_value_2" }, :networks => ["11111111-1111-1111-1111-111111111111", "00000000-0000-0000-0000-000000000000"], :personality => [ { "path" => "/root/.csivh", "contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4=" } ], :launch_config_type => :launch_server, :load_balancers => { "port" => 8080, "loadBalancerId" => 9099} } builder.build_server_launch_config(attributes).args end end tests('#build_group_config') do attributes = { :max_entities => 3, :min_entities => 0, :cooldown => 360, :name => "testscalinggroup198547", :metadata => { "gc_meta_key_2" => "gc_meta_value_2", "gc_meta_key_1" => "gc_meta_value_1" } } config = builder.build_group_config(attributes) returns(3) { config.max_entities } returns(0) { config.min_entities } returns(360) { config.cooldown } returns("testscalinggroup198547") { config.name } returns(attributes[:metadata]) { config.metadata } end tests('build') do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord group = builder.build(service, :launch_config_type => :launch_server, :server_name => 'test', :cooldown => 500) returns(500) { group.group_config.cooldown } returns('test') { group.launch_config.args["server"]["name"]} end end fog-1.34.0/tests/rackspace/models/identity/0000755000004100000410000000000012600047642020615 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/identity/service_catalog_tests.rb0000644000004100000410000002643712600047642025532 0ustar www-datawww-datarequire 'fog/rackspace/models/identity/service_catalog' Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do tests('successful') do before_hash = {"access"=>{"token"=>{"expires"=>"2013-02-20T10:31:00.000-06:00", "tenant"=>{"name"=>"777", "id"=>"777"}, "id"=>"6ca10877-7c50-4a5c-b58f-004d835c39c3"}, "serviceCatalog"=>[{"type"=>"volume", "endpoints"=>[{"region"=>"DFW", "tenantId"=>"777", "publicURL"=>"https://dfw.blockstorage.api.rackspacecloud.com/v1/777"}, {"region"=>"ORD", "tenantId"=>"777", "publicURL"=>"https://ord.blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}, {"type"=>"rax:load-balancer", "endpoints"=>[{"region"=>"ORD", "tenantId"=>"777", "publicURL"=>"https://ord.loadbalancers.api.rackspacecloud.com/v1.0/777"}, {"region"=>"DFW", "tenantId"=>"777", "publicURL"=>"https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudLoadBalancers"}, {"type"=>"object-store", "endpoints"=>[{"internalURL"=>"https://snet-storage101.dfw1.clouddrive.com/v1/Mosso777", "region"=>"DFW", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777"}, {"internalURL"=>"https://snet-storage101.ord1.clouddrive.com/v1/Mosso777", "region"=>"ORD", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFiles"}, {"type"=>"rax:database", "endpoints"=>[{"region"=>"DFW", "tenantId"=>"777", "publicURL"=>"https://dfw.databases.api.rackspacecloud.com/v1.0/777"}, {"region"=>"ORD", "tenantId"=>"777", "publicURL"=>"https://ord.databases.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudDatabases"}, {"type"=>"rax:dns", "endpoints"=>[{"tenantId"=>"777", "publicURL"=>"https://dns.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudDNS"}, {"type"=>"compute", "endpoints"=>[{"versionId"=>"1.0", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v1.0", "publicURL"=>"https://servers.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudServers"}, {"type"=>"compute", "endpoints"=>[{"region"=>"DFW", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}], "name"=>"cloudServersOpenStack"}, {"type"=>"rax:monitor", "endpoints"=>[{"tenantId"=>"777", "publicURL"=>"https://monitoring.api.rackspacecloud.com/v1.0/777"}], "name"=>"cloudMonitoring"}, {"type"=>"rax:object-cdn", "endpoints"=>[{"region"=>"DFW", "tenantId"=>"Mosso777", "publicURL"=>"https://cdn1.clouddrive.com/v1/Mosso777"}, {"region"=>"ORD", "tenantId"=>"Mosso777", "publicURL"=>"https://cdn2.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFilesCDN"}, {"type"=>"not_here", "name" => "not_here", "endpoints"=>[{"tenantId"=>"777", "region" => "LON", "publicURL"=>"https://monitoring.api.rackspacecloud.com/v1.0/777"}]} ], "user"=>{"roles"=>[{"description"=>"User Admin Role.", "name"=>"identity:user-admin", "id"=>"3"}], "name"=>"joe-racker", "RAX-AUTH:defaultRegion"=>"", "id"=>"TK421"}}} @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash) end tests('services') do services = ["cloudBlockStorage", "cloudDNS", "cloudDatabases", "cloudFiles", "cloudFilesCDN", "cloudLoadBalancers", "cloudMonitoring", "cloudServers", "cloudServersOpenStack", "not_here"] returns(services) { @service_catalog.services.map {|s| s.to_s }.sort } end tests('get_endpoints') do endpoints = [{"region"=>"DFW", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}] returns(endpoints) { @service_catalog.get_endpoints(:cloudServersOpenStack) } returns(endpoints) { @service_catalog.get_endpoints('cloudServersOpenStack') } returns({}) { @service_catalog.get_endpoints('non-existent') } end tests('get_endpoint') do tests('service with mulitple endpoints') do returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :dfw) } returns("https://ord.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord) } returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, 'dfw') } returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', 'dfw') } returns("https://servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', :global) } end tests('with one endpoint') do tests('catalog contains global endpoint') do catalog_hash = [{"type"=>"volume", "endpoints"=>[{"tenantId"=>"777", "publicURL"=>"https://blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}] @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash) tests('no region specifed').returns("https://blockstorage.api.rackspacecloud.com/v1/777") do @service_catalog.get_endpoint(:cloudBlockStorage) end tests('region specifed').returns("https://blockstorage.api.rackspacecloud.com/v1/777") do @service_catalog.get_endpoint(:cloudBlockStorage, :ord) end end tests('catalog does not contain global endpoint') do catalog_hash = [{"type"=>"volume", "endpoints"=>[{"region" => "ORD", "tenantId"=>"777", "publicURL"=>"https://ord.blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}] @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash) tests('non-existing region') do raises(RuntimeError) { @service_catalog.get_endpoint(:cloudBlockStorage, :dfw) } end tests('existing region').returns("https://ord.blockstorage.api.rackspacecloud.com/v1/777") do @service_catalog.get_endpoint(:cloudBlockStorage, :ord) end end end tests('endpoint type') do catalog_hash = [{"type"=>"object-store", "endpoints"=>[{"internalURL"=>"https://snet-storage101.dfw1.clouddrive.com/v1/Mosso777", "region"=>"DFW", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777"}, {"internalURL"=>"https://snet-storage101.ord1.clouddrive.com/v1/Mosso777", "region"=>"ORD", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFiles"}] @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash) returns("https://storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord) } returns("https://snet-storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, true) } returns("https://storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, false) } end tests('error conditions') do raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack) } raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :sat) } raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :sat, true) } raises(RuntimeError) { @service_catalog.get_endpoint(:not_here, :dfw) } raises(RuntimeError) { @service_catalog.get_endpoint('non-existent') } raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord, true) } end end tests('reload').succeeds do pending if Fog.mocking? service = Fog::Identity[:rackspace] service_catalog = service.service_catalog service_catalog.catalog << {"name"=>"fakeService", "endpoints"=>[{ "publicURL"=>"http:///fake-endpoint.com"}]} returns("http:///fake-endpoint.com") { service_catalog.get_endpoint :fakeService } returns("http:///fake-endpoint.com") { service.service_catalog.get_endpoint :fakeService } service_catalog.reload raises(RuntimeError) { service_catalog.get_endpoint :fakeService } raises(RuntimeError) { service.service_catalog.get_endpoint :fakeService } end tests('display_service_regions') do tests('with global endpoint').returns(":dfw, :ord, :global") do catalog_hash = [{"type"=>"compute", "endpoints"=>[{"region"=>"DFW", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}], "name"=>"cloudServersOpenStack"}] @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash) @service_catalog.display_service_regions(:cloudServersOpenStack) end tests('endpoint types') do catalog_hash = [{"type"=>"object-store", "endpoints"=>[{"internalURL"=>"https://snet-storage101.dfw1.clouddrive.com/v1/Mosso777", "region"=>"DFW", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.dfw1.clouddrive.com/v1/Mosso777"}, { "region"=>"ORD", "tenantId"=>"Mosso777", "publicURL"=>"https://storage101.ord1.clouddrive.com/v1/Mosso777"}], "name"=>"cloudFiles"},] @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.new(:service => nil, :catalog => catalog_hash) tests('public').returns(":dfw, :ord") do @service_catalog.display_service_regions(:cloudFiles) end tests('private').returns(":dfw") do @service_catalog.display_service_regions(:cloudFiles, true) end end end end fog-1.34.0/tests/rackspace/models/identity/tenants_tests.rb0000644000004100000410000000071712600047642024045 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | tenants', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Identity.new username = "fog_user_#{Time.now.to_i.to_s}" options = { :username => username, :email => 'email@example.com', :enabled => true } tests("#all").succeeds do service.tenants.all end tests("#get").succeeds do tenant = service.tenants.all.first service.tenants.get(tenant.identity) end end fog-1.34.0/tests/rackspace/models/identity/credentials_tests.rb0000644000004100000410000000121512600047642024660 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | credentials', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Identity.new user = service.users.all.first tests('success') do tests("#all").succeeds do credentials = user.credentials.all credentials.all? { |c| c.username && c.apiKey } end tests("#get").succeeds do list_credential = user.credentials.all.first credential = user.credentials.get(list_credential.identity) credential.username && credential.apiKey end end tests("failure").returns(nil) do user.credentials.get('i am a credential that does not exist') end end fog-1.34.0/tests/rackspace/models/identity/users_tests.rb0000644000004100000410000000065412600047642023532 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | users', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Identity.new username = "fog#{Time.now.to_i.to_s}" options = { :username => username, :email => 'email@example.com', :enabled => true } collection_tests(service.users, options, false) do tests('#get_by_name').succeeds do service.users.get_by_name(username) end end end fog-1.34.0/tests/rackspace/models/identity/roles_tests.rb0000644000004100000410000000051012600047642023504 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | roles', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Identity.new user = service.users.all.first tests("#all").succeeds do user.roles.all end tests("#get").succeeds do role = user.roles.all.first user.roles.get(role.identity) end end fog-1.34.0/tests/rackspace/models/identity/user_tests.rb0000644000004100000410000000061012600047642023337 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Identity | user', ['rackspace']) do pending if Fog.mocking? service = Fog::Rackspace::Identity.new options = { :username => "fog#{Time.now.to_i.to_s}", :email => 'email@example.com', :enabled => true } model_tests(service.users, options, false) do tests('#save with existing user').succeeds do @instance.save end end end fog-1.34.0/tests/rackspace/models/load_balancers/0000755000004100000410000000000012600047642021715 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/load_balancers/access_lists_tests.rb0000644000004100000410000000050612600047642026144 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | access_lists', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do collection_tests(@lb.access_rules, { :address => '1.1.1.2', :type => 'ALLOW'}, false) do @lb.wait_for { ready? } end end end end fog-1.34.0/tests/rackspace/models/load_balancers/node_tests.rb0000644000004100000410000000076012600047642024414 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | node', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do model_tests(@lb.nodes, { :address => '1.1.1.2', :port => 80, :condition => 'ENABLED'}, false) do @lb.wait_for { ready? } tests("#save() => existing node with port = 88").succeeds do @instance.port = 88 @instance.save end @lb.wait_for { ready? } end end end end fog-1.34.0/tests/rackspace/models/load_balancers/virtual_ips_tests.rb0000644000004100000410000000045612600047642026032 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | virtual_ips', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do collection_tests(@lb.virtual_ips, { :type => 'PUBLIC'}, false) do @lb.wait_for { ready? } end end end end fog-1.34.0/tests/rackspace/models/load_balancers/load_balancers_tests.rb0000644000004100000410000000101712600047642026414 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | load_balancers', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do @lb_name = 'fog' + Time.now.to_i.to_s collection_tests(@service.load_balancers, { :name => @lb_name, :protocol => 'HTTP', :port => 80, :virtual_ips => [{ :type => 'PUBLIC'}], :nodes => [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}] }, false) do @instance.wait_for { ready? } end end end fog-1.34.0/tests/rackspace/models/load_balancers/nodes_tests.rb0000644000004100000410000000051412600047642024574 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | nodes', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do collection_tests(@lb.nodes, { :address => '1.1.1.2', :port => 80, :condition => 'ENABLED'}, false) do @lb.wait_for { ready? } end end end end fog-1.34.0/tests/rackspace/models/load_balancers/virtual_ip_tests.rb0000644000004100000410000000063212600047642025643 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | virtual_ip', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do model_tests(@lb.virtual_ips, { :type => 'PUBLIC'}, false) do @lb.wait_for { ready? } tests("#save => existing virtual IP").raises(Fog::Errors::Error) do @instance.save end end end end end fog-1.34.0/tests/rackspace/models/load_balancers/access_list_tests.rb0000644000004100000410000000050012600047642025753 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | access_list', ['rackspace']) do pending if Fog.mocking? given_a_load_balancer_service do given_a_load_balancer do model_tests(@lb.access_rules, { :address => '1.1.1.2', :type => 'ALLOW'}, false) do @lb.wait_for { ready? } end end end end fog-1.34.0/tests/rackspace/models/load_balancers/load_balancer_tests.rb0000644000004100000410000001475712600047642026250 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers | load_balancer', ['rackspace']) do pending if Fog.mocking? MINIMAL_LB_ATTRIBUTES = { :name => "fog#{Time.now.to_i}", :protocol => 'HTTP', :virtual_ips => [{ :type => 'PUBLIC' }], } NORMAL_LB_ATTRIBUTES = MINIMAL_LB_ATTRIBUTES.merge({ :port => 8080, :nodes => [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED' }] }) FULL_LB_ATTRIBUTES = NORMAL_LB_ATTRIBUTES.merge({ :algorithm => 'LEAST_CONNECTIONS', :timeout => 60 }) HTTPS_REDIRECT_LB_ATTRIBUTES = FULL_LB_ATTRIBUTES.merge({ :protocol => 'HTTPS', :https_redirect => true }) given_a_load_balancer_service do model_tests(@service.load_balancers, NORMAL_LB_ATTRIBUTES, false) do @instance.wait_for { ready? } tests('#save => saving existing with port = 88').succeeds do @instance.port = 88 @instance.save end @instance.wait_for { ready? } tests('#stats').succeeds do @instance.stats end tests('#enable_connection_logging').succeeds do @instance.enable_connection_logging returns(true) { @instance.connection_logging } end tests('#enable_connection_logging after reload').succeeds do @instance.reload returns(true) { @instance.connection_logging } end @instance.wait_for { ready? } tests('#disable_connection_logging').succeeds do @instance.disable_connection_logging returns(false) { @instance.connection_logging } end @instance.wait_for { ready? } tests('#enable_content_caching').succeeds do @instance.enable_content_caching returns(true) { @instance.content_caching } end tests('#enable_content_caching after reload').succeeds do @instance.reload returns(true) { @instance.content_caching } end @instance.wait_for { ready? } tests('#disable_content_caching').succeeds do @instance.disable_content_caching returns(false) { @instance.content_caching } end tests('#usage').succeeds do @instance.usage end tests("#usage(:start_time => '2010-05-10', :end_time => '2010-05-11')").succeeds do @instance.usage(:start_time => '2010-05-10', :end_time => '2010-05-11') end tests("#health_monitor").returns(nil) do @instance.health_monitor end @instance.wait_for { ready? } tests("#enable_health_monitor('CONNECT', 5, 5, 5)").succeeds do @instance.enable_health_monitor('CONNECT', 5, 5, 5) end @instance.wait_for { ready? } tests("#health_monitor").succeeds do monitor = @instance.health_monitor returns('CONNECT') { monitor['type'] } end @instance.wait_for { ready? } tests("#enable_health_monitor('HTTP', 10, 5, 2, {:status_regex => '^[234][0-9][0-9]$', :path=>'/', :body_regex=>' '})").succeeds do @instance.enable_health_monitor('HTTP', 10, 5, 2, {:status_regex => '^[234][0-9][0-9]$', :path=>'/', :body_regex=>' '}) end @instance.wait_for { ready? } tests("#disable_health_monitor").succeeds do @instance.disable_health_monitor end @instance.wait_for { ready? } tests("#connection_throttling").returns(nil) do @instance.connection_throttling end tests("#enable_connection_throttling(5, 5, 5, 5)").succeeds do @instance.enable_connection_throttling(5, 5, 5, 5) end @instance.wait_for { ready? } tests("#connection_throttling").succeeds do throttle = @instance.connection_throttling returns(5) { throttle['maxConnections'] } end @instance.wait_for { ready? } tests("#disable_connection_throttling").succeeds do @instance.disable_connection_throttling end @instance.wait_for { ready? } tests("#session_persistence").returns(nil) do @instance.session_persistence end tests("#enable_session_persistence('HTTP_COOKIE')").succeeds do @instance.enable_session_persistence('HTTP_COOKIE') end @instance.wait_for { ready? } tests("#connction_throttling").succeeds do persistence = @instance.session_persistence returns('HTTP_COOKIE') { persistence['persistenceType'] } end @instance.wait_for { ready? } tests("#disable_session_persistence").succeeds do @instance.disable_session_persistence end @instance.wait_for { ready? } tests("#error_page").succeeds do @instance.error_page end @instance.wait_for { ready? } tests("#error_page = 'asdf'").succeeds do @instance.error_page = 'asdf' end @instance.wait_for { ready? } tests("#reset_error_page").succeeds do @instance.reset_error_page end @instance.wait_for { ready? } tests("#ssl_termination is nil").returns(nil) do @instance.ssl_termination end @instance.wait_for { ready? } tests("#enable_ssl_termination(443, PRIVATE_KEY, CERTIFICATE").succeeds do @instance.enable_ssl_termination(443, PRIVATE_KEY, CERTIFICATE) end @instance.wait_for { ready? } tests("#ssl_termination").succeeds do @instance.ssl_termination end @instance.wait_for { ready? } tests("#disable_ssl_termination").succeeds do @instance.disable_ssl_termination end @instance.wait_for { ready? } end tests('create with minimal attributes') do @lb = @service.load_balancers.create MINIMAL_LB_ATTRIBUTES returns(MINIMAL_LB_ATTRIBUTES[:name]) { @lb.name } returns('HTTP') { @lb.protocol } returns(80) { @lb.port } @lb.wait_for { ready? } @lb.destroy end tests('create with full attributes') do @lb = @service.load_balancers.create FULL_LB_ATTRIBUTES returns('LEAST_CONNECTIONS') { @lb.algorithm } returns(60) { @lb.timeout } @lb.wait_for { ready? } @lb.destroy end tests('create with httpsRedirect') do @lb = @service.load_balancers.create HTTPS_REDIRECT_LB_ATTRIBUTES returns('HTTPS') { @lb.protocol } returns(true) { @lb.https_redirect } @lb.wait_for { ready? } @lb.destroy end tests('failure') do @lb = @service.load_balancers.new NORMAL_LB_ATTRIBUTES tests('#usage => Requires ID').raises(ArgumentError) do @lb.usage end tests('#health_monitor => Requires ID').raises(ArgumentError) do @lb.health_monitor end end end end fog-1.34.0/tests/rackspace/models/dns/0000755000004100000410000000000012600047642017550 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/dns/zones_tests.rb0000644000004100000410000000273512600047642022464 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::DNS | zones', ['rackspace']) do provider = Fog::DNS[:rackspace] domain_sld = uniq_id domain_name = domain_sld + '.com' begin unless Fog.mocking? zone = provider.zones.create({:domain => domain_name, :email => "hostmaster@#{domain_name}"}) end tests("zones.find(#{domain_sld}) => finds domain_name") do pending if Fog.mocking? returns(true) { provider.zones.all.any? {|z| z.domain == domain_name} } end random_name = uniq_id tests("zones.find(#{random_name}) => finds nothing") do pending if Fog.mocking? returns(false) { provider.zones.all.any? {|z| z.domain == random_name} } end ensure zone.destroy unless Fog.mocking? end tests('next_params') do zones = Fog::DNS::Rackspace::Zones.new returns(nil, "no body") { zones.send(:next_params, nil)} returns(nil, "no links") { zones.send(:next_params, {}) } returns(nil, "links are empty") { zones.send(:next_params, {'links' => []}) } returns(nil, "links does not contain next hash") { zones.send(:next_params, {'links' => [ {'rel' => 'previous'} ] }) } returns(nil, "contains a link without parameters") { zones.send(:next_params, {'links' => [ {'rel' => 'next', 'href' => "http://localhost/next"} ] }) } returns({"offset"=>["3"], "limit"=>["3"]}, "contains a link without parameters") { zones.send(:next_params, {'links' => [ {'rel' => 'next', 'href' => "http://localhost/next?offset=3&limit=3"} ] }) } end end fog-1.34.0/tests/rackspace/models/dns/zone_tests.rb0000644000004100000410000000072112600047642022272 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::DNS | zone', ['rackspace']) do pending if Fog.mocking? provider = Fog::DNS[:rackspace] domain_name = uniq_id + '.com' zone = provider.zones.create({:domain => domain_name, :email => 'hostmaster@' + domain_name}) tests('adding same domain twice throws error').raises(Fog::DNS::Rackspace::CallbackError) do provider.zones.create({:domain => domain_name, :email => 'hostmaster@' + domain_name}) end zone.destroy end fog-1.34.0/tests/rackspace/models/compute_v2/0000755000004100000410000000000012600047642021047 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/compute_v2/networks_tests.rb0000644000004100000410000000041612600047642024473 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | networks', ['rackspace']) do service = Fog::Compute::RackspaceV2.new options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } collection_tests(service.networks, options, true) end fog-1.34.0/tests/rackspace/models/compute_v2/flavors_tests.rb0000644000004100000410000000062612600047642024276 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | flavors', ['rackspace']) do service = Fog::Compute::RackspaceV2.new tests("success") do tests("#all").succeeds do service.flavors.all end tests("#get").succeeds do service.flavors.get(service.flavors.first.id) end end tests("failure").returns(nil) do service.flavors.get(Fog::Rackspace::MockData::NOT_FOUND_ID) end end fog-1.34.0/tests/rackspace/models/compute_v2/metadata_tests.rb0000644000004100000410000000250212600047642024375 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do pending if Fog.mocking? service = Fog::Compute::RackspaceV2.new test_time = Time.now.to_i.to_s tests('success') do begin @server = service.servers.create(:name => "fog_server_#{test_time}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service)) @server.wait_for { ready? } tests('server') do collection_tests(@server.metadata, {:key => 'my_key', :value => 'my_value'}) do @server.wait_for { ready? } end end tests('image') do @image = @server.create_image("fog_image_#{test_time}", :metadata => {:my_key => 'my_value'}) @image.wait_for { ready? } tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented metadata = @image.metadata.all my_metadata = metadata.select {|datum| datum.key == 'my_key'} returns(1) { my_metadata.size } returns('my_value') {my_metadata[0].value } end tests("#get('my_key')").returns('my_value') do pending if Fog.mocking? && !mocks_implemented @image.metadata.get('my_key').value end end ensure @image.destroy if @image @server.destroy if @server end end end fog-1.34.0/tests/rackspace/models/compute_v2/image_tests.rb0000644000004100000410000000461512600047642023706 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | image', ['rackspace']) do service = Fog::Compute::RackspaceV2.new test_time = Time.now.to_i.to_s options = { :name => "fog_server_#{test_time}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } tests('ready?') do @server = Fog::Compute::RackspaceV2::Image.new tests('default in ready state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Image::ACTIVE @server.ready? end tests('custom ready state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Image::SAVING @server.ready?(Fog::Compute::RackspaceV2::Image::SAVING) end tests('default NOT in ready state').returns(false) do @server.state = Fog::Compute::RackspaceV2::Image::SAVING @server.ready? end tests('custom NOT ready state').returns(false) do @server.state = Fog::Compute::RackspaceV2::Image::UNKNOWN @server.ready?(Fog::Compute::RackspaceV2::Image::SAVING) end tests('default error state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Image::ERROR exception_occurred = false begin @server.ready? rescue Fog::Compute::RackspaceV2::InvalidImageStateException => e exception_occurred = true returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Image::ACTIVE } returns(true) {e.current_state == Fog::Compute::RackspaceV2::Image::ERROR } end exception_occurred end tests('custom error state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Image::UNKNOWN exception_occurred = false begin @server.ready?(Fog::Compute::RackspaceV2::Image::SAVING, Fog::Compute::RackspaceV2::Image::UNKNOWN) rescue Fog::Compute::RackspaceV2::InvalidImageStateException => e exception_occurred = true returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Image::SAVING } returns(true) {e.current_state == Fog::Compute::RackspaceV2::Image::UNKNOWN } end exception_occurred end end tests("success") do begin server = service.servers.create(options) server.wait_for { ready? } image = server.create_image("fog_image_#{test_time}") tests("destroy").succeeds do image.destroy end ensure server.destroy if server end end end fog-1.34.0/tests/rackspace/models/compute_v2/server_tests.rb0000644000004100000410000002013712600047642024127 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do service = Fog::Compute::RackspaceV2.new cbs_service = Fog::Rackspace::BlockStorage.new tests('setup test network').succeeds do @network = service.networks.create :label => "fog_test_net_#{Time.now.to_i.to_s}", :cidr => '192.168.1.0/24' end options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service), :metadata => { 'fog_test' => 'true' }, :networks => [@network.id] } tests('ready?') do @server = Fog::Compute::RackspaceV2::Server.new tests('default in ready state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Server::ACTIVE @server.ready? end tests('custom ready state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE @server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE) end tests('default NOT in ready state').returns(false) do @server.state = Fog::Compute::RackspaceV2::Server::REBOOT @server.ready? end tests('custom NOT ready state').returns(false) do @server.state = Fog::Compute::RackspaceV2::Server::REBOOT @server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE) end tests('default error state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Server::ERROR exception_occurred = false begin @server.ready? rescue Fog::Compute::RackspaceV2::InvalidServerStateException => e exception_occurred = true returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Server::ACTIVE } returns(true) {e.current_state == Fog::Compute::RackspaceV2::Server::ERROR } end exception_occurred end tests('custom error state').returns(true) do @server.state = Fog::Compute::RackspaceV2::Server::ACTIVE exception_occurred = false begin @server.ready?(Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE, Fog::Compute::RackspaceV2::Server::ACTIVE) rescue Fog::Compute::RackspaceV2::InvalidServerStateException => e exception_occurred = true returns(true) {e.desired_state == Fog::Compute::RackspaceV2::Server::VERIFY_RESIZE } returns(true) {e.current_state == Fog::Compute::RackspaceV2::Server::ACTIVE } end exception_occurred end end model_tests(service.servers, options, true) do @instance.wait_for { ready? } tests('#metadata[\'fog_test\']').returns('true') do @instance.metadata['fog_test'] end tests("includes #{@network.label}").returns(true) do @instance.addresses.keys.include?(@network.label) end tests('#create').succeeds do pending unless Fog.mocking? original_options = Marshal.load(Marshal.dump(options)) @instance.create(options) returns(true) { original_options == options } end tests('#update').succeeds do new_name = "fog_server_update#{Time.now.to_i.to_s}" @instance.name = new_name @instance.access_ipv4_address= "10.10.0.1" @instance.access_ipv6_address= "::1" @instance.save sleep 60 unless Fog.mocking? @instance.reload returns("10.10.0.1") { @instance.access_ipv4_address } returns("::1") { @instance.access_ipv6_address } returns(new_name) { @instance.name } end tests('#reboot("SOFT")').succeeds do @instance.reboot('SOFT') returns('REBOOT') { @instance.state } end @instance.wait_for { ready? } tests('#reboot("HARD")').succeeds do @instance.reboot('HARD') returns('HARD_REBOOT') { @instance.state } end sleep 30 unless Fog.mocking? @instance.wait_for { ready? } sleep 60 unless Fog.mocking? tests('#rebuild').succeeds do @instance.rebuild rackspace_test_image_id(service) returns('REBUILD') { @instance.state } end sleep 30 unless Fog.mocking? @instance.wait_for { ready? } sleep 60 unless Fog.mocking? tests('#resize').succeeds do @instance.resize(3) returns('RESIZE') { @instance.state } end sleep 30 unless Fog.mocking? @instance.wait_for { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) } sleep 60 unless Fog.mocking? tests('#confirm_resize').succeeds do @instance.confirm_resize end sleep 30 unless Fog.mocking? @instance.wait_for { ready? } sleep 60 unless Fog.mocking? tests('#resize').succeeds do @instance.resize(2) returns('RESIZE') { @instance.state } end @instance.wait_for { ready?('VERIFY_RESIZE') } sleep 60 unless Fog.mocking? tests('#revert_resize').succeeds do @instance.revert_resize end @instance.wait_for { ready? } tests('#rescue').succeeds do @instance.rescue end @instance.wait_for { ready?('RESCUE') } tests('#unrescue').succeeds do @instance.unrescue end @instance.wait_for { ready? } tests('#change_admin_password').succeeds do @instance.change_admin_password('somerandompassword') returns('PASSWORD') { @instance.state } returns('somerandompassword') { @instance.password } end @instance.wait_for { ready? } @test_image = nil begin tests('#create_image').succeeds do @test_image = @instance.create_image('fog-test-image') @test_image.reload returns('SAVING') { @test_image.state } end ensure @test_image.destroy unless @test_image.nil? || Fog.mocking? end tests('attachments') do begin @volume = cbs_service.volumes.create(:size => 100, :display_name => "fog-#{Time.now.to_i.to_s}") @volume.wait_for { ready? } tests('#attach_volume').succeeds do @instance.attach_volume(@volume) end tests('#attachments').returns(true) do @instance.wait_for do !attachments.empty? end @instance.attachments.any? {|a| a.volume_id == @volume.id } end ensure @volume.wait_for { !attachments.empty? } @instance.attachments.each {|a| a.detach } @volume.wait_for { ready? && attachments.empty? } @volume.destroy if @volume end end @instance.wait_for { ready? } end tests('#setup') do ATTRIBUTES = { :name => "foo", :image_id => 42, :flavor_id => 42 } create_server = lambda { |attributes| service = Fog::Compute::RackspaceV2.new attributes.merge!(:service => service) Fog::SSH::Mock.data.clear server = Fog::Compute::RackspaceV2::Server.new(attributes) server.save(attributes) @address = 123 server.ipv4_address = @address server.identity = "bar" server.public_key = "baz" server.setup server } commands = lambda { Fog::SSH::Mock.data[@address].first[:commands] } test("leaves user unlocked only when requested") do create_server.call(ATTRIBUTES.merge(:no_passwd_lock => true)) commands.call.none? { |c| c =~ /passwd\s+-l\s+root/ } end test("provide a password when the passed isn't locked") do pwd = create_server.call( ATTRIBUTES.merge(:no_passwd_lock => true) ).password # shindo expects a boolean not truthyness :-( !!pwd end test("locks user by default") do create_server.call(ATTRIBUTES) commands.call.one? { |c| c =~ /passwd\s+-l\s+root/ } end test("nils password when password is locked") do pwd = create_server.call(ATTRIBUTES).password pwd.nil? end end #When after testing resize/resize_confirm we get a 409 when we try to resize_revert so I am going to split it into two blocks model_tests(service.servers, options, true) do @instance.wait_for { ready? } tests('#resize').succeeds do @instance.resize(4) returns('RESIZE') { @instance.state } end @instance.wait_for { ready?('VERIFY_RESIZE') } sleep 60 unless Fog.mocking? tests('#revert_resize').succeeds do @instance.revert_resize end @instance.wait_for { ready? } end wait_for_server_deletion(@instance) delete_test_network(@network) end fog-1.34.0/tests/rackspace/models/compute_v2/servers_tests.rb0000644000004100000410000000103412600047642024305 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | servers', ['rackspace']) do service = Fog::Compute::RackspaceV2.new options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } collection_tests(service.servers, options, true) do @instance.wait_for { ready? } end tests("#bootstrap").succeeds do pending if Fog.mocking? @server = service.servers.bootstrap(options) end if @server @server.destroy end end fog-1.34.0/tests/rackspace/models/compute_v2/keypairs_tests.rb0000644000004100000410000000230712600047642024447 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | key_pairs', ['rackspace']) do service = Fog::Compute::RackspaceV2.new name = Fog::Mock.random_letters(32) key = nil tests("API access") do begin tests("create").succeeds do key = service.key_pairs.create({:name => name}) end tests("list all").succeeds do service.key_pairs.all end tests("get").succeeds do service.key_pairs.get(name) end tests("delete").succeeds do key = nil if service.key_pairs.destroy(name) key == nil end tests("get unknown").returns(nil) do service.key_pairs.get(Fog::Mock.random_letters(32)) end tests("delete unknown").raises(Fog::Compute::RackspaceV2::NotFound) do service.key_pairs.destroy(Fog::Mock.random_letters(32)) end tests("create again after delete").succeeds do key = service.key_pairs.create({:name => name}) end tests("create already existing").raises(Fog::Compute::RackspaceV2::ServiceError) do service.key_pairs.create({:name => name}) end ensure key.destroy if key end end end fog-1.34.0/tests/rackspace/models/compute_v2/network_tests.rb0000644000004100000410000000041012600047642024302 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | network', ['rackspace']) do service = Fog::Compute::RackspaceV2.new options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } model_tests(service.networks, options, true) end fog-1.34.0/tests/rackspace/models/compute_v2/virtual_interfaces_tests.rb0000644000004100000410000000113712600047642026511 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | virtual_interfaces', ['rackspace']) do service = Fog::Compute::RackspaceV2.new options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } tests('virtual_interfaces') do pending if Fog.mocking? begin @server = service.servers.create options @server.wait_for { ready? } tests('#virtual_interfaces').succeeds do @server.virtual_interfaces.all end ensure @server.destroy if @server end end end fog-1.34.0/tests/rackspace/models/compute_v2/images_tests.rb0000644000004100000410000000067612600047642024074 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | images', ['rackspace']) do service = Fog::Compute::RackspaceV2.new image_id = nil tests("success") do tests("#all").succeeds do images = service.images.all image_id = images.first.id end tests("#get").succeeds do service.images.get(image_id) end end tests("failure").returns(nil) do service.images.get(Fog::Rackspace::MockData::NOT_FOUND_ID) end end fog-1.34.0/tests/rackspace/models/compute_v2/virtual_interface_tests.rb0000644000004100000410000000156112600047642026327 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2 | virtual_interface', ['rackspace']) do service = Fog::Compute::RackspaceV2.new net_options = { :label => "fog_network_#{Time.now.to_i.to_s}", :cidr => '192.168.0.0/24' } server_options = { :name => "fog_server_#{Time.now.to_i.to_s}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service) } tests('virtual_interface') do pending if Fog.mocking? begin @server = service.servers.create server_options @network = service.networks.create net_options @server.wait_for { ready? } model_tests(@server.virtual_interfaces, {:network => @network}, false) ensure if @server @server.destroy # wait_for_server_deletion(@server) if @server delete_test_network(@network) if @network end end end end fog-1.34.0/tests/rackspace/models/queues/0000755000004100000410000000000012600047642020273 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/queues/queues_tests.rb0000644000004100000410000000033712600047642023354 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | queues', ['rackspace']) do service = Fog::Rackspace::Queues.new options = { :name => "fog_instance_#{Time.now.to_i.to_s}", } collection_tests(service.queues, options) end fog-1.34.0/tests/rackspace/models/queues/message_tests.rb0000644000004100000410000000277612600047642023502 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | message', ['rackspace']) do service = Fog::Rackspace::Queues.new queue = service.queues.create({ :name => "fog_instance_#{Time.now.to_i.to_s}", }) options = { :ttl => VALID_TTL, :body => { :key => 'value' } } begin model_tests(queue.messages, options) do tests('#href').returns(true) do !@instance.href.nil? end tests('#identity').returns(true) do !@instance.identity.nil? end tests('#save => Fails to update').raises(StandardError) do @instance.save end end message = queue.messages.create(options.merge({:claim_id => '10'})) tests('#destroy => fails if claim is not valid').raises(Fog::Rackspace::Queues::ServiceError) do #API team should be fixing this so that it errors in this scenario pending message.destroy end ensure queue.destroy end tests('identity') do tests('nil') do message = Fog::Rackspace::Queues::Message.new :href => nil returns(nil) { message.id } end tests('with claim id') do message = Fog::Rackspace::Queues::Message.new :href => '/v1/queues/queue1/messages/528b7e4bb04a584f2eb805a3?claim_id=528b7e6aef913e6d2977ee6d' returns('528b7e4bb04a584f2eb805a3') { message.id } end tests('without claim id') do message = Fog::Rackspace::Queues::Message.new :href => '/v1/queues/queue1/messages/528b7e4bb04a584f2eb805a3' returns('528b7e4bb04a584f2eb805a3') { message.id } end end end fog-1.34.0/tests/rackspace/models/queues/claim_tests.rb0000644000004100000410000000165312600047642023134 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | claim', ['rackspace']) do service = Fog::Rackspace::Queues.new queue = service.queues.create({ :name => "fog_queue_#{Time.now.to_i.to_s}", }) queue.messages.create({ :ttl => VALID_TTL, :body => { :random => :body } }) params = { :ttl => VALID_TTL, :grace => VALID_GRACE } begin model_tests(queue.claims, params) do tests('#messages') do returns(1) { @instance.messages.length } returns('body') { @instance.messages.first.body['random'] } end tests('#update').succeeds do @instance.ttl = VALID_TTL + 5 @instance.save end end queue.messages.create({ :ttl => VALID_TTL, :body => { :random => :body } }) tests('destroying claimed messages').succeeds do claim = queue.claims.create(params) claim.messages.first.destroy end ensure queue.destroy end end fog-1.34.0/tests/rackspace/models/queues/claims_tests.rb0000644000004100000410000000245712600047642023322 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | claims', ['rackspace']) do service = Fog::Rackspace::Queues.new queue = service.queues.create({ :name => "fog_queue_#{Time.now.to_i.to_s}", }) queue.messages.create({ :ttl => VALID_TTL, :body => { :random => :body } }) params = { :ttl => VALID_TTL, :grace => VALID_GRACE } begin collection_tests(queue.claims, params) tests('creating claims when there are no messages') do before do #clear all message from queue queue.messages.all.each do |message| message.destroy end end tests("#create(#{params.inspect}) => with no messages does not show up in claim list") do returns(false) { queue.claims.create(params) } returns(true) { queue.claims.empty? } end end tests('create claims when there are messages') do before do queue.messages.create({ :ttl => VALID_TTL, :body => { :random => :body } }) end tests("#create(#{params.inspect}) => with messages does show up in claim list") do returns(true) do queue.claims.create(params).instance_of? Fog::Rackspace::Queues::Claim end returns(false) { queue.claims.empty? } end end ensure queue.destroy end end fog-1.34.0/tests/rackspace/models/queues/messages_tests.rb0000644000004100000410000000047512600047642023657 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | messages', ['rackspace']) do service = Fog::Rackspace::Queues.new queue = service.queues.create({ :name => "fog_queue_#{Time.now.to_i.to_s}", }) options = { :ttl => 300, :body => "blah" } collection_tests(queue.messages, options) queue.destroy end fog-1.34.0/tests/rackspace/models/queues/queue_tests.rb0000644000004100000410000000170012600047642023164 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Queues | queue', ['rackspace']) do service = Fog::Rackspace::Queues.new options = { :name => "fog_instance_#{Time.now.to_i.to_s}", } model_tests(service.queues, options) do tests('#stats').formats(QUEUE_STATS_FORMAT['messages']) do @instance.stats end tests('#enqueue("msg", 60)') do @instance.enqueue("msg", 60) end tests('#dequeue(60, 60)').returns(true) do @instance.dequeue(60, 60) do |message| returns("msg") { message.body } end end tests('#dequeue(60, 60) => with not messages').returns(false) do @instance.dequeue(60, 60) do |message| end end tests('#dequeue(60, 60) => not passing block').returns(true) do @instance.enqueue("msg", 60) @instance.dequeue(60, 60) end tests('#dequeue(60, 60) => with not messages and not passing block').returns(false) do @instance.dequeue(60, 60) end end end fog-1.34.0/tests/rackspace/models/block_storage/0000755000004100000410000000000012600047642021602 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/block_storage/snapshots_tests.rb0000644000004100000410000000076712600047642025405 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | snapshots', ['rackspace']) do service = Fog::Rackspace::BlockStorage.new volume = service.volumes.create({ :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 }) volume.wait_for { ready? } options = { :display_name => "fog_#{Time.now.to_i.to_s}", :volume_id => volume.id } collection_tests(service.snapshots, options, true) do @instance.wait_for { ready? } end volume.wait_for { snapshots.empty? } volume.destroy end fog-1.34.0/tests/rackspace/models/block_storage/volume_types_tests.rb0000644000004100000410000000064612600047642026112 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | volume_types', ['rackspace']) do service = Fog::Rackspace::BlockStorage.new tests("success") do tests("#all").succeeds do service.volume_types.all end tests("#get").succeeds do service.volume_types.get(service.volume_types.first.id) end end tests("failure").returns(nil) do service.volume_types.get('some_random_identity') end end fog-1.34.0/tests/rackspace/models/block_storage/snapshot_tests.rb0000644000004100000410000000123612600047642025212 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | snapshot', ['rackspace']) do service = Fog::Rackspace::BlockStorage.new begin volume = service.volumes.create({ :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 }) volume.wait_for { ready? } options = { :display_name => "fog_#{Time.now.to_i.to_s}", :volume_id => volume.id } model_tests(service.snapshots, options, true) do @instance.wait_for { ready? } tests('double save').raises(Fog::Rackspace::BlockStorage::IdentifierTaken) do @instance.save end end volume.wait_for { snapshots.empty? } ensure volume.destroy if volume end end fog-1.34.0/tests/rackspace/models/block_storage/volumes_tests.rb0000644000004100000410000000044512600047642025046 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | volumes', ['rackspace']) do service = Fog::Rackspace::BlockStorage.new options = { :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 } collection_tests(service.volumes, options, true) do @instance.wait_for { ready? } end end fog-1.34.0/tests/rackspace/models/block_storage/volume_tests.rb0000644000004100000410000000150312600047642024657 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do service = Fog::Rackspace::BlockStorage.new options = { :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 } model_tests(service.volumes, options, true) do @instance.wait_for{ ready? } tests('double save').raises(Fog::Rackspace::BlockStorage::IdentifierTaken) do @instance.save end tests('#attached?').succeeds do @instance.state = 'in-use' returns(true) { @instance.attached? } end tests('#snapshots').succeeds do begin snapshot = @instance.create_snapshot snapshot.wait_for { ready? } returns(true) { @instance.snapshots.first.id == snapshot.id } ensure snapshot.destroy if snapshot end end @instance.wait_for { snapshots.empty? } end end fog-1.34.0/tests/rackspace/models/monitoring/0000755000004100000410000000000012600047642021151 5ustar www-datawww-datafog-1.34.0/tests/rackspace/models/monitoring/alarm_example_tests.rb0000644000004100000410000000112212600047642025523 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarm_example', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new alarm_example_id = 'remote.http_body_match_1' alarm = service.alarm_examples.get(alarm_example_id) tests('#bound?') do tests('should return false if not bound') do returns(false) {alarm.bound?} end tests('should return true if bound') do values = {'string' => '12345'} alarm = service.alarm_examples.evaluate(alarm_example_id,values) returns(true) {alarm.bound?} end end end fog-1.34.0/tests/rackspace/models/monitoring/checks_tests.rb0000644000004100000410000000077712600047642024173 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | checks', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new begin @entity = service.entities.create :label => "fog_#{Time.now.to_i.to_s}" options = CHECK_CREATE_OPTIONS.merge(:label => "fog_#{Time.now.to_i.to_s}", :entity => @entity) collection = service.checks(:entity => @entity) collection_tests(collection, options, false) do end ensure @entity.destroy if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/entity_tests.rb0000644000004100000410000000133612600047642024237 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | entity', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}", :ip_addresses => {:default => "127.0.0.1"} } model_tests(service.entities, options, false) do tests('#update').succeeds do new_label = "new_label_#{Time.now.to_i.to_s}" @instance.label = new_label @instance.save @instance.label = nil # blank out label just to make sure @instance.reload returns(new_label) { @instance.label } end tests('#checks').succeeds do @instance.checks end tests('#alarms').succeeds do @instance.alarms end end end fog-1.34.0/tests/rackspace/models/monitoring/check_tests.rb0000644000004100000410000000323212600047642023775 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | check', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new tests('#entity=') do tests('should create new entity if object is a string') do check = Fog::Rackspace::Monitoring::Check.new id = "123123" check.entity = "123123" returns(Fog::Rackspace::Monitoring::Entity) { check.entity.class } returns(id) { check.entity.id } end tests('should set entity if object is an entity') do id = "555" entity = Fog::Rackspace::Monitoring::Entity.new(:id => id) check = Fog::Rackspace::Monitoring::Check.new check.entity = entity returns(Fog::Rackspace::Monitoring::Entity) { check.entity.class } returns(id) { check.entity.id } end end begin @entity = service.entities.create :label => "fog_#{Time.now.to_i.to_s}" options = CHECK_CREATE_OPTIONS.merge(:label => "fog_#{Time.now.to_i.to_s}", :entity => @entity) collection = service.checks(:entity => @entity) model_tests(collection, options, false) do tests('#update').succeeds do new_label = "new_label_#{Time.now.to_i.to_s}" @instance.label = new_label timeout = 2 @instance.timeout = 2 @instance.save @instance.timeout = -1 # blank out timeout just to make sure @instance.label = nil # blank out label just to make sure @instance.reload returns(timeout) { @instance.timeout } returns(new_label) { @instance.label} end tests('#metrics').succeeds do @instance.metrics end end ensure @entity.destroy if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/agent_tokens_tests.rb0000644000004100000410000000041512600047642025401 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | agent tokens', ['rackspace','rackspace_monitoring']) do service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}" } collection_tests(service.agent_tokens, options, false) do end end fog-1.34.0/tests/rackspace/models/monitoring/alarm_tests.rb0000644000004100000410000000377512600047642024030 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarm', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new tests('#alarm=') do tests('should assign alarm id if object is a string') do alarm = Fog::Rackspace::Monitoring::Alarm.new id = "123123" alarm.id = "123123" returns(Fog::Rackspace::Monitoring::Alarm) { alarm.class } returns(id) { alarm.id } end tests('should set check if object is a check') do entity_id = "555" entity = Fog::Rackspace::Monitoring::Entity.new(:id => entity_id) check_id = "54321" check = Fog::Rackspace::Monitoring::Check.new(:id => check_id) check.entity = entity alarm = Fog::Rackspace::Monitoring::Alarm.new alarm.check = check.id returns(Fog::Rackspace::Monitoring::Alarm) { alarm.class } returns(check_id) { alarm.check.id } end end begin @entity = service.entities.create :label => "fog_#{Time.now.to_i.to_s}" @check = service.checks.create(CHECK_CREATE_OPTIONS.merge( :label => "fog_#{Time.now.to_i.to_s}", :entity => @entity) ) np = "npTechnicalContactsEmail" options = CHECK_CREATE_OPTIONS.merge( :disabled => false, :label => "fog_#{Time.now.to_i.to_s}", :entity => @entity, :entity_id => @entity.id, :check => @check, :check_id => @check.id, :notification_plan_id => np ) collection = service.alarms(:entity => @entity) model_tests(collection, options, false) do tests('#update').succeeds do @instance.disabled = true new_label = "new_label_#{Time.now.to_i.to_s}" @instance.label = new_label @instance.save @instance.label = nil # blank out label just to make sure @instance.reload returns(new_label) { @instance.label} returns(true) { @instance.disabled } end end ensure @entity.destroy if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/alarms_tests.rb0000644000004100000410000000157012600047642024202 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarms', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new begin @entity = service.entities.create :label => "fog_#{Time.now.to_i.to_s}" @check = service.checks.create(CHECK_CREATE_OPTIONS.merge( :label => "fog_#{Time.now.to_i.to_s}", :entity => @entity) ) np = "npTechnicalContactsEmail" options = CHECK_CREATE_OPTIONS.merge( :label => "fog_#{Time.now.to_i.to_s}", :entity => @entity, :entity_id => @entity.id, :check => @check, :check_id => @check.id, :notification_plan_id => np ) collection = service.alarms(:entity => @entity) collection_tests(collection, options, false) do end ensure @entity.destroy if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/notification_tests.rb0000644000004100000410000000117112600047642025406 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | notification', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}", :type => "email", :details => {:address => "test@test.com"} } model_tests(service.notifications, options, false) do tests('#update').succeeds do new_label = "new_label_#{Time.now.to_i.to_s}" @instance.label = new_label @instance.save @instance.label = nil # blank out label just to make sure @instance.reload returns(new_label) { @instance.label } end end end fog-1.34.0/tests/rackspace/models/monitoring/metrics_tests.rb0000644000004100000410000000105612600047642024370 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new begin label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) tests('#list_metrics').succeeds do service.metrics(:check => @check).all end ensure @check.destroy rescue nil if @check @entity.destroy rescue nil if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/entities_tests.rb0000644000004100000410000000062012600047642024542 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | entities', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}", :ip_addresses => {:default => "127.0.0.1"} } collection_tests(service.entities, options, false) do end tests('overview').succeeds do service.entities.overview end end fog-1.34.0/tests/rackspace/models/monitoring/agent_token_tests.rb0000644000004100000410000000040712600047642025217 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | agent token', ['rackspace','rackspace_monitoring']) do service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}" } model_tests(service.agent_tokens, options, false) do end end fog-1.34.0/tests/rackspace/models/monitoring/notifications_tests.rb0000644000004100000410000000054612600047642025576 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | notifications', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}", :type => "email", :details => {:address => "test@test.com"} } collection_tests(service.notifications, options, false) do end end fog-1.34.0/tests/rackspace/models/monitoring/check_types_tests.rb0000644000004100000410000000050112600047642025215 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | check_types', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new @check_types = service.check_types tests('#all').succeeds do @check_types.all end tests('#new').succeeds do @check_types.new end end fog-1.34.0/tests/rackspace/models/monitoring/metric_tests.rb0000644000004100000410000000120012600047642024174 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new begin label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) sleep(@check.period + 30) unless Fog.mocking? @metric = service.metrics(:check => @check).first tests('#datapoints').succeeds do @metric.datapoints end ensure @check.destroy rescue nil if @check @entity.destroy rescue nil if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/data_points_tests.rb0000644000004100000410000000132512600047642025226 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | datapoints', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new begin label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) sleep(@check.period + 30) unless Fog.mocking? @metric = service.metrics(:check => @check).first tests('#datapoints').succeeds do service.data_points(:metric => @metric).fetch({ :from => ((Time.now.to_i * 1000) - (3600 * 1000)) }) end ensure @check.destroy rescue nil if @check @entity.destroy rescue nil if @entity end end fog-1.34.0/tests/rackspace/models/monitoring/alarm_examples_tests.rb0000644000004100000410000000104712600047642025714 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Monitoring | alarm_examples', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new alarm_example_id = 'remote.http_body_match_1' tests('success') do tests('all').succeeds do service.alarm_examples.all end tests('get').succeeds do service.alarm_examples.get(alarm_example_id) end tests('evaluate').succeeds do values = {'string'=> '12345'} service.alarm_examples.evaluate(alarm_example_id,values) end end end fog-1.34.0/tests/rackspace/load_balancer_tests.rb0000644000004100000410000001467712600047642022035 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::LoadBalancers', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::LoadBalancers.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('legacy authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_load_balancers end tests('custom endpoint') do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_load_balancers_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('current authentation') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_load_balancers end tests('dfw region').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_load_balancers end tests('ord region').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.list_load_balancers end tests('custom endpoint') do @service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_load_balancers_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_load_balancers end tests('specify old contstant style service endoint').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_lb_endpoint => Fog::Rackspace::LoadBalancers::ORD_ENDPOINT returns(true) { (@service.instance_variable_get("@uri").to_s =~ /#{Fog::Rackspace::LoadBalancers::ORD_ENDPOINT}/ ) != nil } @service.list_load_balancers end tests('specify region').succeeds do @service = Fog::Rackspace::LoadBalancers.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.list_load_balancers end tests('custom endpoint') do @service = Fog::Rackspace::LoadBalancers.new :rackspace_load_balancers_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Rackspace::LoadBalancers.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(200) { @service.list_load_balancers.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Rackspace::LoadBalancers.new:rackspace_api_key => 'bad_key' } end end pending if Fog.mocking? @service = Fog::Rackspace::LoadBalancers.new tests('#algorithms').succeeds do data = @service.algorithms returns(true) { data.is_a? Array } returns(true) { data.first.is_a? String } end tests('#protocols').succeeds do data = @service.protocols returns(true) { data.is_a? Array } end tests('#usage').succeeds do @service.usage end end fog-1.34.0/tests/rackspace/networking_tests.rb0000644000004100000410000001371212600047642021443 0ustar www-datawww-dataShindo.tests('Fog::Rackspace::Networking', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Rackspace::Networking.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('legacy authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_flavors end tests('custom endpoint') do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('current authentation') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true} returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_flavors end tests('dfw region').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_flavors end tests('ord region').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.list_flavors end tests('custom endpoint') do @service = Fog::Rackspace::Networking.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_flavors end tests('specify old contstant style service endoint').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_endpoint => Fog::Rackspace::Networking::ORD_ENDPOINT returns(true) { (@service.instance_variable_get("@uri").to_s =~ /#{Fog::Rackspace::Networking::ORD_ENDPOINT}/ ) != nil } @service.list_flavors end tests('specify region').succeeds do @service = Fog::Rackspace::Networking.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.list_flavors end tests('custom endpoint') do @service = Fog::Rackspace::Networking.new :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Rackspace::Networking.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(true) { [200, 203].include? @service.list_flavors.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Rackspace::Networking.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/compute_v2_tests.rb0000644000004100000410000001367212600047642021344 0ustar www-datawww-dataShindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Compute::RackspaceV2.new assert_method nil, :authenticate_v2 assert_method 'auth.api.rackspacecloud.com', :authenticate_v1 # chef's default auth endpoint assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('legacy authentication') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('current authentation') do pending if Fog.mocking? tests('variables populated').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true} returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.list_flavors end tests('dfw region').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_flavors end tests('ord region').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/) != nil } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do pending if Fog.mocking? tests('no params').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw/) != nil } @service.list_flavors end tests('specify old contstant style service endoint').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_endpoint => Fog::Compute::RackspaceV2::ORD_ENDPOINT returns(true) { (@service.instance_variable_get("@uri").to_s =~ /#{Fog::Compute::RackspaceV2::ORD_ENDPOINT}/ ) != nil } @service.list_flavors end tests('specify region').succeeds do @service = Fog::Compute::RackspaceV2.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord/ ) != nil } @service.list_flavors end tests('custom endpoint') do @service = Fog::Compute::RackspaceV2.new :rackspace_compute_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('reauthentication') do pending if Fog.mocking? tests('should reauth with valid credentials') do @service = Fog::Compute::RackspaceV2.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad_token") returns(true) { [200, 203].include? @service.list_flavors.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Compute::RackspaceV2.new :rackspace_api_key => 'bad_key' } end end end fog-1.34.0/tests/rackspace/storage_tests.rb0000644000004100000410000001425112600047642020717 0ustar www-datawww-dataShindo.tests('Rackspace | Storage', ['rackspace']) do def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } end tests('#authentication_method') do @service = Fog::Storage::Rackspace.new assert_method nil, :authenticate_v2 assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end tests('authentication v1') do tests('variables populated').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? } @service.head_containers end tests('custom endpoint') do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_storage_url => 'https://my-custom-endpoint.com' returns(false, "auth token populated") { @service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('authentation v2') do tests('variables populated').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(false, "path populated") { @service.instance_variable_get("@uri").nil? } identity_service = @service.instance_variable_get("@identity_service") returns(false, "identity service was used") { identity_service.nil? } returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").key?(:ssl_verify_peer) } @service.head_containers end tests('dfw region').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw\d/) != nil } @service.head_containers end tests('ord region').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord\d/) != nil } @service.head_containers end tests('custom endpoint').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_storage_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end end tests('default auth') do tests('no params').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw\d/) != nil } @service.head_containers end tests('specify region').succeeds do @service = Fog::Storage::Rackspace.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /ord\d/ ) != nil } @service.head_containers end tests('custom endpoint') do @service = Fog::Storage::Rackspace.new :rackspace_storage_url => 'https://my-custom-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil } end tests('rackspace_servicenet') do @service = Fog::Storage::Rackspace.new :rackspace_servicenet => true returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /snet-/) != nil } end end tests('reauthentication') do tests('should reauth with valid credentials') do @service = Fog::Storage::Rackspace.new returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @service.instance_variable_set("@auth_token", "bad-token") returns(204) { @service.head_containers.status } end tests('should terminate with incorrect credentials') do raises(Excon::Errors::Unauthorized) { Fog::Storage::Rackspace.new :rackspace_api_key => 'bad_key' } end end tests('account').succeeds do Fog::Storage[:rackspace].account end tests('ssl') do tests('ssl enabled') do @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => true) returns(true) { @service.ssl? } end tests('ssl disabled') do @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => false) returns(false) { @service.ssl? } @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => nil) returns(false) { @service.ssl? } end end end fog-1.34.0/tests/compute/0000755000004100000410000000000012600047642015221 5ustar www-datawww-datafog-1.34.0/tests/compute/helper.rb0000644000004100000410000000676512600047642017043 0ustar www-datawww-datadef compute_providers { :aws => { :server_attributes => {}, :mocked => true }, :bluebox => { :server_attributes => { :flavor_id => '94fd37a7-2606-47f7-84d5-9000deda52ae', # Block 1GB Virtual Server :image_id => 'a8f05200-7638-47d1-8282-2474ef57c4c3', # Scientific Linux 6 :location_id => '37c2bd9a-3e81-46c9-b6e2-db44a25cc675', # Seattle, WA :password => 'chunkybacon' }, :mocked => false }, :cloudstack => { :provider_attributes => { :cloudstack_host => 'http://host.foo' }, :server_attributes => {}.tap do |hash| [:zone_id, :network_ids, :template_id, :service_offering_id].each do |k| key = "cloudstack_#{k}".to_sym if Fog.credentials[key] hash[k]= Fog.credentials[key] end end end, :volume_attributes => {:name => "somevolume"}.tap do |hash| [:zone_id, :disk_offering_id].each do |k| key = "cloudstack_#{k}".to_sym if Fog.credentials[key] hash[k]= Fog.credentials[key] end end end, :snapshot_attributes => {:volume_id => "89198f7c-0245-aa1d-136a-c5f479ef9db7"}.tap do |hash| [:volume_id, :domain_id, :policy_id].each do |k| key = "cloudstack_#{k}".to_sym if Fog.credentials[key] hash[k]= Fog.credentials[key] end end end, :security_group_attributes => {:name => "cloudstack.sg.#{Time.now.to_i}"}, :security_group_rule_attributes => { :cidr => '0.0.0.0/0', :start_port => 123, :end_port => 456, :protocol => 'tcp' }, :disk_offering_attributes => { :name => "new disk offering", :display_text => 'New Disk Offering' }, :egress_firewall_rule_attributes => { :protocol => "tcp", :network_id => "8aacae29-e0a4-4b7b-8a7a-3ee11cfb4362", :cidr_list =>"10.1.1.0/24"}, :public_ip_address_attributes => {}.tap do |hash| [:zone_id].each do |k| key = "cloudstack_#{k}".to_sym if Fog.credentials[key] hash[k]= Fog.credentials[key] end end end, :mocked => true }, :glesys => { :server_attributes => { :rootpassword => "secret_password_#{Time.now.to_i}", :hostname => "fog.example#{Time.now.to_i}.com" }, :mocked => false }, :hp => { :server_attributes => { :flavor_id => 100, :image_id => 1242, :name => "fog_#{Time.now.to_i}" }, :mocked => true }, :ibm => { :server_attributes => {}, :mocked => true }, :joyent => { :mocked => false }, :hp => { :server_attributes => { :flavor_id => 100, :image_id => 1242, :name => "fog_#{Time.now.to_i}" }, :mocked => true }, :ninefold => { :mocked => false }, :openstack => { :mocked => true, :server_attributes => { :flavor_ref => 2, :image_ref => "0e09fbd6-43c5-448a-83e9-0d3d05f9747e", :name => "fog_#{Time.now.to_i}" } }, :rackspace => { :provider_attributes => { :version => :v2 }, :server_attributes => { :image_id => "23b564c9-c3e6-49f9-bc68-86c7a9ab5018", # Ubuntu 12.04 LTS (Precise Pangolin) :flavor_id => 2, :name => "fog_#{Time.now.to_i}" }, :mocked => true }, :xenserver => { :mocked => false } } end fog-1.34.0/tests/compute/models/0000755000004100000410000000000012600047642016504 5ustar www-datawww-datafog-1.34.0/tests/compute/models/flavors_tests.rb0000644000004100000410000000062312600047642021730 0ustar www-datawww-datafor provider, config in compute_providers next if [:glesys, :ibm].include?(provider) Shindo.tests("Fog::Compute[:#{provider}] | flavors", [provider.to_s]) do provider_attributes = config[:provider_attributes] || {} provider_attributes.merge!(:provider => provider) flavors_tests(Fog::Compute.new(provider_attributes), (config[:flavors_attributes] || {}), config[:mocked]) end end fog-1.34.0/tests/compute/models/server_tests.rb0000644000004100000410000000252112600047642021561 0ustar www-datawww-datafor provider, config in compute_providers Shindo.tests("Fog::Compute[:#{provider}] | server", [provider.to_s]) do provider_attributes = config[:provider_attributes] || {} provider_attributes.merge!(:provider => provider) server_tests(Fog::Compute.new(provider_attributes), (config[:server_attributes] || {}), config[:mocked]) do if Fog.mocking? && !config[:mocked] pending else responds_to(:public_ip_address) responds_to(:scp) responds_to(:ssh) end tests('ssh_ip_address') do tests('defaults to public_ip_address').returns(true) do @instance.ssh_ip_address == @instance.public_ip_address end tests('ssh_ip_address overrides default with Proc').returns(true) do ip_address = '5.5.5.5' @instance.ssh_ip_address = Proc.new {|server| ip_address } @instance.ssh_ip_address == ip_address end tests('Proc yields server').returns(true) do @instance.ssh_ip_address = Proc.new {|server| server } @instance.ssh_ip_address == @instance end tests('ssh_ip_address overrides default with String').returns(true) do ip_address = '5.5.5.5' @instance.ssh_ip_address = ip_address @instance.ssh_ip_address == ip_address end end end end end fog-1.34.0/tests/compute/models/servers_tests.rb0000644000004100000410000000054312600047642021746 0ustar www-datawww-datafor provider, config in compute_providers Shindo.tests("Fog::Compute[:#{provider}] | servers", [provider.to_s]) do provider_attributes = config[:provider_attributes] || {} provider_attributes.merge!(:provider => provider) servers_tests(Fog::Compute.new(provider_attributes), (config[:server_attributes] || {}), config[:mocked]) end end fog-1.34.0/tests/opennebula/0000755000004100000410000000000012600047642015675 5ustar www-datawww-datafog-1.34.0/tests/opennebula/requests/0000755000004100000410000000000012600047642017550 5ustar www-datawww-datafog-1.34.0/tests/opennebula/requests/compute/0000755000004100000410000000000012600047642021224 5ustar www-datawww-datafog-1.34.0/tests/opennebula/requests/compute/vm_allocate_tests.rb0000644000004100000410000000454212600047642025266 0ustar www-datawww-dataShindo.tests("Fog::Compute[:opennebula] | vm_create and destroy request", 'opennebula') do compute = Fog::Compute[:opennebula] name_base = Time.now.to_i f = compute.flavors.get_by_name("fogtest") tests("Get 'fogtest' flavor/template") do test("could not get template with name 'fogtest'! This is required for live tests!") {f.kind_of? Array} raise ArgumentError, "Could not get a template with the name 'fogtest'" unless f end f = f.first response = {} tests("Allocate VM") do response = compute.vm_allocate({:name => 'fog-'+name_base.to_s, :flavor => f}) test("response should be a kind of Hash") { response.kind_of? Hash} test("id should be a one-id (Fixnum)") { response['id'].is_a? Fixnum} end tests("Destroy VM") do compute.vm_destroy(response['id']) vms = compute.list_vms({:id => response['id'], :mock_return => false}) test("get vm should be empty") { compute.list_vms({:id => response['id']}).empty?} end #tests("Create VM from template (clone)") do # response = compute.create_vm(:name => 'fog-'+(name_base+ 1).to_s, :template_name => 'hwp_small', :cluster_name => 'Default') # test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} #end tests("Fail Creating VM - no flavor") do begin response = compute.vm_allocate({:name => 'fog-'+name_base.to_s, :flavor => nil}) test("should be a kind of Hash") { response.kind_of? Hash} #mock never raise exceptions rescue => e #should raise vm name already exist exception. test("error should be a kind of ArgumentError") { e.kind_of? ArgumentError} end end tests("Fail Creating VM - nil name") do begin response = compute.vm_allocate({:name => nil, :flavor => f}) test("should be a kind of Hash") { response.kind_of? Hash} #mock never raise exceptions rescue => e #should raise vm name already exist exception. test("error should be a kind of ArgumentError") { e.kind_of? ArgumentError} end end tests("Fail Creating VM - empty name") do begin response = compute.vm_allocate({:name => "", :flavor => f}) test("should be a kind of Hash") { response.kind_of? Hash} #mock never raise exceptions rescue => e #should raise vm name already exist exception. test("error should be a kind of ArgumentError") { e.kind_of? ArgumentError} end end end fog-1.34.0/tests/opennebula/requests/compute/vm_disk_snapshot_test.rb0000644000004100000410000000367412600047642026175 0ustar www-datawww-dataShindo.tests("Fog::Compute[:opennebula] | vm_create and destroy request", 'opennebula') do compute = Fog::Compute[:opennebula] name_base = Time.now.to_i f = compute.flavors.get_by_name("fogtest") tests("Get 'fogtest' flavor/template") do test("Got template with name 'fogtest'") {f.kind_of? Array} raise ArgumentError, "Could not get a template with the name 'fogtest'! This is required for live tests!" unless f end f = f.first newvm = compute.servers.new newvm.flavor = f newvm.name = 'fogtest-'+name_base.to_s vm = newvm.save tests("Start VM") do test("response should be a kind of Hash") { vm.kind_of? Fog::Compute::OpenNebula::Server} test("id should be a one-id (Fixnum)") { vm.id.is_a? Fixnum} vm.wait_for { (vm.state == 'RUNNING') } test("VM should be in RUNNING state") { vm.state == 'RUNNING' } sleep(30) # waiting for 30 seconds to let VM finish booting end tests("Create snapshot of the disk and shutdown VM") do img_id = compute.vm_disk_snapshot(vm.id, 0, 'fogtest-'+name_base.to_s) test("Image ID of created snapshot should be a kind of Fixnum") { img_id.is_a? Fixnum } (1..5).each do # wait maximum 5 seconds sleep(1) # The delay is needed for some reason between issueing disk-snapshot and shutdown images = compute.image_pool( { :mine => true, :id => img_id } ) test("Got Image with ID=#{img_id}") { images.kind_of? Array } if images[0].state == 4 # LOCKED, it is normal we must shutdown VM for image to go into READY state break end end compute.servers.shutdown(vm.id) image_state = 4 (1..25).each do # Waiting for up to 50 seconds for Image to become READY sleep(2) images = compute.image_pool( { :mine => true, :id => img_id } ) image_state = images[0].state if image_state == 1 break end end test("New image with ID=#{img_id} should be in state READY.") { image_state == 1 } end end fog-1.34.0/tests/opennebula/compute_tests.rb0000644000004100000410000000067612600047642021131 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula]', ['opennebula']) do compute = Fog::Compute[:opennebula] tests("Compute collections") do %w{networks groups}.each do |collection| test("it should respond to #{collection}") { compute.respond_to? collection } end end tests("Compute requests") do %w{list_networks}.each do |request| test("it should respond to #{request}") { compute.respond_to? request } end end end fog-1.34.0/tests/opennebula/models/0000755000004100000410000000000012600047642017160 5ustar www-datawww-datafog-1.34.0/tests/opennebula/models/compute/0000755000004100000410000000000012600047642020634 5ustar www-datawww-datafog-1.34.0/tests/opennebula/models/compute/networks_tests.rb0000644000004100000410000000131212600047642024254 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | networks collection', ['opennebula']) do networks = Fog::Compute[:opennebula].networks tests('The networks collection') do test('should be a kind of Fog::Compute::OpenNebula::Networks') { networks.kind_of? Fog::Compute::OpenNebula::Networks } tests('should be able to reload itself').succeeds { networks.reload } tests('should be able to get a model') do tests('all').succeeds { networks.all } tests('by instance id').succeeds { networks.get networks.first.id } tests('by filter').succeeds { networks.get_by_filter ({ :id => networks.first.id }) } tests('by name').succeeds { networks.get_by_name ("fogtest") } end end end fog-1.34.0/tests/opennebula/models/compute/flavors_tests.rb0000644000004100000410000000132312600047642024056 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | flavors collection', ['opennebula']) do flavors = Fog::Compute[:opennebula].flavors tests('The flavors collection should') do test('should be a kind of Fog::Compute::OpenNebula::Flavors') { flavors.kind_of? Fog::Compute::OpenNebula::Flavors } tests('should be able to reload itself').succeeds { flavors.reload } tests('should be able to get models') do tests('all').succeeds { flavors.all } tests('by instance id').succeeds { flavors.get flavors.first.id } tests('by name').succeeds { flavors.get_by_name "fogtest" } tests('by filter').succeeds { flavors.get_by_filter ({:name => "fogtest", :id => flavors.first.id }) } end end end fog-1.34.0/tests/opennebula/models/compute/flavor_tests.rb0000644000004100000410000000271412600047642023700 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | flavor model', ['opennebula']) do flavors = Fog::Compute[:opennebula].flavors flavor = flavors.last tests('The flavor model should') do tests('have the action') do test('reload') { flavor.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = flavor.attributes attributes = tests("The flavor model should respond to") do [:name, :id, :to_label, :to_s, :get_cpu, :get_vcpu, :get_memory, :get_raw, :get_disk, :get_os, :get_graphics, :get_nic, :get_sched_ds_requirements, :get_sched_ds_rank, :get_sched_requirements, :get_sched_rank, :get_context, :get_user_variables].each do |attribute| test("#{attribute}") { flavor.respond_to? attribute } end end tests("The attributes hash should have key") do [:name, :id, :content, :cpu, :vcpu, :memory, :os, :graphics, :raw, :context, :user_variables ].each do |attribute| test("#{attribute}") { model_attribute_hash.has_key? attribute } end end end test('be a kind of Fog::Compute::OpenNebula::Flavor') { flavor.kind_of? Fog::Compute::OpenNebula::Flavor } test('have a nic in network fogtest') { flavor.nic[0].vnet.name == "fogtest" } flavor.vcpu = 666 flavor.memory = 666 test('have a 666 MB memory') { flavor.get_memory == "MEMORY=666\n" } test('have a 666 CPUs') { flavor.get_vcpu == "VCPU=666\n" } end end fog-1.34.0/tests/opennebula/models/compute/network_tests.rb0000644000004100000410000000167312600047642024103 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | network model', ['opennebula']) do networks = Fog::Compute[:opennebula].networks network = networks.last tests('The network model should') do tests('have the action') do test('reload') { network.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = network.attributes attributes = tests("The network model should respond to") do [:name, :id, :vlan, :uid, :uname, :gid, :description].each do |attribute| test("#{attribute}") { network.respond_to? attribute } end end tests("The attributes hash should have key") do [:name, :id, :uid, :uname, :gid ].each do |attribute| test("#{attribute}") { model_attribute_hash.has_key? attribute } end end end test('be a kind of Fog::Compute::OpenNebula::Network') { network.kind_of? Fog::Compute::OpenNebula::Network } end end fog-1.34.0/tests/opennebula/models/compute/groups_tests.rb0000644000004100000410000000116412600047642023724 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | groups collection', ['opennebula']) do groups = Fog::Compute[:opennebula].groups tests('The groups collection') do test('should be a kind of Fog::Compute::OpenNebula::Groups') { groups.kind_of? Fog::Compute::OpenNebula::Groups } tests('should be able to reload itself').succeeds { groups.reload } tests('should be able to get a model by id') do tests('by instance id').succeeds { groups.get groups.first.id } end tests('should be able to get a model by name') do tests('by instance id').succeeds { groups.get_by_name "fogtest" } end end end fog-1.34.0/tests/opennebula/models/compute/group_tests.rb0000644000004100000410000000155612600047642023546 0ustar www-datawww-dataShindo.tests('Fog::Compute[:opennebula] | group model', ['opennebula']) do groups = Fog::Compute[:opennebula].groups group = groups.last tests('The group model should') do tests('have the action') do test('reload') { group.respond_to? 'reload' } end tests('have attributes') do model_attribute_hash = group.attributes attributes = tests("The group model should respond to") do [:name, :id, :to_label].each do |attribute| test("#{attribute}") { group.respond_to? attribute } end end tests("The attributes hash should have key") do [:name, :id].each do |attribute| test("#{attribute}") { model_attribute_hash.has_key? attribute } end end end test('be a kind of Fog::Compute::OpenNebula::Group') { group.kind_of? Fog::Compute::OpenNebula::Group } end end fog-1.34.0/tests/helpers/0000755000004100000410000000000012600047642015207 5ustar www-datawww-datafog-1.34.0/tests/helpers/responds_to_helper.rb0000644000004100000410000000037412600047642021436 0ustar www-datawww-datamodule Shindo class Tests def responds_to(method_names) for method_name in [*method_names] tests("#respond_to?(:#{method_name})").returns(true) do @instance.respond_to?(method_name) end end end end end fog-1.34.0/tests/helpers/formats_helper.rb0000644000004100000410000000705612600047642020556 0ustar www-datawww-datarequire "fog/schema/data_validator" # format related hackery # allows both true.is_a?(Fog::Boolean) and false.is_a?(Fog::Boolean) # allows both nil.is_a?(Fog::Nullable::String) and ''.is_a?(Fog::Nullable::String) module Fog module Boolean; end module Nullable module Boolean; end module Integer; end module String; end module Time; end module Float; end module Hash; end module Array; end end end [FalseClass, TrueClass].each {|klass| klass.send(:include, Fog::Boolean)} [FalseClass, TrueClass, NilClass, Fog::Boolean].each {|klass| klass.send(:include, Fog::Nullable::Boolean)} [NilClass, String].each {|klass| klass.send(:include, Fog::Nullable::String)} [NilClass, Time].each {|klass| klass.send(:include, Fog::Nullable::Time)} [Integer, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Integer)} [Float, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Float)} [Hash, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Hash)} [Array, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Array)} module Shindo class Tests # Generates a Shindo test that compares a hash schema to the result # of the passed in block returning true if they match. # # The schema that is passed in is a Hash or Array of hashes that # have Classes in place of values. When checking the schema the # value should match the Class. # # Strict mode will fail if the data has additional keys. Setting # +strict+ to +false+ will allow additional keys to appear. # # @param [Hash] schema A Hash schema # @param [Hash] options Options to change validation rules # @option options [Boolean] :allow_extra_keys # If +true+ does not fail when keys are in the data that are # not specified in the schema. This allows new values to # appear in API output without breaking the check. # @option options [Boolean] :allow_optional_rules # If +true+ does not fail if extra keys are in the schema # that do not match the data. Not recommended! # @yield Data to check with schema # # @example Using in a test # Shindo.tests("comparing welcome data against schema") do # data = {:welcome => "Hello" } # data_matches_schema(:welcome => String) { data } # end # # comparing welcome data against schema # + data matches schema # # @example Example schema # { # "id" => String, # "ram" => Integer, # "disks" => [ # { # "size" => Float # } # ], # "dns_name" => Fog::Nullable::String, # "active" => Fog::Boolean, # "created" => DateTime # } # # @return [Boolean] def data_matches_schema(schema, options = {}) test('data matches schema') do validator = Fog::Schema::DataValidator.new valid = validator.validate(yield, schema, options) @message = validator.message unless valid valid end end # @deprecated #formats is deprecated. Use #data_matches_schema instead def formats(format, strict = true) test('has proper format') do if strict options = {:allow_extra_keys => false, :allow_optional_rules => true} else options = {:allow_extra_keys => true, :allow_optional_rules => true} end validator = Fog::Schema::DataValidator.new valid = validator.validate(yield, format, options) @message = validator.message unless valid valid end end end end fog-1.34.0/tests/helpers/succeeds_helper.rb0000644000004100000410000000020612600047642020667 0ustar www-datawww-datamodule Shindo class Tests def succeeds test('succeeds') do !!instance_eval(&Proc.new) end end end end fog-1.34.0/tests/helpers/collection_helper.rb0000644000004100000410000000502712600047642021232 0ustar www-datawww-datadef collection_tests(collection, params = {}, mocks_implemented = true) tests('success') do tests("#new(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.new(params) end tests("#create(#{params.inspect})").succeeds do pending if Fog.mocking? && !mocks_implemented @instance = collection.create(params) end # FIXME: work around for timing issue on AWS describe_instances mocks if Fog.mocking? && @instance.respond_to?(:ready?) @instance.wait_for { ready? } end tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented collection.all end if !Fog.mocking? || mocks_implemented @identity = @instance.identity end tests("#get(#{@identity})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end tests('Enumerable') do pending if Fog.mocking? && !mocks_implemented methods = [ 'all?', 'any?', 'find', 'detect', 'collect', 'map', 'find_index', 'flat_map', 'collect_concat', 'group_by', 'none?', 'one?' ] # JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep # https://github.com/jruby/jruby/issues/1265 if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/ methods.delete('all?') end methods.each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true } block_called end end end [ 'max_by','min_by' ].each do |enum_method| if collection.respond_to?(enum_method) tests("##{enum_method}").succeeds do block_called = false collection.send(enum_method) {|x| block_called = true; 0 } block_called end end end end if block_given? yield(@instance) end if !Fog.mocking? || mocks_implemented @instance.destroy end end tests('failure') do if !Fog.mocking? || mocks_implemented @identity = @identity.to_s @identity = @identity.gsub(/[a-zA-Z]/) { Fog::Mock.random_letters(1) } @identity = @identity.gsub(/\d/) { Fog::Mock.random_numbers(1) } @identity end tests("#get('#{@identity}')").returns(nil) do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end end end fog-1.34.0/tests/helpers/compute/0000755000004100000410000000000012600047642016663 5ustar www-datawww-datafog-1.34.0/tests/helpers/compute/servers_helper.rb0000644000004100000410000000041012600047642022233 0ustar www-datawww-datadef servers_tests(connection, params = {}, mocks_implemented = true) collection_tests(connection.servers, params, mocks_implemented) do if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } yield if block_given? end end end fog-1.34.0/tests/helpers/compute/server_helper.rb0000644000004100000410000000124612600047642022060 0ustar www-datawww-datadef server_tests(connection, params = {}, mocks_implemented = true) model_tests(connection.servers, params, mocks_implemented) do tests('#reload').returns(true) do pending if Fog.mocking? && !mocks_implemented @instance.wait_for { ready? } identity = @instance.identity !identity.nil? && identity == @instance.reload.identity end responds_to([:ready?, :state]) yield if block_given? tests('#reboot').succeeds do pending if Fog.mocking? && !mocks_implemented @instance.wait_for { ready? } @instance.reboot end if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } end end end fog-1.34.0/tests/helpers/compute/flavors_helper.rb0000644000004100000410000000146312600047642022227 0ustar www-datawww-datadef flavors_tests(connection, params = {}, mocks_implemented = true) tests('success') do tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented connection.flavors.all end if !Fog.mocking? || mocks_implemented @identity = connection.flavors.first.identity end tests("#get('#{@identity}')").succeeds do pending if Fog.mocking? && !mocks_implemented connection.flavors.get(@identity) end end tests('failure') do if !Fog.mocking? || mocks_implemented invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0') end tests("#get('#{invalid_flavor_identity}')").returns(nil) do pending if Fog.mocking? && !mocks_implemented connection.flavors.get(invalid_flavor_identity) end end end fog-1.34.0/tests/helpers/model_helper.rb0000644000004100000410000000141412600047642020173 0ustar www-datawww-datadef model_tests(collection, params = {}, mocks_implemented = true) tests('success') do @instance = collection.new(params) tests("#save").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.save end if block_given? yield(@instance) end tests("#destroy").succeeds do pending if Fog.mocking? && !mocks_implemented @instance.destroy end end end # Generates a unique identifier with a random differentiator. # Useful when rapidly re-running tests, so we don't have to wait # serveral minutes for deleted objects to disappear from the API # E.g. 'fog-test-1234' def uniq_id(base_name = 'fog-test') # random_differentiator suffix = rand(65536).to_s(16).rjust(4, '0') [base_name, suffix] * '-' end fog-1.34.0/tests/helpers/formats_helper_tests.rb0000644000004100000410000000702012600047642021767 0ustar www-datawww-dataShindo.tests('test_helper', 'meta') do tests('comparing welcome data against schema') do data = {:welcome => "Hello" } data_matches_schema(:welcome => String) { data } end tests('#data_matches_schema') do tests('when value matches schema expectation') do data_matches_schema({"key" => String}) { {"key" => "Value"} } end tests('when values within an array all match schema expectation') do data_matches_schema({"key" => [Integer]}) { {"key" => [1, 2]} } end tests('when nested values match schema expectation') do data_matches_schema({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} } end tests('when collection of values all match schema expectation') do data_matches_schema([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] } end tests('when collection is empty although schema covers optional members') do data_matches_schema([{"key" => String}], {:allow_optional_rules => true}) { [] } end tests('when additional keys are passed and not strict') do data_matches_schema({"key" => String}, {:allow_extra_keys => true}) { {"key" => "Value", :extra => "Bonus"} } end tests('when value is nil and schema expects NilClass') do data_matches_schema({"key" => NilClass}) { {"key" => nil} } end tests('when value and schema match as hashes') do data_matches_schema({}) { {} } end tests('when value and schema match as arrays') do data_matches_schema([]) { [] } end tests('when value is a Time') do data_matches_schema({"time" => Time}) { {"time" => Time.now} } end tests('when key is missing but value should be NilClass (#1477)') do data_matches_schema({"key" => NilClass}, {:allow_optional_rules => true}) { {} } end tests('when key is missing but value is nullable (#1477)') do data_matches_schema({"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) { {} } end end tests('#formats backwards compatible changes') do tests('when value matches schema expectation') do formats({"key" => String}) { {"key" => "Value"} } end tests('when values within an array all match schema expectation') do formats({"key" => [Integer]}) { {"key" => [1, 2]} } end tests('when nested values match schema expectation') do formats({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} } end tests('when collection of values all match schema expectation') do formats([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] } end tests('when collection is empty although schema covers optional members') do formats([{"key" => String}]) { [] } end tests('when additional keys are passed and not strict') do formats({"key" => String}, false) { {"key" => "Value", :extra => "Bonus"} } end tests('when value is nil and schema expects NilClass') do formats({"key" => NilClass}) { {"key" => nil} } end tests('when value and schema match as hashes') do formats({}) { {} } end tests('when value and schema match as arrays') do formats([]) { [] } end tests('when value is a Time') do formats({"time" => Time}) { {"time" => Time.now} } end tests('when key is missing but value should be NilClass (#1477)') do formats({"key" => NilClass}) { {} } end tests('when key is missing but value is nullable (#1477)') do formats({"key" => Fog::Nullable::String}) { {} } end end end fog-1.34.0/tests/helpers/mock_helper.rb0000644000004100000410000001263212600047642020030 0ustar www-datawww-data# Use so you can run in mock mode from the command line # # FOG_MOCK=true fog if ENV["FOG_MOCK"] == "true" Fog.mock! end # if in mocked mode, fill in some fake credentials for us if Fog.mock? Fog.credentials = { :aws_access_key_id => 'aws_access_key_id', :aws_secret_access_key => 'aws_secret_access_key', :ia_access_key_id => 'aws_access_key_id', :ia_secret_access_key => 'aws_secret_access_key', :bluebox_api_key => 'bluebox_api_key', :bluebox_customer_id => 'bluebox_customer_id', :brightbox_client_id => 'brightbox_client_id', :brightbox_secret => 'brightbox_secret', :cloudstack_disk_offering_id => '', :cloudstack_host => 'http://cloudstack.example.org', :cloudstack_network_ids => '', :cloudstack_service_offering_id => '4437ac6c-9fe3-477a-57ec-60a5a45896a4', :cloudstack_template_id => '8a31cf9c-f248-0588-256e-9dbf58785216', :cloudstack_zone_id => 'c554c592-e09c-9df5-7688-4a32754a4305', :cloudstack_project_id => 'f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1', :clodo_api_key => 'clodo_api_key', :clodo_username => 'clodo_username', :digitalocean_api_key => 'digitalocean_api_key', :digitalocean_client_id => 'digitalocean_client_id', :dnsimple_email => 'dnsimple_email', :dnsimple_password => 'dnsimple_password', :dnsmadeeasy_api_key => 'dnsmadeeasy_api_key', :dnsmadeeasy_secret_key => 'dnsmadeeasy_secret_key', :glesys_username => 'glesys_username', :glesys_api_key => 'glesys_api_key', :go_grid_api_key => 'go_grid_api_key', :go_grid_shared_secret => 'go_grid_shared_secret', :hp_access_key => 'hp_access_key', :hp_secret_key => 'hp_secret_key', :hp_tenant_id => 'hp_tenant_id', :hp_avl_zone => 'hp_avl_zone', :hp_auth_uri => 'http://hp/v2.0/tokens', :os_account_meta_temp_url_key => 'os_account_meta_temp_url_key', :ibm_username => 'ibm_username', :ibm_password => 'ibm_password', :joyent_username => "joyentuser", :joyent_password => "joyentpass", :linode_api_key => 'linode_api_key', :local_root => '~/.fog', :bare_metal_cloud_password => 'bare_metal_cloud_password', :bare_metal_cloud_username => 'bare_metal_cloud_username', :ninefold_compute_key => 'ninefold_compute_key', :ninefold_compute_secret => 'ninefold_compute_secret', :ninefold_storage_secret => 'ninefold_storage_secret', :ninefold_storage_token => 'ninefold_storage_token', # :public_key_path => '~/.ssh/id_rsa.pub', # :private_key_path => '~/.ssh/id_rsa', :opennebula_endpoint => 'http://opennebula:2633/RPC2', :opennebula_username => 'oneadmin', :opennebula_password => 'oneadmin', :openstack_api_key => 'openstack_api_key', :openstack_username => 'openstack_username', :openstack_tenant => 'openstack_tenant', :openstack_auth_url => 'http://openstack:35357/v2.0/tokens', :ovirt_url => 'http://ovirt:8080/api', :ovirt_username => 'admin@internal', :ovirt_password => '123123', :profitbricks_username => 'profitbricks_username', :profitbricks_password => 'profitbricks_password', :rackspace_api_key => 'rackspace_api_key', :rackspace_region => 'dfw', :rackspace_username => 'rackspace_username', :sakuracloud_api_token => 'sakuracloud_api_token', :sakuracloud_api_token_secret => 'sakuracloud_api_token_secret', :vcloud_host => 'vcloud_host', :vcloud_password => 'vcloud_password', :vcloud_username => 'vcloud_username', :vcloud_director_host => 'vcloud-director-host', :vcloud_director_password => 'vcloud_director_password', :vcloud_director_username => 'vcd_user@vcd_org_name', :zerigo_email => 'zerigo_email', :zerigo_token => 'zerigo_token', :dynect_customer => 'dynect_customer', :dynect_username => 'dynect_username', :dynect_password => 'dynect_password', :vsphere_server => 'virtualcenter.lan', :vsphere_username => 'apiuser', :vsphere_password => 'apipassword', :vsphere_expected_pubkey_hash => 'abcdef1234567890', :cloudsigma_username => 'csuname', :cloudsigma_password => 'cspass', :docker_username => 'docker-fan', :docker_password => 'i<3docker', :docker_email => 'dockerfan@gmail.com', :docker_url => 'unix://var/run/docker.sock' }.merge(Fog.credentials) end fog-1.34.0/tests/helpers/schema_validator_tests.rb0000644000004100000410000000723112600047642022266 0ustar www-datawww-dataShindo.tests('Fog::Schema::DataValidator', 'meta') do validator = Fog::Schema::DataValidator.new tests('#validate') do tests('returns true') do returns(true, 'when value matches schema expectation') do validator.validate({"key" => "Value"}, {"key" => String}) end returns(true, 'when values within an array all match schema expectation') do validator.validate({"key" => [1, 2]}, {"key" => [Integer]}) end returns(true, 'when nested values match schema expectation') do validator.validate({"key" => {:nested_key => "Value"}}, {"key" => {:nested_key => String}}) end returns(true, 'when collection of values all match schema expectation') do validator.validate([{"key" => "Value"}, {"key" => "Value"}], [{"key" => String}]) end returns(true, 'when collection is empty although schema covers optional members') do validator.validate([], [{"key" => String}]) end returns(true, 'when additional keys are passed and not strict') do validator.validate({"key" => "Value", :extra => "Bonus"}, {"key" => String}, {:allow_extra_keys => true}) end returns(true, 'when value is nil and schema expects NilClass') do validator.validate({"key" => nil}, {"key" => NilClass}) end returns(true, 'when value and schema match as hashes') do validator.validate({}, {}) end returns(true, 'when value and schema match as arrays') do validator.validate([], []) end returns(true, 'when value is a Time') do validator.validate({"time" => Time.now}, {"time" => Time}) end returns(true, 'when key is missing but value should be NilClass (#1477)') do validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => true}) end returns(true, 'when key is missing but value is nullable (#1477)') do validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) end end tests('returns false') do returns(false, 'when value does not match schema expectation') do validator.validate({"key" => nil}, {"key" => String}) end returns(false, 'when key formats do not match') do validator.validate({"key" => "Value"}, {:key => String}) end returns(false, 'when additional keys are passed and strict') do validator.validate({"key" => "Missing"}, {}) end returns(false, 'when some keys do not appear') do validator.validate({}, {"key" => String}) end returns(false, 'when collection contains a member that does not match schema') do validator.validate([{"key" => "Value"}, {"key" => 5}], [{"key" => String}]) end returns(false, 'when collection has multiple schema patterns') do validator.validate([{"key" => "Value"}], [{"key" => Integer}, {"key" => String}]) end returns(false, 'when hash and array are compared') do validator.validate({}, []) end returns(false, 'when array and hash are compared') do validator.validate([], {}) end returns(false, 'when a hash is expected but another data type is found') do validator.validate({"key" => {:nested_key => []}}, {"key" => {:nested_key => {}}}) end returns(false, 'when key is missing but value should be NilClass (#1477)') do validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => false}) end returns(false, 'when key is missing but value is nullable (#1477)') do validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => false}) end end end end fog-1.34.0/tests/bluebox/0000755000004100000410000000000012600047642015205 5ustar www-datawww-datafog-1.34.0/tests/bluebox/requests/0000755000004100000410000000000012600047642017060 5ustar www-datawww-datafog-1.34.0/tests/bluebox/requests/dns/0000755000004100000410000000000012600047642017644 5ustar www-datawww-datafog-1.34.0/tests/bluebox/requests/dns/dns_tests.rb0000644000004100000410000001463112600047642022204 0ustar www-datawww-dataShindo.tests('Fog::DNS[:bluebox] | DNS requests', ['bluebox', 'dns']) do @domain = '' @new_zones = [] @new_records =[] tests( 'success') do test('get current zone count') do pending if Fog.mocking? @org_zone_count= 0 response = Fog::DNS[:bluebox].get_zones() if response.status == 200 zones = response.body['zones'] @org_zone_count = zones.count end response.status == 200 end test('create zone - simple') do pending if Fog.mocking? domain = generate_unique_domain response = Fog::DNS[:bluebox].create_zone(:name => domain, :ttl => 360) if response.status == 202 zone_id = response.body['id'] @new_zones << zone_id end response.status == 202 end test('create zone - set all parameters') do pending if Fog.mocking? options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 } @domain= generate_unique_domain response = Fog::DNS[:bluebox].create_zone(options.merge(:name => @domain)) if response.status == 202 @zone_id = response.body['id'] @new_zones << @zone_id end response.status == 202 end test("get zone #{@zone_id} - check all parameters for #{@domain}") do pending if Fog.mocking? result = false response = Fog::DNS[:bluebox].get_zone(@zone_id) if response.status == 200 zone = response.body if (zone['name'] == @domain) and (zone['ttl'] == 60) result = true end end result end test('get zones - make sure total count is correct') do pending if Fog.mocking? result = false response = Fog::DNS[:bluebox].get_zones() if response.status == 200 zones = response.body['zones'] if (@org_zone_count+2) == zones.count result= true; end end result end test('get zones - check all parameters for a zone') do pending if Fog.mocking? result= false response = Fog::DNS[:bluebox].get_zones() if response.status == 200 zones = response.body['zones'] zones.each { |zone| if zone['id'] == @new_zones[1] options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 } if (zone['name'] == @domain) and (zone['ttl'] == 60) and (zone['retry'] == 3600) and (zone['refresh'] == 1800) and (zone['minimum'] == 30) result = true; end end } if (@org_zone_count+2) == zones.count result = true; end end result end test('create record - simple A record') do pending if Fog.mocking? host= 'www.' + @domain zone_id= @new_zones[1] response = Fog::DNS[:bluebox].create_record(zone_id, 'A', host, '1.2.3.4') if response.status == 202 record_id = response.body['id'] @new_records << record_id end response.status == 202 end test('create record - A record - all parameters set') do pending if Fog.mocking? host= 'ftp.' + @domain zone_id= @new_zones[1] response = Fog::DNS[:bluebox].create_record( zone_id, 'A', host, '1.2.3.4') if response.status == 202 record_id = response.body['id'] @new_records << record_id end response.status == 202 end test('create record - CNAME record') do pending if Fog.mocking? zone_id= @new_zones[1] response = Fog::DNS[:bluebox].create_record( zone_id, 'CNAME', 'mail', @domain) if response.status == 202 record_id = response.body['id'] @new_records << record_id end response.status == 202 end test('create record - NS record') do pending if Fog.mocking? ns_domain = 'ns.' + @domain zone_id= @new_zones[1] response = Fog::DNS[:bluebox].create_record( zone_id, 'NS', @domain, ns_domain) if response.status == 202 record_id = response.body['id'] @new_records << record_id end response.status == 202 end test('create record - MX record') do pending if Fog.mocking? mail_domain = 'mail.' + @domain zone_id= @new_zones[1] response = Fog::DNS[:bluebox].create_record( zone_id, 'MX', @domain, mail_domain, :priority => 10) if response.status == 202 @record_id = response.body['id'] @new_records << @record_id end response.status == 202 end test("get record #{@record_id} - verify all parameters") do pending if Fog.mocking? result= false response = Fog::DNS[:bluebox].get_record(@new_zones[1], @record_id) if response.status == 200 mail_domain = 'mail.' + @domain + "." record = response.body if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10') result= true end end result end test('get records - verify all parameters for one record') do pending if Fog.mocking? result= false response = Fog::DNS[:bluebox].get_records(@new_zones[1]) if response.status == 200 records = response.body['records'] #find mx record records.each {|record| if record['type'] == 'MX' mail_domain = 'mail.' + @domain + "." if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10') result= true break end end } end result end test("delete #{@new_records.count} records created") do pending if Fog.mocking? result= true @new_records.each { |record_id| response = Fog::DNS[:bluebox].delete_record(@new_zones[1], record_id) if response.status != 200 result= false; end } result end test("delete #{@new_zones.count} zones created") do pending if Fog.mocking? result= true @new_zones.each { |zone_id| response = Fog::DNS[:bluebox].delete_zone( zone_id) if response.status != 200 result= false; end } result end end tests( 'failure') do #create a zone with invalid parameters #get zonfo info with invalid zone id #delete a zone with an invalid zone id tests('#create_zone') do end end end fog-1.34.0/tests/bluebox/requests/compute/0000755000004100000410000000000012600047642020534 5ustar www-datawww-datafog-1.34.0/tests/bluebox/requests/compute/helper.rb0000644000004100000410000000043612600047642022343 0ustar www-datawww-dataclass Bluebox module Compute module Formats PRODUCT = { 'cost' => String, 'description' => String, 'id' => String }, LOCATION = { 'id' => String, 'description' => String } end end end fog-1.34.0/tests/bluebox/requests/compute/template_tests.rb0000644000004100000410000000172312600047642024121 0ustar www-datawww-dataShindo.tests('Fog::Compute[:bluebox] | template requests', ['bluebox']) do @template_format = { 'created' => String, 'description' => String, 'id' => String, 'public' => Fog::Boolean, 'locations' => [ String ], 'status' => String } tests('success') do @template_id = compute_providers[:bluebox][:server_attributes][:image_id] tests("get_template('#{@template_id}')").formats(@template_format) do pending if Fog.mocking? Fog::Compute[:bluebox].get_template(@template_id).body end tests("get_templates").formats([@template_format]) do pending if Fog.mocking? Fog::Compute[:bluebox].get_templates.body end end tests('failure') do tests("get_template('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].get_template('00000000-0000-0000-0000-000000000000') end end end fog-1.34.0/tests/bluebox/requests/compute/product_tests.rb0000644000004100000410000000152312600047642023764 0ustar www-datawww-dataShindo.tests('Fog::Compute[:bluebox] | product requests', ['bluebox']) do @product_format = { 'id' => String, 'description' => String, 'cost' => String } tests('success') do @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id] tests("get_product('#{@flavor_id}')").formats(@product_format) do pending if Fog.mocking? Fog::Compute[:bluebox].get_product(@flavor_id).body end tests("get_products").formats([@product_format]) do pending if Fog.mocking? Fog::Compute[:bluebox].get_products.body end end tests('failure') do tests("get_product('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].get_product('00000000-0000-0000-0000-000000000000') end end end fog-1.34.0/tests/bluebox/requests/compute/block_tests.rb0000644000004100000410000000564012600047642023402 0ustar www-datawww-dataShindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do @block_format = { 'cpu' => Float, 'description' => String, 'hostname' => String, 'id' => String, 'ips' => [{'address' => String}], 'lb_applications' => [], 'memory' => Integer, 'product' => {'cost' => String, 'description' => String, 'id' => String}, 'status' => String, 'storage' => Integer, 'location_id' => String, 'vsh_id' => String } tests('success') do @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id] @image_id = compute_providers[:bluebox][:server_attributes][:image_id] @location_id = compute_providers[:bluebox][:server_attributes][:location_id] @password = compute_providers[:bluebox][:server_attributes][:password] @block_id = nil tests("create_block('#{@flavor_id}', '#{@image_id}', '#{@location_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do pending if Fog.mocking? data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body @block_id = data['id'] data end unless Fog.mocking? Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? } end tests("get_block('#{@block_id}')").formats(@block_format) do pending if Fog.mocking? Fog::Compute[:bluebox].get_block(@block_id).body end tests("get_blocks").formats([@block_format.reject {|key,value| ['product', 'template'].include?(key)}]) do pending if Fog.mocking? Fog::Compute[:bluebox].get_blocks.body end tests("reboot_block('#{@block_id}')").formats([{'status' => String}, {'text' => String}]) do pending if Fog.mocking? Fog::Compute[:bluebox].reboot_block(@block_id).body end unless Fog.mocking? Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? } end tests("destroy_block('#{@block_id})'").formats({'text' => String}) do pending if Fog.mocking? Fog::Compute[:bluebox].destroy_block(@block_id).body end end tests('failure') do tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].get_block('00000000-0000-0000-0000-000000000000') end tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].reboot_block('00000000-0000-0000-0000-000000000000') end tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].destroy_block('00000000-0000-0000-0000-000000000000') end end end fog-1.34.0/tests/bluebox/requests/compute/location_tests.rb0000644000004100000410000000153012600047642024112 0ustar www-datawww-dataShindo.tests('Fog::Compute[:bluebox] | location requests', ['bluebox']) do @location_format = { 'id' => String, 'description' => String } tests('success') do @location_id = compute_providers[:bluebox][:server_attributes][:location_id] tests("get_location('#{@location_id}')").formats(@location_format) do pending if Fog.mocking? Fog::Compute[:bluebox].get_location(@location_id).body end tests("get_locations").formats([@location_format]) do pending if Fog.mocking? Fog::Compute[:bluebox].get_locations.body end end tests('failure') do tests("get_location('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do pending if Fog.mocking? Fog::Compute[:bluebox].get_location('00000000-0000-0000-0000-000000000000') end end end fog-1.34.0/tests/bluebox/requests/blb/0000755000004100000410000000000012600047642017617 5ustar www-datawww-datafog-1.34.0/tests/bluebox/requests/blb/helper.rb0000644000004100000410000000306212600047642021424 0ustar www-datawww-dataclass Bluebox module BLB module Formats LB_APPLICATION = { 'id' => String, 'ip_v4' => String, 'ip_v6' => String, 'name' => String, 'lb_services' => Array, 'source_ip_v4' => Fog::Nullable::String, } LB_APPLICATIONS = [LB_APPLICATION] LB_SERVICE = { 'name' => String, 'port' => Integer, 'private' => Fog::Boolean, 'status_username' => String, 'status_password' => String, 'status_url' => String, 'service_type' => String, 'created' => String, 'lb_backends' => Array, 'pem_file_uploaded?' => Fog::Nullable::Boolean, } LB_SERVICES = [LB_SERVICE] LB_BACKEND = { 'id' => String, 'backend_name' => String, 'lb_machines' => Array, 'acl_name' => String, 'acl_name' => String, 'monitoring_url_hostname' => String, 'monitoring_url' => String, 'monitoring_url_hostname' => String, 'check_interval' => Integer, 'rise' => Fog::Nullable::Integer, 'order' => Fog::Nullable::Integer, 'fall' => Fog::Nullable::Integer, } LB_BACKENDS = [LB_BACKEND] LB_MACHINE = { 'port' => Integer, 'id' => String, 'ip' => String, 'maxconn' => Integer, 'hostname' => String, 'created' => String, } ADD_MACHINE_TO_LB = [ { 'text' => String }, { 'status' => String }, ] REMOVE_MACHINE_FROM_BACKEND = 'Record Removed.' end end end fog-1.34.0/tests/bluebox/requests/blb/lb_tests.rb0000644000004100000410000000672112600047642021771 0ustar www-datawww-datarequire 'securerandom' Shindo.tests('Bluebox::BLB | lb_tests', ['bluebox']) do pending if Fog.mocking? tests('success') do @flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id] @image_id = compute_providers[:bluebox][:server_attributes][:image_id] @location_id = compute_providers[:bluebox][:server_attributes][:location_id] @password = SecureRandom.base64(18) tests("get_lb_applications").formats(Bluebox::BLB::Formats::LB_APPLICATIONS) do @lb_applications = Fog::Bluebox[:blb].get_lb_applications.body end tests("get_lb_application").formats(Bluebox::BLB::Formats::LB_APPLICATION) do Fog::Bluebox[:blb].get_lb_application(@lb_applications.first['id']).body end tests("get_lb_services").formats(Bluebox::BLB::Formats::LB_SERVICES) do @lb_services = Fog::Bluebox[:blb].get_lb_services(@lb_applications.first['id']).body end tests("get_lb_service").formats(Bluebox::BLB::Formats::LB_SERVICE) do Fog::Bluebox[:blb].get_lb_service(@lb_applications.first['id'], @lb_services.first['id']).body end tests("get_lb_backends").formats(Bluebox::BLB::Formats::LB_BACKENDS) do @lb_backends = Fog::Bluebox[:blb].get_lb_backends(@lb_services.first['id']).body end tests("get_lb_backend").formats(Bluebox::BLB::Formats::LB_BACKEND) do Fog::Bluebox[:blb].get_lb_backend(@lb_services.first['id'], @lb_backends.first['id']).body end # create block data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body @block_id = data['id'] Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? } tests("add_machine_to_lb_application").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do Fog::Bluebox[:blb].add_machine_to_lb_application(@lb_applications.first['id'], @block_id).body end @default_backend = @lb_backends.select { |x| x['backend_name'] == 'default' }.first @id_in_backend = @default_backend['lb_machines'].last['id'] @machine_opts = { 'port' => 4361, 'backup' => true }; tests("update_lb_backend_machine(#{@lb_backends.first['id']}, #{@id_in_backend}, #{@machine_opts})").formats(Bluebox::BLB::Formats::LB_MACHINE) do Fog::Bluebox[:blb].update_lb_backend_machine(@lb_backends.first['id'], @id_in_backend, @machine_opts).body end tests("remove_machine_from_lb_backend(#{@default_backend['id']}, #{@id_in_backend})").formats(Bluebox::BLB::Formats::REMOVE_MACHINE_FROM_BACKEND) do Fog::Bluebox[:blb].remove_machine_from_lb_backend(@default_backend['id'], @id_in_backend).body end tests("add_machine_to_lb_backend(#{@default_backend['id']}, #{@block_id})").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do Fog::Bluebox[:blb].add_machine_to_lb_backend(@default_backend['id'], @block_id).body end Fog::Compute[:bluebox].destroy_block(@block_id).body end tests('failure') do tests('get_lb_application').raises(Fog::Compute::Bluebox::NotFound) do Fog::Bluebox[:blb].get_lb_application('00000000-0000-0000-0000-000000000000') end tests('get_lb_service').raises(Fog::Compute::Bluebox::NotFound) do Fog::Bluebox[:blb].get_lb_service('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') end tests('get_lb_backend').raises(Fog::Compute::Bluebox::NotFound) do Fog::Bluebox[:blb].get_lb_backend('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') end end end fog-1.34.0/tests/clodo/0000755000004100000410000000000012600047642014645 5ustar www-datawww-datafog-1.34.0/tests/clodo/requests/0000755000004100000410000000000012600047642016520 5ustar www-datawww-datafog-1.34.0/tests/clodo/requests/compute/0000755000004100000410000000000012600047642020174 5ustar www-datawww-datafog-1.34.0/tests/clodo/requests/compute/image_tests.rb0000644000004100000410000000135312600047642023027 0ustar www-datawww-dataShindo.tests('Fog::Compute[:clodo] | image requests', ['clodo']) do ### Fog.mock! clodo = Fog::Compute[:clodo] @image_format = { 'id' => String, 'name' => String, 'status' => String, 'vps_type' => String } @image_details_format = { 'os_type' => String, 'os_bits' => String, 'os_hvm' => String, '_attr' => @image_format } tests("success") do tests("- list_images").formats([@image_format]) do clodo.list_images.body['images'] end tests("- list_images_detail").formats([@image_details_format]) do clodo.list_images_detail.body['images'] end end tests("failure") do tests("- get_image_details(541)").returns(nil) do clodo.images.get(541) end end end fog-1.34.0/tests/clodo/requests/compute/server_tests.rb0000644000004100000410000001335512600047642023260 0ustar www-datawww-dataShindo.tests('Fog::Compute[:clodo] | server requests', ['clodo']) do @ip_format = { 'primary_ip' => Fog::Boolean, 'isp' => Fog::Boolean, 'ip' => String } @server_format = { 'addresses' => { 'public' => [@ip_format] }, 'id' => String, 'imageId' => String, 'name' => String, 'type' => String, 'status' => String } @server_details_format = @server_format.merge({ 'id' => Integer, 'vps_createdate' => String, 'vps_hdd_max' => String, 'vps_traff' => NilClass, 'vps_mem_1h_max' => String, 'vps_mem_load' => String, 'vps_user_pass' => String, 'vps_vnc_pass' => String, 'vps_adddate' => String, 'vps_os_title' => String, 'vps_update' => String, 'vps_mem_1h_min' => String, 'vps_mem_1h_avg' => NilClass, 'vps_memory_max' => String, 'vps_os_version' => String, 'vps_cpu_1h_max' => String, 'vps_hdd_load' => String, 'vps_disk_load' => String, 'vps_os_type' => String, 'vps_memory' => String, 'vps_cpu_load' => String, 'vps_update_days' => String, 'vps_os_bits' => String, 'vps_vnc' => String, 'vps_cpu_max' => String, 'vps_cpu_1h_min' => String, 'vps_cpu_1h_avg' => NilClass, 'vps_root_pass' => String }) @server_create_format = { 'name' => String, 'adminPass' => String, 'imageId' => String, 'id' => Integer } # Fog.mock! clodo = Fog::Compute[:clodo] tests('success') do tests('- create_server(541)').formats(@server_create_format) do data = clodo.create_server(541,{:vps_type => 'ScaleServer'}).body['server'] @server_id = data['id'] data end tests('- list_servers(ready)').formats([@server_format]) do clodo.list_servers.body['servers'].reject {|s| !['is_running', 'is_disabled'].include?(s['status']) } end tests('- list_servers(not ready)').formats([@server_format.merge({'addresses'=>{'public'=>NilClass}})]) do clodo.list_servers.body['servers'].reject {|s| !['is_request'].include?(s['status']) } end clodo.servers.get(@server_id).wait_for { ready? || state == 'is_error' } unless Fog.mocking? tests("- add_ip_address(#{@server_id})").succeeds do clodo.add_ip_address(@server_id) end # tests("- get_server_details(#{@server_id})").formats(@server_details_format) do # data = clodo.get_server_details(@server_id).body['server'] # @additional_ip = data['addresses']['public'].select {|a| !a['primary_ip'] }.first # data # end tests("- reboot_server(#{@server_id})").succeeds do clodo.reboot_server(@server_id, :hard) end clodo.servers.get(@server_id).wait_for { ready? || state == 'is_error' } unless Fog.mocking? # tests("- delete_ip_address(#{@server_id}, #{@additional_ip['ip']})").success do # clodo.delete_ip_address(@server_id, @additional_ip['ip']) # end tests("- stop_server(#{@server_id})").succeeds do clodo.stop_server(@server_id) end unless Fog.mocking? clodo.servers.get(@server_id).wait_for { state == 'is_disabled' || state == 'is_error' } end tests("- start_server(#{@server_id})").succeeds do clodo.start_server(@server_id) end clodo.servers.get(@server_id).wait_for { ready? || state == 'is_error' } unless Fog.mocking? tests("- delete_server(#{@server_id})").succeeds do clodo.delete_server(@server_id) end end tests('failure') do tests('- create_server(0)').raises(Excon::Errors::BadRequest) do data = clodo.create_server(0,{:vps_type => 'ScaleServer'}).body['server'] @server_id = data['id'] data end tests("- reboot_server(0)").raises(Excon::Errors::BadRequest) do clodo.reboot_server(0, :hard) end tests("- stop_server(0)").raises(Excon::Errors::BadRequest) do clodo.stop_server(0) end tests("- start_server(0)").raises(Excon::Errors::BadRequest) do clodo.start_server(0) end ## delete_server(0) in actual API, works not as it must, ## so I do not include this test in tests sequence. # tests("- delete_server(0)").raises(Fog::Compute::Clodo::NotFound) do # clodo.delete_server(0) # end # # tests("- delete_ip_address(0, 6.6.6.6)").raises(Fog::Compute::Clodo::NotFound) do # clodo.delete_ip_address(0, "6.6.6.6") # end tests("- delete_ip_address(#{@server_id}, 6.6.6.6)").raises(Excon::Errors::BadRequest) do clodo.delete_ip_address(@server_id, "6.6.6.6") end end end fog-1.34.0/tests/openvz/0000755000004100000410000000000012600047642015066 5ustar www-datawww-datafog-1.34.0/tests/openvz/helper.rb0000644000004100000410000000214612600047642016675 0ustar www-datawww-data # Shortcut for Fog::Compute[:openvz] def openvz_service Fog::Compute[:openvz] end # Create a long lived server for the tests def openvz_fog_test_server server = openvz_service.servers.find { |s| s.ctid == '104' } unless server server = openvz_service.servers.create :ctid => '104' server.start server.reload # Wait for the server to come up begin server.wait_for(120) { server.reload rescue nil; server.ready? } rescue Fog::Errors::TimeoutError # Server bootstrap took more than 120 secs! end end openvz_fog_test_cleanup server end # Destroy the long lived server def openvz_fog_test_server_destroy server = openvz_service.servers.find { |s| s.ctid == '104' } server.destroy if server end # Prepare a callback to destroy the long lived test server def openvz_fog_test_cleanup at_exit do unless Fog.mocking? server = openvz_service.servers.find { |s| s.name == '104' } if server server.wait_for(120) do reload rescue nil; ready? end end server.stop openvz_fog_test_server_destroy end end end fog-1.34.0/tests/openvz/models/0000755000004100000410000000000012600047642016351 5ustar www-datawww-datafog-1.34.0/tests/openvz/models/compute/0000755000004100000410000000000012600047642020025 5ustar www-datawww-datafog-1.34.0/tests/openvz/models/compute/server_tests.rb0000644000004100000410000000225112600047642023102 0ustar www-datawww-dataShindo.tests("Fog::Compute[:openvz] | server model", ['openvz', 'compute']) do server = openvz_fog_test_server tests('The server model should') do tests('have the action') do test('reload') { server.respond_to? 'reload' } %w{ destroy mount umount restart stop start quotaon quotaoff quotainit suspend resume }.each do |action| test(action) { server.respond_to? action } end end tests('have attributes') do model_attribute_hash = server.attributes attributes = [ :ctid, :description ] tests("The server model should respond to") do attributes.each do |attribute| test("#{attribute}") { server.respond_to? attribute } end end end test('#stop') do pending if Fog.mocking? server.stop server.wait_for { server.status == 'stopped' } server.status == 'stopped' end test('#start') do pending if Fog.mocking? server.start server.wait_for { ready? } server.ready? end end # restore server status server.start end fog-1.34.0/tests/openvz/models/compute/servers_tests.rb0000644000004100000410000000154612600047642023273 0ustar www-datawww-dataShindo.tests('Fog::Compute[:openvz] | servers collection', ['openvz']) do openvz_service = Fog::Compute[:openvz] tests('The servers collection') do servers = openvz_service.servers.all server = openvz_fog_test_server test('should NOT be empty') do servers.reload !servers.empty? end test('should be a kind of Fog::Compute::Openvz::Servers') do servers.kind_of? Fog::Compute::Openvz::Servers end tests('should have Fog::Compute::Openvz::Servers inside') do servers.each do |s| test { s.kind_of? Fog::Compute::Openvz::Server } end end tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do test('by instance ctid') do servers.get(server.ctid).kind_of? Fog::Compute::Openvz::Server end end end end fog-1.34.0/tests/cloudstack/0000755000004100000410000000000012600047642015701 5ustar www-datawww-datafog-1.34.0/tests/cloudstack/requests/0000755000004100000410000000000012600047642017554 5ustar www-datawww-datafog-1.34.0/tests/cloudstack/requests/security_group_tests.rb0000644000004100000410000000135412600047642024411 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | security group requests', ['cloudstack']) do @security_groups_format = { 'listsecuritygroupsresponse' => { 'count' => Integer, 'securitygroup' => [ 'id' => Integer, 'account' => String, 'description' => Fog::Nullable::String, 'domain' => String, 'domainid' => Integer, 'jobid' => Fog::Nullable::Integer, 'jobstatus' => Fog::Nullable::String, 'name' => String, 'ingressrule' => Fog::Nullable::Array ] } } tests('success') do tests('#list_security_groups').formats(@security_groups_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_security_groups end end end fog-1.34.0/tests/cloudstack/requests/service_offering_tests.rb0000644000004100000410000000143212600047642024642 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | service offering requests', ['cloudstack']) do @service_offerings_format = { 'listserviceofferingsresponse' => { 'count' => Integer, 'serviceoffering' => [ 'id' => String, 'name' => String, 'displaytext' => String, 'cpuspeed' => Integer, 'cpunumber' => Integer, 'memory' => Integer, 'created' => String, 'storagetype' => String, 'offerha' => Fog::Boolean, 'limitcpuuse' => Fog::Boolean, 'issystem' => Fog::Boolean, 'defaultuse' => Fog::Boolean ] } } tests('success') do tests('#list_service_offerings').formats(@service_offerings_format) do Fog::Compute[:cloudstack].list_service_offerings end end end fog-1.34.0/tests/cloudstack/requests/egress_firewall_rule_tests.rb0000644000004100000410000000114312600047642025526 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | egress firewall rule requests', ['cloudstack']) do @egress_firewall_rules_format = { 'listegressfirewallrulesresponse' => { 'count' => Integer, 'firewallrule' => [ 'id' => String, 'protocol' => String, 'networkid' => String, 'state' => String, 'cidrlist' => String, 'tags' => Fog::Nullable::Array ] } } tests('success') do tests('#list_egress_firewall_rules').formats(@egress_firewall_rules_format) do Fog::Compute[:cloudstack].list_egress_firewall_rules end end end fog-1.34.0/tests/cloudstack/requests/template_tests.rb0000644000004100000410000000320112600047642023132 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | template requests', ['cloudstack']) do @templates_format = { 'listtemplatesresponse' => { 'count' => Integer, 'template' => [ 'id' => Integer, 'name' => String, 'displaytext' => String, 'ispublic' => Fog::Boolean, 'created' => String, 'isready' => Fog::Boolean, 'passwordenabled' => Fog::Boolean, 'format' => String, 'isfeatured' => Fog::Boolean, 'crossZones' => Fog::Boolean, 'ostypeid' => Integer, 'ostypename' => String, 'account' => String, 'zoneid' => Integer, 'zonename' => String, 'status' => Fog::Nullable::String, 'size' => Fog::Nullable::Integer, 'templatetype' => String, 'hypervisor' => String, 'domain' => String, 'domainid' => Integer, 'isextractable' => Fog::Boolean, 'checksum' => Fog::Nullable::String, 'sourcetemplateid' => Fog::Nullable::Integer, 'accountid' => Fog::Nullable::Integer, 'bootable' => Fog::Nullable::Boolean, 'hostid' => Fog::Nullable::Integer, 'hostname' => Fog::Nullable::String, 'jobid' => Fog::Nullable::Integer, 'jobstatus' => Fog::Nullable::Integer, 'removed' => Fog::Nullable::Boolean, 'templatetag' => Fog::Nullable::String, 'templatetype' => Fog::Nullable::String ] } } tests('success') do tests('#list_templates').formats(@templates_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_templates('templateFilter' => "executable") end end end fog-1.34.0/tests/cloudstack/requests/firewall_rule_tests.rb0000644000004100000410000000126612600047642024164 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | firewall rule requests', ['cloudstack']) do @firewall_rules_format = { 'listfirewallrulesresponse' => { 'count' => Integer, 'firewallrule' => [ 'id' => String, 'protocol' => String, 'startport' => String, 'endport' => String, 'ipaddressid' => String, 'networkid' => String, 'ipaddress' => String, 'state' => String, 'cidrlist' => String, 'tags' => Fog::Nullable::Array ] } } tests('success') do tests('#list_firewall_rules').formats(@firewall_rules_format) do Fog::Compute[:cloudstack].list_firewall_rules end end end fog-1.34.0/tests/cloudstack/requests/snapshot_tests.rb0000644000004100000410000000134712600047642023167 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | snapshot requests', ['cloudstack']) do @snapshots_format = { 'listsnapshotsresponse' => { 'count' => Integer, 'snapshot' => [ 'id' => Integer, 'account' => String, 'domainid' => Integer, 'domain' => String, 'snapshottype' => String, 'volumeid' => Integer, 'volumename' => String, 'volumetype' => String, 'created' => String, 'name' => String, 'intervaltype' => String, 'state' => String ] } } tests('success') do tests('#list_snapshots').formats(@snapshots_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_snapshots end end end fog-1.34.0/tests/cloudstack/requests/public_ip_address_tests.rb0000644000004100000410000000204512600047642024777 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | public ip address requests', ['cloudstack']) do @public_ip_addresses_format = { 'listpublicipaddressesresponse' => { 'count' => Integer, 'publicipaddress' => [ 'id' => String, 'ipaddress' => String, 'allocated' => String, 'zoneid' => String, 'zonename' => String, 'issourcenat' => Fog::Boolean, 'projectid' => String, 'project' => String, 'domainid' => String, 'domain' => String, 'forvirtualnetwork' => Fog::Boolean, 'isstaticnat' => Fog::Boolean, 'issystem' => Fog::Boolean, 'associatednetworkid' => String, 'associatednetworkname' => String, 'networkid' => String, 'state' => String, 'physicalnetworkid' => String, 'tags' => Fog::Nullable::Array ] } } tests('success') do tests('#list_public_ip_addresses').formats(@public_ip_addresses_format) do Fog::Compute[:cloudstack].list_public_ip_addresses end end end fog-1.34.0/tests/cloudstack/requests/network_offering_tests.rb0000644000004100000410000000152412600047642024675 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | network offering requests', ['cloudstack']) do @network_offerings_format = { 'listnetworkofferingsresponse' => { 'count' => Integer, 'networkoffering' => [ 'id' => String, 'name' => String, 'displaytext' => String, 'traffictype' => String, 'isdefault' => Fog::Boolean, 'specifyvlan' => Fog::Boolean, 'conservemode' => Fog::Boolean, 'specifyipranges' => Fog::Boolean, 'availability' => String, 'networkrate' => Integer, 'state' => String, 'guestiptype' => String, 'serviceofferingid' => String, ] } } tests('success') do tests('#list_network_offerings').formats(@network_offerings_format) do Fog::Compute[:cloudstack].list_network_offerings end end end fog-1.34.0/tests/cloudstack/requests/ssh_key_pair_tests.rb0000644000004100000410000000077212600047642024011 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | ssh key pairs requests', ['cloudstack']) do @ssh_keys_format = { 'listsshkeypairsresponse' => { 'count' => Integer, 'sshkeypair' => [ 'fingerprint' => String, 'name' => String, 'privatekey' => Fog::Nullable::String ] } } tests('success') do tests('#list_ssh_key_pairs').formats(@ssh_keys_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_ssh_key_pairs end end end fog-1.34.0/tests/cloudstack/requests/virtual_machine_tests.rb0000644000004100000410000000425112600047642024477 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | virtual machine requests', ['cloudstack']) do @virtual_machines_format = { 'listvirtualmachinesresponse' => { 'count' => Integer, 'virtualmachine' => [ 'id' => String, 'name' => String, 'displayname' => String, 'account' => String, 'domainid' => String, 'domain' => String, 'created' => String, 'state' => String, 'haenable' => Fog::Boolean, 'zoneid' => String, 'zonename' => String, 'hostid' => Fog::Nullable::String, 'hostname' => Fog::Nullable::String, 'templateid' => String, 'templatename' => String, 'templatedisplaytext' => String, 'passwordenabled' => Fog::Boolean, 'serviceofferingid' => String, 'serviceofferingname' => String, 'cpunumber' => Integer, 'cpuspeed' => Integer, 'networkkbsread' => Fog::Nullable::Integer, 'memory' => Integer, 'cpuused' => Fog::Nullable::String, 'guestosid' => String, 'networkkbswrite' => Fog::Nullable::Integer, 'rootdeviceid' => Integer, 'rootdevicetype' => String, 'hypervisor' => Fog::Nullable::String, 'group' => Fog::Nullable::String, 'groupid' => Fog::Nullable::Integer, 'isoname' => Fog::Nullable::String, 'isoid' => Fog::Nullable::Integer, 'securitygroup' => [ 'id' => Integer, 'name' => Fog::Nullable::String, 'description' => Fog::Nullable::String ], 'nic' => [ 'id' => String, 'networkid' => String, 'netmask' => String, 'gateway' => String, 'ipaddress' => String, 'traffictype' => String, 'type' => String, 'isdefault' => Fog::Boolean, 'macaddress' => String, 'broadcasturi' => Fog::Nullable::String, 'isolationuri' => Fog::Nullable::String ] ] } } tests('success') do tests('#list_virtual_machines').formats(@virtual_machines_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_virtual_machines end end end fog-1.34.0/tests/cloudstack/requests/port_forwarding_rule_tests.rb0000644000004100000410000000163412600047642025564 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | port forwarding rule requests', ['cloudstack']) do @port_forwarding_rule_format = { 'listportforwardingrulesresponse' => { 'count' => Integer, 'portforwardingrule' => [ 'id' => String, 'privateport' => String, 'privateendport' => String, 'protocol' => String, 'publicport' => String, 'publicendport' => String, 'virtualmachineid' => String, 'virtualmachinename' => String, 'virtualmachinedisplayname' => String, 'ipaddressid' => String, 'ipaddress' => String, 'state' => String, 'cidrlist' => String, 'tags' => Fog::Nullable::Array ] } } tests('success') do tests('#list_port_forwarding_rules').formats(@port_forwarding_rule_format) do Fog::Compute[:cloudstack].list_port_forwarding_rules('zoneid' => 1) end end end fog-1.34.0/tests/cloudstack/requests/disk_offering_tests.rb0000644000004100000410000000133512600047642024136 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | disk offering requests', ['cloudstack']) do @disk_offerings_format = { 'listdiskofferingsresponse' => { 'count' => Integer, 'diskoffering' => [ 'id' => String, 'created' => String, 'disksize' => Integer, 'displaytext' => String, 'domain' => Fog::Nullable::String, 'domainid' => Fog::Nullable::String, 'iscustomized' => Fog::Boolean, 'name' => String, 'storagetype' => String, 'tags' => Fog::Nullable::String ] } } tests('success') do tests('#list_disk_offerings').formats(@disk_offerings_format) do Fog::Compute[:cloudstack].list_disk_offerings end end end fog-1.34.0/tests/cloudstack/requests/zone_tests.rb0000644000004100000410000000157312600047642022304 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | zone requests', ['cloudstack']) do @zones_format = { 'listzonesresponse' => { 'count' => Integer, 'zone' => [ 'id' => Integer, 'name' => String, 'dns1' => Fog::Nullable::String, 'dns2' => Fog::Nullable::String, 'internaldns1' => Fog::Nullable::String, 'internaldns2' => Fog::Nullable::String, 'vlan' => Fog::Nullable::String, 'guestcidraddress' => Fog::Nullable::String, 'networktype' => String, 'securitygroupsenabled' => Fog::Nullable::Boolean, 'allocationstate' => String, 'dhcpprovider' => String, 'zonetoken' => Fog::Nullable::String ] } } tests('success') do tests('#list_zones').formats(@zones_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_zones end end end fog-1.34.0/tests/cloudstack/requests/volume_tests.rb0000644000004100000410000000265312600047642022640 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | volume requests', ['cloudstack']) do @volumes_format = { 'listvolumesresponse' => { 'count' => Integer, 'volume' => [ 'id' => String, 'name' => String, 'zoneid' => String, 'zonename' => String, 'type' => String, 'size' => Integer, 'created' => String, 'account' => String, 'domainid' => String, 'domain' => String, 'state' => String, 'storagetype' => String, 'hypervisor' => String, 'diskofferingid' => Fog::Nullable::String, 'diskofferingname' => Fog::Nullable::String, 'diskofferingdisplaytext' => Fog::Nullable::String, 'storage' => String, 'destroyed' => Fog::Boolean, 'isextractable' => Fog::Boolean, 'deviceid' => Fog::Nullable::Integer, 'virtualmachineid' => Fog::Nullable::String, 'vmname' => Fog::Nullable::String, 'vmdisplayname' => Fog::Nullable::String, 'vmstate' => Fog::Nullable::String, 'serviceofferingid' => Fog::Nullable::Integer, 'serviceofferingname' => Fog::Nullable::String, 'serviceofferingdisplaytext' => Fog::Nullable::String, 'attached' => Fog::Nullable::String ] } } tests('success') do tests('#list_volumes').formats(@volumes_format) do Fog::Compute[:cloudstack].list_volumes('zoneid' => 1) end end end fog-1.34.0/tests/cloudstack/requests/os_type_tests.rb0000644000004100000410000000141212600047642023003 0ustar www-datawww-dataShindo.tests('Fog::Compute[:cloudstack] | os type requests', ['cloudstack']) do @os_types_format = { 'listostypesresponse' => { 'count' => Integer, 'ostype' => [ 'id' => String, 'description' => String, 'oscategoryid' => String ] } } @os_categories_format = { 'listoscategoriesresponse' => { 'count' => Integer, 'oscategory' => [ 'id' => Integer, 'name' => String ] } } tests('success') do tests('#list_os_types').formats(@os_types_format) do Fog::Compute[:cloudstack].list_os_types end tests('#list_os_categories').formats(@os_categories_format) do pending if Fog.mocking? Fog::Compute[:cloudstack].list_os_categories end end end fog-1.34.0/tests/cloudstack/compute/0000755000004100000410000000000012600047642017355 5ustar www-datawww-datafog-1.34.0/tests/cloudstack/compute/models/0000755000004100000410000000000012600047642020640 5ustar www-datawww-datafog-1.34.0/tests/cloudstack/compute/models/security_group_tests.rb0000644000004100000410000000077212600047642025500 0ustar www-datawww-datadef security_group_tests(connection, params, mocks_implemented = true) model_tests(connection.security_groups, params[:security_group_attributes], mocks_implemented) do if Fog.mocking? && !mocks_implemented pending else responds_to(:rules) end end end provider, config = :cloudstack, compute_providers[:cloudstack] Shindo.tests("Fog::Compute[:#{provider}] | security_groups", [provider.to_s]) do security_group_tests(Fog::Compute[:cloudstack], config, config[:mocked]) end fog-1.34.0/tests/cloudstack/compute/models/egress_firewall_rule_tests.rb0000644000004100000410000000041712600047642026615 0ustar www-datawww-dataShindo.tests("Fog::Compute[:cloudstack] | egress_firewall_rule", "cloudstack") do config = compute_providers[:cloudstack] compute = Fog::Compute[:cloudstack] model_tests(compute.egress_firewall_rules, config[:egress_firewall_rule_attributes], config[:mocked]) end fog-1.34.0/tests/cloudstack/compute/models/server_tests.rb0000644000004100000410000000120612600047642023714 0ustar www-datawww-dataprovider, config = :cloudstack, compute_providers[:cloudstack] Shindo.tests("Fog::Compute[:#{provider}] | servers + security_groups", [provider.to_s]) do connection = Fog::Compute[provider] @security_group = connection.security_groups.create(config[:security_group_attributes]) @server = connection.servers.create(config[:server_attributes].merge(:security_groups => [@security_group])) tests('#security_group').succeeds do @server.wait_for { ready? } @server.security_groups.map(&:id) == [@security_group.id] end tests('#destroy').succeeds do @server.destroy.wait_for { ready? } @security_group.destroy end end fog-1.34.0/tests/cloudstack/compute/models/security_groups_tests.rb0000644000004100000410000000076212600047642025662 0ustar www-datawww-datadef security_group_tests(provider, params, mocks_implemented = true) collection_tests(provider.security_groups, params, mocks_implemented) do if Fog.mocking? && !mocks_implemented pending else responds_to(:rules) end end end provider, config = :cloudstack, compute_providers[:cloudstack] Shindo.tests("Fog::Compute[:#{provider}] | security_group", [provider.to_s]) do security_group_tests(Fog::Compute[provider], (config[:security_group_attributes] || {}), config[:mocked]) end fog-1.34.0/tests/cloudstack/compute/models/snapshot_tests.rb0000644000004100000410000000077012600047642024252 0ustar www-datawww-datadef snapshot_tests(connection, params, mocks_implemented = true) model_tests(connection.snapshots, params[:snapshot_attributes], mocks_implemented) do if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } end end end Shindo.tests("Fog::Compute[:cloudstack] | snapshot", "cloudstack") do config = compute_providers[:cloudstack] snapshot_tests(Fog::Compute[:cloudstack], config, config[:mocked]) tests('has volume relation') do responds_to(:volume) end end fog-1.34.0/tests/cloudstack/compute/models/public_ip_address_tests.rb0000644000004100000410000000132112600047642026057 0ustar www-datawww-dataShindo.tests("Fog::Compute[:cloudstack] | public_ip_address", "cloudstack") do config = compute_providers[:cloudstack] compute = Fog::Compute[:cloudstack] model_tests(compute.public_ip_addresses, config[:public_ip_address_attributes], config[:mocked]) do @server = Fog::Compute[:cloudstack].servers.create(config[:server_attributes]) @server.wait_for { ready? } tests('#server=').succeeds do @instance.server = @server end tests('#server') do test(' == @server') do @instance.reload @instance.server_id == @server.id end end test('#server = nil') do @instance.server = nil @instance.server_id.nil? end @server.destroy end end fog-1.34.0/tests/cloudstack/compute/models/volumes_tests.rb0000644000004100000410000000067112600047642024105 0ustar www-datawww-datadef volumes_tests(connection, params = {}, mocks_implemented = true) collection_tests(connection.volumes, params, mocks_implemented) do if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } end end end config = compute_providers[:cloudstack] Shindo.tests("Fog::Compute[:cloudstack] | volumes", ["cloudstack"]) do volumes_tests(Fog::Compute[:cloudstack], config[:volume_attributes], config[:mocked]) end fog-1.34.0/tests/cloudstack/compute/models/public_ip_addresses_tests.rb0000644000004100000410000000024712600047642026415 0ustar www-datawww-dataShindo.tests("Fog::Compute[:cloudstack] | public_ip_addresses", ['cloudstack']) do collection_tests(Fog::Compute[:cloudstack].public_ip_addresses, {}, true) end fog-1.34.0/tests/cloudstack/compute/models/disk_offering_tests.rb0000644000004100000410000000037112600047642025221 0ustar www-datawww-dataShindo.tests("Fog::Compute[:cloudstack] | disk_offering", "cloudstack") do config = compute_providers[:cloudstack] compute = Fog::Compute[:cloudstack] model_tests(compute.disk_offerings, config[:disk_offering_attributes], config[:mocked]) end fog-1.34.0/tests/cloudstack/compute/models/volume_tests.rb0000644000004100000410000000150012600047642023712 0ustar www-datawww-datadef volume_tests(connection, params, mocks_implemented = true) model_tests(connection.volumes, params[:volume_attributes], mocks_implemented) do if !Fog.mocking? || mocks_implemented @instance.wait_for { ready? } end @server = @instance.connection.servers.create(params[:server_attributes]) @server.wait_for { ready? } tests('attach').succeeds do @instance.attach(@server) end tests('detach').succeeds do @instance.detach end @server.destroy end end Shindo.tests("Fog::Compute[:cloudstack] | volume", "cloudstack") do config = compute_providers[:cloudstack] volume_tests(Fog::Compute[:cloudstack], config, config[:mocked]) do if Fog.mocking? && !mocks_implemented pending else responds_to(:ready?) responds_to(:flavor) end end end fog-1.34.0/tests/cloudstack/compute/models/security_group_rule_tests.rb0000644000004100000410000000165612600047642026531 0ustar www-datawww-datadef security_group_rule_tests(connection, params, direction, mocks_implemented = true) @security_group = connection.security_groups.create(params[:security_group_attributes]) rule_params = params[:security_group_rule_attributes].merge(:security_group_id => @security_group.id, :direction => direction) model_tests(connection.security_group_rules, rule_params, mocks_implemented) do if Fog.mocking? && !mocks_implemented pending end end @security_group.destroy end provider, config = :cloudstack, compute_providers[:cloudstack] Shindo.tests("Fog::Compute[:#{provider}] | security_group_rules | ingress", [provider.to_s]) do security_group_rule_tests(Fog::Compute[:cloudstack], config, "ingress", config[:mocked]) end Shindo.tests("Fog::Compute[:#{provider}] | security_group_rules | egress", [provider.to_s]) do security_group_rule_tests(Fog::Compute[:cloudstack], config, "egress", config[:mocked]) end fog-1.34.0/tests/cloudstack/signed_params_tests.rb0000644000004100000410000000154112600047642022265 0ustar www-datawww-data# encoding: utf-8 Shindo.tests('Cloudstack | escape', ['cloudstack']) do returns( Fog::Cloudstack.escape( "'Stöp!' said Fred_-~." ) ) { "%27St%C3%B6p%21%27%20said%20Fred_-%7E." } end Shindo.tests('Cloudstack | signed_params', ['cloudstack']) do returns( Fog::Cloudstack.signed_params( 'abcdefg', 'account' => 'Lorem Ipsum', 'domainid' => 42, 'q' => 'keywords' ) ) { "V2CxRU4zQQtox1DZsH/66GDdzhg=" } returns( Fog::Cloudstack.signed_params( 'abcdefg', 'account' => 'Lorem Ipsum', 'domainid' => '42', 'q' => 'keywords' ) ) { "V2CxRU4zQQtox1DZsH/66GDdzhg=" } returns( Fog::Cloudstack.signed_params( 'abcdefg', 'account' => 'Lorem Ipsum', 'domainid' => 42, 'q' => nil ) ) { "5bsDirm5pPgVoreQ6vquKRN+4HI=" } returns( Fog::Cloudstack.signed_params( 'abcdefg', 'account' => 'Lorem Ipsum', 'domainid' => 42, 'q' => '' ) ) { "5bsDirm5pPgVoreQ6vquKRN+4HI=" } end fog-1.34.0/tests/dreamhost/0000755000004100000410000000000012600047642015533 5ustar www-datawww-datafog-1.34.0/tests/dreamhost/helper.rb0000644000004100000410000000103612600047642017337 0ustar www-datawww-datadef test_domain 'fog-dream.com' end def do_not_delete_record "do-not-delete.#{test_domain}" end ## Cleanup # We need to have at least one record defined for the Dreamhost DNS api to work # or you will get a no_such_zone runtime error # The first record needs to be created using the Dreamhost Web panel AFAIK # def cleanup_records Fog::DNS[:dreamhost].records.each do |r| # Do not delete the 'do-not-delete' record, we need it for the tests r.destroy if r.name =~ /#{test_domain}/ and r.name != do_not_delete_record end end fog-1.34.0/tests/dreamhost/dns_tests.rb0000644000004100000410000000123212600047642020064 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dreamhost]', ['dreamhost', 'dns']) do service = Fog::DNS[:dreamhost] tests("collections") do %w{ records zones }.each do |collection| test("it should respond to #{collection}") { service.respond_to? collection } test("it should respond to #{collection}.all") { eval("service.#{collection}").respond_to? 'all' } test("it should respond to #{collection}.get") { eval("service.#{collection}").respond_to? 'get' } end end tests("requests") do %w{ list_records create_record delete_record }.each do |request| test("it should respond to #{request}") { service.respond_to? request } end end end fog-1.34.0/tests/dreamhost/requests/0000755000004100000410000000000012600047642017406 5ustar www-datawww-datafog-1.34.0/tests/dreamhost/requests/dns/0000755000004100000410000000000012600047642020172 5ustar www-datawww-datafog-1.34.0/tests/dreamhost/requests/dns/delete_record_tests.rb0000644000004100000410000000122112600047642024535 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dreamhost] | delete_record request', ['dreamhost', 'dns']) do tests("success") do test("delete testing records") do name = "delete-test.#{test_domain}" type = "A" value = "1.2.3.4" comment = "test" Fog::DNS[:dreamhost].create_record(name, type, value, comment) response = Fog::DNS[:dreamhost].delete_record(name, type, value) response.body['result'] == 'success' end end tests( 'failure') do raises(RuntimeError, 'deleting non-existent record') do Fog::DNS[:dreamhost].delete_record('foo.bar.bar', 'A', '1.2.3.4') end end # helper cleanup_records end fog-1.34.0/tests/dreamhost/requests/dns/create_record_tests.rb0000644000004100000410000000173212600047642024545 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dreamhost] | create_record request', ['dreamhost', 'dns']) do tests("success") do test("create an A resource record without comment") do name = "foo.testing.#{test_domain}" type = "A" value = "1.2.3.4" response = Fog::DNS[:dreamhost].create_record(name, type, value) response.body['result'] == 'success' end test("create an A resource record with comment") do name = "foo2.testing.#{test_domain}" type = "A" value = "1.2.3.4" comment = "test" response = Fog::DNS[:dreamhost].create_record(name, type, value, comment) response.body['result'] == 'success' end test("create TXT record") do name = "txt.testing.#{test_domain}" type = "txt" value = "foobar" comment = "test" response = Fog::DNS[:dreamhost].create_record(name, type, value, comment) response.body['result'] == 'success' end end # helper cleanup_records end fog-1.34.0/tests/dreamhost/requests/dns/list_records_tests.rb0000644000004100000410000000122612600047642024436 0ustar www-datawww-dataShindo.tests('Fog::DNS[:dreamhost] | list_records request', ['dreamhost', 'dns']) do tests("success") do response = Fog::DNS[:dreamhost].list_records test("should return 200") do if response.status == 200 @records = response.body["data"] end (response.status == 200) and (response.body.size == 2) end test("data should be an Array") do @records.is_a? Array end tests("should return records") do %w{type zone value comment record}.each do |elem| test("with #{elem}") do @records.first[elem].is_a? String end end end end # helper cleanup_records end fog-1.34.0/tests/dreamhost/models/0000755000004100000410000000000012600047642017016 5ustar www-datawww-datafog-1.34.0/tests/dreamhost/models/dns/0000755000004100000410000000000012600047642017602 5ustar www-datawww-datafog-1.34.0/tests/dreamhost/models/dns/zones_tests.rb0000644000004100000410000000122412600047642022506 0ustar www-datawww-dataShindo.tests("Fog::DNS[:dreamhost] | Zones Collection", ['dreamhost', 'dns']) do service = Fog::DNS[:dreamhost] tests('#all') do zones = service.zones test('should be an array') { zones.is_a? Array } test('should not be empty') { !zones.empty? } tests('should list Fog::DNS::Dreamhost::Zone') do zones.each do |r| test("as zone") { r.is_a?(Fog::DNS::Dreamhost::Zone) } end end end tests('#get') do tests('should fetch a zone') do zone = service.zones.get test_domain test('should be a Fog::DNS::Dreamhost::Zone') do zone.is_a? Fog::DNS::Dreamhost::Zone end end end end fog-1.34.0/tests/dreamhost/models/dns/zone_tests.rb0000644000004100000410000000307512600047642022331 0ustar www-datawww-dataShindo.tests("Fog::DNS[:dreamhost] | zone", ['dreamhost', 'dns']) do service = Fog::DNS[:dreamhost] zone = service.zones.first tests('#attributes') do tests('should have') do model_attribute_hash = zone.attributes attributes = [ :domain, :id, ] attributes.each do |attribute| test("#{attribute} method") { zone.respond_to? attribute } end attributes.each do |attribute| test("#{attribute} key") { model_attribute_hash.key? attribute } end end test('be a kind of Fog::DNS::Dreamhost::Zone') do zone.kind_of? Fog::DNS::Dreamhost::Zone end tests('Write operations') do name = "#{test_domain}" tests('#save') do # Does not capture the exception for some reason #raises(NotImplementedError, 'raises NotImplementedError') do # service.zones.create :domain => name #end test 'raises NotImplementedError' do begin service.zones.create :domain => name false rescue NotImplementedError => e true end end end tests('#destroy') do test 'raises NotImplementedError' do begin zone.destroy false rescue NotImplementedError => e true end end end tests('#records') do zone.records.each do |r| test('list records') { r.is_a? Fog::DNS::Dreamhost::Record } test('zone matches') { r.zone == test_domain } end end end end end fog-1.34.0/tests/dreamhost/models/dns/records_tests.rb0000644000004100000410000000126112600047642023012 0ustar www-datawww-dataShindo.tests("Fog::DNS[:dreamhost] | records", ['dreamhost', 'dns']) do service = Fog::DNS[:dreamhost] tests('#all') do records = service.records test('should be an array') { records.is_a? Array } test('should not be empty') { !records.empty? } tests('should list Fog::DNS::Dreamhost::Record') do records.each do |r| test("as records") { r.is_a?(Fog::DNS::Dreamhost::Record) } end end end tests('#get') do tests('should fetch a record') do record = service.records.get do_not_delete_record test('should be a Fog::DNS::Dreamhost::Record') do record.is_a? Fog::DNS::Dreamhost::Record end end end end fog-1.34.0/tests/dreamhost/models/dns/record_tests.rb0000644000004100000410000000376312600047642022640 0ustar www-datawww-dataShindo.tests("Fog::DNS[:dreamhost] | record", ['dreamhost', 'dns']) do service = Fog::DNS[:dreamhost] record = service.records.first tests('#attributes') do tests('should have') do model_attribute_hash = record.attributes attributes = [ :name, :value, :zone, :type, :editable, :account_id, :comment, ] attributes.each do |attribute| test("#{attribute} method") { record.respond_to? attribute } end attributes.each do |attribute| test("#{attribute} key") { model_attribute_hash.key? attribute } end end test('be a kind of Fog::DNS::Dreamhost::Record') do record.kind_of? Fog::DNS::Dreamhost::Record end tests('Write operations') do name = "test.#{test_domain}" r = service.records.create :name => name, :type => 'A', :value => "8.8.8.8" sleep 10 tests('#save') do test('returns Fog::DNS::Dreamhost::Record') do r.is_a? Fog::DNS::Dreamhost::Record end test('value is 8.8.8.8') do r.value == '8.8.8.8' end test("name is #{name}") do r.name == name end test("listed") do !(service.records.find { |r| r.name == name }).nil? end end tests('#destroy') do test('returns true') { r.destroy == true } test('destroyed record not listed') do (service.records.find { |r| r.name == name }).nil? end end tests('#save from zone') do name = "zone-create.#{test_domain}" r = service.zones.first.records.create :name => name, :type => 'A', :value => "8.8.8.8" sleep 10 test("listed") do !(service.records.find { |r| r.name == name }).nil? end end end end # cleanup cleanup_records end fog-1.34.0/tests/dreamhost/README.md0000644000004100000410000000317512600047642017020 0ustar www-datawww-data# Testing the Dreamhost DNS API Dreamhost API sandbox only permits read-only commands, so you'll need a Dreamhost PS account for the testing and a dedicated domain. See http://wiki.dreamhost.com/Application_programming_interface#Test_Account ## Create an API key You'll need a Dreamhost (PS I think) account and a dedicated domain for testing. 1. Go to the Dreamhost web panel and create an API key to manage DNS records https://panel.dreamhost.com/index.cgi?tree=home.api Select 'All dns functions' for the new API key to be able to add/remove/list records. 2. Create a .fog file in the tests/ directory with the following contents: ```yaml :default: :dreamhost_api_key: SDFASDFWQWASDFASDFAS ``` Where dreamhost_api_key is the key you created in the previous step. 3. Update the test_domain helper in tests/dreamhost/helper.rb to use your own domain for testing. You will also need at least a record created via the Dreamhost Webpanel (you'll get a **no_such_zone** error otherwise). I usually create a do-not-delete.my-domain.com record. The tests skip that record when cleaning up (see the do_not_delete_record helper). 4. Run the tests ``` shindo tests/dreamhost ``` ## Notes The API is rate limited, so do not smash the DH servers too often. Two consecutive test runs will trigger the rate limit. You'll see a **slow_down_bucko** error if the frequency is too high. http://wiki.dreamhost.com/Application_programming_interface#Rate_Limit ## Resources Dreamhost API: http://wiki.dreamhost.com/Application_programming_interface Dreamhost DNS API: http://wiki.dreamhost.com/API/Dns_commands fog-1.34.0/.rubocop_todo.yml0000644000004100000410000002655212600047641015713 0ustar www-datawww-data# This configuration was generated by `rubocop --auto-gen-config` # on 2014-05-26 15:23:01 +0100 using RuboCop version 0.22.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 85 AccessorMethodName: Enabled: false # Offense count: 139 # Cop supports --auto-correct. AlignArray: Enabled: false # Offense count: 449 # Cop supports --auto-correct. # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles. AlignHash: Enabled: false # Offense count: 104 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. AlignParameters: Enabled: false # Offense count: 3 AmbiguousOperator: Enabled: false # Offense count: 4 AmbiguousRegexpLiteral: Enabled: false # Offense count: 221 # Cop supports --auto-correct. AndOr: Enabled: false # Offense count: 1 ArrayJoin: Enabled: false # Offense count: 9 AsciiComments: Enabled: false # Offense count: 594 # Configuration parameters: AllowSafeAssignment. AssignmentInCondition: Enabled: false # Offense count: 3 # Cop supports --auto-correct. Attr: Enabled: false # Offense count: 35 BlockAlignment: Enabled: false # Offense count: 56 BlockNesting: Max: 7 # Offense count: 230 # Cop supports --auto-correct. Blocks: Enabled: false # Offense count: 1366 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. BracesAroundHashParameters: Enabled: false # Offense count: 9 CaseEquality: Enabled: false # Offense count: 291 # Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep. CaseIndentation: Enabled: false # Offense count: 2 # Configuration parameters: EnforcedStyle, SupportedStyles. ClassAndModuleChildren: Enabled: false # Offense count: 99 # Configuration parameters: CountComments. ClassLength: Max: 1131 # Offense count: 46 ClassVars: Enabled: false # Offense count: 41 # Cop supports --auto-correct. ColonMethodCall: Enabled: false # Offense count: 33 # Configuration parameters: Keywords. CommentAnnotation: Enabled: false # Offense count: 82 # Cop supports --auto-correct. CommentIndentation: Enabled: false # Offense count: 1 ConstantName: Enabled: false # Offense count: 450 CyclomaticComplexity: Max: 46 # Offense count: 29 # Cop supports --auto-correct. DefWithParentheses: Enabled: false # Offense count: 6310 Documentation: Enabled: false # Offense count: 42 # Configuration parameters: EnforcedStyle, SupportedStyles. DotPosition: Enabled: false # Offense count: 34 DoubleNegation: Enabled: false # Offense count: 16 EachWithObject: Enabled: false # Offense count: 2 ElseLayout: Enabled: false # Offense count: 13 # Cop supports --auto-correct. EmptyLines: Enabled: false # Offense count: 64 EmptyLinesAroundAccessModifier: Enabled: false # Offense count: 4 # Cop supports --auto-correct. EmptyLinesAroundBody: Enabled: false # Offense count: 40 # Cop supports --auto-correct. EmptyLiteral: Enabled: false # Offense count: 101 # Configuration parameters: AlignWith, SupportedStyles. EndAlignment: Enabled: false # Offense count: 8 Eval: Enabled: false # Offense count: 1 EvenOdd: Enabled: false # Offense count: 7 # Configuration parameters: Exclude. FileName: Enabled: false # Offense count: 175 # Configuration parameters: EnforcedStyle, SupportedStyles. For: Enabled: false # Offense count: 16 # Configuration parameters: EnforcedStyle, SupportedStyles. FormatString: Enabled: false # Offense count: 143 # Configuration parameters: MinBodyLength. GuardClause: Enabled: false # Offense count: 27 HandleExceptions: Enabled: false # Offense count: 21 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. HashSyntax: Enabled: false # Offense count: 486 # Configuration parameters: MaxLineLength. IfUnlessModifier: Enabled: false # Offense count: 54 # Cop supports --auto-correct. IndentArray: Enabled: false # Offense count: 990 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. IndentHash: Enabled: false # Offense count: 285 # Cop supports --auto-correct. IndentationConsistency: Enabled: false # Offense count: 310 # Cop supports --auto-correct. IndentationWidth: Enabled: false # Offense count: 7 Lambda: Enabled: false # Offense count: 655 # Cop supports --auto-correct. LeadingCommentSpace: Enabled: false # Offense count: 10 # Cop supports --auto-correct. LineEndConcatenation: Enabled: false # Offense count: 6 Loop: Enabled: false # Offense count: 66 # Cop supports --auto-correct. MethodCallParentheses: Enabled: false # Offense count: 87 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. MethodDefParentheses: Enabled: false # Offense count: 2036 # Configuration parameters: CountComments. MethodLength: Max: 1129 # Offense count: 13 # Configuration parameters: EnforcedStyle, SupportedStyles. MethodName: Enabled: false # Offense count: 21 MultilineBlockChain: Enabled: false # Offense count: 66 MultilineIfThen: Enabled: false # Offense count: 13 MultilineTernaryOperator: Enabled: false # Offense count: 85 # Cop supports --auto-correct. NegatedIf: Enabled: false # Offense count: 2 # Cop supports --auto-correct. NegatedWhile: Enabled: false # Offense count: 121 # Configuration parameters: EnforcedStyle, SupportedStyles. Next: Enabled: false # Offense count: 28 # Cop supports --auto-correct. NilComparison: Enabled: false # Offense count: 89 # Cop supports --auto-correct. # Configuration parameters: IncludeSemanticChanges. NonNilCheck: Enabled: false # Offense count: 56 # Cop supports --auto-correct. Not: Enabled: false # Offense count: 220 # Cop supports --auto-correct. NumericLiterals: MinDigits: 14 # Offense count: 3 OneLineConditional: Enabled: false # Offense count: 33 # Configuration parameters: CountKeywordArgs. ParameterLists: Max: 9 # Offense count: 63 # Cop supports --auto-correct. # Configuration parameters: AllowSafeAssignment. ParenthesesAroundCondition: Enabled: false # Offense count: 17 ParenthesesAsGroupedExpression: Enabled: false # Offense count: 189 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. PercentLiteralDelimiters: Enabled: false # Offense count: 24 # Cop supports --auto-correct. PerlBackrefs: Enabled: false # Offense count: 8 # Configuration parameters: NamePrefixBlacklist. PredicateName: Enabled: false # Offense count: 7 # Cop supports --auto-correct. Proc: Enabled: false # Offense count: 640 # Configuration parameters: EnforcedStyle, SupportedStyles. RaiseArgs: Enabled: false # Offense count: 25 # Cop supports --auto-correct. RedundantBegin: Enabled: false # Offense count: 4 RedundantException: Enabled: false # Offense count: 32 # Cop supports --auto-correct. # Configuration parameters: AllowMultipleReturnValues. RedundantReturn: Enabled: false # Offense count: 1939 # Cop supports --auto-correct. RedundantSelf: Enabled: false # Offense count: 66 # Configuration parameters: MaxSlashes. RegexpLiteral: Enabled: false # Offense count: 1 RequireParentheses: Enabled: false # Offense count: 5 # Cop supports --auto-correct. RescueException: Enabled: false # Offense count: 52 RescueModifier: Enabled: false # Offense count: 29 SelfAssignment: Enabled: false # Offense count: 62 # Cop supports --auto-correct. # Configuration parameters: AllowAsExpressionSeparator. Semicolon: Enabled: false # Offense count: 78 ShadowingOuterLocalVariable: Enabled: false # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. SignalException: Enabled: false # Offense count: 10 # Configuration parameters: Methods. SingleLineBlockParams: Enabled: false # Offense count: 9 # Cop supports --auto-correct. # Configuration parameters: AllowIfMethodIsEmpty. SingleLineMethods: Enabled: false # Offense count: 909 # Cop supports --auto-correct. SingleSpaceBeforeFirstArg: Enabled: false # Offense count: 4 # Cop supports --auto-correct. SpaceAfterColon: Enabled: false # Offense count: 581 # Cop supports --auto-correct. SpaceAfterComma: Enabled: false # Offense count: 15 # Cop supports --auto-correct. SpaceAfterControlKeyword: Enabled: false # Offense count: 1 # Cop supports --auto-correct. SpaceAfterMethodName: Enabled: false # Offense count: 19 # Cop supports --auto-correct. SpaceAfterNot: Enabled: false # Offense count: 1332 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. SpaceAroundEqualsInParameterDefault: Enabled: false # Offense count: 4362 # Cop supports --auto-correct. SpaceAroundOperators: Enabled: false # Offense count: 441 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. SpaceBeforeBlockBraces: Enabled: false # Offense count: 11 # Cop supports --auto-correct. SpaceBeforeComment: Enabled: false # Offense count: 19 SpaceBeforeFirstArg: Enabled: false # Offense count: 1946 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. SpaceInsideBlockBraces: Enabled: false # Offense count: 146 # Cop supports --auto-correct. SpaceInsideBrackets: Enabled: false # Offense count: 6159 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles. SpaceInsideHashLiteralBraces: Enabled: false # Offense count: 720 # Cop supports --auto-correct. SpaceInsideParens: Enabled: false # Offense count: 3 # Cop supports --auto-correct. SpecialGlobalVars: Enabled: false # Offense count: 91 # Cop supports --auto-correct. StringConversionInInterpolation: Enabled: false # Offense count: 45608 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. StringLiterals: Enabled: false # Offense count: 197 Tab: Enabled: false # Offense count: 592 # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. TrailingComma: Enabled: false # Offense count: 125 # Cop supports --auto-correct. # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist. TrivialAccessors: Enabled: false # Offense count: 94 UnderscorePrefixedVariableName: Enabled: false # Offense count: 42 UnlessElse: Enabled: false # Offense count: 278 # Cop supports --auto-correct. UnusedBlockArgument: Enabled: false # Offense count: 1010 # Cop supports --auto-correct. UnusedMethodArgument: Enabled: false # Offense count: 6 UselessAccessModifier: Enabled: false # Offense count: 405 UselessAssignment: Enabled: false # Offense count: 3 UselessSetterCall: Enabled: false # Offense count: 13 # Cop supports --auto-correct. VariableInterpolation: Enabled: false # Offense count: 29 # Configuration parameters: EnforcedStyle, SupportedStyles. VariableName: Enabled: false # Offense count: 23 Void: Enabled: false # Offense count: 6 # Cop supports --auto-correct. WhileUntilDo: Enabled: false # Offense count: 1 # Configuration parameters: MaxLineLength. WhileUntilModifier: Enabled: false # Offense count: 521 # Cop supports --auto-correct. WordArray: MinSize: 29 fog-1.34.0/RELEASE.md0000644000004100000410000000262512600047641014011 0ustar www-datawww-data# Release process This is fog's current release process, documented so people know what is currently done. ## Versioning fog uses semantic versioning (http://semver.org/) ## When we release Releases occur monthly and are manually handled by fog's Benevolent Dictator Wes (@geemus). To request a new release please raise an issue. ## Prepare the release * Ensure the code is passing on the CI server [![Build Status](https://secure.travis-ci.org/fog/fog.png?branch=master)](http://travis-ci.org/fog/fog) * Ensure the code is passing for live tests (Requires Credentials for all services) * Ensure working on **master** * Update the version number (`lib/fog/version.rb`) * Run `rake changelog` to update `CHANGELOG.md` * Run `rake release` to prepare the release which does: * Prepares the release (`rake release:prepare`) * Builds the gem * Tags the commit * Creates commits for version * Publishes the release (`rake release:publish`) * Pushes commit and tag to Github (Requires Credentials) * Pushes gem to Rubygems (Requires Credentials) * Run `rake github_release` to add release to [github release feed](https://github.com/fog/fog/releases.atom) (Requires Credentials) ## Announce the release Once the release is prepared and uploaded it needs to be announced. * Send an email to https://groups.google.com/forum/?fromgroups#!forum/ruby-fog * Tweet as @fog on Twitter (Requires Credentials) fog-1.34.0/.irbrc0000644000004100000410000000426712600047641013515 0ustar www-datawww-data## This is primarily used for easier testing and development or # usage of Fog. # # How to use: # 1. Add this at the end of your `.irbrc` in your home directory. # # @working_directory = Dir.pwd # @local_irbrc = File.join(@working_directory, '.irbrc') # # if @working_directory != ENV['HOME'] # load @local_irbrc if File.exists?(@local_irbrc) # end # # remove_instance_variable(:@working_directory) # remove_instance_variable(:@local_irbrc) # # 2. Inside the Fog execute `bundle exec irb` # require 'fog' class ConnectionManager < Hash def [](key) $connection_manager_previous_key = key super(key) end def []=(key, value) $connection_manager_previous_key = key super(key, value) end end def connections return @connections if @connections @connections = ConnectionManager.new end def connection connections[$connection_manager_previous_key] end def connect_openstack(username, password, tenant = nil, url = 'http://192.168.27.100:35357/') parameters = { :provider => 'openstack', :openstack_api_key => password, :openstack_username => username, :openstack_auth_url => "#{url}v2.0/tokens" } parameters.merge!(:openstack_tenant => tenant) if tenant key = username.to_sym set_service(key, Fog::Identity, parameters) set_service(key, Fog::Compute, parameters) set_service(key, Fog::Volume, parameters) set_service(key, Fog::Image, parameters) end def connect(parameters) connections_count = connections.count connections[connections_count] = Hash.new set_service(connections_count, Fog::Identity, parameters) set_service(connections_count, Fog::Compute , parameters) set_service(connections_count, Fog::Storage , parameters) set_service(connections_count, Fog::Volume , parameters) set_service(connections_count, Fog::Image , parameters) set_service(connections_count, Fog::DNS , parameters) set_service(connections_count, Fog::CDN , parameters) connection end def set_service(connections_count, type, parameters) service_symbol = type.to_s.split('::').last.downcase.to_sym connections[connections_count].merge!({ service_symbol => type.new(parameters) }) rescue # Service not available end fog-1.34.0/CONTRIBUTORS.md0000644000004100000410000010543712600047641014673 0ustar www-datawww-data* A.S. Lomoff * Aaron Bell * Aaron Donovan * Aaron Huber * Aaron Suggs * Abhishek Chanda * Achim Ledermüller * Adam Bozanich * Adam Greene * Adam Heinz * Adam Reese * Adam Stegman and Zach Robinson * Adam Tanner * Adam Tucker * Adan Saenz * Ahmed Al Hafoudh * Ahmed Elsabbahy * Akira Matsuda * Akshay Joshi * Akshay Moghe * Alan Ivey * Albert Choi * Alex Coomans * Alex Dunn * Alex Gaudio * Alex Malinovich * Alex Malinovich * Alex Tambellini * Alexander Kolesen * Alexander Lomov * Alexander Wenzowski * Alfonso Juan Dillera * Alfonso Juan Dillera * Alfonso Juan Dillera * Alfred Moreno * Aliaksei Kliuchnikau * Allan * Allan * AltJ * Alvin Garcia * Alvin Garcia * Amitava * Amos Benari * Amy Sutedja * Amy Woodward * Andre Meij * Andreas Gerauer * Andreas Josephson * Andrei Serdeliuc * Andrew Brown * Andrew Bruce * Andrew Donald Kennedy * Andrew Hodges * Andrew Kuklewicz * Andrew Leonard * Andrew Newman * Andrew Newman * Andrew Stangl * Andrew Taylor * Andy Delcambre * Andy Lindeman * Angelo Marletta * Anna Shipman * Anshul Khandelwal * Anthony Accardi * Anthony Eden * Anton Lindstrom * Anton Lindström * Anton Lindström * Antonio <0x414f@gmail.com> * Ariel Zavala * Arnab * Artem * Artem Veremey * Arthur Gunawan * Arvid Andersson * Ash Wilson * Ash Wilson * Athir Nuaimi * Athir Nuaimi * Atsushi Sasaki * Avrohom Katz * BK Box * Barrett Jones * Bart Vercammen * Ben Bleything * Ben Burkert * Ben Butler-Cole * Ben Chadwick * Ben House * Ben Hundley * Ben Sandberg * Ben Turley * Benjamin Chadwick * Benjamin Manns * Benjamin Pillet * Benson Kalahar * Benton Roberts * Benton Roberts * Bert Hajee * Bill Wei * Blake Gentry * Blake Irvin and Eric Saxby * Bob Briski * Bob Lail and Luke Booth * Bobby Wilson * Bohuslav Kabrda * Brad Gignac * Brad Gignac * Brad Heller * Bradley Schaefer * Brandon Dunne * Brendan Fosberry * Brett Lentz * Brett Porter * Brian D. Burns * Brian Dorry * Brian Hartsock * Brian Hartsock * Brian Nelson * Brian O'Keefe * Brian Palmer * Brice Figureau * Bruno Enten * Bruz Marzolf * Bryan Paxton * Bulat Shakirzyanov * Caius Durling * Caleb Tennis * Carl Allen * Carl Caum * Carl Hicks * Carl Loa Odin * Carl Woodward * Carl Woodward * Carlos Sanchez * Casey Abernathy * Celso Fernandes * Cezar Sa Espinola * Chielo Zimmerman * Chirag Jog * Chirag Jog * Chirag Jog * Chmouel Boudjnah * Chris Chalstrom * Chris Chiodo * Chris Frederick * Chris Gianelloni * Chris Hasenpflug * Chris Howe * Chris Kershaw * Chris Luo * Chris Mague * Chris McClimans * Chris Roberts * Chris Thompson * Chris Thompson * Chris Wuest * Chris Wuest * Christian Berendt * Christian Höltje * Christian Ott * Christian Paredes * Christoffer Artmann * Christoph Schiessl * Christoph Witzany * Christophe Larsonneur * Christophe Roux * Christopher Meiklejohn * Christopher Oliver * Christopher Oliver * Christopher Snell * Claudio Poli * Coby Randquist * Cody Herriges * Colin Hebert * Colin Hebert * Curtis Stewart * Curtis Stewart * Cyrus Team * Dan Abel * Dan Bode * Dan Carley * Dan Peterson * Dan Prince * Dan Prince * Dan Prince * Dan Simpson * Daniel Aragao * Daniel Broudy * Daniel Libanori * Daniel Lobato * Daniel Reichert * Daniel Schweighoefer * Danny Garcia * Darren Foo * Darren Hague * Darrin Eden * Dave Benvenuti * Dave Donahue * Dave Myron * Dave Ungerer * David * David Andersen * David Calavera * David Chen * David Davis * David Faber * David Illsley * David Nalley * David Prater * David Wittman * Decklin Foster * Dejan Menges * Denis Barishev * Derek Richard and Karen Wang * Diego Desani * Dmitri Dolguikh * Dmitry Dedov * Dmitry Gutov * Dominic Cleal * DoubleMalt * Doug Henderson * Doug Henderson * Doug McInnes * Dr Nic Williams * Dusty Jones * Dusty Jones * Dylan Egan * Dylan Egan * E.J. Finneran * Edward Middleton * Edward Muller * Edward Muller * Edward Muller * Efe Yardimci * Efe Yardimci * Eric Abbott * Eric Boehs * Eric Chernuka * Eric Hankins * Eric Herot * Eric Hodel * Eric Johnson * Eric Lindvall * Eric Sakowski * Eric Stonfer * Eric Stonfer * Eric Stonfer * Eric Wong * Erik Mackdanz * Erik Michaels-Ober * Erik Terpstra * Erik van Pienbroek * Ethan Devenport * Eugene Howe & Josh Lane * Eugene Howe * Eugene Howe * Evan Light * Evan Petrie * Evan Petrie * Evan Smith * Evgeny Yurchenko * Ewoud Kohl van Wijngaarden * Fabian Wiesel * Fabio Lessa * Ferran Rodenas * Fletcher Nichol * Francois Herbert * Francois Herbert * Frederic Jean * Frederick Cheung * Fujimura Daisuke * Gabe Conradi * Gabriel Horner * Gabriel Rosendorf * Garima Singh * Garret Alfert * Gaurish Sharma * Gavin Sandie * Gavin Sandie * Geoff Pado * George Scott * Geraud * German Germanovich * Gerred Dillon * Glenn Tweedie * Graeme Wilson * Greg Blomquist * Greg Burek * Greg Sutcliffe * Greg Sutcliffe * Grégory Karékinian * Grzesiek Kolodziejczyk * Guilherme Souza * Gustavo Villalta * H. Wade Minter * H. Wade Minter * Harry Wilkinson * Hector Castro * Hemant Kumar * Hendrik Volkmer * Henry Addison * Hippie Hacker * Hiro Asari * Hongbin Lu * Hunter Haugen * Hunter Nield * Ian Downes * Igor Bolotin * Igor Rodionov * Igor Rodionov * Ijonas Kisselbach * Ilja Bobkevic * Irio Irineu Musskopf Junior * Isaac Hollander McCreery * Istvan Hoka * JD Huntington & Jason Hansen * JJ Asghar * Jacob Burkhart & Shai Rosenfeld * Jacob Mattingley * Jade Tucker * James Belchamber * James Bence * James Fairbairn * James Findley * James Fraser * James Healy * James Herdman * James Miller * James Rose * James Rose * James Stremick * James W. Brinkerhoff * Jamie H * Jamie Paton * Jan Raasch * Jared Everett * Jaroslav Barton * Jason Faulkner * Jason Hansen & Josh Lane * Jason Hansen * Jason Montleon * Jason Roelofs * Jason Smith * Jay Faulkner * Jay Perry * Jeff McCune * Jeff Moody * Jeffrey C. Ollie * Jens Braeuer * Jeremy Deininger * Jesse Davis * Jesse Hallett * Jesse Newland * Jesse Proudman * Jesse Proudman * Jesse Scott * Jim Berlage * Jim Salinas * Joachim Nolten * Joakim Kolsjö and Tomas Skogberg * Joe Kinsella * Joe Rafaniello * Joe Topjian * Joe Yates * John Dyer * John E. Vincent * John F. Douthat * John Feminella * John Ferlito * John Hawthorn * John Keiser * John Nishinaga * John Parker * John Wang * John Wang * Jon Crosby * Jon Frisby * Jon Holt * Jon K Hellan * Jon Palmer * Jon Palmer * Jon Topper * Jon-Erik Schneiderhan * Jonas Kongslund * Jonas Kongslund * Jonas Pfenniger * Jonas Pfenniger * Jonathan Serafini * Jonathon Scanes * Joonas Reynders * Jordan Day * Jordan Running * Jose Diaz-Gonzalez * Jose Luis Salas * Josef Stribny * Joseph Anthony Pasquale Holsten * Josh Blancett * Josh Kalderimis * Josh Kearney * Josh Lane & Ines Sombra * Josh Lane & Jason Hansen * Josh Lane & Thom Mahoney * Josh Lane * Josh Lane * Josh Lane * Josh Pasqualetto * Josh Yotty * Joshua Garnett * Joshua Gross * Joshua Krall * Joshua Napoli * Joshua Napoli * Joshua Nichols * Joshua Schairbaum * Josué Lima * Julian Fischer * Julian Weber * Julian Weber * Julio Feijo * Juris Galang * Justin Barry * Justin Clayton * Justin Pratt * Justin Pratt * KATOH Yasufumi * Kaloyan Kanev * Karan Misra * Karl Freeman * Kashif Rasul * Keith Barrette * Keith Duncan * Kelsey Hightower * Kenji Kabashima * Kenny Johnston * Kevin Chan * Kevin McFadden * Kevin Menard * Kevin Menard * Kevin Moore * Kevin Olbrich * Kieran Pilkington * Konstantin Haase * Konstantinos Natsakis * Kunal Parikh * Kunal Thakar * Kyla Kolb * Kyle Drake * Kyle Rames * Kyle Rames * Kyle Tolle * Ladislav Smola * Lance Carlson * Lance Ivy * Larry Gilbert * Larry Wright * Lars Pind * Laurent Bigonville * Lee Henson * Lee Huffman * Lee Huffman * Lee Jensen * Len * Lincoln Stoll * Lincoln Stoll * Lucas Carlson * Luiz Ribeiro * Lukas Zapletal * Luke Robins * Lum * Luqman Amjad * MaF * Manuel Meurer * Marc G Gauthier * Marc Grimme * Marc Grimme * Marc Seeger * Marc Seeger * Marcin Owsiany * Marcus Nilsson * Marek Kasztelnik * Mariusz Pietrzyk * Marjun Pagalan * Mark A. Miller * Mark IJbema * Mark Maglana * Mark Phillips * Mark Rushakoff * Mark Turner * Mark Yen * Markus Schwed * Marques Johansson * Marques Johansson * Marques Johansson * Marshall Yount * Martin Emde * Martin Englund * Martin Matuska * Mat Ellis * Mateusz Juraszek * Matheus Mina * Mathias Meyer * Matt Bostock * Matt Darby * Matt Darby * Matt Eldridge * Matt Gillooly * Matt Griffin * Matt Pokress * Matt Ray * Matt Sanders * Matt Sanders * Matt Sanders * Matt Todd * Matthew Black * Matthew Black * Matthew Breeden * Matthew O'Riordan * Matthias Gröbner * Matthieu Huin * Max Lincoln * Max Lincoln * Max Stepanov * Mevan Samaratunga * Michael Brodhead & Shai Rosenfeld * Michael Brodhead * Michael Conigliaro * Michael D. Hall * Michael Elfassy * Michael Hale * Michael Harrison * Michael Jackson * Michael Keirnan * Michael Linderman * Michael Moll * Michael Rykov * Michael Sprauer * Michael Zeng * Michał Krzyżanowski * Michiel Sikkes * Mick Pollard * Miguel Martinez * Miguel Z * Mike Dillon * Mike Fiedler * Mike Gehard * Mike Hagedorn * Mike Manewitz * Mike Marion * Mike Moore * Mike Pountney * Ming Jin * Mitchell Hashimoto * Naoto TAKAHASHI * Nassos Antoniou * Nat Welch * Nathan Sullivan * Nathan Sutton * Nathan Williams * Neill Turner * Nelvin Driz * Nelvin Driz * Nelvin Driz * Nelvin Driz * Nicholas Ricketts * Nick Huanca * Nick Huanca * Nick Huanuca * Nick Janus * Nick Merwin * Nick Osborn * Nick Osborn * Nick Osborn * Nick Osborn * Nick Osborn * Nico * Nik Wakelin * Nikita Pomyashchiy * Niko Felger * Nils Landt * NomadRain * Oge Nnadi * Oguz Bilgic * Ohad Levy * Ohad Levy * Oleg * Olle Lundberg * Omar Reiss * Oscar Elfving * Ozgur Akan * Pablo Baños López * Pablo Baños López * Pan Thomakos * Parker Selbert * Partha Aji * Patrick Debois * Patrick McKenzie * Paul * Paul Gideon Dann * Paul Thornthwaite * Paul Thornthwaite * Paul Vudmaska * Paulo Henrique Lopes Ribeiro * Paulo Henrique Lopes Ribeiro * Pavel Repin * Pavol Dilung * Pedro Belo * Pedro Nascimento * Pedro Perez * Peter Bonnell * Peter C. Norton * Peter Drake * Peter M. Goldstein * Peter Meier * Peter Souter * Peter Vawser * Peter Weldon * Peter Weldon * Petr Blaho * Phil Cohen * Phil Kates * Phil Kates * Philip Mark Deazeta * Philip Mark Deazeta * Philip Mark M. Deazeta * Philip Potter * Pierre Carrier * Pierre Massat * Pieter van de Bruggen * Pieter van de Bruggen * Piotr Kedziora * Postmodern * Prashant Nadarajan * Pratik Naik * Rad Gruchalski * Raphael Costa * Reda NOUSHI * Reinaldo Junior * Renato Furter * Rich Lane * Richard Hall * Richard Henning * Rick Bradley * Rida Al Barazi * Rizwan Reza * Rob Lockstone * Robert Bousquet * Robert Clark * Rodrigo Estebanez * Romain Haenni * Romain Vrignaud * Romain Vrignaud * Ruben Koster * Rupak Ganguly * Rusty Geldmacher * Ryan Davies * Ryan Richard * Ryan Stout * Sairam * Sam Cooper * Sam Cooper * Sam Kottler * Sam Merritt * Sami Samhuri * Sammy Larbi * Samuel Keeley * Samuel Merritt * Sarah Vessels * Sascha Korth * Scott Carleton * Scott Gonyea * Sean Caffery * Sean Handley * Sean Handley * Sean Handley * Sean Handley * Sean Hart * Sean Hart * Sean Porter * Sebastian Saemann * Sergio Rubio * Sergio Rubio * Seth Chisamore * Shai Rosenfeld & Jacob Burkhart * Shai Rosenfeld * Shai Rosenfeld * Shaun Davis * Shawn Catanzarite * Shay Bergmann * Shlomi Zadok * Simas Cepaitis * Simas Cepaitis * Simon Gate * Simon Josi * Simon Rozet * Simone Carletti * Sjoerd Andringa * Sneha Somwanshi * Spencer Dillard * Stefan Majewsky * Stefano Tortarolo * Stepan G Fedorov * Stepan G. Fedorov * Stephan Kaag * Stephen Augenstein * Stephen Bannasch * Stephen von Takach * Steve Agalloco * Steve Frank * Steve Meyfroidt * Steve Smith * Steven Danna * Stuart Eccles * Sven Pfleiderer * Sylvain Kalache * Tal Yalon * Tal Yalon * Tejas Ravindra Mandke * Terry Howe * Terry Howe * TerryHowe * Thom Mahoney & Eugene Howe * Thom Mahoney * Thom May * Thom May * Thomas Cate * Thomas Cate * Thomas Kadauke * Thomas Wright * Tim * Tim Carey-Smith * Tim Carey-Smith and Andy Delcambre * Timothy Klim * Timothée Peignier * Timur Alperovich * Timur Alperovich * Tobias Nygren * Toby Hede * Todd Willey * Todd Willey * Tom Armitage * Tom Caspy * Tom Hulihan * Tom Mornini * Tom Noonan II * Tom Stuart * Tomas Varaneckas * Tomasz Bak * Tomokazu Hirai * Toni Stjepanovic * Tony Ta * Topper Bowers * Tor-Ake Fransson * Trae Robrock * Trevor Bramble * Trevor Bramble * Trotter Cashion * Tzu-Mainn Chen * Tõnis Simo * Ulf Mansson * Vadim Spivak * Viktor Petersson * Ville Lautanala * Vincent Demeester * Virender Khatri * VirtualStaticVoid * Viven * Warren Bain * Wes Morgan * Wesley Beary * Wesley Beary * Wesley Beary * Wesley Beary * Wesley Beary * Wesley Beary * Weston Platter * Will Leinweber * William Lawson * Wyatt Walter * Xavier Fontrodona * Yamashita Yuu * Yann Hamon * Yauheni Kryudziuk * Your Name * Yousef Ourabi * Yury Tsarev * Zachary Danger Campbell * Ziyad Mir * Ziyad Mir * Zuhaib M Siddique * Zuhaib M Siddique * Zuhaib Siddique * aabes * abenari * alex * althras * angus * anomalousthought * arnab * ashmrtnz * atlantacs * avic85 * bdorry * bdorry * bdorry * bigfleet * biomancer * bmiller * bonkydog * brettcave * brookemckim * bugagazavr * caryp * ccloes * coliver * crazed * croaker * dJason * dblock * deepj * dennis-sig * dm1try * elkelk * endzyme * epdejager * eyurchenko * fbiete@gmail.com * fred-secludit * freeformz * gavin * geemus (Wesley Beary) * geemus (Wesley Beary) * geemus * georgyous * ggoodale * ggoodale * gilles * gregburek * gust * hedgehog * heyryanw * howete * irdan * james-lawrence * jamiehannaford * jblancett * jc00ke * jimworm * joe * joe morgan * joewilliams * jordangbull * jschneiderhan * kanetann * karmab * kbockmanrs * kfafel * leehuffman * leonidlm * lostboy * marios * marios * mattray * mauro catenacci * mlincoln * mriley * msa * neillturner * nightshade427 * ooVoo LLC * phiggins * phillc * questionnet * radekg * rebelagentm * ronen barzel * rsalm * ryanlower * sashap * sawanoboly * seanhandley * seeingidog * snyquist2 * starbelly * stephen charles baldwin * thattommyhall * tipt0e * torake.fransson * unknown * vkhatri * watsonian * wenlock * Ørjan Blom * Обоев Рулон ибн Хаттаб * 应俊 fog-1.34.0/spec/0000755000004100000410000000000012600047642013335 5ustar www-datawww-datafog-1.34.0/spec/spec_helper.rb0000644000004100000410000000033412600047642016153 0ustar www-datawww-dataif ENV["COVERAGE"] require "simplecov" SimpleCov.start do add_filter "/spec/" end end require "minitest/autorun" require "minitest/spec" require "minitest/stub_const" $LOAD_PATH.unshift "lib" require "fog" fog-1.34.0/spec/fog/0000755000004100000410000000000012600047642014110 5ustar www-datawww-datafog-1.34.0/spec/fog/bin/0000755000004100000410000000000012600047642014660 5ustar www-datawww-datafog-1.34.0/spec/fog/bin/bluebox_spec.rb0000644000004100000410000000250512600047642017661 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Bluebox do include Fog::BinSpec let(:subject) { Bluebox } describe "#services" do it "includes all services" do assert_includes Bluebox.services, :compute assert_includes Bluebox.services, :dns assert_includes Bluebox.services, :blb end end describe "#class_for" do describe "when requesting compute service" do it "returns correct class" do assert_equal Fog::Compute::Bluebox, Bluebox.class_for(:compute) end end describe "when requesting dns service" do it "returns correct class" do assert_equal Fog::DNS::Bluebox, Bluebox.class_for(:dns) end end describe "when requesting blb service" do it "returns correct class" do assert_equal Fog::Bluebox::BLB, Bluebox.class_for(:blb) end end end describe "#[]" do describe "when requesting compute service" do it "returns instance" do Fog::Compute::Bluebox.stub(:new, "instance") do assert_equal "instance", Bluebox[:compute] end end end describe "when requesting dns service" do it "returns instance" do Fog::DNS::Bluebox.stub(:new, "instance") do assert_equal "instance", Bluebox[:dns] end end end end end fog-1.34.0/spec/fog/bin/opennebula_spec.rb0000644000004100000410000000024412600047642020347 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe OpenNebula do include Fog::BinSpec let(:subject) { OpenNebula } end fog-1.34.0/spec/fog/bin/softlayer_spec.rb0000644000004100000410000000024212600047642020225 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Softlayer do include Fog::BinSpec let(:subject) { Softlayer } end fog-1.34.0/spec/fog/bin/fogdocker_spec.rb0000644000004100000410000000024212600047642020160 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Fogdocker do include Fog::BinSpec let(:subject) { Fogdocker } end fog-1.34.0/spec/fog/bin/brightbox_spec.rb0000644000004100000410000000131312600047642020205 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Brightbox do include Fog::BinSpec let(:subject) { Brightbox } describe "#services" do it "includes all services" do assert_includes Brightbox.services, :compute assert_includes Brightbox.services, :storage end end describe "#class_for" do describe "when requesting compute service" do it "returns correct class" do assert_equal Fog::Compute::Brightbox, Brightbox.class_for(:compute) end end describe "when requesting storage service" do it "returns correct class" do assert_equal Fog::Storage::Brightbox, Brightbox.class_for(:storage) end end end end fog-1.34.0/spec/fog/bin/rage4_spec.rb0000644000004100000410000000023212600047642017216 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Rage4 do include Fog::BinSpec let(:subject) { Rage4 } end fog-1.34.0/spec/fog/bin/dnsimple_spec.rb0000644000004100000410000000021512600047642020030 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe DNSimple do include Fog::BinSpec let(:subject) { DNSimple } end fog-1.34.0/spec/fog/bin/google_spec.rb0000644000004100000410000000023412600047642017472 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Google do include Fog::BinSpec let(:subject) { Google } end fog-1.34.0/spec/fog/bin/serverlove_spec.rb0000644000004100000410000000024412600047642020413 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Serverlove do include Fog::BinSpec let(:subject) { Serverlove } end fog-1.34.0/spec/fog/bin/linode_spec.rb0000644000004100000410000000023412600047642017470 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Linode do include Fog::BinSpec let(:subject) { Linode } end fog-1.34.0/spec/fog/bin/glesys_spec.rb0000644000004100000410000000023412600047642017524 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Glesys do include Fog::BinSpec let(:subject) { Glesys } end fog-1.34.0/spec/fog/bin/hp_spec.rb0000644000004100000410000000022412600047642016624 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe HP do include Fog::BinSpec let(:subject) { HP } end fog-1.34.0/spec/fog/bin/cloudsigma_spec.rb0000644000004100000410000000022112600047642020341 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe CloudSigma do include Fog::BinSpec let(:subject) { CloudSigma } end fog-1.34.0/spec/fog/bin/openstack_spec.rb0000644000004100000410000000024212600047642020204 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe OpenStack do include Fog::BinSpec let(:subject) { OpenStack } end fog-1.34.0/spec/fog/bin/clodo_spec.rb0000644000004100000410000000020712600047642017316 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Clodo do include Fog::BinSpec let(:subject) { Clodo } end fog-1.34.0/spec/fog/bin/xenserver_spec.rb0000644000004100000410000000024212600047642020236 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe XenServer do include Fog::BinSpec let(:subject) { XenServer } end fog-1.34.0/spec/fog/bin/rackspace_spec.rb0000644000004100000410000000024212600047642020151 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Rackspace do include Fog::BinSpec let(:subject) { Rackspace } end fog-1.34.0/spec/fog/bin/internetarchive_spec.rb0000644000004100000410000000025612600047642021414 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe InternetArchive do include Fog::BinSpec let(:subject) { InternetArchive } end fog-1.34.0/spec/fog/bin/cloudstack_spec.rb0000644000004100000410000000022112600047642020346 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Cloudstack do include Fog::BinSpec let(:subject) { Cloudstack } end fog-1.34.0/spec/fog/bin/riakcs_spec.rb0000644000004100000410000000023412600047642017472 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe RiakCS do include Fog::BinSpec let(:subject) { RiakCS } end fog-1.34.0/spec/fog/bin/vsphere_spec.rb0000644000004100000410000000023612600047642017674 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Vsphere do include Fog::BinSpec let(:subject) { Vsphere } end fog-1.34.0/spec/fog/bin/local_spec.rb0000644000004100000410000000023212600047642017306 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Local do include Fog::BinSpec let(:subject) { Local } end fog-1.34.0/spec/fog/bin/digitalocean_spec.rb0000644000004100000410000000022512600047642020641 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe DigitalOcean do include Fog::BinSpec let(:subject) { DigitalOcean } end fog-1.34.0/spec/fog/bin/ninefold_spec.rb0000644000004100000410000000024012600047642020011 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Ninefold do include Fog::BinSpec let(:subject) { Ninefold } end fog-1.34.0/spec/fog/bin/dnsmadeeasy_spec.rb0000644000004100000410000000022312600047642020511 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe DNSMadeEasy do include Fog::BinSpec let(:subject) { DNSMadeEasy } end fog-1.34.0/spec/fog/bin/zerigo_spec.rb0000644000004100000410000000023412600047642017515 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Zerigo do include Fog::BinSpec let(:subject) { Zerigo } end fog-1.34.0/spec/fog/bin/baremetalcloud_spec.rb0000644000004100000410000000140112600047642021176 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe BareMetalCloud do include Fog::BinSpec let(:subject) { BareMetalCloud } describe "#services" do it "includes all services" do assert_includes BareMetalCloud.services, :compute end end describe "#class_for" do describe "when requesting storage service" do it "returns correct class" do assert_equal Fog::Compute::BareMetalCloud, BareMetalCloud.class_for(:compute) end end end describe "#[]" do describe "when requesting compute service" do it "returns instance" do Fog::Compute::BareMetalCloud.stub(:new, "instance") do assert_equal "instance", BareMetalCloud[:compute] end end end end end fog-1.34.0/spec/fog/bin/openvz_spec.rb0000644000004100000410000000023412600047642017537 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Openvz do include Fog::BinSpec let(:subject) { Openvz } end fog-1.34.0/spec/fog/bin/vmfusion_spec.rb0000644000004100000410000000024012600047642020061 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Vmfusion do include Fog::BinSpec let(:subject) { Vmfusion } end fog-1.34.0/spec/fog/bin/powerdns_spec.rb0000644000004100000410000000024312600047642020057 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Fog::PowerDNS do include Fog::BinSpec let(:subject) { PowerDNS } endfog-1.34.0/spec/fog/bin/stormondemand_spec.rb0000644000004100000410000000025212600047642021070 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe StormOnDemand do include Fog::BinSpec let(:subject) { StormOnDemand } end fog-1.34.0/spec/fog/bin/sakuracloud_spec.rb0000644000004100000410000000024612600047642020536 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe SakuraCloud do include Fog::BinSpec let(:subject) { SakuraCloud } end fog-1.34.0/spec/fog/bin/ibm_spec.rb0000644000004100000410000000022612600047642016766 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe IBM do include Fog::BinSpec let(:subject) { IBM } end fog-1.34.0/spec/fog/bin/joyent_spec.rb0000644000004100000410000000023412600047642017526 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Joyent do include Fog::BinSpec let(:subject) { Joyent } end fog-1.34.0/spec/fog/bin/vcloud_spec.rb0000644000004100000410000000023412600047642017512 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Vcloud do include Fog::BinSpec let(:subject) { Vcloud } end fog-1.34.0/spec/fog/bin/aws_spec.rb0000644000004100000410000000557012600047642017020 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe AWS do include Fog::BinSpec let(:subject) { AWS } KEY_CLASS_MAPPING = { :auto_scaling => Fog::AWS::AutoScaling, :beanstalk => Fog::AWS::ElasticBeanstalk, :cdn => Fog::CDN::AWS, :cloud_formation => Fog::AWS::CloudFormation, :cloud_watch => Fog::AWS::CloudWatch, :compute => Fog::Compute::AWS, :data_pipeline => Fog::AWS::DataPipeline, :ddb => Fog::AWS::DynamoDB, :dynamodb => Fog::AWS::DynamoDB, :dns => Fog::DNS::AWS, :elasticache => Fog::AWS::Elasticache, :elb => Fog::AWS::ELB, :emr => Fog::AWS::EMR, :glacier => Fog::AWS::Glacier, :iam => Fog::AWS::IAM, :redshift => Fog::AWS::Redshift, :sdb => Fog::AWS::SimpleDB, :simpledb => Fog::AWS::SimpleDB, :ses => Fog::AWS::SES, :sqs => Fog::AWS::SQS, :eu_storage => Fog::Storage::AWS, :storage => Fog::Storage::AWS, :rds => Fog::AWS::RDS, :sns => Fog::AWS::SNS, :sts => Fog::AWS::STS } describe "#services" do it "includes all services" do assert_includes AWS.services, :auto_scaling assert_includes AWS.services, :beanstalk assert_includes AWS.services, :cdn assert_includes AWS.services, :cloud_formation assert_includes AWS.services, :cloud_watch assert_includes AWS.services, :compute assert_includes AWS.services, :data_pipeline assert_includes AWS.services, :dynamodb assert_includes AWS.services, :dns assert_includes AWS.services, :elasticache assert_includes AWS.services, :elb assert_includes AWS.services, :emr assert_includes AWS.services, :glacier assert_includes AWS.services, :iam assert_includes AWS.services, :redshift assert_includes AWS.services, :rds assert_includes AWS.services, :simpledb assert_includes AWS.services, :ses assert_includes AWS.services, :sqs assert_includes AWS.services, :storage assert_includes AWS.services, :sns assert_includes AWS.services, :sts end end describe "#class_for" do describe "when key exists" do it "maps to correct class" do KEY_CLASS_MAPPING.each do |key, klass| assert_equal klass, AWS.class_for(key) end end end describe "when key does not exist" do it "raises ArgumentError" do assert_raises(ArgumentError) { AWS.class_for(:bad_key) } end end end describe "#[]" do describe "when service is recognised" do it "returns correct instance" do KEY_CLASS_MAPPING.each do |key, klass| klass.stub(:new, "#{klass} instance") do assert_equal "#{klass} instance", AWS[key] end end end end describe "when service is not recognised" do it "raises ArgumentError" do assert_raises(ArgumentError) { AWS[:bad_service] } end end end end fog-1.34.0/spec/fog/bin/dynect_spec.rb0000644000004100000410000000021112600047642017477 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Dynect do include Fog::BinSpec let(:subject) { Dynect } end fog-1.34.0/spec/fog/bin/profitbricks_spec.rb0000644000004100000410000000025012600047642020715 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe ProfitBricks do include Fog::BinSpec let(:subject) { ProfitBricks } end fog-1.34.0/spec/fog/bin/ecloud_spec.rb0000644000004100000410000000023412600047642017471 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Ecloud do include Fog::BinSpec let(:subject) { Ecloud } end fog-1.34.0/spec/fog/bin/dreamhost_spec.rb0000644000004100000410000000021712600047642020205 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Dreamhost do include Fog::BinSpec let(:subject) { Dreamhost } end fog-1.34.0/spec/fog/bin/atmos_spec.rb0000644000004100000410000000130212600047642017336 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" require "helpers/bin" describe Atmos do include Fog::BinSpec let(:subject) { Atmos } describe "#services" do it "includes all services" do assert_includes Atmos.services, :storage end end describe "#class_for" do describe "when requesting storage service" do it "returns correct class" do assert_equal Fog::Storage::Atmos, Atmos.class_for(:storage) end end end describe "#[]" do describe "when requesting storage service" do it "returns instance" do Fog::Storage::Atmos.stub(:new, "instance") do assert_equal "instance", Atmos[:storage] end end end end end fog-1.34.0/spec/fog/bin/gogrid_spec.rb0000644000004100000410000000023412600047642017471 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe GoGrid do include Fog::BinSpec let(:subject) { GoGrid } end fog-1.34.0/spec/fog/bin/ovirt_spec.rb0000644000004100000410000000023212600047642017357 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Ovirt do include Fog::BinSpec let(:subject) { Ovirt } end fog-1.34.0/spec/fog/bin/voxel_spec.rb0000644000004100000410000000023212600047642017351 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe Voxel do include Fog::BinSpec let(:subject) { Voxel } end fog-1.34.0/spec/fog/bin/vclouddirector_spec.rb0000644000004100000410000000025412600047642021250 0ustar www-datawww-datarequire "minitest/autorun" require "fog" require "fog/bin" require "helpers/bin" describe VcloudDirector do include Fog::BinSpec let(:subject) { VcloudDirector } end fog-1.34.0/spec/fog/metering_spec.rb0000644000004100000410000000067012600047642017264 0ustar www-datawww-datarequire "spec_helper" describe Fog::Metering do Fog::Metering.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Metering[provider] } end end end end end fog-1.34.0/spec/fog/support_spec.rb0000644000004100000410000000066512600047642017172 0ustar www-datawww-datarequire "spec_helper" describe Fog::Support do Fog::Support.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Support[provider] } end end end end end fog-1.34.0/spec/fog/openstack/0000755000004100000410000000000012600047642016077 5ustar www-datawww-datafog-1.34.0/spec/fog/openstack/identity_v3/0000755000004100000410000000000012600047642020340 5ustar www-datawww-datafog-1.34.0/spec/fog/openstack/identity_v3/idv3_service.yml0000644000004100000410000003210612600047642023452 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e7507857-b61a-4f4c-90af-04c59aec6afc Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-832f395e-e925-4f75-b77e-e1771137e3a4 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-64e863c7-c5f7-42ac-828b-bcf475ea8163 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-45af3683-ab7b-4090-a9e9-4e7b703c31c4 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-813db214-c996-4b93-af5b-08a257e8599f Content-Length: - '93' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find project: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_project.yml0000644000004100000410000001704612600047642024033 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"name":"Default"},"name":"admin"}}},"scope":{"project":{"name":"admin","domain":{"name":"Default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:16 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 3b7d657cc17843e48049d77fdbe68b83 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7576d06c-1d8f-4974-b881-a392558826cf Content-Length: - '5874' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:16.620987Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["cr8lTJyrR7Si8-nrQYKMdg"], "issued_at": "2015-06-23T15:09:16.621047Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_project_group_user_roles_mutation.yml0000644000004100000410000010321312600047642031054 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar69 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1daefc8f-d2bc-420b-8295-cc2be2e73352 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar69", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar69 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-42f9755e-e94e-4764-9888-7d5833bbb244 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar69", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-foobar69"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-cc4f0600-ace8-4454-89dc-257438612b62 Content-Length: - '251' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560"}, "enabled": true, "id": "d07e7028f83649c6857a3ee9368cf560", "parent_id": null, "domain_id": "default", "name": "p-foobar69"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-56a91b14-df8f-4e8c-b0d9-7c9fdeb57324 Content-Length: - '113' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=baz", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"baz69"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d468ed8c-5fa0-4e29-b999-15740ba5597c Content-Length: - '161' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "3a270450bbc14749be4593a849b19eed", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/3a270450bbc14749be4593a849b19eed"}, "name": "baz69"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"u-foobar69","email":"foobar@example.com","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1057b84b-a4fe-4b9d-bad6-0d0981c47c8c Content-Length: - '238' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "u-foobar69", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "5acef369a39a4be395cc0845e52c801c"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: UTF-8 string: ! '{"group":{"name":"g-foobar69","description":"Group of Foobar users"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e471c720-182c-4cc5-af21-0a707b2155c2 Content-Length: - '232' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"group": {"domain_id": "default", "description": "Group of Foobar users", "id": "1f0c437e1b714db28c7109e602c12ba1", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1f0c437e1b714db28c7109e602c12ba1"}, "name": "g-foobar69"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/groups/1f0c437e1b714db28c7109e602c12ba1/users/5acef369a39a4be395cc0845e52c801c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1bb569eb-18af-40ec-a1c6-570aee546b67 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bcc194b1-85c1-4b14-829b-4f7c03c13bc2 Content-Length: - '149' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-dde7465f-2a0c-47dc-8c7f-a68d12b8e6a3 Content-Length: - '232' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fef962b6-82a3-4b34-8c46-9ec2742d6ca1 Content-Length: - '185' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5632a8de-ee9f-4733-bf68-55403909211e Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:35 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9fe705ac-5740-47e7-8a39-03877e6a3dbd Content-Length: - '387' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560"}, "enabled": true, "id": "d07e7028f83649c6857a3ee9368cf560", "parent_id": null, "domain_id": "default", "name": "p-foobar69"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:35 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9485906e-8d0f-445c-8a26-4baa04c70273 body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a881d949-2a7d-4753-990a-88031d615f80 Content-Length: - '336' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles", "previous": null, "next": null}, "roles": [{"id": "3a270450bbc14749be4593a849b19eed", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/3a270450bbc14749be4593a849b19eed"}, "name": "baz69"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a7ca063a-46c4-41e4-8812-7e8be2ada7cb Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-db4ae22b-a2e7-43a2-be58-eefcec23d923 Content-Length: - '149' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/users/5acef369a39a4be395cc0845e52c801c/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-abcf0c44-0115-4434-a630-f986d91cc5aa Content-Length: - '237' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6994b94f-9c7a-4ba4-86b0-60533fe47b5d Content-Length: - '186' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a45824fe-b44b-4666-93d4-fe1837acbe87 Content-Length: - '232' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-67083a0e-62b6-4624-b0b9-6213342d4675 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:36 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f2a9f0de-4a25-402e-9763-5238f49f77e9 body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:36 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2cbf5c16-2213-41b2-ab64-ecb0828ef034 Content-Length: - '337' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles", "previous": null, "next": null}, "roles": [{"id": "3a270450bbc14749be4593a849b19eed", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/3a270450bbc14749be4593a849b19eed"}, "name": "baz69"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-dcea5c1c-403f-4047-9b57-1d40571bc0c3 Content-Length: - '709' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [{"scope": {"project": {"id": "d07e7028f83649c6857a3ee9368cf560"}}, "role": {"id": "3a270450bbc14749be4593a849b19eed"}, "user": {"id": "5acef369a39a4be395cc0845e52c801c"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles/3a270450bbc14749be4593a849b19eed", "membership": "http://devstack.openstack.stack:35357/v3/groups/1f0c437e1b714db28c7109e602c12ba1/users/5acef369a39a4be395cc0845e52c801c"}}], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&scope.project.id=d07e7028f83649c6857a3ee9368cf560&user.id=5acef369a39a4be395cc0845e52c801c", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b475a9d0-bd78-4494-bc25-027375afd400 Content-Length: - '387' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560"}, "enabled": true, "id": "d07e7028f83649c6857a3ee9368cf560", "parent_id": null, "domain_id": "default", "name": "p-foobar69"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0ca36d96-46c9-46ea-a1d8-7072c80ff189 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ef8b9e30-92e8-45f3-a330-e804f6f44a93 Content-Length: - '149' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c/projects", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560/groups/1f0c437e1b714db28c7109e602c12ba1/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a16e7c94-e3ad-494d-8503-5580773f3be6 Content-Length: - '237' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:37 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/5acef369a39a4be395cc0845e52c801c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-24d84ff4-d159-4427-ada7-825ca6a81ef6 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/groups/1f0c437e1b714db28c7109e602c12ba1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fe361bc3-3be9-4db1-b0da-311404223f0b Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/3a270450bbc14749be4593a849b19eed body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:37 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fd03cd39-2474-4a9b-861a-75f823a215f3 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560 body: encoding: UTF-8 string: ! '{"project":{"enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-47eb9868-6be0-4fdf-bdd0-ef10fae290e5 Content-Length: - '265' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560"}, "extra": {}, "enabled": false, "id": "d07e7028f83649c6857a3ee9368cf560", "parent_id": null, "domain_id": "default", "name": "p-foobar69"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/d07e7028f83649c6857a3ee9368cf560 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3b24a007-bd8d-48a9-a763-2a3d04b15ecf Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:38 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_policy_crud.yml0000644000004100000410000002460412600047642024332 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ea24b863-f785-44d2-8286-46a2b044b8ca Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: UTF-8 string: ! '{"policy":{"type":"application/json","blob":"{\"foobar_user\":[\"role:compute-user\"]}"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5f77dba3-1975-48c3-9eb8-8b6943263584 Content-Length: - '230' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"policy": {"type": "application/json", "id": "b32b559596b445e8a3f7e4e148f7a528", "links": {"self": "http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528"}, "blob": "{\"foobar_user\":[\"role:compute-user\"]}"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b695a693-68e1-4967-8400-cdbd474618d2 Content-Length: - '328' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": [{"type": "application/json", "id": "b32b559596b445e8a3f7e4e148f7a528", "links": {"self": "http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528"}, "blob": "{\"foobar_user\":[\"role:compute-user\"]}"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528 body: encoding: UTF-8 string: ! '{"policy":{"blob":"{\"baz_user\":[\"role:compute-user\"]}"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f5b9a8d5-7989-45ee-a2e3-4498313fe317 Content-Length: - '227' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"policy": {"type": "application/json", "id": "b32b559596b445e8a3f7e4e148f7a528", "links": {"self": "http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528"}, "blob": "{\"baz_user\":[\"role:compute-user\"]}"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2268e0d1-2a64-4697-aa82-ff1e8c8bedfd Content-Length: - '325' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": [{"type": "application/json", "id": "b32b559596b445e8a3f7e4e148f7a528", "links": {"self": "http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528"}, "blob": "{\"baz_user\":[\"role:compute-user\"]}"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-601d03cc-4753-47b9-9a96-0e86e5f5b2a1 Content-Length: - '325' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": [{"type": "application/json", "id": "b32b559596b445e8a3f7e4e148f7a528", "links": {"self": "http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528"}, "blob": "{\"baz_user\":[\"role:compute-user\"]}"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-06eadca3-8e9f-4732-892c-e8fac82da864 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e60d4cb6-1f43-4f8f-a76a-b42e5d21a4c2 Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies/b32b559596b445e8a3f7e4e148f7a528 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c65477a3-03dc-440b-b5ea-1fbe8aa8d0b7 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find policy: b32b559596b445e8a3f7e4e148f7a528", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:48 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ef3e5e0a-6e50-4121-89ff-dee245b1e8dd Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:49 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_services_crud.yml0000644000004100000410000005170212600047642024655 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:38 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-af3b2535-2676-4ac9-a839-89bc473c2eb1 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/services body: encoding: UTF-8 string: ! '{"service":{"type":"volume","name":"foobar"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-481cf7dd-5016-4f8e-8ac1-ba9b6ef187e6 Content-Length: - '203' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"service": {"enabled": true, "type": "volume", "name": "foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4"}, "id": "43d21a8a348e48b085dfad86e8fb49d4"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services?type=volume body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f2461471-aa4c-4885-94dd-43ea6309ac40 Content-Length: - '544' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"enabled": true, "type": "volume", "name": "foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4"}, "id": "43d21a8a348e48b085dfad86e8fb49d4"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services?type=volume", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4 body: encoding: UTF-8 string: ! '{"service":{"name":"baz"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-49631a13-c3ac-4d54-a2f3-4e2155be9727 Content-Length: - '200' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"service": {"enabled": true, "type": "volume", "name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4"}, "id": "43d21a8a348e48b085dfad86e8fb49d4"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-02709a79-ab82-4f6a-8739-5fec4f51d673 Content-Length: - '2181' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"enabled": true, "type": "volume", "name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4"}, "id": "43d21a8a348e48b085dfad86e8fb49d4"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-82c297d0-d331-41ea-908b-bcf6abb3df6d Content-Length: - '2181' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"enabled": true, "type": "volume", "name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4"}, "id": "43d21a8a348e48b085dfad86e8fb49d4"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:39 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/services/43d21a8a348e48b085dfad86e8fb49d4 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b9da7b46-f53d-4518-8374-3f35aa502e63 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f27a144f-285b-4e4d-a610-8b1442116b70 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/43d21a8a348e48b085dfad86e8fb49d4 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:39 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fa735daa-3977-469e-9857-b98ec76c716f Content-Length: - '117' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find project: 43d21a8a348e48b085dfad86e8fb49d4", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f6092b81-ebfc-4c64-badb-cd43d572dc83 Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/common_setup.yml0000644000004100000410000005520012600047642023575 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"name":"Default"},"name":"admin"}}},"scope":{"project":{"name":"admin","domain":{"name":"Default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:12 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - ea1e9622dc8f4802a5f26955ccd8763f Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5a19ef3e-332c-469d-86ce-5d2c8253c632 Content-Length: - '5874' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:13.038388Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["UugwcE3NRu6NFGUC1u2hfA"], "issued_at": "2015-06-23T15:09:13.038446Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=admin body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-78e76d3d-6314-40d7-aaa8-0d1d6342fcaf Content-Length: - '322' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=admin", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=admin body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9127272d-301f-4a91-b428-8130d0c75208 Content-Length: - '266' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=admin", "previous": null, "next": null}, "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/domains/default/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fd9e1f93-fc0e-4a24-9af5-83d384fdabe9 Content-Length: - '212' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/domains/default/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7f57ecdf-b99a-4363-851b-c74fe19bda4c Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"name":"Default"},"name":"admin"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 847a87758a0d418885dc7ed0342c8abd Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ead8e790-30ec-4907-a3f8-e011bebebadb Content-Length: - '297' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "expires_at": "2015-06-23T16:09:13.570127Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["zoeurBInTLCweQdJ-xdUlw"], "issued_at": "2015-06-23T15:09:13.570177Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 847a87758a0d418885dc7ed0342c8abd response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-68f325f9-9668-476a-a171-b4975322e0b2 Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:13 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"847a87758a0d418885dc7ed0342c8abd"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 0c4458de5ba5446885c65b1dedfb2404 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-15000bbf-2669-4fa6-8626-aab4cafa6d4a Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:13.570127Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["pQhnkdy4RGusshH1F5xaWQ", "zoeurBInTLCweQdJ-xdUlw"], "issued_at": "2015-06-23T15:09:13.859970Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:14 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/domains/default/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:48 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ef9bb75c-0b6f-4303-92fd-261db34805d2 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:49 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_a.yml0000644000004100000410000001165012600047642022600 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","id":"aa9f25defa6d4cafb48466df83106065"}}},"scope":{"domain":{"id":"default"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:13 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - aa2d000e4f8a41a2ab6f5dcac7099f65 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5a5a48d1-5bee-4526-bf9e-bb27525bcf9a Content-Length: - '3532' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"domain": {"id": "default", "name": "Default"}, "methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:14.166804Z", "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["D9doa9rPSoO-bPw9mbsjyw"], "issued_at": "2015-06-23T15:09:14.166855Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:14 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_role_crud.yml0000644000004100000410000002743712600047642024003 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"foobar23"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-585f9e21-8194-4449-9aef-ea4ffd0eee42 Content-Length: - '164' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "79ff1c253e224b728af6e563f06fe85c", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c"}, "name": "foobar23"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=foobar23 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-16280bb9-d5a8-4506-85f6-ab950e19e60c Content-Length: - '272' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=foobar23", "previous": null, "next": null}, "roles": [{"id": "79ff1c253e224b728af6e563f06fe85c", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c"}, "name": "foobar23"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c body: encoding: UTF-8 string: ! '{"role":{"name":"baz23"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6368d9e7-caa0-4b1d-b95b-799579f53fc5 Content-Length: - '161' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "79ff1c253e224b728af6e563f06fe85c", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c"}, "name": "baz23"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=baz23 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-980935ef-797a-43d2-af70-b716ec54984f Content-Length: - '266' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=baz23", "previous": null, "next": null}, "roles": [{"id": "79ff1c253e224b728af6e563f06fe85c", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c"}, "name": "baz23"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e69d3a34-fac4-46d2-966f-d59abd256dec Content-Length: - '1037' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "79ff1c253e224b728af6e563f06fe85c", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c"}, "name": "baz23"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-954d7068-22d3-4fc7-a0da-0b1c0102373f Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-701844eb-61e2-4f24-83b8-b3fc5e747c2a Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles/79ff1c253e224b728af6e563f06fe85c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-18e04efb-727a-4332-a34f-4124c5c7e27a Content-Length: - '114' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find role: 79ff1c253e224b728af6e563f06fe85c", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=foobar23 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f90fdd83-dc5b-42f6-bd81-5d9a26d55d5b Content-Length: - '118' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=foobar23", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles?name=baz23 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e205ff27-5a23-4333-9915-07c685dcfcec Content-Length: - '115' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles?name=baz23", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_policy.yml0000644000004100000410000000740012600047642023310 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:46 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-101fa1d1-0ee1-4880-97f8-0e54b2f52bab Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ee720c2a-dc63-457a-90e4-e9e392a191d3 Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-991b5ccd-8f91-4830-9d52-5d481b7edce9 Content-Length: - '110' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/policies", "previous": null, "next": null}, "policies": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/policies/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:47 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-46b1c5e9-e7f2-4a5a-9a12-cc16fb558a95 Content-Length: - '92' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find policy: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:47 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_project.yml0000644000004100000410000002173612600047642023467 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3bae0fc9-8858-48a2-8331-c419f0be8d45 Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2a6e6cc2-8406-40e4-a718-2fca08020b4b Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:32 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bc9229c8-4afd-4f2f-87f8-5e5434a3f178 Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f4048369-2fb7-4a39-9f95-e3d19afcdba3 Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d680c0e4-2411-42d2-8668-c91b7e9efe89 Content-Length: - '93' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find project: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_unscoped.yml0000644000004100000410000006604212600047642024205 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","id":"aa9f25defa6d4cafb48466df83106065"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:16 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 919e5943176b40b2aa92575174a09edf Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1647a52b-e17f-4332-9a14-ea9d61d87eea Content-Length: - '297' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "expires_at": "2015-06-23T16:09:16.794798Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["MhjQGO1rT-qIW4iREeR0pw"], "issued_at": "2015-06-23T15:09:16.794852Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 919e5943176b40b2aa92575174a09edf response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:16 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f3e61eae-1fce-44ce-a4ed-a315ccb8dacb Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:17 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"919e5943176b40b2aa92575174a09edf"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:16 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - f2ebaa392e9642c8b7da32c9f77bf625 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7b84797c-7fda-4146-a87a-cdee99caf23f Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:16.794798Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["eeVwVPDbSNaVifQspKBjKQ", "MhjQGO1rT-qIW4iREeR0pw"], "issued_at": "2015-06-23T15:09:17.082461Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:17 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"f2ebaa392e9642c8b7da32c9f77bf625"}},"scope":{"project":{"name":"admin","domain":{"name":"Default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:17 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 4b4b922c5aa24a26b8db9b517593faa8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-00d551e4-4b61-4bbe-b6c8-c9e31eee3aae Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:16.794798Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["4n2FDEhtROCXj-MLqyNs3Q", "MhjQGO1rT-qIW4iREeR0pw"], "issued_at": "2015-06-23T15:09:17.309683Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - f2ebaa392e9642c8b7da32c9f77bf625 X-Subject-Token: - 4b4b922c5aa24a26b8db9b517593faa8 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:17 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 4b4b922c5aa24a26b8db9b517593faa8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-08ba98a3-4b92-43a8-b09d-76f24918dd18 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:16.794798Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"url": "http://devstack.openstack.stack:9292", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "6e82c8912d3f49a09df51035681d564c"}, {"url": "http://devstack.openstack.stack:9292", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"url": "http://devstack.openstack.stack:9292", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8773/", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"url": "http://devstack.openstack.stack:8773/", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"url": "http://devstack.openstack.stack:8773/", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "185eda94de9340e58245062f75d7f80e"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "9abd6797844d455f875af9537325cba4"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "europe", "region_id": "europe", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "europe", "region_id": "europe", "id": "600638643d22494fad4f30e3b22ae124"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "8a254651925e4a3e9505c863a00c017e"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "europe", "region_id": "europe", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["4n2FDEhtROCXj-MLqyNs3Q", "MhjQGO1rT-qIW4iREeR0pw"], "issued_at": "2015-06-23T15:09:17.309683Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:17 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - f2ebaa392e9642c8b7da32c9f77bf625 X-Subject-Token: - 4b4b922c5aa24a26b8db9b517593faa8 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:17 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 4b4b922c5aa24a26b8db9b517593faa8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-4cc2da59-ac54-4c99-bb29-bc62bbd221c3 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:17 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - f2ebaa392e9642c8b7da32c9f77bf625 X-Subject-Token: - random-token response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:17 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2fb489e9-8e24-4b6d-860f-f472630b8f34 Content-Length: - '95' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_group_crud_mutation.yml0000644000004100000410000007466512600047642026123 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7e24b2ad-0ec3-4e0d-a80f-ec74e874888f Content-Length: - '539' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-76ffd774-6cb4-4f7a-8a4d-47e2fe88d2bb Content-Length: - '539' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: UTF-8 string: ! '{"group":{"name":"foobar","description":"Group of Foobar users"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a2de0fdb-a73f-4046-83d8-14b65aa90408 Content-Length: - '228' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"group": {"domain_id": "default", "description": "Group of Foobar users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f7ff0f9a-4dfc-4ef5-9134-7a6438425ddd Content-Length: - '758' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "Group of Foobar users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "foobar"}, {"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c body: encoding: UTF-8 string: ! '{"group":{"name":"baz","description":"Group of Baz users"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-cdd9deed-289e-472c-9220-ceccb51af9a2 Content-Length: - '222' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"group": {"domain_id": "default", "description": "Group of Baz users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "baz"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ed6a67df-6de8-42b4-97b2-525296ae5a98 Content-Length: - '752' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "Group of Baz users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "baz"}, {"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-8f1aec9e-c43b-4467-8a9c-27d698373b5b Content-Length: - '752' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "Group of Baz users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "baz"}, {"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"foobar1","email":"foobar1@example.com","password":"s3cret!1"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c4407bca-f31b-47ec-a087-2c17b47f6a6f Content-Length: - '236' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "foobar1", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7"}, "domain_id": "default", "enabled": true, "email": "foobar1@example.com", "id": "b24c0c8dc4b44e35b211284b154e34c7"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:21 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"foobar2","email":"foobar2@example.com","password":"s3cret!2"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-108bf179-243d-4a95-9b79-dcdca92995b8 Content-Length: - '236' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "foobar2", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/c5a6a71cee344cafb2d1c472d74b7c20"}, "domain_id": "default", "enabled": true, "email": "foobar2@example.com", "id": "c5a6a71cee344cafb2d1c472d74b7c20"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ec0058aa-068b-4e59-9058-7afd3c27efcd Content-Length: - '145' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7/groups", "previous": null, "next": null}, "groups": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:21 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2bff04bc-d7a4-46d7-a832-147bcd54ec6a Content-Length: - '144' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/b24c0c8dc4b44e35b211284b154e34c7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-cc6f65ab-43c6-41ba-a971-b2f20fbfaaae Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9537b499-8614-4ea7-9a41-1ee5b2a4fa72 Content-Length: - '356' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "Group of Baz users", "id": "1abd6b026da7499fbc1476609bb9346c", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c"}, "name": "baz"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/b24c0c8dc4b44e35b211284b154e34c7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9d32f46e-a8e7-420e-bde4-e7501ea87927 body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/c5a6a71cee344cafb2d1c472d74b7c20 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5d3acdc2-6a6c-4586-a39f-3d9fc12b2655 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-efe15440-0f71-4215-ae1e-63a8a22c78e0 Content-Length: - '598' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "foobar1", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7"}, "domain_id": "default", "enabled": true, "email": "foobar1@example.com", "id": "b24c0c8dc4b44e35b211284b154e34c7"}, {"name": "foobar2", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/c5a6a71cee344cafb2d1c472d74b7c20"}, "domain_id": "default", "enabled": true, "email": "foobar2@example.com", "id": "c5a6a71cee344cafb2d1c472d74b7c20"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/b24c0c8dc4b44e35b211284b154e34c7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-351c688a-91eb-4bac-b2e1-a039954eacb4 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/b24c0c8dc4b44e35b211284b154e34c7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c53766f0-be66-40ca-a4d8-cf62315bb153 Content-Length: - '154' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-39162346-f32d-469f-a1e9-9b0ca702b5cd Content-Length: - '370' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "foobar2", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/c5a6a71cee344cafb2d1c472d74b7c20"}, "domain_id": "default", "enabled": true, "email": "foobar2@example.com", "id": "c5a6a71cee344cafb2d1c472d74b7c20"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:22 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/b24c0c8dc4b44e35b211284b154e34c7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9afd6413-4028-4d34-b204-5331ff9ac5c2 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/c5a6a71cee344cafb2d1c472d74b7c20 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:22 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7e8dff76-14e3-4676-b16a-3e388ce63a65 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users/c5a6a71cee344cafb2d1c472d74b7c20 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-977d1032-0759-48c7-90d2-0ffb4d4b7128 Content-Length: - '114' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-61cc871b-9ae8-4a29-a917-0e3756f543aa Content-Length: - '144' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-acc427c2-8558-4095-b945-c2294ead95eb Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3fbc0cc9-2083-4639-969f-49a90dda07ef Content-Length: - '539' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups/1abd6b026da7499fbc1476609bb9346c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-83c0ed64-c67b-4f57-b20b-0c7f026bbd69 Content-Length: - '115' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find group: 1abd6b026da7499fbc1476609bb9346c", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-64043596-7c1e-44c8-b2d5-3300e7200c5d Content-Length: - '539' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/groups", "previous": null, "next": null}, "groups": [{"domain_id": "default", "description": "non-admin group", "id": "456293145b0b48b1be46e71d97ad14e4", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/456293145b0b48b1be46e71d97ad14e4"}, "name": "nonadmins"}, {"domain_id": "default", "description": "openstack admin group", "id": "b87395bdcc4c40d18a83277430f60f29", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/b87395bdcc4c40d18a83277430f60f29"}, "name": "admins"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_credential_crud.yml0000644000004100000410000004177312600047642025153 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"u-foobar_cred","email":"foobar@example.com","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-72010b2a-ab1a-40b1-acdf-33f4cd1a6b62 Content-Length: - '241' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "u-foobar_cred", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/c681c33e7d9546cb91e29298d99c7dff"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "c681c33e7d9546cb91e29298d99c7dff"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-90f1fed0-e320-4f97-9837-d0178ee91659 Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0911fd7b-7d70-4385-8446-f3677d959c13 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d1779361-985b-4353-b7b3-e96cf1dcc5f5 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: UTF-8 string: ! '{"credential":{"type":"ec2","project_id":"123ac695d4db400a9001b91bb3b8aa46","user_id":"c681c33e7d9546cb91e29298d99c7dff","blob":"{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"7e084117-b13d-4656-9eca-85376b690897\"}"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-313f6bef-567b-4104-b4b6-eadb406b595c Content-Length: - '449' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credential": {"user_id": "c681c33e7d9546cb91e29298d99c7dff", "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}, "blob": "{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"7e084117-b13d-4656-9eca-85376b690897\"}", "project_id": "123ac695d4db400a9001b91bb3b8aa46", "type": "ec2", "id": "9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b1b98ced-b2aa-490b-8163-8485884b7f32 Content-Length: - '549' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [{"user_id": "c681c33e7d9546cb91e29298d99c7dff", "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}, "blob": "{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"7e084117-b13d-4656-9eca-85376b690897\"}", "project_id": "123ac695d4db400a9001b91bb3b8aa46", "type": "ec2", "id": "9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae body: encoding: UTF-8 string: ! '{"credential":{"blob":"{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"62307bcd-ca3c-47ae-a114-27a6cadb5bc9\"}"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d5dfd69a-0e68-405b-9fd8-0153fb559a62 Content-Length: - '449' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credential": {"user_id": "c681c33e7d9546cb91e29298d99c7dff", "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}, "blob": "{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"62307bcd-ca3c-47ae-a114-27a6cadb5bc9\"}", "project_id": "123ac695d4db400a9001b91bb3b8aa46", "type": "ec2", "id": "9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:43 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b51713d2-f286-4761-a675-e447da7f0c24 Content-Length: - '549' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [{"user_id": "c681c33e7d9546cb91e29298d99c7dff", "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}, "blob": "{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"62307bcd-ca3c-47ae-a114-27a6cadb5bc9\"}", "project_id": "123ac695d4db400a9001b91bb3b8aa46", "type": "ec2", "id": "9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:43 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-68441f5f-d209-4bae-ac9a-27936602d7d9 Content-Length: - '549' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [{"user_id": "c681c33e7d9546cb91e29298d99c7dff", "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}, "blob": "{\"access\":\"9c4e774a-f644-498f-90c4-970b3f817fc5\",\"secret\":\"62307bcd-ca3c-47ae-a114-27a6cadb5bc9\"}", "project_id": "123ac695d4db400a9001b91bb3b8aa46", "type": "ec2", "id": "9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/c681c33e7d9546cb91e29298d99c7dff body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:44 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f9df6559-8185-420e-998b-a4d8f0b0e6f1 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:44 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bfb9a098-feca-4798-ac69-633914d79433 Content-Length: - '152' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find credential: 9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:44 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d9a2f130-f824-4ae1-ae30-e902b75c2560 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials/9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:44 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d972b239-7d71-4eb7-8266-9a4287a15342 Content-Length: - '152' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find credential: 9e7bb4e633cc08cc863fe15351911e267f2a953b24c1a80f0f35e173303bafae", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:44 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0993ca29-8414-4414-9ba5-28ae23d0d157 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:44 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_b.yml0000644000004100000410000001165112600047642022602 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"id":"default"},"name":"admin"}}},"scope":{"domain":{"id":"default"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:14 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - b578d2c108144a3b9d62ec94625e731e Vary: - X-Auth-Token X-Openstack-Request-Id: - req-db30eb45-f3a1-4411-af7f-4d22318e81e5 Content-Length: - '3532' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"domain": {"id": "default", "name": "Default"}, "methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:14.388398Z", "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["glPwaJIQQ_iD7DJHWUgcNw"], "issued_at": "2015-06-23T15:09:14.388453Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:14 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_credential.yml0000644000004100000410000000554012600047642024126 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d8ab74c2-e427-49cc-a17c-95b523e9f534 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0396484f-f4f0-44e1-9224-de8660d3babd Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"credentials": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/credentials", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/credentials/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1102123a-7126-45ed-9ec1-eb32cb694558 Content-Length: - '96' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find credential: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_domain_crud.yml0000644000004100000410000003123112600047642024274 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: UTF-8 string: ! '{"domain":{"name":"foobar"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a58e282d-bf32-4c63-baaf-d3560cba57e1 Content-Length: - '183' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domain": {"enabled": true, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5854cd5d-5d45-410e-bf3e-c47653abb235 Content-Length: - '291' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"enabled": true, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "foobar"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7 body: encoding: UTF-8 string: ! '{"domain":{"name":"baz","enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-575c634d-0875-4df8-916b-27e159e9ba15 Content-Length: - '181' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domain": {"enabled": false, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "baz"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c12040aa-6c35-4d97-b62f-1c4e65eaf7e3 Content-Length: - '286' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"enabled": false, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "baz"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5d2dd635-9363-439b-b152-1505b79c7ff8 Content-Length: - '488' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"enabled": false, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "baz"}, {"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7 body: encoding: UTF-8 string: ! '{"domain":{"enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1f861c1f-98e8-427e-b1cc-05ca80a7d9a8 Content-Length: - '181' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domain": {"enabled": false, "id": "2c2406af8b9645258705948ee07699b7", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7"}, "name": "baz"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b8f80af9-f6d1-43af-bcf5-4025b733bfa5 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7 body: encoding: UTF-8 string: ! '{"domain":{"enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ae6b0c1e-a831-4d38-8e55-656233a0919f Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find domain: 2c2406af8b9645258705948ee07699b7", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-beb9452c-e781-4c1e-bbe8-5bab6b4f8573 Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/2c2406af8b9645258705948ee07699b7 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e41b9d66-a6c8-45c8-b6e7-b9ed08370aed Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find domain: 2c2406af8b9645258705948ee07699b7", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3667c2bc-a416-4936-b724-d8d66aa633f7 Content-Length: - '120' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6a574e03-0ba8-40c0-9752-238c2df55b01 Content-Length: - '117' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_c.yml0000644000004100000410000002443212600047642022604 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"name":"Default"},"name":"admin"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:14 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 88ed2d0e288c4ee39fbb103dedd28cbe Vary: - X-Auth-Token X-Openstack-Request-Id: - req-160a8f78-e015-4025-b3f2-ccc996a0911b Content-Length: - '297' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "expires_at": "2015-06-23T16:09:14.572456Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["qODAIqYWQgSj_9a16LP-nQ"], "issued_at": "2015-06-23T15:09:14.572502Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:14 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 88ed2d0e288c4ee39fbb103dedd28cbe response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:14 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b9f5418d-e03e-4439-a114-a601af4a7f37 Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:14 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"88ed2d0e288c4ee39fbb103dedd28cbe"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:14 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - bd39ab695e7e4e1b8b3b9b1c0d58c7cb Vary: - X-Auth-Token X-Openstack-Request-Id: - req-adf03d28-7176-4f94-ae36-96b0c1d6fad7 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:14.572456Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["UM41YhUXSlm--6pfwYId1Q", "qODAIqYWQgSj_9a16LP-nQ"], "issued_at": "2015-06-23T15:09:14.873457Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_user_crud.yml0000644000004100000410000005057412600047642024016 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6f46b6ef-497e-4564-9aac-8525086dfadb Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a9e2ca99-3cb3-4c30-95c1-fdc3742c4f9c Content-Length: - '113' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-897d8e36-5bf2-40a4-8ff6-baece16e82cb Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-adfb3e9b-125e-4a5c-b03e-7bddd36ba0e3 Content-Length: - '113' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"foobar","email":"foobar@example.com","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5e47af77-0a62-40e1-9244-209d4896c80c Content-Length: - '234' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "687f330c9c55499798b97709637983a1"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-4fa226b3-ac49-46e7-8dab-7e1ec7a8b8a2 Content-Length: - '340' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "687f330c9c55499798b97709637983a1"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1 body: encoding: UTF-8 string: ! '{"user":{"name":"baz","enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-086d5562-d543-44ad-b3d7-63a8b7a4f1b4 Content-Length: - '274' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1"}, "extra": {"email": "foobar@example.com"}, "domain_id": "default", "enabled": false, "email": "foobar@example.com", "id": "687f330c9c55499798b97709637983a1"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d9f6353b-5b12-4c14-8915-98cc149b9b65 Content-Length: - '335' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1"}, "domain_id": "default", "enabled": false, "email": "foobar@example.com", "id": "687f330c9c55499798b97709637983a1"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:19 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e15932ad-aedd-4983-bbe6-e62e89a6d278 Content-Length: - '1613' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "baz", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1"}, "domain_id": "default", "enabled": false, "email": "foobar@example.com", "id": "687f330c9c55499798b97709637983a1"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"baz","email":"foobar@example.com","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 409 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7b827d76-f834-458b-ae02-ced9676a5c91 Content-Length: - '120' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Conflict occurred attempting to store user - Duplicate Entry", "code": 409, "title": "Conflict"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b95715e3-1b04-417a-a8b7-eac15314b2de Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-83fce625-a2c5-4382-a870-12120427fa5f Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/687f330c9c55499798b97709637983a1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-887fd6a6-c1f4-4279-97a0-dab02afebc7f Content-Length: - '114' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find user: 687f330c9c55499798b97709637983a1", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3f26900f-84db-481b-9e49-3419778b5671 Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=foobar body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e7ecac96-4ba0-4ad6-9657-9a9dad1ab8f3 Content-Length: - '116' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=foobar", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=baz body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:20 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3629f214-c55e-4cc4-b619-8cdf3260a595 Content-Length: - '113' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=baz", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:20 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_role.yml0000644000004100000410000002031012600047642022745 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-4bdf8936-d6d8-4a61-aacd-2dd0f00cd046 Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6c8419cb-53d9-48e5-9af4-d031450a4dc3 Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9ff19255-dd9b-4f04-9d81-db3e279a8872 Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-391c8638-2d60-4efd-b1f5-15c94a473f6c Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-08857458-848d-444d-9b43-4dd69dbdba28 Content-Length: - '90' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find role: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:32 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_project_crud.yml0000644000004100000410000003356612600047642024510 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d29b5b23-6576-4dd5-949b-c8f3f6ea7522 Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-foobar46"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-933de277-8964-4f05-be6a-980a7e19a75e Content-Length: - '251' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e"}, "enabled": true, "id": "9fdb7b5b90cb41f783d2c78cfde5221e", "parent_id": null, "domain_id": "default", "name": "p-foobar46"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar46 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1e745ee2-0b2d-4822-9998-da3c5572efe3 Content-Length: - '364' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar46", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e"}, "enabled": true, "id": "9fdb7b5b90cb41f783d2c78cfde5221e", "parent_id": null, "domain_id": "default", "name": "p-foobar46"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e body: encoding: UTF-8 string: ! '{"project":{"name":"p-baz46","enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-efd23e28-0c54-406e-99f6-2b59aef7b08e Content-Length: - '262' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e"}, "extra": {}, "enabled": false, "id": "9fdb7b5b90cb41f783d2c78cfde5221e", "parent_id": null, "domain_id": "default", "name": "p-baz46"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-baz46 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-74c007b2-4120-4783-bc01-b5048a8544f2 Content-Length: - '359' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-baz46", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e"}, "enabled": false, "id": "9fdb7b5b90cb41f783d2c78cfde5221e", "parent_id": null, "domain_id": "default", "name": "p-baz46"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:33 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c910c1f6-7930-45b6-a4be-12d7eabeb8c2 Content-Length: - '1308' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}, {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e"}, "enabled": false, "id": "9fdb7b5b90cb41f783d2c78cfde5221e", "parent_id": null, "domain_id": "default", "name": "p-baz46"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:33 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f6510d24-22f4-4cb4-9d43-16f150a802dd Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e04337e1-f5b2-4df2-9e8a-1536387add39 Content-Length: - '1070' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602"}, "enabled": true, "id": "3e06db1f2ff64d219d27a3f6858bf602", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f"}, "enabled": true, "id": "956fbf1d663b4d6fa9d26c4d78de113f", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/9fdb7b5b90cb41f783d2c78cfde5221e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9ef4e413-d872-44dc-9788-8f1687e4c086 Content-Length: - '117' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find project: 9fdb7b5b90cb41f783d2c78cfde5221e", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar46 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d8bbf304-a95a-4316-963f-b627d42cc621 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar46", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-baz46 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:34 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7ba61e3b-e60a-44d6-b60a-3c726633e0a8 Content-Length: - '123' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-baz46", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:34 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_unscoped_reauth.yml0000644000004100000410000005077412600047642025562 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","id":"aa9f25defa6d4cafb48466df83106065"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 6fdab0ea65b34d7caa377f711872251c Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bfb6b3c2-4f85-4f0a-b46a-9aefe0b9dc60 Content-Length: - '297' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "expires_at": "2015-06-23T16:09:15.587960Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["nFFK-uNzRoe_dV_1q69M5g"], "issued_at": "2015-06-23T15:09:15.588066Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 6fdab0ea65b34d7caa377f711872251c response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5ed2c8b0-707c-46cf-bd0a-29e3eec339d9 Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"6fdab0ea65b34d7caa377f711872251c"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - d61ea1d675954859b7c1b667d8896fbe Vary: - X-Auth-Token X-Openstack-Request-Id: - req-82c4242a-38e3-4d3b-a146-f98834070e42 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:15.587960Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["h_lBUFAFSAWxhMqao9iP1g", "nFFK-uNzRoe_dV_1q69M5g"], "issued_at": "2015-06-23T15:09:15.834851Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"d61ea1d675954859b7c1b667d8896fbe"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 8aaf499eb08f402c91773fdb0867e1c1 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-39d77ff3-1672-4f36-8b74-805891a9fd1e Content-Length: - '332' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "expires_at": "2015-06-23T16:09:15.587960Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["c-MYIIa0QWaexqAlYFCYkQ", "nFFK-uNzRoe_dV_1q69M5g"], "issued_at": "2015-06-23T15:09:15.973894Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 8aaf499eb08f402c91773fdb0867e1c1 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0e13440c-e953-48c0-842b-f6e00aa77fa6 Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"d61ea1d675954859b7c1b667d8896fbe"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:16 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 49efadc690824da2a5ad1121ee14dd8a Vary: - X-Auth-Token X-Openstack-Request-Id: - req-96971fce-cbf3-4eb9-827a-534870fe34a7 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:15.587960Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["i7LXkArmTBmWNSiW4Z9HbA", "nFFK-uNzRoe_dV_1q69M5g"], "issued_at": "2015-06-23T15:09:16.272885Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:16 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/authv3_token.yml0000644000004100000410000004304012600047642023476 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"foobar_385","email":"foobar_demo@example.com","domain_id":"default","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7500224b-d72c-40fa-9f57-c502b7e467a1 Content-Length: - '243' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "foobar_385", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/47d9bd80f4b549089609fcca39479140"}, "domain_id": "default", "enabled": true, "email": "foobar_demo@example.com", "id": "47d9bd80f4b549089609fcca39479140"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"foobar_role390"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5b6421c3-072e-485e-93be-5add1c84a22d Content-Length: - '170' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "a60c9dcd072b4fad8ec326e5e61d9955", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/a60c9dcd072b4fad8ec326e5e61d9955"}, "name": "foobar_role390"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/domains/default/users/47d9bd80f4b549089609fcca39479140/roles/a60c9dcd072b4fad8ec326e5e61d9955 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d6fa789d-8e54-4263-a495-400afebc911d Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"s3cret!","domain":{"id":"default"},"name":"foobar_385"}}},"scope":{"domain":{"id":"default"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - de277fd5e2054079a380d41e43b40686 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9d90ce38-e1c6-4316-930d-780764790067 Content-Length: - '3546' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"domain": {"id": "default", "name": "Default"}, "methods": ["password"], "roles": [{"id": "a60c9dcd072b4fad8ec326e5e61d9955", "name": "foobar_role390"}], "expires_at": "2015-06-23T16:09:24.930033Z", "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "47d9bd80f4b549089609fcca39479140", "name": "foobar_385"}, "audit_ids": ["FsYe1DR9RcuaXCjkm0ElvA"], "issued_at": "2015-06-23T15:09:24.930079Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"de277fd5e2054079a380d41e43b40686"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 357daba7c7654ea4a40f95bfc18e152a Vary: - X-Auth-Token X-Openstack-Request-Id: - req-93e38120-8f8b-4605-9ae5-9b350532b251 Content-Length: - '337' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "expires_at": "2015-06-23T16:09:24.930033Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "47d9bd80f4b549089609fcca39479140", "name": "foobar_385"}, "audit_ids": ["4CUW0pnWTn2mkdyTsIDqEQ", "FsYe1DR9RcuaXCjkm0ElvA"], "issued_at": "2015-06-23T15:09:25.076422Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/47d9bd80f4b549089609fcca39479140/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 357daba7c7654ea4a40f95bfc18e152a response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e9978caa-587c-4bc0-a147-39b1e3104a21 Content-Length: - '148' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/47d9bd80f4b549089609fcca39479140/projects", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"de277fd5e2054079a380d41e43b40686"}},"scope":{"domain":{"id":"default"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 315efd1c5f8d4664815cd5fe69406b38 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f7e6a683-17b1-4177-8224-d9aaf3ba2584 Content-Length: - '3581' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"domain": {"id": "default", "name": "Default"}, "methods": ["token", "password"], "roles": [{"id": "a60c9dcd072b4fad8ec326e5e61d9955", "name": "foobar_role390"}], "expires_at": "2015-06-23T16:09:24.930033Z", "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "47d9bd80f4b549089609fcca39479140", "name": "foobar_385"}, "audit_ids": ["_bDviad6S_mO37zUd1-z5g", "FsYe1DR9RcuaXCjkm0ElvA"], "issued_at": "2015-06-23T15:09:25.280490Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"blahblahblah"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-dbae33aa-50fd-498d-86cc-0526abd157da Content-Length: - '95' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find token: blahblahblah", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/47d9bd80f4b549089609fcca39479140 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0662bfee-8245-44a7-9c8b-d71b8bfbc1eb Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/a60c9dcd072b4fad8ec326e5e61d9955 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3e669481-17a2-4a05-9b87-13268be81781 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_other_region.yml0000644000004100000410000002442712600047642024505 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","id":"aa9f25defa6d4cafb48466df83106065"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 9f7df72efb3749ed8eb12699d16f56cc Vary: - X-Auth-Token X-Openstack-Request-Id: - req-77ed8c5d-de40-42ea-b7ac-013eedf72558 Content-Length: - '297' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "expires_at": "2015-06-23T16:09:15.097008Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["K9N-CugNRDSarC82lwYYHQ"], "issued_at": "2015-06-23T15:09:15.097078Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT - request: method: get uri: http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 9f7df72efb3749ed8eb12699d16f56cc response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-99d9e960-accc-4943-b647-f0454eb9f9ba Content-Length: - '617' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:5000/v3/users/aa9f25defa6d4cafb48466df83106065/projects", "previous": null, "next": null}, "projects": [{"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/123ac695d4db400a9001b91bb3b8aa46"}, "enabled": true, "id": "123ac695d4db400a9001b91bb3b8aa46", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": null, "links": {"self": "http://devstack.openstack.stack:5000/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff"}, "enabled": true, "id": "3ed7ee0512b641d3bb1fe17fc86d8bff", "parent_id": null, "domain_id": "default", "name": "demo"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["token"],"token":{"id":"9f7df72efb3749ed8eb12699d16f56cc"}},"scope":{"project":{"name":"admin","domain":{"id":"default"}}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:15 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 6974d4e66dbb47e9a4ca379c14f706f4 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7111935d-8900-4dff-ba6f-f1f691cb6b48 Content-Length: - '5909' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["token", "password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:15.097008Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["1yvNE0UcSCWjedTDCBbDsA", "K9N-CugNRDSarC82lwYYHQ"], "issued_at": "2015-06-23T15:09:15.359531Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:15 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_domain_group_roles_mutation.yml0000644000004100000410000005465212600047642027633 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: UTF-8 string: ! '{"domain":{"name":"d-foobar"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-29ff2740-5393-47d7-9020-c09e88911aa5 Content-Length: - '185' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domain": {"enabled": true, "id": "e056d5ecff0b41159c080aed5603d58e", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e"}, "name": "d-foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/groups body: encoding: UTF-8 string: ! '{"group":{"name":"g-foobar","description":"Group of Foobar users","domain_id":"e056d5ecff0b41159c080aed5603d58e"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7d21a243-9647-4d19-b530-be94bb03f030 Content-Length: - '255' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"group": {"domain_id": "e056d5ecff0b41159c080aed5603d58e", "description": "Group of Foobar users", "id": "3a84b31f250948e3bff567c307e1c343", "links": {"self": "http://devstack.openstack.stack:35357/v3/groups/3a84b31f250948e3bff567c307e1c343"}, "name": "g-foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"u-foobar_foobar","email":"foobar@example.com","password":"s3cret!","domain_id":"e056d5ecff0b41159c080aed5603d58e"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-dd5f5aba-65a9-4f76-be21-961f38113700 Content-Length: - '268' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "u-foobar_foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/5adaf93d3e094030b6418eb79034e95e"}, "domain_id": "e056d5ecff0b41159c080aed5603d58e", "enabled": true, "email": "foobar@example.com", "id": "5adaf93d3e094030b6418eb79034e95e"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/users/5adaf93d3e094030b6418eb79034e95e/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f07f15bd-6719-4c79-9a64-6a89093877c6 Content-Length: - '184' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/users/5adaf93d3e094030b6418eb79034e95e/roles", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-79f560e9-a6f8-4a4f-b926-625af75aa528 Content-Length: - '884' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/roles", "previous": null, "next": null}, "roles": [{"id": "1348e84f9797426bb6ec4cae1e6289d7", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/1348e84f9797426bb6ec4cae1e6289d7"}, "name": "anotherrole"}, {"id": "430e91ef76b74b728a2864bc8a410a60", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/430e91ef76b74b728a2864bc8a410a60"}, "name": "service"}, {"id": "64537dfec884463faf4978fcb9ec1e14", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/64537dfec884463faf4978fcb9ec1e14"}, "name": "Member"}, {"id": "6ead57f8ae124996af8b0beb72ff1007", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/6ead57f8ae124996af8b0beb72ff1007"}, "name": "admin"}, {"id": "d7390adf0b014ceb9247591b70d0eac9", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/d7390adf0b014ceb9247591b70d0eac9"}, "name": "ResellerAdmin"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"foobar_role"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d9dd6c11-e908-4020-aa80-0592a888ce8b Content-Length: - '167' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "b4df549f31d44b159f5ee3beea09e593", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/b4df549f31d44b159f5ee3beea09e593"}, "name": "foobar_role"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles/b4df549f31d44b159f5ee3beea09e593 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b895b4b2-4adc-4056-bd94-2f89c6276dcf Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-409d5cce-c444-472f-b423-c0243656f33e Content-Length: - '342' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles", "previous": null, "next": null}, "roles": [{"id": "b4df549f31d44b159f5ee3beea09e593", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/b4df549f31d44b159f5ee3beea09e593"}, "name": "foobar_role"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/users/5adaf93d3e094030b6418eb79034e95e/roles/b4df549f31d44b159f5ee3beea09e593 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-630c9f28-151d-456c-b805-43952c42432a Content-Length: - '237' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:29 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9d6ed759-2d7a-4493-99d2-9375803d7376 Content-Length: - '182' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/groups/3a84b31f250948e3bff567c307e1c343/users/5adaf93d3e094030b6418eb79034e95e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-04d2ece5-8532-4e67-b5e1-4fe9d4f9daaf Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/users/5adaf93d3e094030b6418eb79034e95e/roles/b4df549f31d44b159f5ee3beea09e593 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e63fa640-fcc2-433a-ae29-b6c6227d409c Content-Length: - '237' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-faeb1dca-5128-4daf-8717-34e720680e88 Content-Length: - '657' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [{"scope": {"domain": {"id": "e056d5ecff0b41159c080aed5603d58e"}}, "role": {"id": "b4df549f31d44b159f5ee3beea09e593"}, "user": {"id": "5adaf93d3e094030b6418eb79034e95e"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles/b4df549f31d44b159f5ee3beea09e593", "membership": "http://devstack.openstack.stack:35357/v3/groups/3a84b31f250948e3bff567c307e1c343/users/5adaf93d3e094030b6418eb79034e95e"}}], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?group.id=3a84b31f250948e3bff567c307e1c343 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-012e85f7-7d85-4b4c-9bc4-8e7a35f13e30 Content-Length: - '517' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [{"role": {"id": "b4df549f31d44b159f5ee3beea09e593"}, "group": {"id": "3a84b31f250948e3bff567c307e1c343"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles/b4df549f31d44b159f5ee3beea09e593"}, "scope": {"domain": {"id": "e056d5ecff0b41159c080aed5603d58e"}}}], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?group.id=3a84b31f250948e3bff567c307e1c343", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e/groups/3a84b31f250948e3bff567c307e1c343/roles/b4df549f31d44b159f5ee3beea09e593 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6d24b8a0-4d10-468f-8f45-f165e9a83da9 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d87d84af-4a0b-4328-94f0-3e1cbb3ae4c4 Content-Length: - '182' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?effective=true&user.id=5adaf93d3e094030b6418eb79034e95e", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:30 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/5adaf93d3e094030b6418eb79034e95e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ce6370f6-cdef-4ad4-b709-a22aa7828700 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/groups/3a84b31f250948e3bff567c307e1c343 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:30 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f2ee4855-7efa-40d2-b2f9-f84e10199d93 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/b4df549f31d44b159f5ee3beea09e593 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-07b7a1ec-4317-4a5c-9751-b1c2ebbc5d4c Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e body: encoding: UTF-8 string: ! '{"domain":{"enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3f239da1-92a8-481d-9ea6-e8fb61f2c0ff Content-Length: - '186' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domain": {"enabled": false, "id": "e056d5ecff0b41159c080aed5603d58e", "links": {"self": "http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e"}, "name": "d-foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/domains/e056d5ecff0b41159c080aed5603d58e body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:31 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e0d636d3-1084-4a43-aa77-cd308c3eded8 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:31 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_endpoints_crud.yml0000644000004100000410000017066112600047642025043 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/services body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-03e92c7a-71ee-4975-a1d3-d5b9413e549b Content-Length: - '1992' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"services": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/0d56500210a24c38a3702b6825e24164"}, "enabled": true, "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "description": "Glance Image Service"}, {"name": "cinderv2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/2b92e79c45254516932c633229cd0e8b"}, "enabled": true, "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "description": "Cinder Volume Service V2"}, {"name": "ec2", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/3364a7b95c664bf89a7a8db081576364"}, "enabled": true, "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "description": "EC2 Compatibility Layer"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/511b94ce0482484ea09028091dd5e9a5"}, "enabled": true, "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "description": "Cinder Volume Service"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/5b7028751ed045d79467c7845ecb8c58"}, "enabled": true, "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "description": "Nova Compute Service"}, {"name": "novav21", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/97e665cbada043718180c5a6316df76a"}, "enabled": true, "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "description": "Nova Compute Service V2.1"}, {"name": "keystone_v3x", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/b577d8f7c7074d04a1165fcca638b600"}, "enabled": true, "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "description": "OpenStack Identity v3 x"}, {"name": "keystone_v3", "links": {"self": "http://devstack.openstack.stack:35357/v3/services/cd9002bbadfe495d81b5ee4c50768009"}, "enabled": true, "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "description": "OpenStack Identity v3"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/services", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2c6e7a18-cece-47f5-99e7-199eedadfc08 Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: UTF-8 string: ! '{"endpoint":{"service_id":"0d56500210a24c38a3702b6825e24164","interface":"internal","name":"foobar","url":"http://example.com/foobar","enabled":false}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a4a26c70-9272-498f-8e3b-67c6240528ae Content-Length: - '334' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoint": {"region_id": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766"}, "url": "http://example.com/foobar", "region": null, "enabled": false, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "906a4e56f92c4915b69f174b0f850766", "name": "foobar"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints?interface=internal body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0d49fff4-1384-42af-9caa-dcd922878801 Content-Length: - '3387' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766"}, "url": "http://example.com/foobar", "region": null, "enabled": false, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "906a4e56f92c4915b69f174b0f850766", "name": "foobar"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints?interface=internal", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: patch uri: http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766 body: encoding: UTF-8 string: ! '{"endpoint":{"name":"baz","url":"http://example.com/baz"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2582ee0f-4664-4f34-9d9f-8477c60bcb83 Content-Length: - '328' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoint": {"region_id": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766"}, "url": "http://example.com/baz", "region": null, "enabled": false, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "906a4e56f92c4915b69f174b0f850766", "name": "baz"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints?interface=internal body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a17b33e4-44e5-4aab-8bae-d704db63c16d Content-Length: - '3381' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766"}, "url": "http://example.com/baz", "region": null, "enabled": false, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "906a4e56f92c4915b69f174b0f850766", "name": "baz"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints?interface=internal", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d5a40019-9e6f-47fc-bcda-ec135f7e5e99 Content-Length: - '9192' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": null, "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766"}, "url": "http://example.com/baz", "region": null, "enabled": false, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "906a4e56f92c4915b69f174b0f850766", "name": "baz"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6f88df23-f030-4138-977a-401c9eebb06e Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:41 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f7603507-2641-4ae9-a49c-ef57b67de89f Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints/906a4e56f92c4915b69f174b0f850766 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b834f9a2-44d7-459f-afab-88d6d98e41dc Content-Length: - '118' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find endpoint: 906a4e56f92c4915b69f174b0f850766", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:42 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-82f4a561-c0fb-45db-a35e-0f30f69d0d24 Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:42 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_token.yml0000644000004100000410000004334212600047642023136 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"id":"aa9f25defa6d4cafb48466df83106065","password":"password"}}},"scope":{"project":{"domain":{"name":"Default"},"name":"admin"}}}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-abc543be-3802-489b-8482-d6fa23cd8454 Content-Length: - '5874' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:23.773740Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "internal", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "public", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "region": "RegionOne", "interface": "admin", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"region_id": "europe", "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "interface": "admin", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "public", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "public", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "interface": "internal", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "europe", "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "interface": "internal", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "interface": "admin", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["R7EbvK58T8u1HSKY6PtkEg"], "issued_at": "2015-06-23T15:09:23.773793Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:23 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-98f7fc3b-da58-4c9d-94f9-3f9143fb191a Content-Length: - '5874' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "roles": [{"id": "6ead57f8ae124996af8b0beb72ff1007", "name": "admin"}], "expires_at": "2015-06-23T16:09:23.773740Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "123ac695d4db400a9001b91bb3b8aa46", "name": "admin"}, "catalog": [{"endpoints": [{"url": "http://devstack.openstack.stack:9292", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "6e82c8912d3f49a09df51035681d564c"}, {"url": "http://devstack.openstack.stack:9292", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"url": "http://devstack.openstack.stack:9292", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "c9a090a4597040849c03bc13588167f6"}], "type": "image", "id": "0d56500210a24c38a3702b6825e24164", "name": "glance"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"url": "http://devstack.openstack.stack:8776/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}], "type": "volumev2", "id": "2b92e79c45254516932c633229cd0e8b", "name": "cinderv2"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8773/", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"url": "http://devstack.openstack.stack:8773/", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"url": "http://devstack.openstack.stack:8773/", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "ece52860cf1e4eb6a8fed05c47a30147"}], "type": "ec2", "id": "3364a7b95c664bf89a7a8db081576364", "name": "ec2"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"url": "http://devstack.openstack.stack:8776/v1/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "90977723dba04ea9a2a184c99565ccff"}], "type": "volume", "id": "511b94ce0482484ea09028091dd5e9a5", "name": "cinder"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"url": "http://devstack.openstack.stack:8774/v2/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "type": "compute", "id": "5b7028751ed045d79467c7845ecb8c58", "name": "nova"}, {"endpoints": [{"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"url": "http://devstack.openstack.stack:8774/v2.1/123ac695d4db400a9001b91bb3b8aa46", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}], "type": "computev21", "id": "97e665cbada043718180c5a6316df76a", "name": "novav21"}, {"endpoints": [{"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "185eda94de9340e58245062f75d7f80e"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "9abd6797844d455f875af9537325cba4"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "d3b31f24e4ea40699f731e29e625c187"}], "type": "identity", "id": "b577d8f7c7074d04a1165fcca638b600", "name": "keystone_v3x"}, {"endpoints": [{"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "europe", "region_id": "europe", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "RegionOne", "region_id": "RegionOne", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "public", "region": "europe", "region_id": "europe", "id": "600638643d22494fad4f30e3b22ae124"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "RegionOne", "region_id": "RegionOne", "id": "8a254651925e4a3e9505c863a00c017e"}, {"url": "http://devstack.openstack.stack:5000/v3", "interface": "internal", "region": "europe", "region_id": "europe", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"url": "http://devstack.openstack.stack:35357/v3", "interface": "admin", "region": "RegionOne", "region_id": "RegionOne", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}], "type": "identity_v3", "id": "cd9002bbadfe495d81b5ee4c50768009", "name": "keystone_v3"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa9f25defa6d4cafb48466df83106065", "name": "admin"}, "audit_ids": ["R7EbvK58T8u1HSKY6PtkEg"], "issued_at": "2015-06-23T15:09:23.773793Z"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:23 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a6f4732f-aaaa-4bd6-b9ae-9cb22ec247ae Content-Length: - '5874' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-ab1548fd-0c4d-4b9c-9e59-12a1105302c8 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/auth/tokens body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 X-Subject-Token: - 2d543850a9ac4e8bb69f070a7fa01ad8 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:24 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7ffdd504-5d63-4687-8bd2-cc1f118a9600 Content-Length: - '115' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:24 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_endpoint.yml0000644000004100000410000013061412600047642023635 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0d680d45-f5af-41f2-b444-700269afc55e Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d1c59f8b-fc07-44b4-9a91-05b3f999bd48 Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f4a13fba-b310-4166-96c1-84e2c2d36624 Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b2865147-cc83-4478-94d9-ae720808b0d6 Content-Length: - '8876' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"endpoints": [{"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/185eda94de9340e58245062f75d7f80e"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "185eda94de9340e58245062f75d7f80e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/1ce26a6fffd0424bac135b9c68055b6e"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "1ce26a6fffd0424bac135b9c68055b6e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/261aaf6239bb49a4a1cfa87c19859138"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "261aaf6239bb49a4a1cfa87c19859138"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/2f17e155b0aa47838394e6c4f6fe30e0"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "97e665cbada043718180c5a6316df76a", "id": "2f17e155b0aa47838394e6c4f6fe30e0"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/32bb2c6aea944ea6b4956eb24142d2e2"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "europe", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "32bb2c6aea944ea6b4956eb24142d2e2"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/437d282e0bb94622aaacc4d194c069a9"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "437d282e0bb94622aaacc4d194c069a9"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4442fbd064844a7bbe6a792507d4b8e3"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4442fbd064844a7bbe6a792507d4b8e3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/480ea71dc8cf4c959df1c6304be87056"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "480ea71dc8cf4c959df1c6304be87056"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/4b4178fd2e3d4f329600cc4ceaaa7e3a"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "4b4178fd2e3d4f329600cc4ceaaa7e3a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/5e78bf7bae7c4ff5b9720b2c2e4da743"}, "url": "http://devstack.openstack.stack:8776/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "2b92e79c45254516932c633229cd0e8b", "id": "5e78bf7bae7c4ff5b9720b2c2e4da743"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/600638643d22494fad4f30e3b22ae124"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "public", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "600638643d22494fad4f30e3b22ae124"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/6e82c8912d3f49a09df51035681d564c"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "6e82c8912d3f49a09df51035681d564c"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/7e44d321ae80457abc3728fa1e6feb32"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "7e44d321ae80457abc3728fa1e6feb32"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/81c51855280345e9a6c322ca986d4e4b"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "81c51855280345e9a6c322ca986d4e4b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/8a254651925e4a3e9505c863a00c017e"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "8a254651925e4a3e9505c863a00c017e"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/90977723dba04ea9a2a184c99565ccff"}, "url": "http://devstack.openstack.stack:8776/v1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "511b94ce0482484ea09028091dd5e9a5", "id": "90977723dba04ea9a2a184c99565ccff"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/98db699b9ffa4dffb027d78163aad8cc"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "98db699b9ffa4dffb027d78163aad8cc"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9abd6797844d455f875af9537325cba4"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "9abd6797844d455f875af9537325cba4"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/9d2555fd27dd44e5acfb5e56127d974b"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "97e665cbada043718180c5a6316df76a", "id": "9d2555fd27dd44e5acfb5e56127d974b"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/a0310a37cf6144a6a967cbae9a7959ba"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "a0310a37cf6144a6a967cbae9a7959ba"}, {"region_id": "europe", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/b93da6aaba654d8cb451ff8378d7d2a5"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "europe", "enabled": true, "interface": "internal", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "b93da6aaba654d8cb451ff8378d7d2a5"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/c9a090a4597040849c03bc13588167f6"}, "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "0d56500210a24c38a3702b6825e24164", "id": "c9a090a4597040849c03bc13588167f6"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d3b31f24e4ea40699f731e29e625c187"}, "url": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "b577d8f7c7074d04a1165fcca638b600", "id": "d3b31f24e4ea40699f731e29e625c187"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/d5f8e0da0f3345529a5fb324d735d4a3"}, "url": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "cd9002bbadfe495d81b5ee4c50768009", "id": "d5f8e0da0f3345529a5fb324d735d4a3"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, "url": "http://devstack.openstack.stack:8774/v2.1/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "admin", "service_id": "97e665cbada043718180c5a6316df76a", "id": "e8bdd9403fbb4efa8d77bfd4f6a5e34a"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/ece52860cf1e4eb6a8fed05c47a30147"}, "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "enabled": true, "interface": "internal", "service_id": "3364a7b95c664bf89a7a8db081576364", "id": "ece52860cf1e4eb6a8fed05c47a30147"}, {"region_id": "RegionOne", "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints/f6d38c03b9c04a9e924aaa288ce014b8"}, "url": "http://devstack.openstack.stack:8774/v2/$(tenant_id)s", "region": "RegionOne", "enabled": true, "interface": "public", "service_id": "5b7028751ed045d79467c7845ecb8c58", "id": "f6d38c03b9c04a9e924aaa288ce014b8"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/endpoints", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:40 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/endpoints/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:40 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9762e65e-846a-4abc-83bb-8aa657eee9bb Content-Length: - '94' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find endpoint: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:41 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_domain.yml0000644000004100000410000001313012600047642023255 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9e6ba978-decb-4ee6-8667-e163a9983174 Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5d516662-a25d-43a8-9c80-38ab40a7ecaf Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:25 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-41f55c12-a076-4844-a32b-d01821c3790d Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:25 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-14575680-f257-4f8a-b656-14481aedaa27 Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/atlantis body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:26 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d4631565-0c9f-4b7c-9ae0-77e7f0126e3e Content-Length: - '92' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find domain: atlantis", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:26 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_users.yml0000644000004100000410000003067712600047642023166 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:17 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-57c3e3ec-4865-4e4b-91f5-707c94f23ea4 Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users/u-random-blah body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-65913a1e-fbfa-41d4-8270-c54676d18a82 Content-Length: - '95' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find user: u-random-blah", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=admin body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-10e51424-57f8-4986-b6e9-e9004abf7e27 Content-Length: - '322' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=admin", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-8d172234-2fa6-4a23-acd9-0626c87179ce Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-adcc2928-2293-4894-9063-10a079028e81 Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:18 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fc5ff8d3-1e0d-4575-b17d-8252c1b9373f Content-Length: - '1389' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [{"name": "glance", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/07cfb841cddd46819e3dcd5df238ae04"}, "domain_id": "default", "enabled": true, "email": null, "id": "07cfb841cddd46819e3dcd5df238ae04"}, {"name": "demo", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/11ba3db90590446fb6d7e0efe6c1f46a"}, "domain_id": "default", "enabled": true, "email": "demo@example.com", "id": "11ba3db90590446fb6d7e0efe6c1f46a"}, {"name": "cinder", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/1523e8606bd1400cae36a40e0f3f817e"}, "domain_id": "default", "enabled": true, "email": null, "id": "1523e8606bd1400cae36a40e0f3f817e"}, {"name": "nova", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/7afec08993c24bb09df141e513738030"}, "domain_id": "default", "enabled": true, "email": null, "id": "7afec08993c24bb09df141e513738030"}, {"name": "u-foobar", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/938bd5585fd145efaadb4a7e588078c1"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "938bd5585fd145efaadb4a7e588078c1"}, {"name": "admin", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/aa9f25defa6d4cafb48466df83106065"}, "domain_id": "default", "enabled": true, "email": null, "id": "aa9f25defa6d4cafb48466df83106065"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/users", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/users?name=pimpernel body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:18 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f7802cb3-9a40-40f3-a301-f73e6298fd9d Content-Length: - '119' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"users": [], "links": {"self": "http://devstack.openstack.stack:35357/v3/users?name=pimpernel", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:19 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_domain_roles_mutation.yml0000644000004100000410000003661312600047642026414 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:35357/v3/users body: encoding: UTF-8 string: ! '{"user":{"name":"foobar_role_user","email":"foobar@example.com","password":"s3cret!"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-dbd0386b-9861-4b59-b1e2-7ab7d0d5b126 Content-Length: - '244' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"user": {"name": "foobar_role_user", "links": {"self": "http://devstack.openstack.stack:35357/v3/users/706bddd22d5f4e9b8abd918921d184d0"}, "domain_id": "default", "enabled": true, "email": "foobar@example.com", "id": "706bddd22d5f4e9b8abd918921d184d0"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-fdd27062-d3aa-4e22-8b05-cfebe35d41d0 Content-Length: - '159' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles", "previous": null, "next": null}, "roles": []}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"foobar_role"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 201 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-adca599d-8a2d-42ab-ba85-429c05c33b97 Content-Length: - '167' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "c12328d5ad86437c812272cb6de3820f", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/c12328d5ad86437c812272cb6de3820f"}, "name": "foobar_role"}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:27 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-80723982-e811-485c-b93a-9777b8c6f3ce Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:27 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-8edd24e1-4f91-4f0e-9567-90104042de76 Content-Length: - '316' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles", "previous": null, "next": null}, "roles": [{"id": "c12328d5ad86437c812272cb6de3820f", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/c12328d5ad86437c812272cb6de3820f"}, "name": "foobar_role"}]}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments?user.id=706bddd22d5f4e9b8abd918921d184d0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3c301df0-dce4-4e90-a8cb-181c81414b40 Content-Length: - '464' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [{"scope": {"domain": {"id": "default"}}, "role": {"id": "c12328d5ad86437c812272cb6de3820f"}, "user": {"id": "706bddd22d5f4e9b8abd918921d184d0"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f"}}], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments?user.id=706bddd22d5f4e9b8abd918921d184d0", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/role_assignments body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 200 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-397adb81-ae83-4091-bb6c-29e4dbc0d434 Content-Length: - '3530' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role_assignments": [{"scope": {"project": {"id": "956fbf1d663b4d6fa9d26c4d78de113f"}}, "role": {"id": "430e91ef76b74b728a2864bc8a410a60"}, "user": {"id": "07cfb841cddd46819e3dcd5df238ae04"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f/users/07cfb841cddd46819e3dcd5df238ae04/roles/430e91ef76b74b728a2864bc8a410a60"}}, {"scope": {"project": {"id": "3e06db1f2ff64d219d27a3f6858bf602"}}, "role": {"id": "64537dfec884463faf4978fcb9ec1e14"}, "user": {"id": "11ba3db90590446fb6d7e0efe6c1f46a"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/3e06db1f2ff64d219d27a3f6858bf602/users/11ba3db90590446fb6d7e0efe6c1f46a/roles/64537dfec884463faf4978fcb9ec1e14"}}, {"scope": {"project": {"id": "3ed7ee0512b641d3bb1fe17fc86d8bff"}}, "role": {"id": "1348e84f9797426bb6ec4cae1e6289d7"}, "user": {"id": "11ba3db90590446fb6d7e0efe6c1f46a"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff/users/11ba3db90590446fb6d7e0efe6c1f46a/roles/1348e84f9797426bb6ec4cae1e6289d7"}}, {"scope": {"project": {"id": "3ed7ee0512b641d3bb1fe17fc86d8bff"}}, "role": {"id": "64537dfec884463faf4978fcb9ec1e14"}, "user": {"id": "11ba3db90590446fb6d7e0efe6c1f46a"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff/users/11ba3db90590446fb6d7e0efe6c1f46a/roles/64537dfec884463faf4978fcb9ec1e14"}}, {"scope": {"project": {"id": "956fbf1d663b4d6fa9d26c4d78de113f"}}, "role": {"id": "430e91ef76b74b728a2864bc8a410a60"}, "user": {"id": "1523e8606bd1400cae36a40e0f3f817e"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f/users/1523e8606bd1400cae36a40e0f3f817e/roles/430e91ef76b74b728a2864bc8a410a60"}}, {"scope": {"project": {"id": "956fbf1d663b4d6fa9d26c4d78de113f"}}, "role": {"id": "6ead57f8ae124996af8b0beb72ff1007"}, "user": {"id": "7afec08993c24bb09df141e513738030"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/956fbf1d663b4d6fa9d26c4d78de113f/users/7afec08993c24bb09df141e513738030/roles/6ead57f8ae124996af8b0beb72ff1007"}}, {"scope": {"project": {"id": "123ac695d4db400a9001b91bb3b8aa46"}}, "role": {"id": "6ead57f8ae124996af8b0beb72ff1007"}, "user": {"id": "aa9f25defa6d4cafb48466df83106065"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/123ac695d4db400a9001b91bb3b8aa46/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007"}}, {"scope": {"project": {"id": "3ed7ee0512b641d3bb1fe17fc86d8bff"}}, "role": {"id": "6ead57f8ae124996af8b0beb72ff1007"}, "user": {"id": "aa9f25defa6d4cafb48466df83106065"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/projects/3ed7ee0512b641d3bb1fe17fc86d8bff/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007"}}, {"scope": {"domain": {"id": "default"}}, "role": {"id": "c12328d5ad86437c812272cb6de3820f"}, "user": {"id": "706bddd22d5f4e9b8abd918921d184d0"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f"}}, {"scope": {"domain": {"id": "default"}}, "role": {"id": "6ead57f8ae124996af8b0beb72ff1007"}, "user": {"id": "aa9f25defa6d4cafb48466df83106065"}, "links": {"assignment": "http://devstack.openstack.stack:35357/v3/domains/default/users/aa9f25defa6d4cafb48466df83106065/roles/6ead57f8ae124996af8b0beb72ff1007"}}], "links": {"self": "http://devstack.openstack.stack:35357/v3/role_assignments", "previous": null, "next": null}}' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-a244bf4d-5fd8-4082-8e80-3cb28fbf4d01 body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3081cc0e-60f1-4a47-b383-572c0eefc5b2 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: head uri: http://devstack.openstack.stack:35357/v3/domains/default/users/706bddd22d5f4e9b8abd918921d184d0/roles/c12328d5ad86437c812272cb6de3820f body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 404 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-96f4630f-d622-47fa-9b67-3c07a9032d95 Content-Length: - '212' Content-Type: - application/json body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/users/706bddd22d5f4e9b8abd918921d184d0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1bb134cb-6a80-474d-8956-0ed9bedb81ac Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:28 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/c12328d5ad86437c812272cb6de3820f body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0c4458de5ba5446885c65b1dedfb2404 response: status: code: 204 message: '' headers: Date: - Tue, 23 Jun 2015 15:09:28 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7481244e-9f88-4975-956d-6d7b62f0b788 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Tue, 23 Jun 2015 15:09:29 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/identity_v3/idv3_project_hier_crud_list.yml0000644000004100000410000011637112600047642026546 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:35357/v3/domains body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6a9fcfa9-4368-4fa2-82f0-61f16dedb158 Content-Length: - '317' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"domains": [{"links": {"self": "http://devstack.openstack.stack:35357/v3/domains/default"}, "enabled": true, "description": "Owns users and tenants (i.e. projects) available on Identity API v2.", "name": "Default", "id": "default"}], "links": {"self": "http://devstack.openstack.stack:35357/v3/domains", "previous": null, "next": null}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-foobar67"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-c9af88df-0f52-4f8f-a318-492ff1bba5e5 Content-Length: - '251' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4"}, "enabled": true, "id": "edd3bec6a30847349d69216ed4b3e0b4", "parent_id": null, "domain_id": "default", "name": "p-foobar67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-baz67","parent_id":"edd3bec6a30847349d69216ed4b3e0b4"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-14ed4a49-b23f-4d5d-822e-3241a9a28b9f Content-Length: - '278' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0"}, "enabled": true, "id": "570b1075f2a7470ea2b2f009f440b7b0", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-baz67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-baz67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-8517afe6-f361-4004-9a01-411d067f1a92 Content-Length: - '388' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-baz67", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0"}, "enabled": true, "id": "570b1075f2a7470ea2b2f009f440b7b0", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-baz67"}]}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-boo67","parent_id":"edd3bec6a30847349d69216ed4b3e0b4"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-2229c28f-94de-4fdd-b839-e8e23b68c2d3 Content-Length: - '278' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6"}, "enabled": true, "id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-boo67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-booboo67","parent_id":"8e1bc4fbfd6c47fea94d0e6ebad05be6"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:53 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-d36dac0b-3ee8-497f-90b6-ea7ee434bca5 Content-Length: - '281' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259"}, "enabled": true, "id": "15a7ecafe8c44fe18cb9b3ca009f8259", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "domain_id": "default", "name": "p-booboo67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/roles body: encoding: UTF-8 string: ! '{"role":{"name":"r-project67"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-105f752a-0c7a-492a-9080-e8bf5767fa55 Content-Length: - '167' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"role": {"id": "9eeae75b331946dd907f16d3dccb916a", "links": {"self": "http://devstack.openstack.stack:35357/v3/roles/9eeae75b331946dd907f16d3dccb916a"}, "name": "r-project67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:14 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4/users/aa9f25defa6d4cafb48466df83106065/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-895af830-2d83-433d-ba23-8ab43a67483a Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0/users/aa9f25defa6d4cafb48466df83106065/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7f126391-17af-4ca1-a348-fe4280c57450 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6/users/aa9f25defa6d4cafb48466df83106065/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-91451272-cef2-467c-80aa-5de40998c2f2 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259/users/aa9f25defa6d4cafb48466df83106065/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-1cdb03bc-58c5-4d04-b585-19e44ce2d32f Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4?subtree_as_ids body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-0a1a824a-364e-4afc-ba89-91c256128885 Content-Length: - '386' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4"}, "enabled": true, "subtree": {"570b1075f2a7470ea2b2f009f440b7b0": null, "8e1bc4fbfd6c47fea94d0e6ebad05be6": {"15a7ecafe8c44fe18cb9b3ca009f8259": null}}, "id": "edd3bec6a30847349d69216ed4b3e0b4", "parent_id": null, "domain_id": "default", "name": "p-foobar67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4?subtree_as_list body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-b6f5c89d-e9bb-4ab9-9ea7-7ac8c2959b37 Content-Length: - '1107' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4"}, "enabled": true, "subtree": [{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0"}, "enabled": true, "id": "570b1075f2a7470ea2b2f009f440b7b0", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-baz67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6"}, "enabled": true, "id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-boo67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259"}, "enabled": true, "id": "15a7ecafe8c44fe18cb9b3ca009f8259", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "domain_id": "default", "name": "p-booboo67"}}], "id": "edd3bec6a30847349d69216ed4b3e0b4", "parent_id": null, "domain_id": "default", "name": "p-foobar67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: post uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: UTF-8 string: ! '{"project":{"name":"p-fooboo67","parent_id":"8e1bc4fbfd6c47fea94d0e6ebad05be6"}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 201 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7d289ea5-869d-4c95-aa82-194ac4cb805d Content-Length: - '281' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/a288e7f1645e442da84232108c7e3ec9"}, "enabled": true, "id": "a288e7f1645e442da84232108c7e3ec9", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "domain_id": "default", "name": "p-fooboo67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: put uri: http://devstack.openstack.stack:35357/v3/projects/a288e7f1645e442da84232108c7e3ec9/users/aa9f25defa6d4cafb48466df83106065/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-9a87ff8d-26a2-43fb-ad63-cf03e2324854 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4?subtree_as_list body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bee9ca26-a2e6-401b-95da-041161d09bde Content-Length: - '1390' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4"}, "enabled": true, "subtree": [{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0"}, "enabled": true, "id": "570b1075f2a7470ea2b2f009f440b7b0", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-baz67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6"}, "enabled": true, "id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-boo67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259"}, "enabled": true, "id": "15a7ecafe8c44fe18cb9b3ca009f8259", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "domain_id": "default", "name": "p-booboo67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/a288e7f1645e442da84232108c7e3ec9"}, "enabled": true, "id": "a288e7f1645e442da84232108c7e3ec9", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "domain_id": "default", "name": "p-fooboo67"}}], "id": "edd3bec6a30847349d69216ed4b3e0b4", "parent_id": null, "domain_id": "default", "name": "p-foobar67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259?parents_as_ids body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-00f313f0-b3e0-4039-b246-cb2bd06dd51f Content-Length: - '374' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259"}, "enabled": true, "id": "15a7ecafe8c44fe18cb9b3ca009f8259", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parents": {"8e1bc4fbfd6c47fea94d0e6ebad05be6": {"edd3bec6a30847349d69216ed4b3e0b4": null}}, "domain_id": "default", "name": "p-booboo67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259?parents_as_list body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:54 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-343c722a-65c6-4427-8782-b370cca8be6c Content-Length: - '827' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259"}, "enabled": true, "id": "15a7ecafe8c44fe18cb9b3ca009f8259", "parent_id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parents": [{"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6"}, "enabled": true, "id": "8e1bc4fbfd6c47fea94d0e6ebad05be6", "parent_id": "edd3bec6a30847349d69216ed4b3e0b4", "domain_id": "default", "name": "p-boo67"}}, {"project": {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4"}, "enabled": true, "id": "edd3bec6a30847349d69216ed4b3e0b4", "parent_id": null, "domain_id": "default", "name": "p-foobar67"}}], "domain_id": "default", "name": "p-booboo67"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:15 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/a288e7f1645e442da84232108c7e3ec9 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-3e964bce-b106-4edf-bcdc-6da3d74f7f7c Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/15a7ecafe8c44fe18cb9b3ca009f8259 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-e0cd202d-c96f-4b82-b9e9-29650111b15e Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/8e1bc4fbfd6c47fea94d0e6ebad05be6 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-70eb87e6-a48c-4b76-8aa7-f2924b1aadc6 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/570b1075f2a7470ea2b2f009f440b7b0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-997cf019-3a7a-4185-82bb-34a47e38bc21 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-db82b42c-b459-4e5a-9bd8-cb5243f01213 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: delete uri: http://devstack.openstack.stack:35357/v3/roles/9eeae75b331946dd907f16d3dccb916a body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 204 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f3093cb8-4a6e-4510-8121-eb8829aa78e4 Content-Length: - '0' body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-11d93c10-819b-4af0-955c-728e195b9fdc Content-Length: - '1062' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects", "previous": null, "next": null}, "projects": [{"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/287f46e0cc294b8cb0c276dd71b8710f"}, "enabled": true, "id": "287f46e0cc294b8cb0c276dd71b8710f", "parent_id": null, "domain_id": "default", "name": "demo"}, {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/4bd6ed0a80b7465a8b25f4d7df1236ea"}, "enabled": true, "id": "4bd6ed0a80b7465a8b25f4d7df1236ea", "parent_id": null, "domain_id": "default", "name": "invisible_to_admin"}, {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/711f0a64ef5046c084ce904b4445d119"}, "enabled": true, "id": "711f0a64ef5046c084ce904b4445d119", "parent_id": null, "domain_id": "default", "name": "admin"}, {"description": "", "links": {"self": "http://devstack.openstack.stack:35357/v3/projects/a9088d7853b843318cb026dc3373c174"}, "enabled": true, "id": "a9088d7853b843318cb026dc3373c174", "parent_id": null, "domain_id": "default", "name": "service"}]}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects/edd3bec6a30847349d69216ed4b3e0b4 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 404 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-015abdc2-1a35-43d3-bc65-c63f5f2dc272 Content-Length: - '117' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"error": {"message": "Could not find project: edd3bec6a30847349d69216ed4b3e0b4", "code": 404, "title": "Not Found"}}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-booboo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-f02cc3be-a027-491d-9e8a-bb9228e0d4e1 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-booboo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-booboo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:55 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-83df3490-b901-4889-a900-a18e9a12c09f Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-booboo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-fooboo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-6e0fad29-cbf5-43ca-9e78-2df6570346bc Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-fooboo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:16 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-fooboo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-28156923-6d90-46e3-876b-85096a8e4ad5 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-fooboo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-boo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-18d78997-d6be-4192-9354-329878be50ac Content-Length: - '123' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-boo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-boo67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-02cd3c7c-ca92-4bd3-9f97-e76d374c007f Content-Length: - '123' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-boo67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-baz67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-8e20c713-9427-47a0-ba06-677f28a34e90 Content-Length: - '123' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-baz67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-baz67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-4e575274-0e98-4415-be62-29103606464e Content-Length: - '123' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-baz67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-5e735cdd-d6fb-4228-8925-524f6e8a6ba9 Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT - request: method: get uri: http://devstack.openstack.stack:35357/v3/projects?name=p-foobar67 body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - ea1e9622dc8f4802a5f26955ccd8763f response: status: code: 200 message: '' headers: Date: - Fri, 24 Jul 2015 11:03:56 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-7405bdf6-3564-41ac-adc5-bec643ded99e Content-Length: - '126' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"links": {"self": "http://devstack.openstack.stack:35357/v3/projects?name=p-foobar67", "previous": null, "next": null}, "projects": []}' http_version: recorded_at: Fri, 24 Jul 2015 11:04:17 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/network/0000755000004100000410000000000012600047642017570 5ustar www-datawww-datafog-1.34.0/spec/fog/openstack/network/common_setup.yml0000644000004100000410000001743512600047642023035 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v3/auth/tokens body: encoding: UTF-8 string: ! '{"auth":{"identity":{"methods":["password"],"password":{"user":{"password":"password","domain":{"name":"Default"},"name":"admin"}}},"scope":{"project":{"name":"admin","domain":{"name":"Default"}}}}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json response: status: code: 201 message: '' headers: Date: - Thu, 16 Jul 2015 13:30:01 GMT Server: - Apache/2.4.7 (Ubuntu) X-Subject-Token: - 0afbf49d007a4d82850b853b703025d7 Vary: - X-Auth-Token X-Openstack-Request-Id: - req-16fb6527-c6ed-48fc-908c-c4f02a44178a Content-Length: - '5409' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"token": {"methods": ["password"], "roles": [{"id": "c7fc2d49d2f546ab8de6a0901d4408a4", "name": "admin"}], "expires_at": "2015-07-16T14:30:01.464420Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "5b1c4e7218d94dc8879d542002ffbc48", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "admin", "id": "2339b8aa02b3406887552369c5cd8419"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "internal", "id": "4d53c32a49db4d8b96e2e51c43a46a1b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "interface": "public", "id": "cf5bc6fdc4ce416b818c79f45f29f081"}], "type": "ec2", "id": "1b844219e646400ca44176eac9186533", "name": "ec2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v2.0", "region": "RegionOne", "interface": "public", "id": "28314fddad8543e0aa2a2d207d4018a9"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:5000/v2.0", "region": "RegionOne", "interface": "internal", "id": "7c4f7842298b4b8688cb2885cc4d8330"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:35357/v2.0", "region": "RegionOne", "interface": "admin", "id": "f745fca524c149ac934a0d8d392f86a6"}], "type": "identity", "id": "24a331955813408d8676151549cd1b78", "name": "keystone"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "public", "id": "8ff1521affcb4ca3a335993769e9b8f0"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "internal", "id": "e9f7bda53a7d4649a2619ba1b2f10be5"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "admin", "id": "f9ff42e36283417ba05572496dfff99b"}], "type": "volume", "id": "3f9c8198a2724d0ba97648cb8ae33f3d", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "public", "id": "015d9bdeec2c43adb181692fcb52cf3b"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "internal", "id": "e52097447df046cfabc33d6f38a0f9be"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2.1/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "admin", "id": "fe3a8dbf55304123aff67e8344c07376"}], "type": "computev21", "id": "407eeaefaca34073baf78c59f3c26dc3", "name": "novav21"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "public", "id": "12761b1c0f634f7581b986da5080b84a"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "internal", "id": "7968eace2b18475f877b040eec185987"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9292", "region": "RegionOne", "interface": "admin", "id": "eda6b4b034d0431bb3fcd3229326c622"}], "type": "image", "id": "48c8845a0eb243d6802b629dbed2dc79", "name": "glance"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "internal", "id": "00d4a072dd074a6398e5cd35dbbf6913"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "public", "id": "55f0c7b7f8b348c7b7de153ac3388ac8"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8774/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "admin", "id": "afcff3fbd3b04313be932785c50dc0ef"}], "type": "compute", "id": "599e0e4ff2584630bc0fd242443af297", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "admin", "id": "43c972f7af7f465cb3f49d91988427bf"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "internal", "id": "50c9a1fe06094aea908034e55c5e33fe"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:8776/v2/5b1c4e7218d94dc8879d542002ffbc48", "region": "RegionOne", "interface": "public", "id": "dfa345861e48478d8d05ae1d340e5cc9"}], "type": "volumev2", "id": "6520c738495d4688a243d9883213259c", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "interface": "public", "id": "84df3f19b54d46fdbf3c5ecbfb322b10"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "interface": "admin", "id": "9bba82867f4641cfb175a4866f8a8293"}, {"region_id": "RegionOne", "url": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "interface": "internal", "id": "e325c8d1fb0542ccb79dcf4b8a80eb49"}], "type": "network", "id": "fcc46107290f4aa6bb38153ab0a3f63b", "name": "neutron"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "3c3ae1c4f69e404282372fa02bf53cd6", "name": "admin"}, "audit_ids": ["v-kjH6JJTG6PzR3OTMmqfg"], "issued_at": "2015-07-16T13:30:01.464477Z"}}' http_version: recorded_at: Thu, 16 Jul 2015 13:30:18 GMT - request: method: get uri: http://devstack.openstack.stack:9696/ body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0afbf49d007a4d82850b853b703025d7 response: status: code: 200 message: '' headers: Content-Type: - application/json; charset=UTF-8 Content-Length: - '122' Date: - Thu, 16 Jul 2015 13:30:01 GMT body: encoding: US-ASCII string: ! '{"versions": [{"status": "CURRENT", "id": "v2.0", "links": [{"href": "http://devstack.openstack.stack:9696/v2.0", "rel": "self"}]}]}' http_version: recorded_at: Thu, 16 Jul 2015 13:30:18 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/network/subnets_crud.yml0000644000004100000410000000774112600047642023024 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:9696/v2.0/networks body: encoding: UTF-8 string: ! '{"network":{"name":"foo-net12","shared":false}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0afbf49d007a4d82850b853b703025d7 response: status: code: 201 message: '' headers: Content-Type: - application/json; charset=UTF-8 Content-Length: - '344' X-Openstack-Request-Id: - req-cc7677e6-9700-4215-b16d-d4a867db376b Date: - Thu, 16 Jul 2015 13:30:02 GMT body: encoding: US-ASCII string: ! '{"network": {"status": "ACTIVE", "subnets": [], "name": "foo-net12", "provider:physical_network": null, "router:external": false, "tenant_id": "5b1c4e7218d94dc8879d542002ffbc48", "admin_state_up": true, "mtu": 0, "shared": false, "provider:network_type": "vxlan", "id": "0629b827-668a-443c-b73e-1725359350fb", "provider:segmentation_id": 1104}}' http_version: recorded_at: Thu, 16 Jul 2015 13:30:19 GMT - request: method: post uri: http://devstack.openstack.stack:9696/v2.0/subnets body: encoding: UTF-8 string: ! '{"subnet":{"network_id":"0629b827-668a-443c-b73e-1725359350fb","cidr":"172.16.0.0/16","ip_version":4,"name":"my-network","gateway_ip":null}}' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0afbf49d007a4d82850b853b703025d7 response: status: code: 201 message: '' headers: Content-Type: - application/json; charset=UTF-8 Content-Length: - '452' X-Openstack-Request-Id: - req-295d5e91-514b-4980-85a4-adce351161a8 Date: - Thu, 16 Jul 2015 13:30:02 GMT body: encoding: US-ASCII string: ! '{"subnet": {"name": "my-network", "enable_dhcp": true, "network_id": "0629b827-668a-443c-b73e-1725359350fb", "tenant_id": "5b1c4e7218d94dc8879d542002ffbc48", "dns_nameservers": [], "gateway_ip": null, "ipv6_ra_mode": null, "allocation_pools": [{"start": "172.16.0.1", "end": "172.16.255.254"}], "host_routes": [], "ip_version": 4, "ipv6_address_mode": null, "cidr": "172.16.0.0/16", "id": "11bef948-6df8-4fa3-8c21-3fbd3cc4ca6d", "subnetpool_id": null}}' http_version: recorded_at: Thu, 16 Jul 2015 13:30:19 GMT - request: method: delete uri: http://devstack.openstack.stack:9696/v2.0/subnets/11bef948-6df8-4fa3-8c21-3fbd3cc4ca6d body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0afbf49d007a4d82850b853b703025d7 response: status: code: 204 message: '' headers: Content-Length: - '0' X-Openstack-Request-Id: - req-5c4205db-8183-4eeb-a702-e6e156f82db1 Date: - Thu, 16 Jul 2015 13:30:03 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Thu, 16 Jul 2015 13:30:20 GMT - request: method: delete uri: http://devstack.openstack.stack:9696/v2.0/networks/0629b827-668a-443c-b73e-1725359350fb body: encoding: US-ASCII string: '' headers: User-Agent: - fog-core/1.32.0 Content-Type: - application/json Accept: - application/json X-Auth-Token: - 0afbf49d007a4d82850b853b703025d7 response: status: code: 204 message: '' headers: Content-Length: - '0' X-Openstack-Request-Id: - req-f21f4c07-2e64-4920-a53d-19f221af0c99 Date: - Thu, 16 Jul 2015 13:30:03 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Thu, 16 Jul 2015 13:30:20 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/0000755000004100000410000000000012600047642017406 5ustar www-datawww-datafog-1.34.0/spec/fog/openstack/volume/volume_crud.yml0000644000004100000410000004704312600047642022465 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-3bd92e19-bafd-43f9-8a8a-26c19db29cbf Content-Type: - application/json Content-Length: - '15' X-Openstack-Request-Id: - req-3bd92e19-bafd-43f9-8a8a-26c19db29cbf Date: - Fri, 26 Jun 2015 13:35:58 GMT body: encoding: US-ASCII string: ! '{"volumes": []}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:57 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes body: encoding: UTF-8 string: ! '{"volume":{"display_name":"fog-testvolume-1","display_description":"This is the volume description.","size":1}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-a903cbb9-b393-4f24-9a2f-0016de0571f1 Content-Type: - application/json Content-Length: - '431' X-Openstack-Request-Id: - req-a903cbb9-b393-4f24-9a2f-0016de0571f1 Date: - Fri, 26 Jun 2015 13:35:59 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.110068", "multiattach": "false", "display_description": "This is the volume description.", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:58 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-95049a1e-955f-46e5-9832-3adf683228aa Content-Type: - application/json Content-Length: - '737' X-Openstack-Request-Id: - req-95049a1e-955f-46e5-9832-3adf683228aa Date: - Fri, 26 Jun 2015 13:35:59 GMT body: encoding: US-ASCII string: ! '{"volumes": [{"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}]}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:58 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-176936ac-56d2-4f9d-be44-8f27b5f5e6d0 Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-176936ac-56d2-4f9d-be44-8f27b5f5e6d0 Date: - Fri, 26 Jun 2015 13:35:59 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:58 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-1845ec60-807a-410a-bec1-74706aa4eaaa Content-Type: - application/json Content-Length: - '735' X-Openstack-Request-Id: - req-1845ec60-807a-410a-bec1-74706aa4eaaa Date: - Fri, 26 Jun 2015 13:36:00 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:59 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-2d7c72ac-9d2c-42d8-8de4-8b198ef8932f Content-Type: - application/json Content-Length: - '738' X-Openstack-Request-Id: - req-2d7c72ac-9d2c-42d8-8de4-8b198ef8932f Date: - Fri, 26 Jun 2015 13:36:00 GMT body: encoding: US-ASCII string: ! '{"volumes": [{"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}]}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:59 GMT - request: method: delete uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-d4aaeabe-5ed4-4369-af2c-4678e6058bbb Date: - Fri, 26 Jun 2015 13:36:00 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 26 Jun 2015 13:35:59 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-a48b93bb-3c15-462a-95c7-1c1f346658b8 Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-a48b93bb-3c15-462a-95c7-1c1f346658b8 Date: - Fri, 26 Jun 2015 13:36:01 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:59 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-21ad29d5-807e-4b88-b88d-64b6ce5cf5e6 Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-21ad29d5-807e-4b88-b88d-64b6ce5cf5e6 Date: - Fri, 26 Jun 2015 13:36:03 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:36:01 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-9059675a-ce9d-4d2b-9867-f102797f921c Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-9059675a-ce9d-4d2b-9867-f102797f921c Date: - Fri, 26 Jun 2015 13:36:06 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:36:05 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-d9239b96-bc04-4ac5-8403-330a44b7fdf0 Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-d9239b96-bc04-4ac5-8403-330a44b7fdf0 Date: - Fri, 26 Jun 2015 13:36:12 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:36:11 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-51574ae9-cc4b-406b-9942-81bc71870ba8 Content-Type: - application/json Content-Length: - '734' X-Openstack-Request-Id: - req-51574ae9-cc4b-406b-9942-81bc71870ba8 Date: - Fri, 26 Jun 2015 13:36:22 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-06-26T13:35:59.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": "This is the volume description.", "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "8430ef04-0235-471e-9940-1e26aa3edf18", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 26 Jun 2015 13:36:21 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/8430ef04-0235-471e-9940-1e26aa3edf18 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 404 message: '' headers: Content-Length: - '78' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-0b0cd5cb-b77d-4f2f-8893-645c362a5405 X-Openstack-Request-Id: - req-0b0cd5cb-b77d-4f2f-8893-645c362a5405 Date: - Fri, 26 Jun 2015 13:36:38 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "The resource could not be found.", "code": 404}}' http_version: recorded_at: Fri, 26 Jun 2015 13:36:37 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/common_setup.yml0000644000004100000410000001151312600047642022642 0ustar www-datawww-data--- http_interactions: - request: method: post uri: http://devstack.openstack.stack:5000/v2.0/tokens body: encoding: UTF-8 string: ! '{"auth":{"passwordCredentials":{"username":"admin","password":"devstack"},"tenantName":"admin"}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json response: status: code: 200 message: '' headers: Date: - Fri, 26 Jun 2015 13:35:58 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-435ce828-0ac1-4604-b201-2122e542b8f8 Content-Length: - '3372' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"access": {"token": {"issued_at": "2015-06-26T13:35:58.533779", "expires": "2015-06-26T14:35:58Z", "id": "fb5eafb443894cc59c09cf4608dbc5eb", "tenant": {"description": null, "enabled": true, "id": "a19e9490e4504b0b877c55510dfb2842", "name": "admin"}, "audit_ids": ["JoP9cVO1TCmHH4zDFyDEMQ"]}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2/a19e9490e4504b0b877c55510dfb2842", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2/a19e9490e4504b0b877c55510dfb2842", "id": "5f99314d6aa444aba3316a2c835fae1f", "publicURL": "http://devstack.openstack.stack:8774/v2/a19e9490e4504b0b877c55510dfb2842"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9696/", "id": "485e6aa876c54d6cbabfabb8b75d2ca8", "publicURL": "http://devstack.openstack.stack:9696/"}], "endpoints_links": [], "type": "network", "name": "neutron"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v2/a19e9490e4504b0b877c55510dfb2842", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v2/a19e9490e4504b0b877c55510dfb2842", "id": "3b404d1a53ee40db9366cda01d6a9207", "publicURL": "http://devstack.openstack.stack:8776/v2/a19e9490e4504b0b877c55510dfb2842"}], "endpoints_links": [], "type": "volumev2", "name": "cinderv2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9292", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9292", "id": "0763767feeda4ac7bb880ce0269c7e91", "publicURL": "http://devstack.openstack.stack:9292"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842", "id": "7b5d83586d744c9e9a8d953de2d7d872", "publicURL": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8773/", "id": "1aab71b806254f9b9d0c8bbad744c7b5", "publicURL": "http://devstack.openstack.stack:8773/"}], "endpoints_links": [], "type": "ec2", "name": "ec2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2.1/a19e9490e4504b0b877c55510dfb2842", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2.1/a19e9490e4504b0b877c55510dfb2842", "id": "99dbbb73e0ec4d0bb5d2309f0f01d7c6", "publicURL": "http://devstack.openstack.stack:8774/v2.1/a19e9490e4504b0b877c55510dfb2842"}], "endpoints_links": [], "type": "computev21", "name": "novav21"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "5f2863be815548a08b981f31a61168b7", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identity", "name": "keystone"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "20c8dd0c12d443a8be582684e97dcc29", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identityv3", "name": ""}], "user": {"username": "admin", "roles_links": [], "id": "8a5a547492164072a992ef51978bda6c", "roles": [{"name": "admin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["b8613a6b48264d21870f6fa7da65aa88"]}}}' http_version: recorded_at: Fri, 26 Jun 2015 13:35:57 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/volume_transfer_and_accept.yml0000644000004100000410000011100712600047642025505 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-b5b3fdde-d48a-432b-9f6f-9cb8c3e25a7a Content-Type: - application/json Content-Length: - '15' X-Openstack-Request-Id: - req-b5b3fdde-d48a-432b-9f6f-9cb8c3e25a7a Date: - Wed, 08 Jul 2015 12:18:20 GMT body: encoding: US-ASCII string: ! '{"volumes": []}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:20 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes body: encoding: UTF-8 string: ! '{"volume":{"display_name":"fog-testvolume-1","display_description":null,"size":1}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-4ccbb84a-d095-47ba-8de8-ce690c6391e1 Content-Type: - application/json Content-Length: - '402' X-Openstack-Request-Id: - req-4ccbb84a-d095-47ba-8de8-ce690c6391e1 Date: - Wed, 08 Jul 2015 12:18:21 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.309197", "multiattach": "false", "display_description": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:21 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-4cabda12-0f54-4942-be26-ad08e5d32ccf Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-4cabda12-0f54-4942-be26-ad08e5d32ccf Date: - Wed, 08 Jul 2015 12:18:21 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:21 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-c95841ff-472a-4a0c-a632-f39af2bb88de Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-c95841ff-472a-4a0c-a632-f39af2bb88de Date: - Wed, 08 Jul 2015 12:18:23 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-29d54726-4943-4d11-adb8-916918287908 Content-Type: - application/json Content-Length: - '17' X-Openstack-Request-Id: - req-29d54726-4943-4d11-adb8-916918287908 Date: - Wed, 08 Jul 2015 12:18:23 GMT body: encoding: US-ASCII string: ! '{"transfers": []}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer body: encoding: UTF-8 string: ! '{"transfer":{"volume_id":"b80c26fd-1c54-47ff-a366-835a52449aaf","name":"fog-testtransfer-1"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: X-Compute-Request-Id: - req-a1aa75ce-4488-4b69-8cc0-cfa1ba8d0b49 Content-Type: - application/json Content-Length: - '519' X-Openstack-Request-Id: - req-a1aa75ce-4488-4b69-8cc0-cfa1ba8d0b49 Date: - Wed, 08 Jul 2015 12:18:23 GMT body: encoding: US-ASCII string: ! '{"transfer": {"auth_key": "32d7fed244c4109a", "links": [{"href": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "self"}, {"href": "http://devstack.openstack.stack:8776/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "bookmark"}], "created_at": "2015-07-08T12:18:23.476930", "volume_id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "id": "f47f97c3-49de-4b25-8cf9-b720dbba7c77", "name": "fog-testtransfer-1"}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-84326a94-25c0-4183-8c17-6d0e87eb12a0 Content-Type: - application/json Content-Length: - '487' X-Openstack-Request-Id: - req-84326a94-25c0-4183-8c17-6d0e87eb12a0 Date: - Wed, 08 Jul 2015 12:18:23 GMT body: encoding: US-ASCII string: ! '{"transfer": {"created_at": "2015-07-08T12:18:23.000000", "volume_id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "id": "f47f97c3-49de-4b25-8cf9-b720dbba7c77", "links": [{"href": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "self"}, {"href": "http://devstack.openstack.stack:8776/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "bookmark"}], "name": "fog-testtransfer-1"}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-d748265b-5fe9-44ee-88ae-a996051f7e92 Content-Type: - application/json Content-Length: - '490' X-Openstack-Request-Id: - req-d748265b-5fe9-44ee-88ae-a996051f7e92 Date: - Wed, 08 Jul 2015 12:18:23 GMT body: encoding: US-ASCII string: ! '{"transfers": [{"created_at": "2015-07-08T12:18:23.000000", "volume_id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "id": "f47f97c3-49de-4b25-8cf9-b720dbba7c77", "links": [{"href": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "self"}, {"href": "http://devstack.openstack.stack:8776/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "bookmark"}], "name": "fog-testtransfer-1"}]}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v2.0/tokens body: encoding: UTF-8 string: ! '{"auth":{"passwordCredentials":{"username":"demo","password":"devstack"},"tenantName":"demo"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json response: status: code: 200 message: '' headers: Date: - Wed, 08 Jul 2015 12:18:23 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-bb9f266f-5b3d-498e-bf47-3fb56a86aa0f Content-Length: - '3431' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"access": {"token": {"issued_at": "2015-07-08T12:18:24.009113", "expires": "2015-07-08T13:18:23Z", "id": "5470ca7d1eec4630a8c29b236362e2ac", "tenant": {"description": null, "enabled": true, "id": "7ed57f3de3b943bab8a62ee4a7832100", "name": "demo"}, "audit_ids": ["eTA95ydeTOuHhxgLZpnsjg"]}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100", "id": "5f99314d6aa444aba3316a2c835fae1f", "publicURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9696/", "id": "485e6aa876c54d6cbabfabb8b75d2ca8", "publicURL": "http://devstack.openstack.stack:9696/"}], "endpoints_links": [], "type": "network", "name": "neutron"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100", "id": "3b404d1a53ee40db9366cda01d6a9207", "publicURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "volumev2", "name": "cinderv2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9292", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9292", "id": "0763767feeda4ac7bb880ce0269c7e91", "publicURL": "http://devstack.openstack.stack:9292"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100", "id": "7b5d83586d744c9e9a8d953de2d7d872", "publicURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8773/", "id": "1aab71b806254f9b9d0c8bbad744c7b5", "publicURL": "http://devstack.openstack.stack:8773/"}], "endpoints_links": [], "type": "ec2", "name": "ec2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100", "id": "99dbbb73e0ec4d0bb5d2309f0f01d7c6", "publicURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "computev21", "name": "novav21"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "5f2863be815548a08b981f31a61168b7", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identity", "name": "keystone"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "20c8dd0c12d443a8be582684e97dcc29", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identityv3", "name": ""}], "user": {"username": "demo", "roles_links": [], "id": "30d694c45f814cc890d6df70623db68d", "roles": [{"name": "anotherrole"}, {"name": "Member"}], "name": "demo"}, "metadata": {"is_admin": 0, "roles": ["7c90fc56abdc48f9bfb727b3f4a34564", "b883a05dd56144a18bf65a9b6e16d7dc"]}}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:23 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 404 message: '' headers: Content-Length: - '111' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-82790bf5-e47f-4d8b-a22c-f40ba7105a3a X-Openstack-Request-Id: - req-82790bf5-e47f-4d8b-a22c-f40ba7105a3a Date: - Wed, 08 Jul 2015 12:18:24 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "Transfer f47f97c3-49de-4b25-8cf9-b720dbba7c77 could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:24 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-88d29103-b385-4608-8a16-bc53fd4127fc Content-Type: - application/json Content-Length: - '17' X-Openstack-Request-Id: - req-88d29103-b385-4608-8a16-bc53fd4127fc Date: - Wed, 08 Jul 2015 12:18:24 GMT body: encoding: US-ASCII string: ! '{"transfers": []}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:24 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/ec8ff7e8-81e2-4e12-b9fb-3e8890612c2d/accept body: encoding: UTF-8 string: ! '{"accept":{"auth_key":"32d7fed244c4109a"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 404 message: '' headers: Content-Length: - '129' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-16bea751-80ef-490f-9d7d-5e2cc70abec3 X-Openstack-Request-Id: - req-16bea751-80ef-490f-9d7d-5e2cc70abec3 Date: - Wed, 08 Jul 2015 12:18:24 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "TransferNotFound: Transfer ec8ff7e8-81e2-4e12-b9fb-3e8890612c2d could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:24 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77/accept body: encoding: UTF-8 string: ! '{"accept":{"auth_key":"invalidauthkey"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 400 message: '' headers: Content-Length: - '141' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-a91b585e-5cd8-4d1c-842c-3cedf3657398 X-Openstack-Request-Id: - req-a91b585e-5cd8-4d1c-842c-3cedf3657398 Date: - Wed, 08 Jul 2015 12:18:24 GMT body: encoding: US-ASCII string: ! '{"badRequest": {"message": "Invalid auth key: Attempt to transfer f47f97c3-49de-4b25-8cf9-b720dbba7c77 with invalid auth key.", "code": 400}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:24 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77/accept body: encoding: UTF-8 string: ! '{"accept":{"auth_key":"32d7fed244c4109a"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 202 message: '' headers: X-Compute-Request-Id: - req-b492d1c2-27c6-4ef9-b5bc-6c9d082276b6 Content-Type: - application/json Content-Length: - '443' X-Openstack-Request-Id: - req-b492d1c2-27c6-4ef9-b5bc-6c9d082276b6 Date: - Wed, 08 Jul 2015 12:18:25 GMT body: encoding: US-ASCII string: ! '{"transfer": {"links": [{"href": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "self"}, {"href": "http://devstack.openstack.stack:8776/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77", "rel": "bookmark"}], "id": "f47f97c3-49de-4b25-8cf9-b720dbba7c77", "name": "fog-testtransfer-1", "volume_id": "b80c26fd-1c54-47ff-a366-835a52449aaf"}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:25 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-21f82e5e-90cc-41c2-bb46-9b51ebcd4480 Content-Type: - application/json Content-Length: - '561' X-Openstack-Request-Id: - req-21f82e5e-90cc-41c2-bb46-9b51ebcd4480 Date: - Wed, 08 Jul 2015 12:18:25 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:25 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 404 message: '' headers: Content-Length: - '111' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-b564f461-a8c0-410f-9ac2-289ec43ec378 X-Openstack-Request-Id: - req-b564f461-a8c0-410f-9ac2-289ec43ec378 Date: - Wed, 08 Jul 2015 12:18:25 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "Transfer f47f97c3-49de-4b25-8cf9-b720dbba7c77 could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:25 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-45a04ca4-c3c9-4cde-b37e-1b5e67396ef3 Content-Type: - application/json Content-Length: - '17' X-Openstack-Request-Id: - req-45a04ca4-c3c9-4cde-b37e-1b5e67396ef3 Date: - Wed, 08 Jul 2015 12:18:25 GMT body: encoding: US-ASCII string: ! '{"transfers": []}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:25 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/f47f97c3-49de-4b25-8cf9-b720dbba7c77 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 404 message: '' headers: Content-Length: - '111' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-e1ffca03-6e9f-4052-98df-b04d915df641 X-Openstack-Request-Id: - req-e1ffca03-6e9f-4052-98df-b04d915df641 Date: - Wed, 08 Jul 2015 12:18:26 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "Transfer f47f97c3-49de-4b25-8cf9-b720dbba7c77 could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:26 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-8c4faa1e-3de7-4db9-8048-810ec70ff34e Content-Type: - application/json Content-Length: - '17' X-Openstack-Request-Id: - req-8c4faa1e-3de7-4db9-8048-810ec70ff34e Date: - Wed, 08 Jul 2015 12:18:26 GMT body: encoding: US-ASCII string: ! '{"transfers": []}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:26 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-e91354d3-f4bf-4267-9651-62df9e3d6e4f Content-Type: - application/json Content-Length: - '561' X-Openstack-Request-Id: - req-e91354d3-f4bf-4267-9651-62df9e3d6e4f Date: - Wed, 08 Jul 2015 12:18:26 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:26 GMT - request: method: delete uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-552869b5-77fe-4036-b81e-91ba198e3c8c Date: - Wed, 08 Jul 2015 12:18:26 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Wed, 08 Jul 2015 12:18:26 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-b3d7f8dd-0b62-4dbd-80d3-17332da0f28d Content-Type: - application/json Content-Length: - '560' X-Openstack-Request-Id: - req-b3d7f8dd-0b62-4dbd-80d3-17332da0f28d Date: - Wed, 08 Jul 2015 12:18:27 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:27 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-eff4cd0f-74b1-49a4-b80f-44bf9b1979d9 Content-Type: - application/json Content-Length: - '560' X-Openstack-Request-Id: - req-eff4cd0f-74b1-49a4-b80f-44bf9b1979d9 Date: - Wed, 08 Jul 2015 12:18:28 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:28 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-c1e260f3-a709-4ec3-80f0-48776d32c86f Content-Type: - application/json Content-Length: - '560' X-Openstack-Request-Id: - req-c1e260f3-a709-4ec3-80f0-48776d32c86f Date: - Wed, 08 Jul 2015 12:18:31 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:31 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-7a90cb19-9694-4543-b016-94fceb04f3f6 Content-Type: - application/json Content-Length: - '560' X-Openstack-Request-Id: - req-7a90cb19-9694-4543-b016-94fceb04f3f6 Date: - Wed, 08 Jul 2015 12:18:37 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T12:18:21.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "7ed57f3de3b943bab8a62ee4a7832100", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "b80c26fd-1c54-47ff-a366-835a52449aaf", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:37 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/volumes/b80c26fd-1c54-47ff-a366-835a52449aaf body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - 5470ca7d1eec4630a8c29b236362e2ac response: status: code: 404 message: '' headers: Content-Length: - '78' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-2516176b-274d-44f9-a8f7-173fad09b80d X-Openstack-Request-Id: - req-2516176b-274d-44f9-a8f7-173fad09b80d Date: - Wed, 08 Jul 2015 12:18:46 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "The resource could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 12:18:46 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/volume_transfer_and_delete.yml0000644000004100000410000006226212600047642025520 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-cfbdc0b7-ea74-4e0b-88b0-06f772c9d26b Content-Type: - application/json Content-Length: - '15' X-Openstack-Request-Id: - req-cfbdc0b7-ea74-4e0b-88b0-06f772c9d26b Date: - Wed, 08 Jul 2015 13:20:07 GMT body: encoding: US-ASCII string: ! '{"volumes": []}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:07 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes body: encoding: UTF-8 string: ! '{"volume":{"display_name":"fog-testvolume-1","display_description":null,"size":1}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-a66bf283-1d45-441d-81c7-b21180d0fb7e Content-Type: - application/json Content-Length: - '402' X-Openstack-Request-Id: - req-a66bf283-1d45-441d-81c7-b21180d0fb7e Date: - Wed, 08 Jul 2015 13:20:08 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.905147", "multiattach": "false", "display_description": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:07 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-8cb838c2-2978-42ec-b6ec-b6a4c40a679c Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-8cb838c2-2978-42ec-b6ec-b6a4c40a679c Date: - Wed, 08 Jul 2015 13:20:08 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:08 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-e138bafd-33f5-417e-9f30-3f24c129df06 Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-e138bafd-33f5-417e-9f30-3f24c129df06 Date: - Wed, 08 Jul 2015 13:20:09 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:09 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/detail?name=fog-testtransfer-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-91ffcdad-65cb-4f53-aacf-821baec8d082 Content-Type: - application/json Content-Length: - '17' X-Openstack-Request-Id: - req-91ffcdad-65cb-4f53-aacf-821baec8d082 Date: - Wed, 08 Jul 2015 13:20:09 GMT body: encoding: US-ASCII string: ! '{"transfers": []}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:09 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer body: encoding: UTF-8 string: ! '{"transfer":{"volume_id":"9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c","name":"fog-testtransfer-1"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: X-Compute-Request-Id: - req-473a5768-6ef3-4d27-816c-1bbc1ef4bbf2 Content-Type: - application/json Content-Length: - '519' X-Openstack-Request-Id: - req-473a5768-6ef3-4d27-816c-1bbc1ef4bbf2 Date: - Wed, 08 Jul 2015 13:20:10 GMT body: encoding: US-ASCII string: ! '{"transfer": {"auth_key": "e20c00959ae73043", "links": [{"href": "http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/9f13f1ae-bc43-47d0-b7f9-c3401c687b72", "rel": "self"}, {"href": "http://devstack.openstack.stack:8776/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/9f13f1ae-bc43-47d0-b7f9-c3401c687b72", "rel": "bookmark"}], "created_at": "2015-07-08T13:20:10.541862", "volume_id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "id": "9f13f1ae-bc43-47d0-b7f9-c3401c687b72", "name": "fog-testtransfer-1"}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:10 GMT - request: method: post uri: http://devstack.openstack.stack:5000/v2.0/tokens body: encoding: UTF-8 string: ! '{"auth":{"passwordCredentials":{"username":"demo","password":"devstack"},"tenantName":"demo"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json response: status: code: 200 message: '' headers: Date: - Wed, 08 Jul 2015 13:20:10 GMT Server: - Apache/2.4.7 (Ubuntu) Vary: - X-Auth-Token X-Openstack-Request-Id: - req-10b7e171-f836-40f4-8426-534155a5c19b Content-Length: - '3431' Content-Type: - application/json body: encoding: US-ASCII string: ! '{"access": {"token": {"issued_at": "2015-07-08T13:20:10.763537", "expires": "2015-07-08T14:20:10Z", "id": "b42ea28268f44373905dc4648572ce18", "tenant": {"description": null, "enabled": true, "id": "7ed57f3de3b943bab8a62ee4a7832100", "name": "demo"}, "audit_ids": ["mYB99T7DR9empXGdg0J97w"]}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100", "id": "5f99314d6aa444aba3316a2c835fae1f", "publicURL": "http://devstack.openstack.stack:8774/v2/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9696/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9696/", "id": "485e6aa876c54d6cbabfabb8b75d2ca8", "publicURL": "http://devstack.openstack.stack:9696/"}], "endpoints_links": [], "type": "network", "name": "neutron"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100", "id": "3b404d1a53ee40db9366cda01d6a9207", "publicURL": "http://devstack.openstack.stack:8776/v2/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "volumev2", "name": "cinderv2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:9292", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:9292", "id": "0763767feeda4ac7bb880ce0269c7e91", "publicURL": "http://devstack.openstack.stack:9292"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100", "id": "7b5d83586d744c9e9a8d953de2d7d872", "publicURL": "http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8773/", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8773/", "id": "1aab71b806254f9b9d0c8bbad744c7b5", "publicURL": "http://devstack.openstack.stack:8773/"}], "endpoints_links": [], "type": "ec2", "name": "ec2"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100", "id": "99dbbb73e0ec4d0bb5d2309f0f01d7c6", "publicURL": "http://devstack.openstack.stack:8774/v2.1/7ed57f3de3b943bab8a62ee4a7832100"}], "endpoints_links": [], "type": "computev21", "name": "novav21"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:35357/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "5f2863be815548a08b981f31a61168b7", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identity", "name": "keystone"}, {"endpoints": [{"adminURL": "http://devstack.openstack.stack:5000/v3", "region": "RegionOne", "internalURL": "http://devstack.openstack.stack:5000/v3", "id": "20c8dd0c12d443a8be582684e97dcc29", "publicURL": "http://devstack.openstack.stack:5000/v3"}], "endpoints_links": [], "type": "identityv3", "name": ""}], "user": {"username": "demo", "roles_links": [], "id": "30d694c45f814cc890d6df70623db68d", "roles": [{"name": "anotherrole"}, {"name": "Member"}], "name": "demo"}, "metadata": {"is_admin": 0, "roles": ["7c90fc56abdc48f9bfb727b3f4a34564", "b883a05dd56144a18bf65a9b6e16d7dc"]}}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:10 GMT - request: method: delete uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/os-volume-transfer/9f13f1ae-bc43-47d0-b7f9-c3401c687b72 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-f7d9af74-701f-4e30-be04-530e6c6321d7 Date: - Wed, 08 Jul 2015 13:20:11 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Wed, 08 Jul 2015 13:20:10 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/7ed57f3de3b943bab8a62ee4a7832100/os-volume-transfer/9f13f1ae-bc43-47d0-b7f9-c3401c687b72/accept body: encoding: UTF-8 string: ! '{"accept":{"auth_key":"e20c00959ae73043"}}' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - b42ea28268f44373905dc4648572ce18 response: status: code: 404 message: '' headers: Content-Length: - '129' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-59de6528-cb03-4557-9ea1-b5df3e114bd6 X-Openstack-Request-Id: - req-59de6528-cb03-4557-9ea1-b5df3e114bd6 Date: - Wed, 08 Jul 2015 13:20:11 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "TransferNotFound: Transfer 9f13f1ae-bc43-47d0-b7f9-c3401c687b72 could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:10 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-b6c274fa-84ce-43d7-8004-88973cbe696f Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-b6c274fa-84ce-43d7-8004-88973cbe696f Date: - Wed, 08 Jul 2015 13:20:11 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:11 GMT - request: method: delete uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-cee06395-544f-4c66-8b01-a77d4799e242 Date: - Wed, 08 Jul 2015 13:20:11 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Wed, 08 Jul 2015 13:20:11 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-5f8eb6be-abfa-45c3-a75d-fdfc0e8b5453 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-5f8eb6be-abfa-45c3-a75d-fdfc0e8b5453 Date: - Wed, 08 Jul 2015 13:20:12 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:12 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-a18a883c-a1bb-4aef-af7e-9792520ad7b2 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-a18a883c-a1bb-4aef-af7e-9792520ad7b2 Date: - Wed, 08 Jul 2015 13:20:14 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:13 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-31b80cb5-7a98-4078-a206-0ca021198d0f Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-31b80cb5-7a98-4078-a206-0ca021198d0f Date: - Wed, 08 Jul 2015 13:20:17 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:17 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-c9b52e02-519d-48b1-82d2-5252374d35c5 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-c9b52e02-519d-48b1-82d2-5252374d35c5 Date: - Wed, 08 Jul 2015 13:20:23 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-08T13:20:07.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:22 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/9d07d2a6-8fa6-4eca-8aa0-bf925de3f16c body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.32.0 fog-core/1.32.0 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 404 message: '' headers: Content-Length: - '78' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-6d5b6e3b-4e94-470a-a496-747807fbfdeb X-Openstack-Request-Id: - req-6d5b6e3b-4e94-470a-a496-747807fbfdeb Date: - Wed, 08 Jul 2015 13:20:31 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "The resource could not be found.", "code": 404}}' http_version: recorded_at: Wed, 08 Jul 2015 13:20:31 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/volume_extend.yml0000644000004100000410000006317412600047642023022 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-16b79930-2aa4-4e85-b02e-cb20f2c1baf2 Content-Type: - application/json Content-Length: - '15' X-Openstack-Request-Id: - req-16b79930-2aa4-4e85-b02e-cb20f2c1baf2 Date: - Fri, 03 Jul 2015 12:39:33 GMT body: encoding: US-ASCII string: ! '{"volumes": []}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:33 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes body: encoding: UTF-8 string: ! '{"volume":{"display_name":"fog-testvolume-1","display_description":null,"size":1}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-89dab305-0f58-4ff2-9d0c-3f809714148a Content-Type: - application/json Content-Length: - '402' X-Openstack-Request-Id: - req-89dab305-0f58-4ff2-9d0c-3f809714148a Date: - Fri, 03 Jul 2015 12:39:34 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.021237", "multiattach": "false", "display_description": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "size": 1}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:33 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/detail?display_name=fog-testvolume-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-1eab97d4-73df-40f8-9626-82655ee1323f Content-Type: - application/json Content-Length: - '708' X-Openstack-Request-Id: - req-1eab97d4-73df-40f8-9626-82655ee1323f Date: - Fri, 03 Jul 2015 12:39:34 GMT body: encoding: US-ASCII string: ! '{"volumes": [{"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 1}]}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:33 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-da2bad46-3591-457e-8801-fa6bbfe452ac Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-da2bad46-3591-457e-8801-fa6bbfe452ac Date: - Fri, 03 Jul 2015 12:39:34 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "creating", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:34 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-23f18e81-6113-4e88-9675-ba46b30e0aaa Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-23f18e81-6113-4e88-9675-ba46b30e0aaa Date: - Fri, 03 Jul 2015 12:39:34 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:34 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0/action body: encoding: UTF-8 string: ! '{"os-extend":{"new_size":2}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-d5bb36f6-f9e8-452d-a9b8-adfa2e55372a Date: - Fri, 03 Jul 2015 12:39:35 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 03 Jul 2015 12:39:34 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-082f5196-64d9-470a-a3e6-8355c0173522 Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-082f5196-64d9-470a-a3e6-8355c0173522 Date: - Fri, 03 Jul 2015 12:39:35 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "extending", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 1}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:35 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-4f2e0d28-c78f-4e2e-b2a0-e52702d1268a Content-Type: - application/json Content-Length: - '706' X-Openstack-Request-Id: - req-4f2e0d28-c78f-4e2e-b2a0-e52702d1268a Date: - Fri, 03 Jul 2015 12:39:36 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "available", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:36 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0/action body: encoding: UTF-8 string: ! '{"os-extend":{"new_size":1}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 400 message: '' headers: Content-Length: - '149' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-5aa179b9-f49a-4ad8-a511-850f622fb2be X-Openstack-Request-Id: - req-5aa179b9-f49a-4ad8-a511-850f622fb2be Date: - Fri, 03 Jul 2015 12:39:37 GMT body: encoding: US-ASCII string: ! '{"badRequest": {"message": "Invalid input received: New size for extend must be greater than current size. (current: 2, extended: 1).", "code": 400}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:36 GMT - request: method: delete uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 202 message: '' headers: Content-Type: - text/html; charset=UTF-8 Content-Length: - '0' X-Openstack-Request-Id: - req-eb00b584-4373-442a-beb5-6c02e260fba9 Date: - Fri, 03 Jul 2015 12:39:37 GMT body: encoding: US-ASCII string: '' http_version: recorded_at: Fri, 03 Jul 2015 12:39:37 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-99f0bd48-f5f3-4ba0-ac46-291302294a60 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-99f0bd48-f5f3-4ba0-ac46-291302294a60 Date: - Fri, 03 Jul 2015 12:39:37 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:37 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-29479376-1b77-4fb3-9381-16d2656847d3 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-29479376-1b77-4fb3-9381-16d2656847d3 Date: - Fri, 03 Jul 2015 12:39:39 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:38 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-adf4c117-6385-4f7b-b9ae-25d59206ef22 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-adf4c117-6385-4f7b-b9ae-25d59206ef22 Date: - Fri, 03 Jul 2015 12:39:43 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:43 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-89552932-4cef-424d-a60f-18acefec90bf Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-89552932-4cef-424d-a60f-18acefec90bf Date: - Fri, 03 Jul 2015 12:39:48 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:48 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-9edda35e-a14b-4647-b3b0-9041d2a1a6e1 Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-9edda35e-a14b-4647-b3b0-9041d2a1a6e1 Date: - Fri, 03 Jul 2015 12:39:57 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:39:57 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-7cff8f84-ab7a-4825-80c4-c223dad40a0f Content-Type: - application/json Content-Length: - '705' X-Openstack-Request-Id: - req-7cff8f84-ab7a-4825-80c4-c223dad40a0f Date: - Fri, 03 Jul 2015 12:40:15 GMT body: encoding: US-ASCII string: ! '{"volume": {"status": "deleting", "display_name": "fog-testvolume-1", "attachments": [], "availability_zone": "nova", "bootable": "false", "encrypted": false, "created_at": "2015-07-03T12:39:34.000000", "multiattach": "false", "os-vol-tenant-attr:tenant_id": "a19e9490e4504b0b877c55510dfb2842", "os-volume-replication:driver_data": null, "display_description": null, "os-volume-replication:extended_status": null, "os-vol-host-attr:host": "mo-780872711@lvmdriver-1#lvmdriver-1", "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "os-vol-mig-status-attr:name_id": null, "metadata": {}, "id": "5bc63964-414d-4f0f-ae21-1b9202e7acf0", "os-vol-mig-status-attr:migstat": null, "size": 2}}' http_version: recorded_at: Fri, 03 Jul 2015 12:40:14 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 404 message: '' headers: Content-Length: - '78' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-904acc13-d49a-487a-89dc-f3a071dc7618 X-Openstack-Request-Id: - req-904acc13-d49a-487a-89dc-f3a071dc7618 Date: - Fri, 03 Jul 2015 12:40:47 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "The resource could not be found.", "code": 404}}' http_version: recorded_at: Fri, 03 Jul 2015 12:40:46 GMT - request: method: post uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/volumes/5bc63964-414d-4f0f-ae21-1b9202e7acf0/action body: encoding: UTF-8 string: ! '{"os-extend":{"new_size":1}}' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 404 message: '' headers: Content-Length: - '109' Content-Type: - application/json; charset=UTF-8 X-Compute-Request-Id: - req-c6680104-d416-4910-9cde-a04e4019b9f6 X-Openstack-Request-Id: - req-c6680104-d416-4910-9cde-a04e4019b9f6 Date: - Fri, 03 Jul 2015 12:40:47 GMT body: encoding: US-ASCII string: ! '{"itemNotFound": {"message": "Volume 5bc63964-414d-4f0f-ae21-1b9202e7acf0 could not be found.", "code": 404}}' http_version: recorded_at: Fri, 03 Jul 2015 12:40:47 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume/volume_type_read.yml0000644000004100000410000000657312600047642023507 0ustar www-datawww-data--- http_interactions: - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/types body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-d219712e-fc18-44bf-a9a8-01b8e4ca4dfd Content-Type: - application/json Content-Length: - '206' X-Openstack-Request-Id: - req-d219712e-fc18-44bf-a9a8-01b8e4ca4dfd Date: - Fri, 26 Jun 2015 14:39:27 GMT body: encoding: US-ASCII string: ! '{"volume_types": [{"os-volume-type-access:is_public": true, "extra_specs": {"volume_backend_name": "lvmdriver-1"}, "id": "dfd01103-04cb-48ed-9cac-26e10b971812", "name": "lvmdriver-1", "description": null}]}' http_version: recorded_at: Fri, 26 Jun 2015 14:39:26 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/types/dfd01103-04cb-48ed-9cac-26e10b971812 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-bf6db357-855c-44c6-abde-5058252225b0 Content-Type: - application/json Content-Length: - '203' X-Openstack-Request-Id: - req-bf6db357-855c-44c6-abde-5058252225b0 Date: - Fri, 26 Jun 2015 14:39:27 GMT body: encoding: US-ASCII string: ! '{"volume_type": {"os-volume-type-access:is_public": true, "extra_specs": {"volume_backend_name": "lvmdriver-1"}, "id": "dfd01103-04cb-48ed-9cac-26e10b971812", "name": "lvmdriver-1", "description": null}}' http_version: recorded_at: Fri, 26 Jun 2015 14:39:26 GMT - request: method: get uri: http://devstack.openstack.stack:8776/v1/a19e9490e4504b0b877c55510dfb2842/types?lvmdriver-1 body: encoding: US-ASCII string: '' headers: User-Agent: - fog/1.31.0 fog-core/1.31.1 Proxy-Connection: - Keep-Alive Content-Type: - application/json Accept: - application/json X-Auth-Token: - fb5eafb443894cc59c09cf4608dbc5eb response: status: code: 200 message: '' headers: X-Compute-Request-Id: - req-af76f251-0a78-4152-b005-36bb164be5dd Content-Type: - application/json Content-Length: - '206' X-Openstack-Request-Id: - req-af76f251-0a78-4152-b005-36bb164be5dd Date: - Fri, 26 Jun 2015 14:39:28 GMT body: encoding: US-ASCII string: ! '{"volume_types": [{"os-volume-type-access:is_public": true, "extra_specs": {"volume_backend_name": "lvmdriver-1"}, "id": "dfd01103-04cb-48ed-9cac-26e10b971812", "name": "lvmdriver-1", "description": null}]}' http_version: recorded_at: Fri, 26 Jun 2015 14:39:27 GMT recorded_with: VCR 2.9.3 fog-1.34.0/spec/fog/openstack/volume_spec.rb0000644000004100000410000003055012600047642020750 0ustar www-datawww-datarequire 'fog/openstack/compute' require 'fog/openstack/identity' require 'fog/openstack/identity_v3' require 'fog/openstack/volume' if RUBY_VERSION =~ /1.8/ require File.expand_path('../shared_context', __FILE__) else require_relative './shared_context' end RSpec.describe Fog::Volume::OpenStack do include_context 'OpenStack specs with VCR' before :all do setup_vcr_and_service( :vcr_directory => 'spec/fog/openstack/volume', :service_class => Fog::Volume::OpenStack ) end def setup_test_object(options) type = options.delete(:type) case type when :volume puts "Checking for leftovers..." if ENV['DEBUG_VERBOSE'] volume_name = options[:display_name] # if this fails, cleanup this object (it was left over from a failed test run) expect(@service.volumes.all(:display_name => volume_name).length).to be(0) puts "Creating volume #{volume_name}..." if ENV['DEBUG_VERBOSE'] return @service.volumes.create(options) when :transfer puts "Checking for leftovers..." if ENV['DEBUG_VERBOSE'] transfer_name = options[:name] # if this fails, cleanup this object (it was left over from a failed test run) expect(@service.transfers.all(:name => transfer_name).length).to be(0) puts "Creating transfer #{transfer_name}..." if ENV['DEBUG_VERBOSE'] return @service.transfers.create(options) else raise ArgumentError, "don't know how to setup a test object of type #{type.inspect}" end end def cleanup_test_object(collection, id) # has the object already been deleted? begin object = collection.get(id) rescue Fog::Compute::OpenStack::NotFound # "Compute", not "Volume"; see issue #3618 true end puts "Deleting object #{object.class} #{id}..." if ENV['DEBUG_VERBOSE'] object.destroy # wait for the object to be deleted Fog.wait_for do begin object = collection.get(id) puts "Current status: #{object ? object.status : 'deleted'}" if ENV['DEBUG_VERBOSE'] false rescue Fog::Compute::OpenStack::NotFound # "Compute", not "Volume"; see issue #3618 true end end end it 'CRUD volumes' do VCR.use_cassette('volume_crud') do volume_name = "fog-testvolume-1" volume_description = 'This is the volume description.' volume_size = 1 # in GB # create volume volume_id = setup_test_object(:type => :volume, :display_name => volume_name, :display_description => volume_description, :size => volume_size ).id expect(@service.volumes.all(:display_name => volume_name).length).to be 1 # check retrieval of volume by ID puts "Retrieving volume by ID..." if ENV['DEBUG_VERBOSE'] volume = @service.volumes.get(volume_id) expect(volume).to be_a(Fog::Volume::OpenStack::Volume) expect(volume.id).to eq(volume_id) expect(volume.display_name).to eq(volume_name) expect(volume.display_description).to eq(volume_description) expect(volume.size).to eq(volume_size) puts "Waiting for volume to be available..." if ENV['DEBUG_VERBOSE'] volume.wait_for { ready? } # check retrieval of volume by name puts "Retrieving volume by name..." if ENV['DEBUG_VERBOSE'] volumes = @service.volumes.all(:display_name => volume_name) expect(volumes.length).to be 1 volume = volumes[0] expect(volume).to be_a(Fog::Volume::OpenStack::Volume) expect(volume.id).to eq(volume_id) expect(volume.display_name).to eq(volume_name) expect(volume.display_description).to eq(volume_description) expect(volume.size).to eq(volume_size) # delete volume cleanup_test_object(@service.volumes, volume_id) end end it 'reads volume types' do VCR.use_cassette('volume_type_read') do # list all volume types puts "Listing volume types..." if ENV['DEBUG_VERBOSE'] types = @service.volume_types.all expect(types.length).to be > 0 types.each do |type| expect(type.name).to be_a(String) end type_id = types[0].id type_name = types[0].name # get a single volume type by ID puts "Retrieving volume type by ID..." if ENV['DEBUG_VERBOSE'] type = @service.volume_types.get(type_id) expect(type).to be_a(Fog::Volume::OpenStack::VolumeType) expect(type.id).to eq(type_id) expect(type.name).to eq(type_name) # get a single volume type by name puts "Retrieving volume type by name..." if ENV['DEBUG_VERBOSE'] type = @service.volume_types.all(type_name).first expect(type).to be_a(Fog::Volume::OpenStack::VolumeType) expect(type.id).to eq(type_id) expect(type.name).to eq(type_name) end end it 'can extend volumes' do VCR.use_cassette('volume_extend') do volume_size_small = 1 # in GB volume_size_large = 2 # in GB volume = setup_test_object(:type => :volume, :display_name => 'fog-testvolume-1', :size => volume_size_small ) volume.wait_for { ready? and size == volume_size_small } # extend volume puts "Extending volume..." if ENV['DEBUG_VERBOSE'] volume.extend(volume_size_large) volume.wait_for { ready? and size == volume_size_large } # shrinking is not allowed in OpenStack puts "Shrinking volume should fail..." if ENV['DEBUG_VERBOSE'] expect { volume.extend(volume_size_small) }.to raise_error(Excon::Errors::BadRequest, /Invalid input received: New size for extend must be greater than current size./) # delete volume cleanup_test_object(@service.volumes, volume.id) # check that extending a non-existing volume fails puts "Extending deleted volume should fail..." if ENV['DEBUG_VERBOSE'] expect { @service.extend_volume(volume.id, volume_size_small) }.to raise_error(Fog::Compute::OpenStack::NotFound) end end it 'can create and accept volume transfers' do VCR.use_cassette('volume_transfer_and_accept') do transfer_name = 'fog-testtransfer-1' # create volume object volume = setup_test_object(:type => :volume, :display_name => 'fog-testvolume-1', :size => 1 ) volume.wait_for { ready? } # create transfer object transfer = setup_test_object(:type => :transfer, :name => transfer_name, :volume_id => volume.id ) # we need to save the auth_key NOW, it's only present in the response # from the create_transfer request auth_key = transfer.auth_key transfer_id = transfer.id # check retrieval of transfer by ID puts 'Retrieving transfer by ID...' if ENV['DEBUG_VERBOSE'] transfer = @service.transfers.get(transfer_id) expect(transfer).to be_a(Fog::Volume::OpenStack::Transfer) expect(transfer.id).to eq(transfer_id) expect(transfer.name).to eq(transfer_name) expect(transfer.volume_id).to eq(volume.id) # check retrieval of transfer by name puts 'Retrieving transfer by name...' if ENV['DEBUG_VERBOSE'] transfers = @service.transfers.all(:name => transfer_name) expect(transfers.length).to be(1) transfer = transfers[0] expect(transfer).to be_a(Fog::Volume::OpenStack::Transfer) expect(transfer.id).to eq(transfer_id) expect(transfer.name).to eq(transfer_name) expect(transfer.volume_id).to eq(volume.id) # to accept the transfer, we need a second connection to a different project puts 'Checking object visibility from different projects...' if ENV['DEBUG_VERBOSE'] other_service = Fog::Volume::OpenStack.new( :openstack_auth_url => "#{@os_auth_url}/tokens", :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_api_key => ENV['OS_PASSWORD_OTHER'] || 'devstack', :openstack_username => ENV['OS_USERNAME_OTHER'] || 'demo', :openstack_tenant => ENV['OS_PROJECT_NAME_OTHER'] || 'demo' ) # check that recipient cannot see the transfer object expect { other_service.transfers.get(transfer.id) }.to raise_error(Fog::Compute::OpenStack::NotFound) expect(other_service.transfers.all(:name => transfer_name).length).to be(0) # # check that recipient cannot see the volume before transfer # expect { other_service.volumes.get(volume.id) }.to raise_error(Fog::Compute::OpenStack::NotFound) # expect(other_service.volumes.all(:display_name => volume_name).length).to be(0) # The recipient can inexplicably see the volume even before the # transfer, so to confirm that the transfer happens, we record its tenant ID. expect(volume.tenant_id).to match(/^[0-9a-f-]+$/) # should look like a UUID source_tenant_id = volume.tenant_id # check that accept_transfer fails without valid transfer ID and auth key bogus_uuid = 'ec8ff7e8-81e2-4e12-b9fb-3e8890612c2d' # generated by Fog::UUID.uuid, but fixed to play nice with VCR expect { other_service.transfers.accept(bogus_uuid, auth_key) }.to raise_error(Fog::Compute::OpenStack::NotFound) expect { other_service.transfers.accept(transfer_id, 'invalidauthkey') }.to raise_error(Excon::Errors::BadRequest) # accept transfer puts 'Accepting transfer...' if ENV['DEBUG_VERBOSE'] transfer = other_service.transfers.accept(transfer.id, auth_key) expect(transfer).to be_a(Fog::Volume::OpenStack::Transfer) expect(transfer.id).to eq(transfer_id) expect(transfer.name).to eq(transfer_name) # check that recipient can see the volume volume = other_service.volumes.get(volume.id) expect(volume).to be_a(Fog::Volume::OpenStack::Volume) # # check that sender cannot see the volume anymore # expect { @service.volumes.get(volume.id) }.to raise_error(Fog::Compute::OpenStack::NotFound) # expect(@service.volumes.all(:display_name => volume_name).length).to be(0) # As noted above, both users seem to be able to see the volume at all times. # Check change of ownership by looking at the tenant_id, instead. expect(volume.tenant_id).to match(/^[0-9a-f-]+$/) # should look like a UUID expect(volume.tenant_id).not_to eq(source_tenant_id) # check that the transfer object is gone on both sides [ @service, other_service ].each do |service| expect { service.transfers.get(transfer.id) }.to raise_error(Fog::Compute::OpenStack::NotFound) expect(service.transfers.all(:name => transfer_name).length).to be(0) end # cleanup volume cleanup_test_object(other_service.volumes, volume.id) end end it 'can create and delete volume transfers' do VCR.use_cassette('volume_transfer_and_delete') do # create volume object volume = setup_test_object(:type => :volume, :display_name => 'fog-testvolume-1', :size => 1 ) volume.wait_for { ready? } # create transfer object transfer = setup_test_object(:type => :transfer, :name => 'fog-testtransfer-1', :volume_id => volume.id ) # we need to save the auth_key NOW, it's only present in the response # from the create_transfer request auth_key = transfer.auth_key transfer_id = transfer.id # to try to accept the transfer, we need a second connection to a different project other_service = Fog::Volume::OpenStack.new( :openstack_auth_url => "#{@os_auth_url}/tokens", :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_api_key => ENV['OS_PASSWORD_OTHER'] || 'devstack', :openstack_username => ENV['OS_USERNAME_OTHER'] || 'demo', :openstack_tenant => ENV['OS_PROJECT_NAME_OTHER'] || 'demo' ) # delete transfer again transfer.destroy # check that transfer cannot be accepted when it has been deleted puts 'Checking that accepting a deleted transfer fails...' if ENV['DEBUG_VERBOSE'] expect { other_service.transfers.accept(transfer_id, auth_key) }.to raise_error(Fog::Compute::OpenStack::NotFound) # cleanup volume cleanup_test_object(@service.volumes, volume.id) end end # TODO: tests for snapshots it 'responds to list_snapshots_detailed' do expect(@service.respond_to?(:list_snapshots_detailed)).to be true end # TODO: tests for quotas end fog-1.34.0/spec/fog/openstack/identity_v3_spec.rb0000644000004100000410000012626412600047642021712 0ustar www-datawww-datarequire 'fog/openstack/identity' require 'fog/openstack/identity_v3' if RUBY_VERSION =~ /1.8/ require File.expand_path('../shared_context', __FILE__) else require_relative './shared_context' end RSpec.describe Fog::Identity::OpenStack::V3 do include_context 'OpenStack specs with VCR' before :all do setup_vcr_and_service( :vcr_directory => 'spec/fog/openstack/identity_v3', :service_class => Fog::Identity::OpenStack::V3 ) end it 'authenticates with password, userid and domain_id' do VCR.use_cassette('authv3_a') do Fog::Identity::OpenStack::V3.new( :openstack_domain_id => ENV['OS_USER_DOMAIN_ID'] || 'default', :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_userid => ENV['OS_USER_ID'] || 'aa9f25defa6d4cafb48466df83106065', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") end end it 'authenticates with password, username and domain_id' do VCR.use_cassette('authv3_b') do Fog::Identity::OpenStack::V3.new( :openstack_domain_id => ENV['OS_USER_DOMAIN_ID'] || 'default', :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_username => ENV['OS_USERNAME'] || 'admin', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") end end it 'authenticates with password, username and domain_name' do VCR.use_cassette('authv3_c') do Fog::Identity::OpenStack::V3.new( :openstack_user_domain => ENV['OS_USER_DOMAIN_NAME'] || 'Default', :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_username => ENV['OS_USERNAME'] || 'admin', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") end end it 'authenticates in another region' do VCR.use_cassette('idv3_endpoint') do @endpoints_all = @service.endpoints.all end endpoints_in_region = @endpoints_all.select { |endpoint| endpoint.region == (ENV['OS_REGION_OTHER']||'europe') } VCR.use_cassette('idv3_other_region') do @fog = Fog::Identity::OpenStack::V3.new({ :openstack_region => ENV['OS_REGION_OTHER']||'europe', :openstack_auth_url => "#{@os_auth_url}/auth/tokens", :openstack_userid => ENV['OS_USER_ID'] || 'aa9f25defa6d4cafb48466df83106065', :openstack_api_key => ENV['OS_PASSWORD'] || "password" }) expect(@fog).to_not be_nil end unless endpoints_in_region.empty? end it 'get an unscoped token, then reauthenticate with it' do VCR.use_cassette('authv3_unscoped_reauth') do id_v3 = Fog::Identity::OpenStack::V3.new( :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_userid => ENV['OS_USER_ID'] || 'aa9f25defa6d4cafb48466df83106065', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") auth_params = {:provider => "openstack", :openstack_auth_token => id_v3.credentials[:openstack_auth_token], :openstack_auth_url => "#{@os_auth_url}/auth/tokens", :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne'} @fog2 = Fog::Identity::OpenStack::V3.new(auth_params) expect(@fog2).to_not be_nil token = @fog2.credentials[:openstack_auth_token] expect(token).to_not be_nil end end it 'authenticates with project scope' do VCR.use_cassette('authv3_project') do Fog::Identity::OpenStack::V3.new( :openstack_project_name => ENV['OS_PROJECT_NAME'] || 'admin', :openstack_domain_name => ENV['OS_USER_DOMAIN_NAME'] || 'Default', :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_username => ENV['OS_USERNAME'] || 'admin', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") end end it 'get an unscoped token, then use it to get a scoped token' do VCR.use_cassette('authv3_unscoped') do id_v3 = Fog::Identity::OpenStack::V3.new( :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_userid => ENV['OS_USER_ID']||'aa9f25defa6d4cafb48466df83106065', :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") # Exchange it for a project-scoped token auth = Fog::Identity::OpenStack::V3.new( :openstack_project_name => ENV['OS_PROJECT_NAME'] || 'admin', :openstack_domain_name => ENV['OS_USER_DOMAIN_NAME'] || 'Default', :openstack_tenant => ENV['OS_USERNAME'] || 'admin', :openstack_auth_token => id_v3.credentials[:openstack_auth_token], :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_auth_url => "#{@os_auth_url}/auth/tokens") token = auth.credentials[:openstack_auth_token] # We can use the unscoped token to validate the scoped token validated_token = id_v3.tokens.validate(token) expect(validated_token).to_not be_nil id_v3.tokens.check(token) expect { id_v3.tokens.check('random-token') }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "find specific user, lists users" do VCR.use_cassette('idv3_users') do expect { nonexistent_user = @service.users.find_by_id 'u-random-blah' }.to raise_error(Fog::Identity::OpenStack::NotFound) admin_user = @service.users.find_by_name ENV['OS_USERNAME'] || 'admin' expect(admin_user.length).to be 1 users = @service.users expect(users).to_not be_nil expect(users.length).to_not be 0 users_all = @service.users.all expect(users_all).to_not be_nil expect(users_all.length).to_not be 0 admin_by_id = @service.users.find_by_id admin_user.first.id expect(admin_by_id).to_not be_nil expect(@service.users.find_by_name('pimpernel').length).to be 0 end end it 'CRUD users' do VCR.use_cassette('idv3_user_crud') do # Make sure there are no existing users called foobar or baz ['foobar', 'baz'].each do |username| user = @service.users.find_by_name(username).first user.update(:enabled => false) if user user.destroy if user end expect(@service.users.find_by_name('foobar').length).to be 0 expect(@service.users.find_by_name('baz').length).to be 0 # Create a user called foobar foobar_user = @service.users.create(:name => 'foobar', :email => 'foobar@example.com', :password => 's3cret!') foobar_id = foobar_user.id expect(@service.users.find_by_name('foobar').length).to be 1 # Rename it to baz and disable it (required so we can delete it) foobar_user.update(:name => 'baz', :enabled => false) expect(foobar_user.name).to eq 'baz' # Read the user freshly and check the name & enabled state expect(@service.users.find_by_name('baz').length).to be 1 baz_user = @service.users.find_by_id foobar_id expect(baz_user).to_not be_nil expect(baz_user.name).to eq 'baz' expect(baz_user.email).to eq 'foobar@example.com' expect(baz_user.enabled).to be false # Try to create the user again expect { @service.users.create(:name => 'baz', :email => 'foobar@example.com', :password => 's3cret!') }.to raise_error(Excon::Errors::Conflict) # Delete the user baz_user.destroy # Check that the deletion worked expect { @service.users.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) expect(@service.users.all.select { |user| ['foobar', 'baz'].include? user.name }.length).to be 0 expect(@service.users.find_by_name('foobar').length).to be 0 expect(@service.users.find_by_name('baz').length).to be 0 end end it "CRUD & manipulate groups" do VCR.use_cassette('idv3_group_crud_mutation') do # Make sure there are no existing groups called foobar or baz @service.groups.all.select { |group| ['foobar', 'baz'].include? group.name }.each do |group| group.destroy end expect(@service.groups.all.select { |group| ['foobar', 'baz'].include? group.name }.length).to be 0 # Create a group called foobar foobar_group = @service.groups.create(:name => 'foobar', :description => "Group of Foobar users") foobar_id = foobar_group.id expect(@service.groups.all.select { |group| group.name == 'foobar' }.length).to be 1 # Rename it to baz foobar_group.update(:name => 'baz', :description => "Group of Baz users") expect(foobar_group.name).to eq 'baz' # Read the group freshly and check the name expect(@service.groups.all.select { |group| group.name == 'baz' }.length).to be 1 baz_group = @service.groups.find_by_id foobar_id expect(baz_group).to_not be_nil expect(baz_group.name).to eq 'baz' # Add users to the group #foobar_user1 = @service.users.find_by_name('foobar1').first #foobar_user1.destroy if foobar_user1 foobar_user1 = @service.users.create(:name => 'foobar1', :email => 'foobar1@example.com', :password => 's3cret!1') #foobar_user2 = @service.users.find_by_name('foobar2').first #foobar_user2.destroy if foobar_user2 foobar_user2 = @service.users.create(:name => 'foobar2', :email => 'foobar2@example.com', :password => 's3cret!2') expect(foobar_user1.groups.length).to be 0 expect(baz_group.users.length).to be 0 baz_group.add_user(foobar_user1.id) # Check that a user is in the group expect(foobar_user1.groups.length).to be 1 expect(baz_group.contains_user? foobar_user1.id).to be true baz_group.add_user(foobar_user2.id) # List users in the group expect(baz_group.users.length).to be 2 # Remove a user from the group baz_group.remove_user(foobar_user1.id) expect(baz_group.contains_user? foobar_user1.id).to be false expect(baz_group.users.length).to be 1 # Delete the users and make sure they are no longer in the group foobar_user1.destroy foobar_user2.destroy expect(baz_group.contains_user? foobar_user2.id).to be false expect(baz_group.users.length).to be 0 # Delete the group baz_group.destroy expect { @service.groups.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) expect(@service.groups.all.select { |group| ['foobar', 'baz'].include? group.name }.length).to be 0 end end it "gets a token, checks it and then revokes it" do VCR.use_cassette('idv3_token') do auth = {:auth => {:identity => {:methods => %w{password}, :password => {:user => {:id => ENV['OS_USER_ID']||'aa9f25defa6d4cafb48466df83106065', :password => ENV['OS_PASSWORD']||'password'}}}, :scope => {:project => {:domain => {:name => ENV['OS_USER_DOMAIN_NAME']||'Default'}, :name => ENV['OS_PROJECT_NAME']||'admin'}}}} token = @service.tokens.authenticate(auth) expect(token).to_not be_nil validated_token = @service.tokens.validate token.value expect(validated_token).to_not be_nil @service.tokens.check(token.value) @service.tokens.revoke(token.value) expect { @service.tokens.check(token.value) }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it 'authenticates with a token' do VCR.use_cassette('authv3_token') do # Setup - get a non-admin token to check by using username/password authentication to start with auth_url = "#{@os_auth_url}/auth/tokens" begin foobar_user = @service.users.create(:name => 'foobar_385', :email => 'foobar_demo@example.com', :domain_id => ENV['OS_USER_DOMAIN_ID'] || 'default', :password => 's3cret!') foobar_role = @service.roles.create(:name => 'foobar_role390') foobar_user.grant_role(foobar_role.id) nonadmin_v3 = Fog::Identity::OpenStack::V3.new( :openstack_domain_id => foobar_user.domain_id, :openstack_api_key => 's3cret!', :openstack_username => 'foobar_385', :openstack_region => ENV['OS_REGION_NAME']||'europe', :openstack_auth_url => auth_url) # Test - check the token validity by using it to create a new Fog::Identity::OpenStack::V3 instance token_check = Fog::Identity::OpenStack::V3.new( :openstack_auth_token => nonadmin_v3.auth_token, :openstack_region => ENV['OS_REGION_NAME']||'europe', :openstack_auth_url => auth_url) expect(token_check).to_not be_nil expect { Fog::Identity::OpenStack::V3.new( :openstack_auth_token => 'blahblahblah', :openstack_region => ENV['OS_REGION_NAME']||'europe', :openstack_auth_url => auth_url) }.to raise_error(Excon::Errors::NotFound) ensure # Clean up foobar_user = @service.users.find_by_name('foobar_385').first unless foobar_user foobar_user.destroy if foobar_user foobar_role = @service.roles.all.select { |role| role.name == 'foobar_role390' }.first unless foobar_role foobar_role.destroy if foobar_role end end end it "lists domains" do VCR.use_cassette('idv3_domain') do domains = @service.domains expect(domains).to_not be_nil expect(domains.length).to_not be 0 domains_all = @service.domains.all expect(domains_all).to_not be_nil expect(domains_all.length).to_not be 0 default_domain = @service.domains.find_by_id ENV['OS_USER_DOMAIN_ID']||'default' expect(default_domain).to_not be_nil expect { @service.domains.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD domains" do VCR.use_cassette('idv3_domain_crud') do begin # Create a domain called foobar foobar_domain = @service.domains.create(:name => 'foobar') foobar_id = foobar_domain.id expect(@service.domains.all(:name => 'foobar').length).to be 1 # Rename it to baz and disable it (required so we can delete it) foobar_domain.update(:name => 'baz', :enabled => false) expect(foobar_domain.name).to eq 'baz' # Read the domain freshly and check the name & enabled state expect(@service.domains.all(:name => 'baz').length).to be 1 baz_domain = @service.domains.find_by_id foobar_id expect(baz_domain).to_not be_nil expect(baz_domain.name).to eq 'baz' expect(baz_domain.enabled).to be false ensure # Delete the domains begin baz_domain.update(:enabled => false) if baz_domain baz_domain.destroy if baz_domain foobar_domain.update(:enabled => false) if foobar_domain foobar_domain.destroy if foobar_domain rescue end # Check that the deletion worked expect { @service.domains.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) if foobar_id ['foobar', 'baz'].each do |domain_name| expect(@service.domains.all(:name => domain_name).length).to be 0 end end end end it "Manipulates roles on domains" do # Note that the domain is implicit in the user operations here VCR.use_cassette('idv3_domain_roles_mutation') do begin foobar_user = @service.users.create(:name => 'foobar_role_user', :email => 'foobar@example.com', :password => 's3cret!') # User has no roles initially expect(foobar_user.roles.length).to be 0 # Create a role and add it to the user in the user's domain foobar_role = @service.roles.create(:name => 'foobar_role') foobar_user.grant_role(foobar_role.id) expect(foobar_user.roles.length).to be 1 assignments = @service.role_assignments.all(:user_id => foobar_user.id) expect(assignments.length).to be 1 expect(assignments.first.role['id']).to eq foobar_role.id expect(assignments.first.user['id']).to eq foobar_user.id expect(assignments.first.scope['domain']['id']).to eq foobar_user.domain_id expect(assignments.first.links['assignment'].end_with? "/v3/domains/#{foobar_user.domain_id}/users/#{foobar_user.id}/roles/#{foobar_role.id}").to be true # Quick test of @service.role_assignments.all while we're at it all_assignments = @service.role_assignments.all expect(all_assignments.length).to be >= 1 # Check that the user has the role expect(foobar_user.check_role(foobar_role.id)).to be true # Revoke the role from the user foobar_user.revoke_role(foobar_role.id) expect(foobar_user.check_role(foobar_role.id)).to be false ensure foobar_user = @service.users.find_by_name('u-foobar_role_user').first unless foobar_user foobar_user.destroy if foobar_user foobar_role = @service.roles.all.select { |role| role.name == 'foobar_role' }.first unless foobar_role foobar_role.destroy if foobar_role end end end it "Manipulates roles on domain groups" do VCR.use_cassette('idv3_domain_group_roles_mutation') do begin # Create a domain called foobar foobar_domain = @service.domains.create(:name => 'd-foobar') # Create a group in this domain foobar_group = @service.groups.create(:name => 'g-foobar', :description => "Group of Foobar users", :domain_id => foobar_domain.id) # Create a user in the domain foobar_user = @service.users.create(:name => 'u-foobar_foobar', :email => 'foobar@example.com', :password => 's3cret!', :domain_id => foobar_domain.id) # User has no roles initially expect(foobar_user.roles.length).to be 0 # Create a role and add it to the domain group foobar_role = @service.roles.all.select { |role| role.name == 'foobar_role' }.first foobar_role.destroy if foobar_role foobar_role = @service.roles.create(:name => 'foobar_role') foobar_group.grant_role foobar_role.id expect(foobar_group.roles.length).to be 1 # Add user to the group and check that it inherits the role expect(foobar_user.check_role foobar_role.id).to be false expect(@service.role_assignments.all(:user_id => foobar_user.id, :effective => true).length).to be 0 foobar_group.add_user foobar_user.id expect(foobar_user.check_role foobar_role.id).to be false # Still false in absolute assignment terms assignments = @service.role_assignments.all(:user_id => foobar_user.id, :effective => true) expect(assignments.length).to be 1 expect(assignments.first.role['id']).to eq foobar_role.id expect(assignments.first.user['id']).to eq foobar_user.id expect(assignments.first.scope['domain']['id']).to eq foobar_user.domain_id expect(assignments.first.links['assignment'].end_with? "/v3/domains/#{foobar_domain.id}/groups/#{foobar_group.id}/roles/#{foobar_role.id}").to be true expect(assignments.first.links['membership'].end_with? "/v3/groups/#{foobar_group.id}/users/#{foobar_user.id}").to be true group_assignments = @service.role_assignments.all(:group_id => foobar_group.id) expect(group_assignments.length).to be 1 expect(group_assignments.first.role['id']).to eq foobar_role.id expect(group_assignments.first.group['id']).to eq foobar_group.id expect(group_assignments.first.scope['domain']['id']).to eq foobar_user.domain_id expect(group_assignments.first.links['assignment'].end_with? "/v3/domains/#{foobar_domain.id}/groups/#{foobar_group.id}/roles/#{foobar_role.id}").to be true # Revoke the role from the group and check the user no longer has it foobar_group.revoke_role foobar_role.id expect(@service.role_assignments.all(:user_id => foobar_user.id, :effective => true).length).to be 0 ensure # Clean up foobar_user = @service.users.find_by_name('u-foobar_foobar').first unless foobar_user foobar_user.destroy if foobar_user foobar_group = @service.groups.all.select { |group| group.name == 'g-foobar' }.first unless foobar_group foobar_group.destroy if foobar_group foobar_role = @service.roles.all.select { |role| role.name == 'foobar_role' }.first unless foobar_role foobar_role.destroy if foobar_role foobar_domain = @service.domains.all.select { |domain| domain.name == 'd-foobar' }.first unless foobar_domain foobar_domain.update(:enabled => false) if foobar_domain foobar_domain.destroy if foobar_domain end end end it "lists roles" do VCR.use_cassette('idv3_role') do roles = @service.roles expect(roles).to_not be_nil expect(roles.length).to_not be 0 roles_all = @service.roles.all expect(roles_all).to_not be_nil expect(roles_all.length).to_not be 0 role_by_id = @service.roles.find_by_id roles_all.first.id expect(role_by_id).to_not be_nil expect { @service.roles.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD roles" do VCR.use_cassette('idv3_role_crud') do begin # Create a role called foobar foobar_role = @service.roles.create(:name => 'foobar23') foobar_id = foobar_role.id expect(@service.roles.all(:name => 'foobar23').length).to be 1 # Rename it to baz foobar_role.update(:name => 'baz23') expect(foobar_role.name).to eq 'baz23' # Read the role freshly and check the name & enabled state expect(@service.roles.all(:name => 'baz23').length).to be 1 baz_role = @service.roles.find_by_id foobar_id expect(baz_role).to_not be_nil expect(baz_role.name).to eq 'baz23' ensure # Delete the role baz_role.destroy if baz_role # Check that the deletion worked expect { @service.roles.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) if foobar_id ['foobar23', 'baz23'].each do |role_name| expect(@service.roles.all(:name => role_name).length).to be 0 end end end end it "lists projects" do VCR.use_cassette('idv3_project') do projects = @service.projects expect(projects).to_not be_nil expect(projects.length).to_not be 0 projects_all = @service.projects.all expect(projects_all).to_not be_nil expect(projects_all.length).to_not be 0 project_byid = @service.projects.find_by_id projects_all.first.id expect(project_byid).to_not be_nil expect { @service.projects.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD projects" do VCR.use_cassette('idv3_project_crud') do default_domain = @service.domains.find_by_id ENV['OS_USER_DOMAIN_ID']||'default' begin # Create a project called foobar - should not work without domain id? foobar_project = @service.projects.create(:name => 'p-foobar46') foobar_id = foobar_project.id expect(@service.projects.all(:name => 'p-foobar46').length).to be 1 expect(foobar_project.domain_id).to eq default_domain.id # Rename it to baz and disable it (required so we can delete it) foobar_project.update(:name => 'p-baz46', :enabled => false) expect(foobar_project.name).to eq 'p-baz46' # Read the project freshly and check the name & enabled state expect(@service.projects.all(:name => 'p-baz46').length).to be 1 baz_project = @service.projects.find_by_id foobar_id expect(baz_project).to_not be_nil expect(baz_project.name).to eq 'p-baz46' expect(baz_project.enabled).to be false ensure # Delete the project baz_project.destroy # Check that the deletion worked expect { @service.projects.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) ['p-foobar46', 'p-baz46'].each do |project_name| expect(@service.projects.all(:name => project_name).length).to be 0 end end end end it "CRUD & list hierarchical projects" do VCR.use_cassette('idv3_project_hier_crud_list') do default_domain = @service.domains.find_by_id ENV['OS_USER_DOMAIN_ID']||'default' begin # Create a project called foobar foobar_project = @service.projects.create(:name => 'p-foobar67') foobar_id = foobar_project.id # Create a sub-project called baz baz_project = @service.projects.create(:name => 'p-baz67', :parent_id => foobar_id) baz_id = baz_project.id expect(baz_project.parent_id).to eq foobar_id # Read the project freshly and check the parent_id fresh_baz_project = @service.projects.all(:name => 'p-baz67').first expect(fresh_baz_project).to_not be_nil expect(fresh_baz_project.parent_id).to eq foobar_id # Create another sub-project called boo boo_project = @service.projects.create(:name => 'p-boo67', :parent_id => foobar_id) boo_id = boo_project.id # Create a sub-project of boo called booboo booboo_project = @service.projects.create(:name => 'p-booboo67', :parent_id => boo_id) booboo_id = booboo_project.id # Make sure we have a role on all these projects (needed for subtree_as_list and parents_as_list) prj_role = @service.roles.create(:name => 'r-project67') [foobar_project, baz_project, boo_project, booboo_project].each do |project| project.grant_role_to_user(prj_role.id, @service.current_user_id) end # Get the children of foobar, as a tree of IDs foobar_kids = @service.projects.find_by_id(foobar_id, :subtree_as_ids).subtree expect(foobar_kids.keys.length).to eq 2 boo_index = foobar_kids.keys.index boo_id expect(boo_index).to_not be_nil foobar_child_id = foobar_kids.keys[boo_index] expect(foobar_kids[foobar_child_id].length).to eq 1 foobar_grandchild_id = foobar_kids[foobar_child_id].keys.first expect(foobar_grandchild_id).to eq booboo_id # Get the children of foobar, as a list of objects foobar_kids = @service.projects.find_by_id(foobar_id, :subtree_as_list).subtree expect(foobar_kids.length).to eq 3 expect([foobar_kids[0].id,foobar_kids[1].id,foobar_kids[2].id].sort ).to eq [baz_id, boo_id, booboo_id].sort # Create a another sub-project of boo called fooboo and check that it appears in the parent's subtree fooboo_project = @service.projects.create(:name => 'p-fooboo67', :parent_id => boo_id) fooboo_id = fooboo_project.id fooboo_project.grant_role_to_user(prj_role.id, @service.current_user_id) foobar_new_kids = @service.projects.find_by_id(foobar_id, :subtree_as_list).subtree expect(foobar_new_kids.length).to eq 4 # Get the parents of booboo, as a tree of IDs booboo_parents = @service.projects.find_by_id(booboo_id, :parents_as_ids).parents expect(booboo_parents.keys.length).to eq 1 booboo_parent_id = booboo_parents.keys.first expect(booboo_parents[booboo_parent_id].length).to eq 1 booboo_grandparent_id = booboo_parents[booboo_parent_id].keys.first expect(booboo_grandparent_id).to eq foobar_id expect(booboo_parents[booboo_parent_id][booboo_grandparent_id]).to be_nil # Get the parents of booboo, as a list of objects booboo_parents = @service.projects.find_by_id(booboo_id, :parents_as_list).parents expect(booboo_parents.length).to eq 2 expect([booboo_parents[0].id,booboo_parents[1].id].sort).to eq [foobar_id, boo_id].sort ensure # Delete the projects fooboo_project.destroy if fooboo_project booboo_project.destroy if booboo_project boo_project.destroy if boo_project baz_project.destroy if baz_project foobar_project.destroy if foobar_project prj_role = @service.roles.all(:name => 'r-project67').first unless prj_role prj_role.destroy if prj_role # Check that the deletion worked expect { @service.projects.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) if foobar_id ['p-booboo67', 'p-fooboo67', 'p-boo67', 'p-baz67', 'p-foobar67'].each do |project_name| prj = @service.projects.all(:name => project_name).first prj.destroy if prj expect(@service.projects.all(:name => project_name).length).to be 0 end end end end it "Manipulates projects - add/remove users/groups via role assignment/revocation" do VCR.use_cassette('idv3_project_group_user_roles_mutation') do # Make sure there is no existing project called foobar @service.projects.all(:name => 'p-foobar69').each do |project| project.update(:enabled => false) project.destroy end expect(@service.projects.all(:name => 'p-foobar69').length).to be 0 begin # Create a project called foobar foobar_project = @service.projects.create(:name => 'p-foobar69') # Create a role called baz @service.roles.all(:name => 'baz').each do |role| role.update(:enabled => false) role.destroy end baz_role = @service.roles.create(:name => 'baz69') # Create a user foobar_user = @service.users.create(:name => 'u-foobar69', :email => 'foobar@example.com', :password => 's3cret!') # Create a group and add the user to it foobar_group = @service.groups.create(:name => 'g-foobar69', :description => "Group of Foobar users") foobar_group.add_user foobar_user.id # User has no projects initially expect(foobar_user.projects.length).to be 0 expect(@service.role_assignments.all(:user_id => foobar_user.id, :project_id => foobar_project.id, :effective => true).length).to be 0 expect(foobar_project.user_roles(foobar_user.id).length).to be 0 # Grant role to the user in the new project - this assigns the project to the user foobar_project.grant_role_to_user(baz_role.id, foobar_user.id) expect(foobar_user.projects.length).to be 1 expect(foobar_project.check_user_role(foobar_user.id, baz_role.id)).to be true expect(foobar_project.user_roles(foobar_user.id).length).to be 1 # Revoke role from the user in the new project - this removes the user from the project foobar_project.revoke_role_from_user(baz_role.id, foobar_user.id) expect(foobar_user.projects.length).to be 0 expect(foobar_project.check_user_role(foobar_user.id, baz_role.id)).to be false # Group initially has no roles in project expect(foobar_project.group_roles(foobar_group.id).length).to be 0 expect(@service.role_assignments.all(:user_id => foobar_user.id, :project_id => foobar_project.id, :effective => true).length).to be 0 # Grant role to the group in the new project - this assigns the project to the group foobar_project.grant_role_to_group(baz_role.id, foobar_group.id) expect(foobar_project.check_group_role(foobar_group.id, baz_role.id)).to be true expect(foobar_project.group_roles(foobar_group.id).length).to be 1 # Now we check that a user has the role in that project assignments = @service.role_assignments.all(:user_id => foobar_user.id, :project_id => foobar_project.id, :effective => true) expect(assignments.length).to be 1 expect(assignments.first.role['id']).to eq baz_role.id expect(assignments.first.user['id']).to eq foobar_user.id expect(assignments.first.scope['project']['id']).to eq foobar_project.id expect(assignments.first.links['assignment'].end_with? "/v3/projects/#{foobar_project.id}/groups/#{foobar_group.id}/roles/#{baz_role.id}").to be true expect(assignments.first.links['membership'].end_with? "/v3/groups/#{foobar_group.id}/users/#{foobar_user.id}").to be true # and we check that the user is in the project because of group membership expect(foobar_user.projects.length).to be 1 # Revoke role from the group in the new project - this removes the group from the project foobar_project.revoke_role_from_group(baz_role.id, foobar_group.id) expect(foobar_user.projects.length).to be 0 expect(foobar_project.check_group_role(foobar_group.id, baz_role.id)).to be false ensure # Clean up foobar_user.destroy if foobar_user foobar_group.destroy if foobar_group baz_role.destroy if baz_role foobar_project.update(:enabled => false) if foobar_project foobar_project.destroy if foobar_project end end end it "lists services" do VCR.use_cassette('idv3_service') do services = @service.services expect(services).to_not be_nil expect(services.length).to_not be 0 services_all = @service.services.all expect(services_all).to_not be_nil expect(services_all.length).to_not be 0 some_service = @service.services.find_by_id services_all.first.id expect(some_service).to_not be_nil expect { @service.services.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD services" do VCR.use_cassette('idv3_services_crud') do all_services = @service.services.all begin # Create a service called foobar foobar_service = @service.services.create(:type => 'volume', :name => 'foobar') foobar_id = foobar_service.id expect(@service.services.all(:type => 'volume').select { |service| service.name == 'foobar' }.length).to be 1 # Rename it to baz foobar_service.update(:name => 'baz') expect(foobar_service.name).to eq 'baz' # Read the service freshly and check the name expect(@service.services.all.select { |service| service.name == 'baz' }.length).to be 1 baz_service = @service.services.find_by_id foobar_id expect(baz_service).to_not be_nil expect(baz_service.name).to eq 'baz' expect(baz_service.type).to eq 'volume' ensure # Delete the service baz_service.destroy if baz_service # Check that the deletion worked expect { @service.services.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) if foobar_id expect(@service.services.all.select { |service| ['foobar', 'baz'].include? service.name }.length).to be 0 end end end it "lists endpoints" do VCR.use_cassette('idv3_endpoint') do endpoints = @service.endpoints expect(endpoints).to_not be_nil expect(endpoints.length).to_not be 0 endpoints_all = @service.endpoints.all expect(endpoints_all).to_not be_nil expect(endpoints_all.length).to_not be 0 some_endpoint = @service.endpoints.find_by_id endpoints_all.first.id expect(some_endpoint).to_not be_nil expect { @service.endpoints.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD endpoints" do VCR.use_cassette('idv3_endpoints_crud') do service = @service.services.all.first all_endpoints = @service.endpoints.all begin # Create a endpoint called foobar foobar_endpoint = @service.endpoints.create(:service_id => service.id, :interface => 'internal', :name => 'foobar', :url => 'http://example.com/foobar', :enabled => false) foobar_id = foobar_endpoint.id expect(@service.endpoints.all(:interface => 'internal').select { |endpoint| endpoint.name == 'foobar' }.length).to be 1 # Rename it to baz foobar_endpoint.update(:name => 'baz', :url => 'http://example.com/baz') expect(foobar_endpoint.name).to eq 'baz' expect(foobar_endpoint.url).to eq 'http://example.com/baz' # Read the endpoint freshly and check the name expect(@service.endpoints.all(:interface => 'internal').select { |endpoint| endpoint.name == 'baz' }.length).to be 1 baz_endpoint = @service.endpoints.find_by_id foobar_id expect(baz_endpoint).to_not be_nil expect(baz_endpoint.name).to eq 'baz' expect(baz_endpoint.url).to eq 'http://example.com/baz' expect(baz_endpoint.interface).to eq 'internal' ensure # Delete the endpoint baz_endpoint.destroy # Check that the deletion worked expect { @service.endpoints.find_by_id foobar_id }.to raise_error(Fog::Identity::OpenStack::NotFound) expect(@service.endpoints.all.select { |endpoint| ['foobar', 'baz'].include? endpoint.name }.length).to be 0 end end end it "lists OS credentials" do VCR.use_cassette('idv3_credential') do credentials = @service.os_credentials expect(credentials).to_not be_nil credentials_all = @service.os_credentials.all expect(credentials_all).to_not be_nil expect { @service.os_credentials.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD OS credentials" do VCR.use_cassette('idv3_credential_crud') do begin # Create a user foobar_user = @service.users.create(:name => 'u-foobar_cred', :email => 'foobar@example.com', :password => 's3cret!') project = @service.projects.all.first access_key = '9c4e774a-f644-498f-90c4-970b3f817fc5' secret_key = '7e084117-b13d-4656-9eca-85376b690897' # OpenStack Keystone requires the blob to be a JSON string - i.e. not JSON, but a string containing JSON :-/ blob_json = {:access => access_key, :secret => secret_key}.to_json # Make sure there are no existing ec2 credentials @service.os_credentials.all.select { |credential| credential.type == 'foo' || credential.type == 'ec2' }.each do |credential| credential.destroy end expect(@service.os_credentials.all.select { |credential| credential.type == 'ec2' }.length).to be 0 # Create a credential foo_credential = @service.os_credentials.create(:type => 'ec2', :project_id => project.id, :user_id => foobar_user.id, :blob => blob_json) credential_id = foo_credential.id expect(@service.os_credentials.all.select { |credential| credential.type == 'ec2' }.length).to be 1 # Update secret key new_secret_key = '62307bcd-ca3c-47ae-a114-27a6cadb5bc9' new_blob_json = {:access => access_key, :secret => new_secret_key}.to_json foo_credential.update(:blob => new_blob_json) expect(JSON.parse(foo_credential.blob)['secret']).to eq new_secret_key # Read the credential freshly and check the secret key expect(@service.os_credentials.all.select { |credential| credential.type == 'ec2' }.length).to be 1 updated_credential = @service.os_credentials.find_by_id credential_id expect(updated_credential).to_not be_nil expect(updated_credential.type).to eq 'ec2' expect(JSON.parse(updated_credential.blob)['secret']).to eq new_secret_key ensure foobar_user = @service.users.find_by_name('u-foobar_cred').first unless foobar_user foobar_user.destroy if foobar_user # Delete the credential begin updated_credential.destroy if updated_credential foo_credential.destroy if foo_credential rescue false end # Check that the deletion worked expect { @service.os_credentials.find_by_id credential_id }.to raise_error(Fog::Identity::OpenStack::NotFound) if credential_id expect(@service.os_credentials.all.select { |credential| credential.type == 'ec2' }.length).to be 0 end end end it "lists policies" do VCR.use_cassette('idv3_policy') do policies = @service.policies expect(policies).to_not be_nil expect(policies.length).to be 0 policies_all = @service.policies.all expect(policies_all).to_not be_nil expect(policies_all.length).to be 0 expect { @service.policies.find_by_id 'atlantis' }.to raise_error(Fog::Identity::OpenStack::NotFound) end end it "CRUD policies" do VCR.use_cassette('idv3_policy_crud') do blob = {'foobar_user' => ['role:compute-user']}.to_json # Make sure there are no existing policies expect(@service.policies.all.select { |policy| policy.type == 'application/json' }.length).to be 0 # Create a policy foo_policy = @service.policies.create(:type => 'application/json', :blob => blob) policy_id = foo_policy.id expect(@service.policies.all.select { |policy| policy.type == 'application/json' }.length).to be 1 # Update policy blob new_blob = {'baz_user' => ['role:compute-user']}.to_json foo_policy.update(:blob => new_blob) expect(foo_policy.blob).to eq new_blob # Read the policy freshly and check the secret key expect(@service.policies.all.select { |policy| policy.type == 'application/json' }.length).to be 1 updated_policy = @service.policies.find_by_id policy_id expect(updated_policy).to_not be_nil expect(updated_policy.type).to eq 'application/json' expect(updated_policy.blob).to eq new_blob # Delete the policy updated_policy.destroy # Check that the deletion worked expect { @service.policies.find_by_id policy_id }.to raise_error(Fog::Identity::OpenStack::NotFound) expect(@service.policies.all.select { |policy| policy.type == 'application/json' }.length).to be 0 end end end fog-1.34.0/spec/fog/openstack/network_spec.rb0000644000004100000410000000173612600047642021136 0ustar www-datawww-datarequire 'fog/openstack/compute' require 'fog/openstack/identity' require 'fog/openstack/identity_v3' require 'fog/openstack/network' if RUBY_VERSION =~ /1.8/ require File.expand_path('../shared_context', __FILE__) else require_relative './shared_context' end RSpec.describe Fog::Network::OpenStack do include_context 'OpenStack specs with VCR' before :all do setup_vcr_and_service( :vcr_directory => 'spec/fog/openstack/network', :service_class => Fog::Network::OpenStack ) end it 'CRUD subnets' do VCR.use_cassette('subnets_crud') do begin foonet = @service.networks.create(:name => 'foo-net12', :shared => false) subnet = @service.subnets.create(:name => "my-network", :network_id => foonet.id, :cidr => '172.16.0.0/16', :ip_version => 4, :gateway_ip => nil) expect(subnet.name).to eq 'my-network' ensure subnet.destroy if subnet foonet.destroy if foonet end end end end fog-1.34.0/spec/fog/openstack/shared_context.rb0000644000004100000410000001041012600047642021432 0ustar www-datawww-datarequire 'rspec/core' require 'rspec/expectations' require 'vcr' require 'fog/openstack/identity' require 'fog/openstack/identity_v3' require 'fog/openstack/network' # # There are basically two modes of operation for these specs. # # 1. ENV[OS_AUTH_URL] exists: talk to an actual OpenStack and record HTTP # traffic in VCRs at "spec/debug" (credentials are read from the conventional # environment variables: OS_AUTH_URL, OS_USERNAME, OS_PASSWORD etc.) # 2. otherwise (under Travis etc.): use VCRs at "spec/fog/openstack/#{service}" # # When you develop a new unit test or change an existing one: # # 1. Record interactions against an actual OpenStack (Devstack is usually # enough if configured correctly) using the first mode from above. # 2. Move the relevant VCRs from "spec/debug" to # "spec/fog/openstack/#{service}". # 3. In these VCRs, string-replace your OpenStack's URLs/IPs by # "devstack.openstack.stack". Also, string-replace the used tokens by the # token obtained in the "common_setup.yml". # RSpec.shared_context 'OpenStack specs with VCR' do # This method should be called in a "before :all" call to set everything up. # A properly configured instance of the service class (e.g. # Fog::Volume::OpenStack) is then made available in @service. def setup_vcr_and_service(options) # read arguments expect(@vcr_directory = options[:vcr_directory]).to be_a(String) expect(@service_class = options[:service_class]).to be_a(Class) # determine mode of operation use_recorded = !ENV.has_key?('OS_AUTH_URL') if use_recorded # when using the cassettes, there is no need to sleep in wait_for() Fog.interval = 0 # use an auth URL that matches our VCR recordings (IdentityV2 for most # services, but IdentityV3 test obviously needs IdentityV3 auth URL) if [Fog::Identity::OpenStack::V3, Fog::Network::OpenStack].include? @service_class @os_auth_url = 'http://devstack.openstack.stack:5000/v3' else @os_auth_url = 'http://devstack.openstack.stack:5000/v2.0' end else # when an auth URL is given, we talk to a real OpenStack @os_auth_url = ENV['OS_AUTH_URL'] end # setup VCR VCR.configure do |config| config.allow_http_connections_when_no_cassette = true config.hook_into :webmock if use_recorded config.cassette_library_dir = @vcr_directory config.default_cassette_options = { :record => :none } config.default_cassette_options.merge! :match_requests_on => [:method, :uri, :body] unless RUBY_VERSION =~ /1.8/ # Ruby 1.8.7 encodes JSON differently, which screws up request matching else config.cassette_library_dir = "spec/debug" config.default_cassette_options = { :record => :all } end end # allow us to ignore dev certificates on servers Excon.defaults[:ssl_verify_peer] = false if ENV['SSL_VERIFY_PEER'] == 'false' # setup the service object VCR.use_cassette('common_setup') do if @service_class == Fog::Identity::OpenStack::V3 || @os_auth_url.end_with?('/v3') options = { :openstack_auth_url => "#{@os_auth_url}/auth/tokens", :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_api_key => ENV['OS_PASSWORD'] || 'password', :openstack_username => ENV['OS_USERNAME'] || 'admin', :openstack_domain_name => ENV['OS_USER_DOMAIN_NAME'] || 'Default', :openstack_project_name => ENV['OS_PROJECT_NAME'] || 'admin' } else options = { :openstack_auth_url => "#{@os_auth_url}/tokens", :openstack_region => ENV['OS_REGION_NAME'] || 'RegionOne', :openstack_api_key => ENV['OS_PASSWORD'] || 'devstack', :openstack_username => ENV['OS_USERNAME'] || 'admin', :openstack_tenant => ENV['OS_PROJECT_NAME'] || 'admin' # FIXME: Identity V3 not properly supported by other services yet # :openstack_user_domain => ENV['OS_USER_DOMAIN_NAME'] || 'Default', # :openstack_project_domain => ENV['OS_PROJECT_DOMAIN_NAME'] || 'Default', } end @service = @service_class.new(options) unless @service end end end fog-1.34.0/spec/fog/orchestration_spec.rb0000644000004100000410000000070712600047642020337 0ustar www-datawww-datarequire "spec_helper" describe Fog::Orchestration do Fog::Orchestration.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Orchestration[provider] } end end end end end fog-1.34.0/spec/fog/account_spec.rb0000644000004100000410000000066512600047642017112 0ustar www-datawww-datarequire "spec_helper" describe Fog::Account do Fog::Account.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Account[provider] } end end end end end fog-1.34.0/spec/fog/monitoring_spec.rb0000644000004100000410000000067612600047642017645 0ustar www-datawww-datarequire "spec_helper" describe Fog::Monitoring do Fog::Monitoring.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Monitoring[provider] } end end end end end fog-1.34.0/spec/fog/billing_spec.rb0000644000004100000410000000066512600047642017076 0ustar www-datawww-datarequire "spec_helper" describe Fog::Billing do Fog::Billing.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Billing[provider] } end end end end end fog-1.34.0/spec/fog/volume_spec.rb0000644000004100000410000000066212600047642016762 0ustar www-datawww-datarequire "spec_helper" describe Fog::Volume do Fog::Volume.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Volume[provider] } end end end end end fog-1.34.0/spec/fog/image_spec.rb0000644000004100000410000000065712600047642016541 0ustar www-datawww-datarequire "spec_helper" describe Fog::Image do Fog::Image.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Image[provider] } end end end end end fog-1.34.0/spec/fog/compute_spec.rb0000644000004100000410000000122212600047642017120 0ustar www-datawww-datarequire "spec_helper" describe Fog::Compute do Fog::Compute.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do # These providers do not raise ArgumentError since they have no requirements defined if [:openvz, :vmfusion].include?(provider) assert Fog::Compute[provider] else assert_raises(ArgumentError) { Fog::Compute[provider] } end end end end end end fog-1.34.0/spec/fog/xml/0000755000004100000410000000000012600047642014710 5ustar www-datawww-datafog-1.34.0/spec/fog/xml/connection_spec.rb0000644000004100000410000000164412600047642020413 0ustar www-datawww-datarequire "spec_helper" # @note This is going to be part of fog-xml eventually describe Fog::XML::Connection do before do @connection = Fog::XML::Connection.new("http://localhost") end after do Excon.stubs.clear end it "responds to #request" do assert_respond_to @connection, :request end describe "when request is passed a parser" do it "returns the body after parsing" do @parser = Fog::ToHashDocument.new Excon.stub({}, { :status => 200, :body => "" }) response = @connection.request(:parser => @parser, :mock => true) assert_equal({ :xml => "" }, response.body) end end describe "when request excludes a parser" do it "returns the response body without change" do Excon.stub({}, { :status => 200, :body => "" }) response = @connection.request(:mock => true) assert_equal("", response.body) end end end fog-1.34.0/spec/fog/cdn_spec.rb0000644000004100000410000000065112600047642016215 0ustar www-datawww-datarequire "spec_helper" describe Fog::CDN do Fog::CDN.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::CDN[provider] } end end end end end fog-1.34.0/spec/fog/network_spec.rb0000644000004100000410000000066512600047642017147 0ustar www-datawww-datarequire "spec_helper" describe Fog::Network do Fog::Network.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Network[provider] } end end end end end fog-1.34.0/spec/fog/bin_spec.rb0000644000004100000410000002230412600047642016220 0ustar www-datawww-datarequire "spec_helper" require "fog/bin" describe Fog do describe "#providers" do it "includes existing providers" do assert_equal "Atmos", Fog.providers[:atmos] assert_equal "AWS", Fog.providers[:aws] assert_equal "BareMetalCloud", Fog.providers[:baremetalcloud] assert_equal "Bluebox", Fog.providers[:bluebox] assert_equal "Brightbox", Fog.providers[:brightbox] assert_equal "Clodo", Fog.providers[:clodo] assert_equal "CloudSigma", Fog.providers[:cloudsigma] assert_equal "Cloudstack", Fog.providers[:cloudstack] assert_equal "DigitalOcean", Fog.providers[:digitalocean] assert_equal "DNSimple", Fog.providers[:dnsimple] assert_equal "DNSMadeEasy", Fog.providers[:dnsmadeeasy] assert_equal "Dreamhost", Fog.providers[:dreamhost] assert_equal "Dynect", Fog.providers[:dynect] assert_equal "Ecloud", Fog.providers[:ecloud] assert_equal "Fogdocker", Fog.providers[:fogdocker] assert_equal "Glesys", Fog.providers[:glesys] assert_equal "GoGrid", Fog.providers[:gogrid] assert_equal "Google", Fog.providers[:google] assert_equal "HP", Fog.providers[:hp] assert_equal "IBM", Fog.providers[:ibm] assert_equal "InternetArchive", Fog.providers[:internetarchive] assert_equal "Joyent", Fog.providers[:joyent] assert_equal "Linode", Fog.providers[:linode] assert_equal "Local", Fog.providers[:local] assert_equal "Ninefold", Fog.providers[:ninefold] assert_equal "OpenNebula", Fog.providers[:opennebula] assert_equal "OpenStack", Fog.providers[:openstack] assert_equal "Openvz", Fog.providers[:openvz] assert_equal "Ovirt", Fog.providers[:ovirt] assert_equal "PowerDNS", Fog.providers[:powerdns] assert_equal "ProfitBricks", Fog.providers[:profitbricks] assert_equal "Rackspace", Fog.providers[:rackspace] assert_equal "Rage4", Fog.providers[:rage4] assert_equal "RiakCS", Fog.providers[:riakcs] assert_equal "SakuraCloud", Fog.providers[:sakuracloud] assert_equal "Serverlove", Fog.providers[:serverlove] assert_equal "Softlayer", Fog.providers[:softlayer] assert_equal "StormOnDemand", Fog.providers[:stormondemand] assert_equal "Vcloud", Fog.providers[:vcloud] assert_equal "VcloudDirector", Fog.providers[:vclouddirector] assert_equal "Vmfusion", Fog.providers[:vmfusion] assert_equal "Voxel", Fog.providers[:voxel] assert_equal "Vsphere", Fog.providers[:vsphere] assert_equal "XenServer", Fog.providers[:xenserver] assert_equal "Zerigo", Fog.providers[:zerigo] end end describe "#registered_providers" do it "includes existing providers" do assert_includes Fog.registered_providers, "Atmos" assert_includes Fog.registered_providers, "AWS" assert_includes Fog.registered_providers, "BareMetalCloud" assert_includes Fog.registered_providers, "Bluebox" assert_includes Fog.registered_providers, "Brightbox" assert_includes Fog.registered_providers, "Clodo" assert_includes Fog.registered_providers, "CloudSigma" assert_includes Fog.registered_providers, "Cloudstack" assert_includes Fog.registered_providers, "DigitalOcean" assert_includes Fog.registered_providers, "DNSimple" assert_includes Fog.registered_providers, "DNSMadeEasy" assert_includes Fog.registered_providers, "Dreamhost" assert_includes Fog.registered_providers, "Dynect" assert_includes Fog.registered_providers, "Ecloud" assert_includes Fog.registered_providers, "Fogdocker" assert_includes Fog.registered_providers, "Glesys" assert_includes Fog.registered_providers, "GoGrid" assert_includes Fog.registered_providers, "Google" assert_includes Fog.registered_providers, "HP" assert_includes Fog.registered_providers, "IBM" assert_includes Fog.registered_providers, "InternetArchive" assert_includes Fog.registered_providers, "Joyent" assert_includes Fog.registered_providers, "Linode" assert_includes Fog.registered_providers, "Local" assert_includes Fog.registered_providers, "Ninefold" assert_includes Fog.registered_providers, "OpenNebula" assert_includes Fog.registered_providers, "OpenStack" assert_includes Fog.registered_providers, "Openvz" assert_includes Fog.registered_providers, "Ovirt" assert_includes Fog.registered_providers, "PowerDNS" assert_includes Fog.registered_providers, "ProfitBricks" assert_includes Fog.registered_providers, "Rackspace" assert_includes Fog.registered_providers, "Rage4" assert_includes Fog.registered_providers, "RiakCS" assert_includes Fog.registered_providers, "SakuraCloud" assert_includes Fog.registered_providers, "Serverlove" assert_includes Fog.registered_providers, "Softlayer" assert_includes Fog.registered_providers, "StormOnDemand" assert_includes Fog.registered_providers, "Vcloud" assert_includes Fog.registered_providers, "VcloudDirector" assert_includes Fog.registered_providers, "Vmfusion" assert_includes Fog.registered_providers, "Voxel" assert_includes Fog.registered_providers, "Vsphere" assert_includes Fog.registered_providers, "XenServer" assert_includes Fog.registered_providers, "Zerigo" end end describe "#available_providers" do it "includes existing providers" do assert_includes Fog.available_providers, "Atmos" if Atmos.available? assert_includes Fog.available_providers, "AWS" if AWS.available? assert_includes Fog.available_providers, "BareMetalCloud" if BareMetalCloud.available? assert_includes Fog.available_providers, "Bluebox" if Bluebox.available? assert_includes Fog.available_providers, "Brightbox" if Brightbox.available? assert_includes Fog.available_providers, "Clodo" if Clodo.available? assert_includes Fog.available_providers, "CloudSigma" if CloudSigma.available? assert_includes Fog.available_providers, "Cloudstack" if Cloudstack.available? assert_includes Fog.available_providers, "DigitalOcean" if DigitalOcean.available? assert_includes Fog.available_providers, "DNSimple" if DNSimple.available? assert_includes Fog.available_providers, "DNSMadeEasy" if DNSMadeEasy.available? assert_includes Fog.available_providers, "Dreamhost" if Dreamhost.available? assert_includes Fog.available_providers, "Dynect" if Dynect.available? assert_includes Fog.available_providers, "Ecloud" if Ecloud.available? assert_includes Fog.available_providers, "Fogdocker" if Fogdocker.available? assert_includes Fog.available_providers, "Glesys" if Glesys.available? assert_includes Fog.available_providers, "GoGrid" if GoGrid.available? assert_includes Fog.available_providers, "Google" if Google.available? assert_includes Fog.available_providers, "HP" if HP.available? assert_includes Fog.available_providers, "IBM" if IBM.available? assert_includes Fog.available_providers, "InternetArchive" if InternetArchive.available? assert_includes Fog.available_providers, "Joyent" if Joyent.available? assert_includes Fog.available_providers, "Linode" if Linode.available? assert_includes Fog.available_providers, "Local" if Local.available? assert_includes Fog.available_providers, "Ninefold" if Ninefold.available? assert_includes Fog.available_providers, "OpenNebula" if OpenNebula.available? assert_includes Fog.available_providers, "OpenStack" if OpenStack.available? assert_includes Fog.available_providers, "Openvz" if Openvz.available? assert_includes Fog.available_providers, "Ovirt" if Ovirt.available? assert_includes Fog.available_providers, "PowerDNS" if PowerDNS.available? assert_includes Fog.available_providers, "ProfitBricks" if ProfitBricks.available? assert_includes Fog.available_providers, "Rackspace" if Rackspace.available? assert_includes Fog.available_providers, "Rage4" if Rage4.available? assert_includes Fog.available_providers, "RiakCS" if RiakCS.available? assert_includes Fog.available_providers, "SakuraCloud" if SakuraCloud.available? assert_includes Fog.available_providers, "Serverlove" if Serverlove.available? assert_includes Fog.available_providers, "Softlayer" if Softlayer.available? assert_includes Fog.available_providers, "StormOnDemand" if StormOnDemand.available? assert_includes Fog.available_providers, "Vcloud" if Vcloud.available? assert_includes Fog.available_providers, "VcloudDirector" if VcloudDirector.available? assert_includes Fog.available_providers, "Vmfusion" if Vmfusion.available? assert_includes Fog.available_providers, "Voxel" if Voxel.available? assert_includes Fog.available_providers, "Vsphere" if Vsphere.available? assert_includes Fog.available_providers, "XenServer" if XenServer.available? assert_includes Fog.available_providers, "Zerigo" if Zerigo.available? end end describe "#services" do it "returns Hash of services" do assert_kind_of Hash, Fog.services assert_includes Fog.services, :cdn assert_includes Fog.services, :compute assert_includes Fog.services, :dns assert_includes Fog.services, :storage end end end fog-1.34.0/spec/fog/vpn_spec.rb0000644000004100000410000000065112600047642016254 0ustar www-datawww-datarequire "spec_helper" describe Fog::VPN do Fog::VPN.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::VPN[provider] } end end end end end fog-1.34.0/spec/fog/dns_spec.rb0000644000004100000410000000117112600047642016233 0ustar www-datawww-datarequire "spec_helper" describe Fog::DNS do Fog::DNS.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do # These providers do not raise ArgumentError since they have no requirements defined if [:dnsimple].include?(provider) assert Fog::DNS[provider] else assert_raises(ArgumentError) { Fog::DNS[provider] } end end end end end end fog-1.34.0/spec/fog/identity_spec.rb0000644000004100000410000000067012600047642017303 0ustar www-datawww-datarequire "spec_helper" describe Fog::Identity do Fog::Identity.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Identity[provider] } end end end end end fog-1.34.0/spec/fog/storage_spec.rb0000644000004100000410000000066512600047642017122 0ustar www-datawww-datarequire "spec_helper" describe Fog::Storage do Fog::Storage.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} do assert_raises(ArgumentError) { Fog::Storage[provider] } end end end end end fog-1.34.0/spec/helpers/0000755000004100000410000000000012600047642014777 5ustar www-datawww-datafog-1.34.0/spec/helpers/bin.rb0000644000004100000410000000144712600047642016102 0ustar www-datawww-datamodule Fog module BinSpec extend Minitest::Spec::DSL it "responds to available?" do assert_respond_to subject, :available? end it "responds to class_for" do assert_respond_to subject, :class_for end it "#class_for raises ArgumentError for unknown services" do assert_raises(ArgumentError) { subject.class_for(:unknown) } end it "responds to collections" do skip if subject == ::Google assert_respond_to subject, :collections end it "responds to []" do assert_respond_to subject, :[] end it "#[] when unknown service is passed raises ArgumentError" do assert_raises(ArgumentError) { subject[:bad_service] } end it "responds to services" do assert_respond_to subject, :services end end end fog-1.34.0/LICENSE.md0000644000004100000410000000217112600047641014007 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2009-2015 [CONTRIBUTORS.md](https://github.com/fog/fog/blob/master/CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fog-1.34.0/.travis.yml0000644000004100000410000000175112600047641014517 0ustar www-datawww-datalanguage: ruby sudo: false script: bundle exec rake travis matrix: fast_finish: true include: - rvm: 1.8.7 gemfile: gemfiles/Gemfile-ruby-1.8.7 - rvm: 1.9.3 gemfile: Gemfile - rvm: 2.0.0 gemfile: Gemfile - rvm: 2.1.0 gemfile: Gemfile - rvm: 2.1.1 gemfile: Gemfile - rvm: 2.1.1 gemfile: gemfiles/Gemfile-edge - rvm: 2.2.0 gemfile: Gemfile - rvm: 2.2.0 gemfile: gemfiles/Gemfile-edge - rvm: jruby-18mode gemfile: gemfiles/Gemfile-ruby-1.8.7 - rvm: jruby-19mode gemfile: Gemfile - rvm: jruby-head gemfile: Gemfile allow_failures: - rvm: jruby-head notifications: email: false irc: channels: - "irc.freenode.org#ruby-fog" template: - "[#%{build_number}] %{message} %{build_url}" - "[#%{build_number}] %{commit} on %{branch} by %{author}" - "[#%{build_number}] %{compare_url}" on_success: always on_failure: always use_notice: false fog-1.34.0/lib/0000755000004100000410000000000012600047642013151 5ustar www-datawww-datafog-1.34.0/lib/fog/0000755000004100000410000000000012600047642013724 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/0000755000004100000410000000000012600047641016346 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/examples/0000755000004100000410000000000012600047641020164 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/examples/getting_started.md0000644000004100000410000000617312600047641023704 0ustar www-datawww-data# Getting started: the compute service You'll need a DigitalOcean account and API key to use this provider. Get one from https://cloud.digitalocean.com/api_access (fog currently uses the v1 API) Write down the Client Key and API Key, you'll need both to use the service. ## Connecting, retrieving and managing server objects Before we start, I guess it will be useful to the reader to know that Fog servers are 'droplets' in DigitalOcean's parlance. 'Server' is the Fog way to name VMs, and we have respected that in the DigitalOcean's Fog provider. First, create a connection to the host: ```ruby require 'fog' docean = Fog::Compute.new({ :provider => 'DigitalOcean', :digitalocean_api_key => 'poiuweoruwoeiuroiwuer', # your API key here :digitalocean_client_id => 'lkjasoidfuoiu' # your client key here }) ``` ## SSH Key Management Access to DigitalOcean servers can be managed with SSH keys. These can be assigned to servers at creation time so you can access them without having to use a password. Creating a key: ```ruby docean.ssh_keys.create( :name => 'Default SSH Key', :ssh_pub_key => File.read('~/.ssh/id_rsa.pub')) ) ``` Listing all keys: ```ruby docean.ssh_keys.each do | key | key.name key.ssh_pub_key end ``` Destroying a key: ```ruby docean.ssh_keys.destroy(:id => '27100') ``` ## Boostrapping a server Fog can be used to bootstrap a server, which will create an SSH key to be assigned to a server at boot. ```ruby server = connection.servers.bootstrap({ :name => 'test', :image_id => 1505447, :size_id => 33, :region_id => 4, :flavor_id => 66, :public_key_path => File.expand_path('~/.ssh/id_rsa.pub'), :private_key_path => File.expand_path('~/.ssh/id_rsa'), }) server.wait_for { ready? } ``` ## Listing servers Listing servers and attributes: ```ruby docean.servers.each do |server| # remember, servers are droplets server.id server.name server.state server.backups_enabled server.image_id server.flavor_id # server 'size' in DigitalOcean's API parlance server.region_id end ``` ## Server creation and life-cycle management Creating a new server (droplet): ```ruby server = docean.servers.create :name => 'foobar', # use the first image listed :image_id => docean.images.first.id, # use the first flavor listed :flavor_id => docean.flavors.first.id, # use the first region listed :region_id => docean.regions.first.id ``` The server is automatically started after that. We didn't pay attention when choosing the flavor, image and region used but you can easily list them too, and then decide: ```ruby docean.images.each do |image| image.id image.name image.distribution end docean.flavors.each do |flavor| flavor.id flavor.name end docean.regions.each do |region| region.id region.name end ``` Rebooting a server: ```ruby server = docean.servers.first server.reboot ``` Power cycle a server: ```ruby server.power_cycle ``` Destroying the server: ```ruby server.destroy ``` fog-1.34.0/lib/fog/digitalocean/requests/0000755000004100000410000000000012600047641020221 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/requests/compute/0000755000004100000410000000000012600047641021675 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/requests/compute/power_cycle_server.rb0000644000004100000410000000127712600047641026132 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def power_cycle_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_cycle" ) end end class Mock def power_cycle_server( id ) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] == id } server['status'] = 'off' if server response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/create_ssh_key.rb0000644000004100000410000000150712600047641025215 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def create_ssh_key( name, pub_key ) request( :expects => [200], :method => 'GET', :path => 'ssh_keys/new', :query => { 'name' => name, 'ssh_pub_key' => pub_key } ) end end class Mock def create_ssh_key( name, pub_key ) response = Excon::Response.new response.status = 200 mock_data = { "id" => Fog::Mock.random_numbers(1).to_i, "name" => name, "ssh_pub_key" => pub_key } response.body = { "status" => "OK", "ssh_key" => mock_data } self.data[:ssh_keys] << mock_data response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/list_flavors.rb0000644000004100000410000000145012600047641024731 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def list_flavors(options = {}) request( :expects => [200], :method => 'GET', :path => 'sizes' ) end end class Mock def list_flavors response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", "sizes" => [ {"id" => 33,"name" => "512MB"}, {"id" => 34,"name" => "1GB"}, {"id" => 35,"name" => "2GB"}, {"id" => 36,"name" => "4GB"}, {"id" => 37,"name" => "8GB"}, {"id" => 38,"name" => "16GB"} ] } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/destroy_server.rb0000644000004100000410000000147312600047641025306 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real # # FIXME: missing ssh keys support # def destroy_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/destroy", # We scrub data so future users can't read our disks. :query => {:scrub_data => '1' } ) end end class Mock def destroy_server( id ) response = Excon::Response.new response.status = 200 response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } server = self.data[:servers].reject! { |s| s['id'] == id } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/list_ssh_keys.rb0000644000004100000410000000105312600047641025104 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def list_ssh_keys(options = {}) request( :expects => [200], :method => 'GET', :path => 'ssh_keys' ) end end class Mock def list_ssh_keys response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", "ssh_keys" => self.data[:ssh_keys] } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/power_on_server.rb0000644000004100000410000000126312600047641025442 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def power_on_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_on" ) end end class Mock def power_on_server( id ) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] } server['status'] = 'active' if server response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/list_images.rb0000644000004100000410000000177712600047641024536 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def list_images(options = {}) request( :expects => [200], :method => 'GET', :path => 'images' ) end end class Mock def list_images response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", "images" => [ # Sample image { "id" => 1601, "name" => "CentOS 5.8 x64", "distribution" => "CentOS" }, { "id" => 1602, "name" => "CentOS 5.8 x32", "distribution" => "CentOS" }, { "id" => 2676, "name" => "Ubuntu 12.04 x64", "distribution" => "Ubuntu" }, ] } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/shutdown_server.rb0000644000004100000410000000132412600047641025463 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def shutdown_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/shutdown" ) end end class Mock def shutdown_server( id ) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] == id } # Simulate reboot server['status'] = 'off' if server response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/power_off_server.rb0000644000004100000410000000126312600047641025600 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def power_off_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_off" ) end end class Mock def power_off_server( id ) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] } server['status'] = 'off' if server response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/get_ssh_key.rb0000644000004100000410000000157412600047641024535 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real # # This method shows a specific public SSH key in your account # that can be added to a droplet. # # @see https://developers.digitalocean.com/ssh-keys # def get_ssh_key(id) request( :expects => [200], :method => 'GET', :path => "ssh_keys/#{id}" ) end end class Mock def get_ssh_key(id) response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", # key listing does not return ssh_pub_key # https://developers.digitalocean.com/ssh-keys "ssh_key" => self.data[:ssh_keys].find { |k| k['id'] == id } } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/list_servers.rb0000644000004100000410000000105012600047641024742 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def list_servers(options = {}) request( :expects => [200], :method => 'GET', :path => 'droplets' ) end end class Mock def list_servers response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", "droplets" => self.data[:servers] } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/list_regions.rb0000644000004100000410000000154712600047641024732 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def list_regions(options = {}) request( :expects => [200], :method => 'GET', :path => 'regions' ) end end class Mock def list_regions response = Excon::Response.new response.status = 200 response.body = { "status" => "OK", "regions" => [ { "id" => 1, "name" => "New York 1" }, { "id" => 2, "name" => "Amsterdam 1" }, { "id" => 3, "name" => "San Francisco 1" }, { "id" => 4, "name" => "New York 2" }, { "id" => 5, "name" => "Amsterdam 2" }, { "id" => 6, "name" => "Singapore 1" } ] } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/create_server.rb0000644000004100000410000000452612600047641025062 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real # # FIXME: missing ssh keys support # def create_server( name, size_id, image_id, region_id, options = {} ) query_hash = { :name => name, :size_id => size_id, :image_id => image_id, :region_id => region_id } if options[:ssh_key_ids] options[:ssh_key_ids] = options[:ssh_key_ids].join(",") if options[:ssh_key_ids].is_a? Array query_hash[:ssh_key_ids] = options[:ssh_key_ids] end query_hash[:private_networking] = !!options[:private_networking] # backups are enabled using backups_enabled query parameter! query_hash[:backups_enabled] = !!options[:backups_active] request( :expects => [200], :method => 'GET', :path => 'droplets/new', :query => query_hash ) end end class Mock def create_server( name, size_id, image_id, region_id, options = {} ) response = Excon::Response.new response.status = 200 # New York 2 (region id 4) is currently the only region that supports # private networking. The Digital Ocean IP will return a null # private_ip_address for any other region has_private_ip = !!options[:private_networking] && (region_id == 4) mock_data = { "id" => Fog::Mock.random_numbers(1).to_i, "event_id" => Fog::Mock.random_numbers(2).to_i, "name" => name, "size_id" => size_id, "image_id" => image_id, "region_id" => region_id, "ip_address" => "127.0.0.1", "private_ip_address" => has_private_ip ? "10.0.0.1" : nil, "status" => 'active', "created_at" => Time.now.strftime("%FT%TZ") } response.body = { "status" => "OK", "droplet" => mock_data } self.data[:servers] << mock_data response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/reboot_server.rb0000644000004100000410000000126012600047641025101 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def reboot_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/reboot" ) end end class Mock def reboot_server( id ) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] == id } server['status'] = 'off' if server response.body = { "event_id" => Fog::Mock.random_numbers(1).to_i, "status" => "OK" } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/get_server_details.rb0000644000004100000410000000126612600047641026101 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real def get_server_details(server_id) request( :expects => [200], :method => 'GET', :path => "droplets/#{server_id}" ) end end class Mock def get_server_details(server_id) response = Excon::Response.new response.status = 200 server = self.data[:servers].find { |s| s['id'] == server_id } response.body = { "status" => "OK", "droplet" => self.data[:servers].find { |s| s['id'] == server_id } } response end end end end end fog-1.34.0/lib/fog/digitalocean/requests/compute/destroy_ssh_key.rb0000644000004100000410000000142112600047641025436 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class Real # # Delete a SSH public key from your account # # @see https://developers.digitalocean.com/ssh-keys # def destroy_ssh_key(id) request( :expects => [200], :method => 'GET', :path => "ssh_keys/#{id}/destroy" ) end end class Mock def destroy_ssh_key(id) response = Excon::Response.new response.status = 200 if self.data[:ssh_keys].reject! { |k| k['id'] == id } response.body = { "status" => "OK" } else response.body = { "status" => "ERROR" } end response end end end end end fog-1.34.0/lib/fog/digitalocean/core.rb0000644000004100000410000000021412600047641017620 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module DigitalOcean extend Fog::Provider service(:compute, 'Compute') end end fog-1.34.0/lib/fog/digitalocean/models/0000755000004100000410000000000012600047641017631 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/models/compute/0000755000004100000410000000000012600047641021305 5ustar www-datawww-datafog-1.34.0/lib/fog/digitalocean/models/compute/regions.rb0000644000004100000410000000070112600047641023276 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/digitalocean/models/compute/region' module Fog module Compute class DigitalOcean class Regions < Fog::Collection model Fog::Compute::DigitalOcean::Region def all load service.list_regions.body['regions'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/images.rb0000644000004100000410000000067412600047641023106 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/digitalocean/models/compute/image' module Fog module Compute class DigitalOcean class Images < Fog::Collection model Fog::Compute::DigitalOcean::Image def all load service.list_images.body['images'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/servers.rb0000644000004100000410000000725412600047641023333 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/digitalocean/models/compute/server' module Fog module Compute class DigitalOcean class Servers < Fog::Collection model Fog::Compute::DigitalOcean::Server # Returns list of servers # @return [Fog::Compute::DigitalOcean::Servers] Retrieves a list of servers. # @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404 # @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400 # @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500 # @raise [Fog::Compute::DigitalOcean::ServiceError] # @see https://developers.digitalocean.com/v1/droplets/ def all(filters = {}) data = service.list_servers.body['droplets'] load(data) end # Creates a new server and populates ssh keys # # @return [Fog::Compute::DigitalOcean::Server] # @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404 # @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400 # @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500 # @raise [Fog::Compute::DigitalOcean::ServiceError] # @note This creates an SSH public key object and assigns it to the server on creation # @example # service.servers.bootstrap :name => 'bootstrap-server', # :flavor_ref => service.flavors.first.id, # :image_ref => service.images.find {|img| img.name =~ /Ubuntu/}.id, # :public_key_path => '~/.ssh/fog_rsa.pub', # :private_key_path => '~/.ssh/fog_rsa' # def bootstrap(new_attributes = {}) server = new(new_attributes) check_keys(new_attributes) credential = Fog.respond_to?(:credential) && Fog.credential || :default name = "fog_#{credential}" ssh_key = service.ssh_keys.find { |key| key.name == name } if ssh_key.nil? ssh_key = service.ssh_keys.create( :name => name, :ssh_pub_key => (new_attributes[:public_key] || File.read(new_attributes[:public_key_path])) ) end server.ssh_keys = [ssh_key] server.save server.wait_for { ready? } if new_attributes[:private_key] server.setup :key_data => [new_attributes[:private_key]] else server.setup :keys => [new_attributes[:private_key_path]] end server end # Retrieves server # @param [String] id for server to be returned # @return [Fog::Compute::DigitalOcean:Server] # @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404 # @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400 # @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500 # @raise [Fog::Compute::DigitalOcean::ServiceError] # @see https://developers.digitalocean.com/v1/droplets/ def get(id) server = service.get_server_details(id).body['droplet'] new(server) if server rescue Fog::Errors::NotFound nil end protected def check_keys(attributes) check_key :public, attributes[:public_key], attributes[:public_key_path] check_key :private, attributes[:private_key], attributes[:private_key_path] end def check_key(name, data, path) if [data, path].all?(&:nil?) raise ArgumentError, "either #{name}_key or #{name}_key_path is required to configure the server" end end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/ssh_key.rb0000644000004100000410000000072412600047641023302 0ustar www-datawww-datamodule Fog module Compute class DigitalOcean class SshKey < Fog::Model identity :id attribute :name attribute :ssh_pub_key def save requires :name, :ssh_pub_key merge_attributes(service.create_ssh_key(name, ssh_pub_key).body['ssh_key']) true end def destroy requires :id service.destroy_ssh_key id true end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/flavors.rb0000644000004100000410000000067712600047641023320 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/digitalocean/models/compute/flavor' module Fog module Compute class DigitalOcean class Flavors < Fog::Collection model Fog::Compute::DigitalOcean::Flavor def all load service.list_flavors.body['sizes'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/ssh_keys.rb0000644000004100000410000000077612600047641023474 0ustar www-datawww-datarequire 'fog/digitalocean/models/compute/ssh_key' module Fog module Compute class DigitalOcean class SshKeys < Fog::Collection identity :href model Fog::Compute::DigitalOcean::SshKey def all data = service.list_ssh_keys.body['ssh_keys'] load(data) end def get(uri) data = service.get_ssh_key(uri).body['ssh_key'] new(data) rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/region.rb0000644000004100000410000000026712600047641023122 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class DigitalOcean class Region < Fog::Model identity :id attribute :name end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/flavor.rb0000644000004100000410000000026712600047641023130 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class DigitalOcean class Flavor < Fog::Model identity :id attribute :name end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/server.rb0000644000004100000410000001500012600047641023134 0ustar www-datawww-datarequire 'fog/compute/models/server' module Fog module Compute class DigitalOcean # A DigitalOcean Droplet # class Server < Fog::Compute::Server identity :id attribute :name attribute :state, :aliases => 'status' attribute :image_id attribute :region_id attribute :flavor_id, :aliases => 'size_id' attribute :public_ip_address, :aliases => 'ip_address' attribute :private_ip_address attribute :private_networking attribute :backups_active, :aliases => 'backups_enabled' attribute :created_at attr_writer :ssh_keys # Deprecated: Use public_ip_address instead. def ip_address Fog::Logger.warning("ip_address has been deprecated. Use public_ip_address instead") public_ip_address end # Reboot the server (soft reboot). # # The preferred method of rebooting a server. def reboot requires :id service.reboot_server self.id end # Reboot the server (hard reboot). # # Powers the server off and then powers it on again. def power_cycle requires :id service.power_cycle_server self.id end # Shutdown the server # # Sends a shutdown signal to the operating system. # The server consumes resources while powered off # so you are still charged. # # @see https://www.digitalocean.com/community/questions/am-i-charged-while-my-droplet-is-in-a-powered-off-state def shutdown requires :id service.shutdown_server self.id end # Power off the server # # Works as a power switch. # The server consumes resources while powered off # so you are still charged. # # @see https://www.digitalocean.com/community/questions/am-i-charged-while-my-droplet-is-in-a-powered-off-state def stop requires :id service.power_off_server self.id end # Power on the server. # # The server consumes resources while powered on # so you will be charged. # # Each time a server is spun up, even if for a few seconds, # it is charged for an hour. # def start requires :id service.power_on_server self.id end def setup(credentials = {}) requires :ssh_ip_address require 'net/ssh' commands = [ %{mkdir .ssh}, %{passwd -l #{username}}, %{echo "#{Fog::JSON.encode(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json} ] if public_key commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys} end # wait for DigitalOcean to be ready wait_for { sshable?(credentials) } Fog::SSH.new(ssh_ip_address, username, credentials).run(commands) end # Creates the server (not to be called directly). # # Usually called by Fog::Collection#create # # docean = Fog::Compute.new({ # :provider => 'DigitalOcean', # :digitalocean_api_key => 'key-here', # your API key here # :digitalocean_client_id => 'client-id-here' # your client key here # }) # docean.servers.create :name => 'foobar', # :image_id => image_id_here, # :flavor_id => flavor_id_here, # :region_id => region_id_here # # @return [Boolean] def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :flavor_id, :image_id, :region_id options = {} if attributes[:ssh_key_ids] options[:ssh_key_ids] = attributes[:ssh_key_ids] elsif @ssh_keys options[:ssh_key_ids] = @ssh_keys.map(&:id) end options[:private_networking] = private_networking options[:backups_active] = backups_active data = service.create_server name, flavor_id, image_id, region_id, options merge_attributes(data.body['droplet']) true end # Destroy the server, freeing up the resources. # # DigitalOcean will stop charging you for the resources # the server was using. # # Once the server has been destroyed, there's no way # to recover it so the data is irrecoverably lost. # # IMPORTANT: As of 2013/01/31, you should wait some time to # destroy the server after creating it. If you try to destroy # the server too fast, the destroy event may be lost and the # server will remain running and consuming resources, so # DigitalOcean will keep charging you. # Double checked this with DigitalOcean staff and confirmed # that it's the way it works right now. # # Double check the server has been destroyed! def destroy requires :id service.destroy_server id end # Checks whether the server status is 'active'. # # The server transitions from 'new' to 'active' sixty to ninety # seconds after creating it (time varies and may take more # than 90 secs). # # @return [Boolean] def ready? state == 'active' end # DigitalOcean API does not support updating server state def update msg = 'DigitalOcean servers do not support updates' raise NotImplementedError.new(msg) end # Helper method to get the flavor name def flavor requires :flavor_id @flavor ||= service.flavors.get(flavor_id.to_i) end # Helper method to get the image name def image requires :image_id @image ||= service.images.get(image_id.to_i) end # Helper method to get the region name def region requires :region_id @region ||= service.regions.get(region_id.to_i) end # Helper method to get an array with all available IP addresses def ip_addresses [public_ip_address, private_ip_address].flatten.select(&:present?) end end end end end fog-1.34.0/lib/fog/digitalocean/models/compute/image.rb0000644000004100000410000000032612600047641022715 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class DigitalOcean class Image < Fog::Model identity :id attribute :name attribute :distribution end end end end fog-1.34.0/lib/fog/digitalocean/CHANGELOG.md0000644000004100000410000000023412600047641020156 0ustar www-datawww-data# 1.10.1 2013/04/04 * Initial release Getting started example: https://github.com/fog/fog/blob/master/lib/fog/digitalocean/examples/getting_started.md fog-1.34.0/lib/fog/digitalocean/compute.rb0000644000004100000410000000672512600047641020361 0ustar www-datawww-datarequire 'fog/digitalocean/core' module Fog module Compute class DigitalOcean < Fog::Service requires :digitalocean_api_key requires :digitalocean_client_id recognizes :digitalocean_api_url model_path 'fog/digitalocean/models/compute' model :server collection :servers model :flavor collection :flavors model :image collection :images model :region collection :regions model :ssh_key collection :ssh_keys request_path 'fog/digitalocean/requests/compute' request :list_servers request :list_images request :list_regions request :list_flavors request :get_server_details request :create_server request :destroy_server request :reboot_server request :power_cycle_server request :power_off_server request :power_on_server request :shutdown_server request :list_ssh_keys request :create_ssh_key request :get_ssh_key request :destroy_ssh_key # request :digitalocean_resize class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :servers => [], :ssh_keys => [] } end end def self.reset @data = nil end def initialize(options={}) @digitalocean_api_key = options[:digitalocean_api_key] end def data self.class.data[@digitalocean_api_key] end def reset_data self.class.data.delete(@digitalocean_api_key) end end class Real def initialize(options={}) @digitalocean_api_key = options[:digitalocean_api_key] @digitalocean_client_id = options[:digitalocean_client_id] @digitalocean_api_url = options[:digitalocean_api_url] || \ "https://api.digitalocean.com" @connection = Fog::XML::Connection.new(@digitalocean_api_url) end def reload @connection.reset end def request(params) params[:query] ||= {} params[:query].merge!(:api_key => @digitalocean_api_key) params[:query].merge!(:client_id => @digitalocean_client_id) response = retry_event_lock { parse @connection.request(params) } unless response.body.empty? if response.body['status'] != 'OK' case response.body['error_message'] when /No Droplets Found/ raise Fog::Errors::NotFound.new else raise Fog::Errors::Error.new response.body.to_s end end end response end private def parse(response) return response if response.body.empty? response.body = Fog::JSON.decode(response.body) response end def retry_event_lock count = 0 response = nil while count < 5 response = yield if response.body && response.body['error_message'] =~ /There is already a pending event for the droplet/ count += 1 sleep count ** 3 else break end end response end end end end end fog-1.34.0/lib/fog/digitalocean.rb0000644000004100000410000000004312600047641016670 0ustar www-datawww-datarequire 'fog/digitalocean/compute' fog-1.34.0/lib/fog/bin/0000755000004100000410000000000012600047641014473 5ustar www-datawww-datafog-1.34.0/lib/fog/bin/digitalocean.rb0000644000004100000410000000134512600047641017446 0ustar www-datawww-dataclass DigitalOcean < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::DigitalOcean else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("DigitalOcean[:compute] is not recommended, use Compute[:digitalocean] for portability") Fog::Compute.new(:provider => 'DigitalOcean') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::DigitalOcean.services end end end fog-1.34.0/lib/fog/bin/brightbox.rb0000644000004100000410000000150612600047641017012 0ustar www-datawww-dataclass Brightbox < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Brightbox when :storage Fog::Storage::Brightbox else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Brightbox[:compute] is not recommended, use Compute[:brightbox] for portability") Fog::Compute.new(:provider => 'Brightbox') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def account @@connections[:compute].account end def services Fog::Brightbox.services end end end fog-1.34.0/lib/fog/bin/aws.rb0000644000004100000410000000040112600047641015605 0ustar www-datawww-datarequire 'fog/aws/service_mapper' class AWS < Fog::Bin def self.services Fog::AWS::ServiceMapper.services end def self.[](key) Fog::AWS::ServiceMapper[key] end def self.class_for(key) Fog::AWS::ServiceMapper.class_for(key) end end fog-1.34.0/lib/fog/bin/dreamhost.rb0000644000004100000410000000126412600047641017011 0ustar www-datawww-dataclass Dreamhost < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::Dreamhost else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::Logger.warning("Dreamhost[:dns] is not recommended, use DNS[:dreamhost] for portability") Fog::DNS.new(:provider => 'Dreamhost') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Dreamhost.services end end end fog-1.34.0/lib/fog/bin/vcloud.rb0000644000004100000410000000111712600047641016314 0ustar www-datawww-dataclass Vcloud < Fog::Bin class << self def class_for(key) case key when :compute Fog::Vcloud::Compute else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'Vcloud') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Vcloud.services end end end fog-1.34.0/lib/fog/bin/cloudsigma.rb0000644000004100000410000000125312600047641017150 0ustar www-datawww-dataclass CloudSigma < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::CloudSigma else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'CloudSigma') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::CloudSigma.services end end end fog-1.34.0/lib/fog/bin/internet_archive.rb0000644000004100000410000000170212600047641020351 0ustar www-datawww-dataclass InternetArchive < Fog::Bin class << self def class_for(key) case key when :storage Fog::Storage::InternetArchive else # @todo Replace most instances of ArgumentError with NotImplementedError # @todo For a list of widely supported Exceptions, see: # => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35 raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :storage Fog::Logger.warning("InternetArchive[:storage] is not recommended, use Storage[:aws] for portability") Fog::Storage.new(:provider => 'InternetArchive') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::InternetArchive.services end end end fog-1.34.0/lib/fog/bin/go_grid.rb0000644000004100000410000000130112600047641016425 0ustar www-datawww-dataclass GoGrid < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::GoGrid else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("GoGrid[:compute] is not recommended, use Compute[:gogrid] for portability") Fog::Compute.new(:provider => 'GoGrid') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::GoGrid.services end end end fog-1.34.0/lib/fog/bin/hp.rb0000644000004100000410000000330212600047641015425 0ustar www-datawww-dataclass HP < Fog::Bin class << self def class_for(key) case key when :block_storage Fog::HP::BlockStorage when :block_storage_v2 Fog::HP::BlockStorageV2 when :cdn Fog::CDN::HP when :compute Fog::Compute::HP when :dns Fog::HP::DNS when :lb Fog::HP::LB when :network Fog::HP::Network when :storage Fog::Storage::HP else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :block_storage Fog::Logger.deprecation "HP Cloud Block Storage V1 service will be soon deprecated. Please use `Fog::HP::BlockStorageV2` provider to use latest HP Cloud Block Storage service." Fog::HP::BlockStorage.new when :block_storage_v2 Fog::HP::BlockStorageV2.new when :cdn Fog::Logger.warning("HP[:cdn] is deprecated, use CDN[:hp] instead") Fog::CDN.new(:provider => 'HP') when :compute Fog::Logger.warning("HP[:compute] is deprecated, use Compute[:hp] instead") Fog::Compute.new(:provider => 'HP') when :dns Fog::HP::DNS.new when :lb Fog::HP::LB.new when :network Fog::HP::Network.new when :storage Fog::Logger.warning("HP[:storage] is deprecated, use Storage[:hp] instead") Fog::Storage.new(:provider => 'HP') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::HP.services end end end fog-1.34.0/lib/fog/bin/rackspace.rb0000644000004100000410000000553112600047641016760 0ustar www-datawww-dataclass Rackspace < Fog::Bin class << self def class_for(key) case key when :auto_scale Fog::Rackspace::AutoScale when :block_storage Fog::Rackspace::BlockStorage when :cdn Fog::CDN::Rackspace when :cdn_v2 Fog::Rackspace::CDNV2 when :compute Fog::Compute::Rackspace when :compute_v2 Fog::Compute::RackspaceV2 when :storage Fog::Storage::Rackspace when :load_balancers Fog::Rackspace::LoadBalancers when :dns Fog::DNS::Rackspace when :identity Fog::Rackspace::Identity when :databases Fog::Rackspace::Databases when :monitoring Fog::Rackspace::Monitoring when :queues Fog::Rackspace::Queues when :networking Fog::Rackspace::Networking when :networking_v2 Fog::Rackspace::NetworkingV2 else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :auto_scale Fog::Rackspace::AutoScale.new when :cdn Fog::Logger.warning("Rackspace[:cdn] is not recommended, use CDN[:rackspace] for portability") Fog::CDN.new(:provider => 'Rackspace') when :cdn_v2 Fog::Rackspace::CDNV2.new when :compute Fog::Logger.warning("Rackspace[:compute] is not recommended, use Compute[:rackspace] for portability") Fog::Compute.new(:provider => 'Rackspace') when :compute_v2 Fog::Logger.warning("Rackspace[:compute] is not recommended, use Compute[:rackspace] for portability") Fog::Compute.new(:provider => 'Rackspace', :version => 'v2') when :dns Fog::DNS.new(:provider => 'Rackspace') when :load_balancers Fog::Rackspace::LoadBalancers.new when :storage Fog::Logger.warning("Rackspace[:storage] is not recommended, use Storage[:rackspace] for portability") Fog::Storage.new(:provider => 'Rackspace') when :identity Fog::Logger.warning("Rackspace[:identity] is not recommended, use Identity[:rackspace] for portability") Fog::Identity.new(:provider => 'Rackspace') when :databases Fog::Rackspace::Databases.new when :block_storage Fog::Rackspace::BlockStorage.new when :monitoring Fog::Rackspace::Monitoring.new when :queues Fog::Rackspace::Queues.new when :networking Fog::Rackspace::Networking.new when :networking_v2 Fog::Rackspace::NetworkingV2.new else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Rackspace.services end end end fog-1.34.0/lib/fog/bin/ibm.rb0000644000004100000410000000127512600047641015574 0ustar www-datawww-dataclass IBM < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::IBM when :storage Fog::Storage::IBM else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'IBM') when :storage Fog::Storage.new(:provider => 'Storage') else raise ArgumentError, "Unrecognized service: #{service}" end end @@connections[service] end def services Fog::IBM.services end end end fog-1.34.0/lib/fog/bin/fogdocker.rb0000644000004100000410000000122712600047641016765 0ustar www-datawww-dataclass Fogdocker < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Fogdocker else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'Fogdocker') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Fogdocker.services end end end fog-1.34.0/lib/fog/bin/bluebox.rb0000644000004100000410000000167512600047641016471 0ustar www-datawww-dataclass Bluebox < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Bluebox when :dns Fog::DNS::Bluebox when :blb Fog::Bluebox::BLB else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Bluebox[:compute] is not recommended, use Compute[:bluebox] for portability") Fog::Compute.new(:provider => 'Bluebox') when :dns Fog::Logger.warning("Bluebox[:dns] is not recommended, use DNS[:bluebox] for portability") Fog::DNS.new(:provider => 'Bluebox') else raise ArgumentError, "Unrecognized service: #{service}" end end @@connections[service] end def services Fog::Bluebox.services end end end fog-1.34.0/lib/fog/bin/clodo.rb0000644000004100000410000000130212600047641016114 0ustar www-datawww-dataclass Clodo < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Clodo else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Formatador.display_line("[yellow][WARN] Clodo[:compute] is deprecated, use Compute[:clodo] instead[/]") Fog::Compute.new(:provider => 'Clodo') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Clodo.services end end end fog-1.34.0/lib/fog/bin/zerigo.rb0000644000004100000410000000124212600047641016316 0ustar www-datawww-dataclass Zerigo < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::Zerigo else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::Logger.warning("Zerigo[:dns] is not recommended, use DNS[:zerigo] for portability") Fog::DNS.new(:provider => 'Zerigo') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Zerigo.services end end end fog-1.34.0/lib/fog/bin/cloudstack.rb0000644000004100000410000000113712600047641017156 0ustar www-datawww-dataclass Cloudstack < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Cloudstack else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'Cloudstack') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Cloudstack.services end end end fog-1.34.0/lib/fog/bin/softlayer.rb0000644000004100000410000000332512600047641017033 0ustar www-datawww-data# # Author:: Matt Eldridge () # © Copyright IBM Corporation 2014. # # LICENSE: MIT (http://opensource.org/licenses/MIT) # class Softlayer < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Softlayer when :dns Fog::DNS::Softlayer when :network Fog::Network::Softlayer when :storage Fog::Storage::Softlayer else # @todo Replace most instances of ArgumentError with NotImplementedError # @todo For a list of widely supported Exceptions, see: # => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35 raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Softlayer[:compute] is not recommended, use Compute[:aws] for portability") Fog::Compute.new(:provider => :softlayer) when :dns Fog::Logger.warning("Softlayer[:dns] is not recommended, use DNS[:aws] for portability") Fog::DNS.new(:provider => :softlayer) when :network Fog::Network.new(:provider => :softlayer) when :storage Fog::Storage.new(:provider => :softlayer) else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Softlayer.services end end end fog-1.34.0/lib/fog/bin/glesys.rb0000644000004100000410000000127512600047641016333 0ustar www-datawww-dataclass Glesys < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Glesys else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Glesys[:compute] is not recommended, use Compute[:glesys] for portability") Fog::Compute.new(:provider => 'Glesys') else raise ArgumentError, "Unrecognized service: #{service}" end end @@connections[service] end def services Fog::Glesys.services end end end fog-1.34.0/lib/fog/bin/rage4.rb0000644000004100000410000000123412600047641016022 0ustar www-datawww-dataclass Rage4 < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::Rage4 else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::Logger.warning("Rage4[:dns] is not recommended, use DNS[:rage4] for portability") Fog::DNS.new(:provider => 'Rage4') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Rage4.services end end end fog-1.34.0/lib/fog/bin/dnsmadeeasy.rb0000644000004100000410000000130012600047641017307 0ustar www-datawww-dataclass DNSMadeEasy < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::DNSMadeEasy else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::Logger.warning("DNSMadeEasy[:dns] is not recommended, use DNS[:dnsmadeeasy] for portability") Fog::DNS.new(:provider => 'DNSMadeEasy') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::DNSMadeEasy.services end end end fog-1.34.0/lib/fog/bin/bare_metal_cloud.rb0000644000004100000410000000136112600047641020302 0ustar www-datawww-dataclass BareMetalCloud < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::BareMetalCloud else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("BareMetalCloud[:compute] is not recommended, use Compute[:baremetalcloud] for portability") Fog::Compute.new(:provider => 'BareMetalCloud') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::BareMetalCloud.services end end end fog-1.34.0/lib/fog/bin/linode.rb0000644000004100000410000000161512600047641016275 0ustar www-datawww-dataclass Linode < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Linode when :dns Fog::DNS::Linode else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Linode[:compute] is not recommended, use Compute[:linode] for portability") Fog::Compute.new(:provider => 'Linode') when :dns Fog::Logger.warning("Linode[:dns] is not recommended, use DNS[:linode] for portability") Fog::DNS.new(:provider => 'Linode') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Linode.services end end end fog-1.34.0/lib/fog/bin/openvz.rb0000644000004100000410000000130112600047641016334 0ustar www-datawww-dataclass Openvz < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Openvz else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Openvz[:compute] is not recommended, use Compute[:openvz] for portability") Fog::Compute.new(:provider => 'Openvz') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Openvz.services end end end fog-1.34.0/lib/fog/bin/joyent.rb0000644000004100000410000000145412600047641016334 0ustar www-datawww-dataclass Joyent < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Joyent when :analytics Fog::Joyent::Analytics else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Joyent[:compute] is not recommended, use Compute[:joyent] for portability") Fog::Compute.new(:provider => 'Joyent') when :analytics Fog::Joyent::Analytics.new else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Joyent.services end end end fog-1.34.0/lib/fog/bin/xenserver.rb0000644000004100000410000000131412600047641017040 0ustar www-datawww-dataclass XenServer < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::XenServer else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("XenServer[:compute] is not recommended, use Compute[:xenserver] for portability") Fog::Compute.new(:provider => 'XenServer') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::XenServer.services end end end fog-1.34.0/lib/fog/bin/openstack.rb0000644000004100000410000000525412600047641017015 0ustar www-datawww-dataclass OpenStack < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::OpenStack when :identity Fog::Identity::OpenStack when :image Fog::Image::OpenStack when :network Fog::Network::OpenStack when :storage Fog::Storage::OpenStack when :volume Fog::Volume::OpenStack when :metering Fog::Metering::OpenStack when :orchestration Fog::Orchestration::OpenStack when :baremetal Fog::Baremetal::OpenStack when :planning Fog::Openstack::Planning else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("OpenStack[:compute] is not recommended, use Compute[:openstack] for portability") Fog::Compute.new(:provider => 'OpenStack') when :identity Fog::Logger.warning("OpenStack[:identity] is not recommended, use Identity[:openstack] for portability") Fog::Identity.new(:provider => 'OpenStack') when :image Fog::Logger.warning("OpenStack[:image] is not recommended, use Image[:openstack] for portability") Fog::Image.new(:provider => 'OpenStack') when :network Fog::Logger.warning("OpenStack[:network] is not recommended, use Network[:openstack] for portability") Fog::Network.new(:provider => 'OpenStack') when :storage Fog::Logger.warning("OpenStack[:storage] is not recommended, use Storage[:openstack] for portability") Fog::Storage.new(:provider => 'OpenStack') when :volume Fog::Logger.warning("OpenStack[:volume] is not recommended, use Volume[:openstack] for portability") Fog::Volume.new(:provider => 'OpenStack') when :metering Fog::Logger.warning("OpenStack[:metering] is not recommended, use Metering[:openstack] for portability") Fog::Metering.new(:provider => 'OpenStack') when :orchestration Fog::Logger.warning("OpenStack[:orchestration] is not recommended, use Orchestration[:openstack] for portability") Fog::Orchestration.new(:provider => 'OpenStack') when :baremetal Fog::Logger.warning("OpenStack[:baremetal] is not recommended, use Baremetal[:openstack] for portability") Fog::Baremetal.new(:provider => 'OpenStack') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::OpenStack.services end end end fog-1.34.0/lib/fog/bin/dnsimple.rb0000644000004100000410000000125612600047641016637 0ustar www-datawww-dataclass DNSimple < Fog::Bin class << self def class_for(key) case key when :dns Fog::DNS::DNSimple else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :dns Fog::Logger.warning("DNSimple[:dns] is not recommended, use DNS[:dnsimple] for portability") Fog::DNS.new(:provider => 'DNSimple') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::DNSimple.services end end end fog-1.34.0/lib/fog/bin/vcloud_director.rb0000644000004100000410000000115712600047641020213 0ustar www-datawww-dataclass VcloudDirector < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::VcloudDirector else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'VcloudDirector') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::VcloudDirector.services end end end fog-1.34.0/lib/fog/bin/ninefold.rb0000644000004100000410000000166512600047641016626 0ustar www-datawww-dataclass Ninefold < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Ninefold when :storage Fog::Storage::Ninefold else raise ArgumentError, "Unsupported #{self} service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("Ninefold[:compute] is not recommended, use Compute[:ninefold] for portability") Fog::Compute.new(:provider => 'Ninefold') when :storage Fog::Logger.warning("Ninefold[:storage] is not recommended, use Storage[:ninefold] for portability") Fog::Storage.new(:provider => 'Ninefold') else raise ArgumentError, "Unrecognized service: #{service}" end end @@connections[service] end def services Fog::Ninefold.services end end end fog-1.34.0/lib/fog/bin/opennebula.rb0000644000004100000410000000304212600047641017147 0ustar www-datawww-datamodule OpenNebula # deviates from other bin stuff to accomodate gem class << self def class_for(key) case key when :compute Fog::Compute::OpenNebula else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Logger.warning("OpenNebula[:compute] is not recommended, use Compute[:opennebula] for portability") Fog::Compute.new(:provider => 'OpenNebula') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def available? begin availability=true unless Gem::Specification::find_by_name("opennebula").nil? rescue Gem::LoadError availability=false rescue availability_gem=Gem.available?("opennebula") end if availability for service in services for collection in self.class_for(service).collections unless self.respond_to?(collection) self.class_eval <<-EOS, __FILE__, __LINE__ def self.#{collection} self[:#{service}].#{collection} end EOS end end end end availability end def collections services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s} end def services Fog::OpenNebula.services end end end fog-1.34.0/lib/fog/bin/ovirt.rb0000644000004100000410000000120712600047641016163 0ustar www-datawww-dataclass Ovirt < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Ovirt else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'Ovirt') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Ovirt.services end end end fog-1.34.0/lib/fog/bin/vsphere.rb0000644000004100000410000000112312600047641016471 0ustar www-datawww-dataclass Vsphere < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::Vsphere else raise ArgumentError, "Unrecognized service: #{key}" end end def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :compute Fog::Compute.new(:provider => 'Vsphere') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::Vsphere.services end end end fog-1.34.0/lib/fog/cloudsigma/0000755000004100000410000000000012600047641016052 5ustar www-datawww-datafog-1.34.0/lib/fog/cloudsigma/connection.rb0000644000004100000410000001524112600047641020541 0ustar www-datawww-datarequire 'fog/cloudsigma/error' module Fog module CloudSigma module CloudSigmaConnection module Real def auth_header(type = :basic) case type when :basic unless @username and @password raise ArgumentError, 'Username and password required for basic auth' end {'Authorization' => 'Basic ' << Base64.encode64("#{@username}:#{@password}").gsub("\n", '')} else unless @username and @password raise ArgumentError, 'Username and password required for basic auth' end {'Authorization' => 'Basic ' << Base64.encode64("#{@username}:#{@password}").gsub("\n", '')} end end def setup_connection(options) @persistent = options[:persistent] || false @connection_options = options[:connection_options] || {} @connection_options[:ssl_verify_peer] = false @auth_type = options[:cloudsigma_auth_type] || :basic @username = options[:cloudsigma_username] @password = options[:cloudsigma_password] @scheme = options[:cloudsigma_scheme] || 'https' @host = options[:cloudsigma_host] || 'lvs.cloudsigma.com' @port = options[:cloudsigma_port] || '443' @api_path_prefix = options[:cloudsigma_api_path_prefix] || 'api' @api_version = options[:cloudsigma_api_version] || '2.0' @path_prefix = "#{@api_path_prefix}/#{@api_version}/" @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) params[:headers] = params.fetch(:headers, {}).merge(auth_header(@auth_type)) params[:headers]['Content-Type'] = 'application/json; charset=utf-8' req_path = params[:path] params[:path] = "#{@path_prefix}#{req_path}" params[:body] = Fog::JSON.encode(params[:body]) if params[:body] begin response = @connection.request(params) rescue Excon::Errors::HTTPStatusError => e e.response.data[:body] = Fog::JSON.decode(e.response[:body]) unless e.response[:body].empty? err = Fog::CloudSigma::Errors.slurp_http_status_error(e) raise err end response.body = Fog::JSON.decode(response.body) unless response.body.empty? response end def list_request(path, override_params={}) default_params = {:method => 'GET', :expects => 200, :query => {:limit => 0}} override_params[:path] = path params = default_params.merge(override_params) request(params) end def get_request(path, override_params={}) default_params = {:method => 'GET', :expects => 200} override_params[:path] = path params = default_params.merge(override_params) request(params) end def delete_request(path, override_params={}) default_params = {:method => 'DELETE', :expects => 204} override_params[:path] = path params = default_params.merge(override_params) request(params) end def create_request(path, data, override_params={}) default_params = {:method => 'POST', :expects => [200, 201, 202]} override_params[:path] = path override_params[:body] = data params = default_params.merge(override_params) request(params) end def update_request(path, data, override_params={}) default_params = {:method => 'PUT', :expects => [200, 202]} override_params[:path] = path override_params[:body] = data params = default_params.merge(override_params) request(params) end end module Mock def setup_connection(options) @username = options[:cloudsigma_username] @password = options[:cloudsigma_password] end def mock_get(obj_or_collection, status, key=nil) data = self.data[obj_or_collection] if key data = data[key] unless data raise Fog::CloudSigma::Errors::NotFound.new("Object with uuid #{key} does not exist", 'notexist') end end Excon::Response.new(:body => Fog::JSON.decode(Fog::JSON.encode(data)), :status => status) end def mock_list(collection, status) data_array = self.data[collection].values Excon::Response.new(:body => {'objects' => data_array}, :status => status) end def mock_update(data, obj_or_collection, status, key, &clean_before_update) data = Fog::JSON.decode(Fog::JSON.encode(data)) if key unless self.data[obj_or_collection][key] raise Fog::CloudSigma::Errors::NotFound.new("Object with uuid #{key} does not exist", 'notexist') end if clean_before_update new_data = clean_before_update.call(self.data[obj_or_collection][key], data) else new_data = self.data[obj_or_collection][key].merge(data) end self.data[obj_or_collection][key] = new_data else if clean_before_update new_data = clean_before_update.call(self.data[obj_or_collection], data) else new_data = self.data[obj_or_collection].merge(data) end self.data[obj_or_collection] = new_data end Excon::Response.new(:body => Fog::JSON.decode(Fog::JSON.encode(new_data)), :status => status) end def mock_delete(collection, status, key) self.data[collection].delete(key) Excon::Response.new(:body => '', :status => status) end def mock_create(collection, status, data, key, defaults={}, &clean_before_store) data_with_defaults = data.merge(defaults) {|k, oldval, newval| oldval == nil ? newval: oldval} if clean_before_store cleaned_data = clean_before_store.call(data_with_defaults) else cleaned_data = data_with_defaults end # Encode and decode into JSON so that the result is the same as the one returned and parsed from the API final_data = Fog::JSON.decode(Fog::JSON.encode(cleaned_data)) self.data[collection][key] = final_data # dup so that stored data is different instance from response data response_data = final_data.dup response = Excon::Response.new response.body = {'objects' => [response_data]} response.status = status response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/0000755000004100000410000000000012600047641017725 5ustar www-datawww-datafog-1.34.0/lib/fog/cloudsigma/requests/get_server.rb0000644000004100000410000000046212600047641022421 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_server(server_id) get_request("servers/#{server_id}/") end end class Mock def get_server(server_id) mock_get(:servers, 200, server_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_vlan.rb0000644000004100000410000000042612600047641022053 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_vlan(vlan) get_request("vlans/#{vlan}/") end end class Mock def get_vlan(vlan) mock_get(:vlans, 200, vlan) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_lib_volume.rb0000644000004100000410000000046312600047641023251 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_lib_volume(vol_id) get_request("libdrives/#{vol_id}/") end end class Mock def get_lib_volume(vol_id) mock_get(:libvolumes, 200, vol_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/clone_server.rb0000644000004100000410000000140712600047641022742 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def clone_server(server_id, clone_params={}) request(:path => "servers/#{server_id}/action/", :method => 'POST', :query => {:do => :clone}, :body => clone_params, :expects => [200, 202]) end end class Mock def clone_server(server_id, clone_params={}) server = self.data[:servers][server_id].dup uuid = self.class.random_uuid server['uuid'] = uuid self.data[:servers][uuid] = server response = Excon::Response.new response.status = 200 response.body = server response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/delete_server.rb0000644000004100000410000000047612600047641023111 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def delete_server(server_id) delete_request("servers/#{server_id}/") end end class Mock def delete_server(server_id) mock_delete(:servers, 204, server_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/open_vnc.rb0000644000004100000410000000146012600047641022062 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def open_vnc(server_id) request(:path => "servers/#{server_id}/action/", :method => 'POST', :query => {:do => :open_vnc}, :expects => [200, 202]) end end class Mock def open_vnc(server_id) response = Excon::Response.new response.status = 200 host = @init_options[:cloudsigma_host] port = Fog::Mock.random_number(65000) vnc_url = "vnc://#{host}:#{port}" response.body = { 'action' => 'open_vnc', 'result' => 'success', 'uuid' => server_id, 'vnc_url' => vnc_url } response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/clone_libvolume.rb0000644000004100000410000000140612600047641023431 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def clone_libvolume(vol_id, clone_params={}) request(:path => "libdrives/#{vol_id}/action/", :method => 'POST', :query => {:do => :clone}, :body => clone_params, :expects => [200, 202]) end end class Mock def clone_libvolume(vol_id, clone_params={}) volume = self.data[:libvolumes][vol_id].dup uuid = self.class.random_uuid volume['uuid'] = uuid self.data[:volumes][uuid] = volume response = Excon::Response.new response.status = 200 response.body = volume response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_current_usage.rb0000644000004100000410000000036512600047641023763 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_current_usage get_request("currentusage/") end end class Mock def get_current_usage end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/stop_server.rb0000644000004100000410000000132612600047641022627 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def stop_server(server_id) request(:path => "servers/#{server_id}/action/", :method => 'POST', :query => {:do => :stop}, :expects => [200, 202]) end end class Mock def stop_server(server_id) server = self.data[:servers][server_id] server['status'] = 'stopped' response = Excon::Response.new response.status = 200 response.body = { 'action' => 'stop', 'result' => 'success', 'uuid' => server_id } response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/create_volume.rb0000644000004100000410000000127112600047641023105 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def create_volume(data) create_request("drives/", data) end end class Mock def create_volume(data) uuid = self.class.random_uuid defaults = {'uuid' => uuid, 'status' => 'unmounted', 'tags' => [], 'mounted_on' => [], 'affinities' => [], 'licenses' => [], 'jobs' => [], 'allow_multimount' => false, } mock_create(:volumes, 202, data, uuid, defaults) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/delete_volume.rb0000644000004100000410000000046112600047641023104 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def delete_volume(vol_id) delete_request("drives/#{vol_id}/") end end class Mock def delete_volume(vol_id) mock_delete(:volumes, 204, vol_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_vlans.rb0000644000004100000410000000041112600047641022424 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_vlans list_request('vlans/detail/') end end class Mock def list_vlans mock_list(:vlans, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_subscription.rb0000644000004100000410000000047612600047641023644 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_subscription(sub_id) get_request("subscriptions/#{sub_id}/") end end class Mock def get_subscription(sub_id) mock_get(:subscriptions, 200, sub_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/calculate_subscription_price.rb0000644000004100000410000000045212600047641026176 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def calculate_subscription_price(data) create_request("subscriptioncalculator/", data) end end class Mock def calculate_subscription_price(data) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_balance.rb0000644000004100000410000000040712600047641022477 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_balance get_request("balance/") end end class Mock def get_balance mock_get(:balance, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/update_server.rb0000644000004100000410000000241412600047641023123 0ustar www-datawww-datarequire 'set' module Fog module Compute class CloudSigma class Real def update_server(server_id, data) update_request("servers/#{server_id}/", data) end end class Mock def update_server(server_id, data) mock_update(data, :servers, 200, server_id) do |old_data, new_data| old_nics = old_data['nics'] new_nics = new_data['nics'] old_nics_macs = old_nics.map { |nic| nic['mac'] }.compact new_nics_macs = new_nics.map { |nic| nic['mac'] }.compact newly_created_macs = Set.new(new_nics_macs) - old_nics_macs unless newly_created_macs.empty? mac_err = <<-EOS MAC(s) #{newly_created_macs.to_a} not specified on guest #{server_id}. Nic MACs are automatically assigned at creation time and cannot be changed. Do not specify MAC to create a new NIC or specify existing MAC to update existing NIC. EOS raise Fog::CloudSigma::Errors::RequestError.new(mac_err, 'permission') end new_nics.each { |nic| nic['mac'] ||= Fog::Compute::CloudSigma::Mock.random_mac } old_data.merge(new_data) end end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/close_vnc.rb0000644000004100000410000000120412600047641022222 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def close_vnc(server_id) request(:path => "servers/#{server_id}/action/", :method => 'POST', :query => {:do => :close_vnc}, :expects => [200, 202]) end end class Mock def close_vnc(server_id) response = Excon::Response.new response.status = 200 response.body = { 'action' => 'close_vnc', 'result' => 'success', 'uuid' => server_id, } response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/start_server.rb0000644000004100000410000000142112600047641022773 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def start_server(server_id, start_params={}) request(:path => "servers/#{server_id}/action/", :method => 'POST', :query => {:do => :start}.merge!(start_params), :expects => [200, 202]) end end class Mock def start_server(server_id, start_params={}) server = self.data[:servers][server_id] server['status'] = 'running' response = Excon::Response.new response.status = 200 response.body = { 'action' => 'start', 'result' => 'success', 'uuid' => server_id } response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_pricing.rb0000644000004100000410000000115412600047641022545 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_pricing(currency=nil, subscription=false) query = {:limit => 0} if currency query[:currency] = currency end if subscription query[:level] = 0 end request(:path => "pricing/", :method => 'GET', :expects => 200, :query => query) end end class Mock def get_pricing(currency=nil, subscription=false) mock_get(:pricing, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_servers.rb0000644000004100000410000000042112600047641022773 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_servers list_request('servers/detail/') end end class Mock def list_servers mock_list(:servers, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_ips.rb0000644000004100000410000000040112600047641022073 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_ips list_request('ips/detail/') end end class Mock def list_ips mock_list(:ips, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_volume.rb0000644000004100000410000000044512600047641022423 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_volume(vol_id) get_request("drives/#{vol_id}/") end end class Mock def get_volume(vol_id) mock_get(:volumes, 200, vol_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_volumes.rb0000644000004100000410000000042012600047641022773 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_volumes list_request('drives/detail/') end end class Mock def list_volumes mock_list(:volumes, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/create_server.rb0000644000004100000410000000141412600047641023103 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def create_server(data) create_request("servers/", data) end end class Mock def create_server(data) uuid = self.class.random_uuid defaults = {'uuid' => uuid, 'status' => 'stopped', 'smp' => 1, 'hv_relaxed' => false, 'hv_tsc' => false, 'enable_numa' => false, 'cpus_instead_of_cores' => false, 'drives' => [], 'nics' => [], 'tags' => [] } mock_create(:servers, 202, data, uuid, defaults) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_lib_volumes.rb0000644000004100000410000000042712600047641023630 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_lib_volumes list_request('libdrives/') end end class Mock def list_lib_volumes mock_list(:libvolumes, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/extend_subscription.rb0000644000004100000410000000071012600047641024343 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def extend_subscription(sub_id, data) request(:path => "subscriptions/#{sub_id}/action/", :method => 'POST', :expects => [200, 202], :query => {:do => :extend}, :body=>data) end end class Mock def extend_subscription(sub_id, data) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/update_profile.rb0000644000004100000410000000045212600047641023255 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def update_profile(data) update_request("profile/", data) end end class Mock def update_profile(data) mock_update(data, :profile, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/update_vlan.rb0000644000004100000410000000052512600047641022556 0ustar www-datawww-datarequire 'set' module Fog module Compute class CloudSigma class Real def update_vlan(vlan_id, data) update_request("vlans/#{vlan_id}/", data) end end class Mock def update_vlan(vlan_id, data) mock_update(data, :vlans, 200, vlan_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/create_subscription.rb0000644000004100000410000000247312600047641024327 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def create_subscription(data) create_request("subscriptions/", data) end end class Mock def create_subscription(data) if data[:period] != '1 month' || data[:start_time] || data[:end_time] raise Fog::Errors::MockNotImplemented.new('Currently only mocks for subscriptions with period 1 month from now are implemented as mock') end id = Fog::Mock.random_numbers(3).to_i defaults = {'id' => id, 'start_time' => DateTime.now, 'end_time' => DateTime.now + 30 * 24 * 60 *60, 'auto_renew' => false, 'amount' => 1.0} if data[:resource] == 'vlan' vlan_uuid = self.class.random_uuid self.data[:vlans][vlan_uuid] = {'uuid' => vlan_uuid, 'subscription' => {'id' => id}, 'servers' => [], 'meta' => {}, 'tags' => []} defaults['subscribed_object'] = vlan_uuid end mock_create(:subscriptions, 200, data, id, defaults) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_ip.rb0000644000004100000410000000040212600047641021515 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_ip(ip) request("ips/#{ip}/") end end class Mock def get_ip(ip) mock_get(:ips, 200, ip) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/update_volume.rb0000644000004100000410000000051212600047641023121 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def update_volume(vol_id, data) update_request("drives/#{vol_id}/", data) end end class Mock def update_volume(vol_id, data) mock_update(data, :volumes, 200, vol_id) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/clone_volume.rb0000644000004100000410000000137212600047641022744 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def clone_volume(vol_id, clone_params={}) request(:path => "drives/#{vol_id}/action/", :method => 'POST', :query => {:do => :clone}, :body => clone_params, :expects => [200, 202]) end end class Mock def clone_volume(vol_id, clone_params={}) volume = self.data[:volumes][vol_id].dup uuid = self.class.random_uuid volume['uuid'] = uuid self.data[:volumes][uuid] = volume response = Excon::Response.new response.status = 200 response.body = volume response end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_subscriptions.rb0000644000004100000410000000044212600047641024214 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_subscriptions list_request('subscriptions/') end end class Mock def list_subscriptions mock_list(:subscriptions, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/list_fwpolicies.rb0000644000004100000410000000043312600047641023451 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def list_fwpolicies list_request('fwpolicies/detail/') end end class Mock def list_fwpolicies Fog::Mock.not_implemented end end end end end fog-1.34.0/lib/fog/cloudsigma/requests/get_profile.rb0000644000004100000410000000040712600047641022552 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Real def get_profile get_request("profile/") end end class Mock def get_profile mock_get(:profile, 200) end end end end end fog-1.34.0/lib/fog/cloudsigma/nested_model.rb0000644000004100000410000000364012600047641021044 0ustar www-datawww-datamodule Fog module CloudSigma class CloudsigmaModel < Fog::Model class << self def model_attribute_array(name, model, options={}) attributes_key = options[:aliases] || name class_eval <<-EOS, __FILE__, __LINE__ def #{name} #{name}_attrs = attributes[:#{attributes_key}] || [] refreshed_#{name} = #{name}_attrs.map { |x| #{model}.new(x) } attributes[:#{attributes_key}] = refreshed_#{name}.map { |x| x.attributes } refreshed_#{name} end def #{name}=(new_#{name}) new_#{name} ||= [] attributes[:#{attributes_key}] = new_#{name}.map { |x| x.kind_of?(Hash) ? x : x.attributes} end EOS @attributes ||= [] @attributes |= [name] for new_alias in [*options[:aliases]] aliases[new_alias] = name end end def model_attribute(name, model, options={}) attributes_key = options[:aliases] || name class_eval <<-EOS, __FILE__, __LINE__ def #{name} #{name}_attrs = attributes[:#{attributes_key}] if #{name}_attrs refreshed_#{name} = #{name}_attrs ? #{model}.new(#{name}_attrs) : nil attributes[:#{attributes_key}] = refreshed_#{name}.attributes refreshed_#{name} else nil end end def #{name}=(new_#{name}) if new_#{name} attributes[:#{attributes_key}] = new_#{name}.kind_of?(Hash) ? new_#{name} : new_#{name}.attributes else nil end end EOS @attributes ||= [] @attributes |= [name] for new_alias in [*options[:aliases]] aliases[new_alias] = name end end end end end end fog-1.34.0/lib/fog/cloudsigma/docs/0000755000004100000410000000000012600047641017002 5ustar www-datawww-datafog-1.34.0/lib/fog/cloudsigma/docs/getting_started.md0000644000004100000410000000625412600047641022522 0ustar www-datawww-data# Getting Started with Fog on CloudSigma ## Requirements In order to use CloudSigma with Fog, you must use Fog version 1.12.0 or later. ## Setting credentials Fog uses `~/.fog` to store credentials. To add CloudSigma as your default provider, simply add the following: :default: :cloudsigma_username: user@example.com :cloudsigma_password: SomeRandomPassword :cloudsigma_host: zrh.cloudsigma.com Please note that you need to specify the host. If you're on the Zurich-based cloud, you will need to enter `zrh.cloudsigma.com` and if you're on the Las Vegas cloud, you'll need to enter `lvs.cloudsigma.com`. ## Creating a server You can of course interact with Fog directly from your Ruby application, but in this example, we'll simply use the `fog` CLI tool. In the example below, we'll first create a 5GB disk, then we create server with 2Ghz CPU and 2GB RAM. Finally we attach the drive and boot up the server. $ fog > cs = Compute[:CloudSigma] > drive = cs.volumes.create(:name => 'fog_drive', :size => '5368709120', :media => 'disk') > server = cs.servers.create(:name => 'fog_server', :cpu => '2000', :mem => '2147483648', :vnc_password => 'foobar') > server.mount_volume(drive.uuid) > server.update > server.start Now, this wasn't very useful by itself since the drive we created was just a blank drive (as a result it cannot boot). It does however illustrate a minimal work flow. To make this a bit more useful, let's try to attach an ISO image (in this case Ubuntu 12.04 LTS), and boot into the installer. To do this, we'll run the following commands (assuming you haven't closed the session from above). You can either upload your own installer image, or you can use one from the drives library. In either case, you need to pass the UUID for the drive. > server.stop > ubuntu_image_uuid = '41d848c2-44e4-4428-9406-84e95bb1288d' > server.unmount_volume(drive.uuid) > server.mount_volume(ubuntu_image_uuid, 'ide', '0:0', 1) > server.mount_volume(drive.uuid, 'virtio', '0:0', 2) > server.update > server.start What this does is to stop the server, unmount the previous drive, then we attach the Ubuntu installation drive as an IDE device (on bus 0:0), with the boot order 1 (first). We then mount the system drive as Virtio device (on bus 0:0) with the boot order 2. Finally we push the changes to the server and start it. This will bring you into the Ubuntu installation. In order to actually run the installer, you need to open a VNC session to the server. This can be done bye issue the following command: > server.open_vnc That will print out the VNC URL, among with other data. You can simply pass the value of 'vnc_url' into your VNC client. When opening the session, you also need to provide the password, which we set to 'foobar' during the server creation. After you're done with the installation, you can unmount the Ubuntu installation disk by running the following command: > server.unmount_volume(ubuntu_image_uuid) You might also want to close the VNC session to increase security. This can be done by running: > server.close_vnc That's it. You've now set up a fully working Ubuntu server on CloudSigma using fog. fog-1.34.0/lib/fog/cloudsigma/core.rb0000644000004100000410000000021312600047641017323 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module CloudSigma extend Fog::Provider service(:compute, 'Compute') end end fog-1.34.0/lib/fog/cloudsigma/models/0000755000004100000410000000000012600047641017335 5ustar www-datawww-datafog-1.34.0/lib/fog/cloudsigma/models/vlan.rb0000644000004100000410000000120212600047641020615 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class VLAN < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :tags attribute :servers attribute :meta attribute :owner attribute :resource_uri, :type => :string attribute :subscription def update requires :identity data = attributes response = service.update_vlan(identity, data) new_attributes = response.body merge_attributes(new_attributes) end alias_method :save, :update end end end end fog-1.34.0/lib/fog/cloudsigma/models/mountpoint.rb0000644000004100000410000000105212600047641022074 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class CloudSigma class MountPoint < Fog::Model attribute :device, :type => 'string' attribute :dev_channel, :type => 'string' attribute :drive attribute :boot_order, :type => 'integer' def drive drive = attributes[:drive] drive.kind_of?(Hash) ? drive['uuid'] : drive end def drive=(new_drive) attributes[:drive] = new_drive end alias_method :volume, :drive end end end end fog-1.34.0/lib/fog/cloudsigma/models/volume.rb0000644000004100000410000000320112600047641021165 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class Volume < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :status, :type => :string attribute :jobs attribute :name, :type => :string attribute :tags attribute :media, :type => :string attribute :mounted_on attribute :owner attribute :meta attribute :allow_multimount, :type => :boolean attribute :licenses attribute :affinities, :type => :array attribute :size, :type => :integer attribute :resource_uri, :type => :string def save if persisted? update else create end end def create requires :name, :size, :media data = attributes response = service.create_volume(data) new_attributes = response.body['objects'].first merge_attributes(new_attributes) end def update requires :identity, :name, :size, :media data = attributes() response = service.update_volume(identity, data) new_attributes = response.body merge_attributes(new_attributes) end def destroy requires :identity service.delete_volume(identity) true end alias_method :delete, :destroy def clone(clone_params={}) requires :identity response = service.clone_volume(identity, clone_params) self.class.new(response.body['objects'].first) end end end end end fog-1.34.0/lib/fog/cloudsigma/models/profile.rb0000644000004100000410000000277212600047641021332 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class Profile < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :last_name, :type => :string attribute :login_sms, :type => :boolean attribute :currency, :type => :string attribute :meta attribute :api_https_only, :type => :boolean attribute :first_name, :type => :string attribute :uuid, :type => :string attribute :title, :type => :string attribute :state, :type => :string attribute :email, :type => :string attribute :vat, :type => :string attribute :autotopup_amount, :type => :float attribute :reseller, :type => :string attribute :company, :type => :string attribute :key_auth, :type => :boolean attribute :phone, :type => :string attribute :address, :type => :string attribute :mailing_list, :type => :boolean attribute :town, :type => :string attribute :has_autotopup, :type => :boolean attribute :my_notes, :type => :string attribute :bank_reference, :type => :string attribute :language, :type => :string attribute :country, :type => :string attribute :postcode, :type => :string def save update end def update response = service.update_profile(attributes) self.attribute.merge!(response.body) self end end end end end fog-1.34.0/lib/fog/cloudsigma/models/ipconf.rb0000644000004100000410000000035212600047641021140 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class IPConf < Fog::CloudSigma::CloudsigmaModel attribute :ip attribute :conf, :type => :string end end end end fog-1.34.0/lib/fog/cloudsigma/models/rule.rb0000644000004100000410000000102312600047641020625 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class Rule < Fog::CloudSigma::CloudsigmaModel attribute :action, :type => :string attribute :comment, :type => :string attribute :direction, :type => :string attribute :dst_ip, :type => :string attribute :dst_port, :type => :integer attribute :ip_proto, :type => :string attribute :src_ip, :type => :string attribute :src_port, :type => :string end end end end fog-1.34.0/lib/fog/cloudsigma/models/ips.rb0000644000004100000410000000102012600047641020446 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/ip' module Fog module Compute class CloudSigma class Ips < Fog::Collection model Fog::Compute::CloudSigma::IP def all resp = service.list_ips data = resp.body['objects'] load(data) end def get(ip) resp = service.get_ip(ip) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end end end end end fog-1.34.0/lib/fog/cloudsigma/models/servers.rb0000644000004100000410000000106212600047641021352 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/server' module Fog module Compute class CloudSigma class Servers < Fog::Collection model Fog::Compute::CloudSigma::Server def all resp = service.list_servers data = resp.body['objects'] load(data) end def get(server_id) resp = service.get_server(server_id) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end end end end end fog-1.34.0/lib/fog/cloudsigma/models/balance.rb0000644000004100000410000000040512600047641021246 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class Balance < Fog::CloudSigma::CloudsigmaModel attribute :balance, :type => :float attribute :currency, :type => :string end end end end fog-1.34.0/lib/fog/cloudsigma/models/current_usage.rb0000644000004100000410000000105412600047641022530 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'fog/cloudsigma/models/usage_record' module Fog module Compute class CloudSigma class CurrentUsage < Fog::CloudSigma::CloudsigmaModel model_attribute :cpu, UsageRecord model_attribute :hdd, UsageRecord model_attribute :ip, UsageRecord model_attribute :mem, UsageRecord model_attribute :sms, UsageRecord model_attribute :ssd, UsageRecord model_attribute :tx, UsageRecord model_attribute :vlan, UsageRecord end end end end fog-1.34.0/lib/fog/cloudsigma/models/fwpolicies.rb0000644000004100000410000000056012600047641022027 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/fwpolicy' module Fog module Compute class CloudSigma class Fwpolicies < Fog::Collection model Fog::Compute::CloudSigma::FWPolicy def all resp = service.list_fwpolicies data = resp.body['objects'] load(data) end end end end end fog-1.34.0/lib/fog/cloudsigma/models/obj_ref.rb0000644000004100000410000000034312600047641021270 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class CloudSigma class ObjRef < Fog::Model attribute :uuid, :type => :string attribute :resource_uri, :type => :string end end end end fog-1.34.0/lib/fog/cloudsigma/models/lib_volume.rb0000644000004100000410000000257412600047641022027 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class CloudSigma class LibVolume < Fog::Model identity :uuid attribute :mounted_on attribute :licenses attribute :meta attribute :owner attribute :affinities attribute :image_format, :type => :string attribute :size, :type => :integer attribute :category attribute :image_type, :type => :string attribute :media, :type => :string attribute :state, :type => :string attribute :status, :type => :string attribute :jobs attribute :description, :type => :string attribute :tags attribute :favourite, :type => :boolean attribute :paid, :type => :boolean attribute :allow_multimount, :type => :boolean attribute :install_notes, :type => :string attribute :arch, :type => :string attribute :name, :type => :string attribute :url, :type => :string attribute :os, :type => :string attribute :resource_uri, :type => :string def reload requires :identity collection.get(identity) end def clone(clone_params={}) requires :identity response = service.clone_volume(identity, clone_params) self.class.new(response.body['objects'].first) end end end end end fog-1.34.0/lib/fog/cloudsigma/models/ip.rb0000644000004100000410000000104012600047641020265 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class IP < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :tags, :type => :array attribute :nameservers, :type => :array attribute :server, :type => :string attribute :netmask, :type => :integer attribute :meta attribute :owner attribute :subscription attribute :gateway, :type => :string attribute :resource_uri, :type => :string end end end end fog-1.34.0/lib/fog/cloudsigma/models/fwpolicy.rb0000644000004100000410000000075212600047641021522 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'fog/core/collection' require 'fog/cloudsigma/models/rule' module Fog module Compute class CloudSigma class FWPolicy < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :name, :type => :string attribute :meta attribute :owner attribute :resource_uri, :type => :string attribute :servers, :type => :array model_attribute_array :rules, Rule end end end end fog-1.34.0/lib/fog/cloudsigma/models/nic.rb0000644000004100000410000000075412600047641020441 0ustar www-datawww-datarequire 'fog/core/model' require 'fog/cloudsigma/nested_model' require 'fog/cloudsigma/models/ipconf' module Fog module Compute class CloudSigma class Nic < Fog::CloudSigma::CloudsigmaModel attribute :boot_order attribute :mac, :type => :string attribute :model, :type => :string attribute :vlan attribute :firewall_policy model_attribute :ip_v4_conf, IPConf model_attribute :ip_v6_conf, IPConf end end end end fog-1.34.0/lib/fog/cloudsigma/models/pricing.rb0000644000004100000410000000104712600047641021317 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'fog/cloudsigma/models/price_record' module Fog module Compute class CloudSigma class Pricing < Fog::CloudSigma::CloudsigmaModel model_attribute :cpu, PriceRecord model_attribute :hdd, PriceRecord model_attribute :ip, PriceRecord model_attribute :mem, PriceRecord model_attribute :sms, PriceRecord model_attribute :ssd, PriceRecord model_attribute :tx, PriceRecord model_attribute :vlan, PriceRecord end end end end fog-1.34.0/lib/fog/cloudsigma/models/subscription.rb0000644000004100000410000000271612600047641022414 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class Subscription < Fog::CloudSigma::CloudsigmaModel identity :id attribute :status, :type => :string attribute :uuid, :type => :string attribute :resource, :type => :string attribute :auto_renew, :type => :boolean attribute :descendants attribute :start_time, :type => :time attribute :price, :type => :float attribute :period, :type => :string attribute :remaining, :type => :string attribute :amount, :type => :integer attribute :end_time, :type => :time attribute :discount_percent, :type => :float attribute :subscribed_object, :type => :string attribute :discount_amount, :type => :float def save create end def create requires :resource, :amount data = attributes response = service.create_subscription(data) new_attributes = response.body['objects'].first merge_attributes(new_attributes) end def extend(period=nil, end_time=nil) requires :identity data = {} if period data[:period] = period elsif end_time data[:end_time] = end_time end response = service.extend_subscription(identity, data) self.class.new(response.body) end end end end end fog-1.34.0/lib/fog/cloudsigma/models/volumes.rb0000644000004100000410000000105412600047641021354 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/volume' module Fog module Compute class CloudSigma class Volumes < Fog::Collection model Fog::Compute::CloudSigma::Volume def all resp = service.list_volumes data = resp.body['objects'] load(data) end def get(vol_id) resp = service.get_volume(vol_id) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end end end end end fog-1.34.0/lib/fog/cloudsigma/models/price_calculation.rb0000644000004100000410000000053612600047641023346 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'fog/cloudsigma/models/subscriptions' module Fog module Compute class CloudSigma class PriceCalculation < Fog::CloudSigma::CloudsigmaModel attribute :price, :type => :float model_attribute_array :subscriptions, Subscription, :aliases => 'objects' end end end end fog-1.34.0/lib/fog/cloudsigma/models/lib_volumes.rb0000644000004100000410000000107612600047641022206 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/lib_volume' module Fog module Compute class CloudSigma class LibVolumes < Fog::Collection model Fog::Compute::CloudSigma::LibVolume def all resp = service.list_lib_volumes data = resp.body['objects'] load(data) end def get(vol_id) resp = service.get_lib_volume(vol_id) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end end end end end fog-1.34.0/lib/fog/cloudsigma/models/subscriptions.rb0000644000004100000410000000217112600047641022572 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/subscription' module Fog module Compute class CloudSigma class Subscriptions < Fog::Collection model Fog::Compute::CloudSigma::Subscription def all resp = service.list_subscriptions data = resp.body['objects'] load(data) end def get(sub_id) resp = service.get_subscription(sub_id) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end def check_price(subscriptions_list) subscriptions_list = subscriptions_list.map {|s| s.kind_of?(Hash) ? s : s.attributes} resp = service.calculate_subscription_price(subscriptions_list) PriceCalculation.new(resp.body) end def create_multiple(subscriptions_list) subscriptions_list = subscriptions_list.map { |s| s.kind_of?(Hash) ? s : s.attributes } resp = service.create_subscription(subscriptions_list) resp.body['objects'].map { |s| Subscription.new(s) } end end end end end fog-1.34.0/lib/fog/cloudsigma/models/server.rb0000644000004100000410000001417712600047641021202 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'fog/cloudsigma/models/mountpoint' require 'fog/cloudsigma/models/nic' module Fog module Compute class CloudSigma class Server < Fog::CloudSigma::CloudsigmaModel identity :uuid attribute :status, :type => :string attribute :vnc_password, :type => :string attribute :name, :type => :string attribute :cpus_instead_of_cores, :type => :boolean attribute :tags attribute :mem, :type => :integer attribute :enable_numa, :type => :boolean attribute :smp attribute :hv_relaxed, :type => :boolean attribute :hv_tsc, :type => :boolean attribute :meta attribute :owner attribute :runtime attribute :cpu, :type => :integer attribute :resource_uri, :type => :string model_attribute_array :volumes, MountPoint, :aliases => 'drives' model_attribute_array :nics, Nic def save if persisted? update else create end end def create requires :name, :cpu, :mem, :vnc_password data = attributes response = service.create_server(data) new_attributes = response.body['objects'].first merge_attributes(new_attributes) end def update requires :identity, :name, :cpu, :mem, :vnc_password data = attributes response = service.update_server(identity, data) new_attributes = response.body merge_attributes(new_attributes) end def destroy requires :identity service.delete_server(identity) true end alias_method :delete, :destroy def start(start_params={}) requires :identity service.start_server(identity, start_params) end def stop requires :identity service.stop_server(identity) end def ready? status == "running" end def open_vnc requires :identity service.open_vnc(identity) end def close_vnc requires :identity service.close_vnc(identity) end def clone(clone_params={}) requires :identity response = service.clone_server(identity, clone_params) self.class.new(response.body) end def mount_volume(volume, device = 'virtio', dev_channel = nil, boot_order = nil) unless dev_channel specified_channels = self.volumes.map { |v| v.dev_channel }.sort if specified_channels controller, controller_channel = 0, 0 max_ctlr, max_chnl = case device when 'ide' [4, 2] else [1024, 5] end dev_channel = "#{controller}:#{controller_channel}" while specified_channels.include? dev_channel controller_channel += 1 if controller_channel >= max_chnl controller_channel = 0 controller += 1 if controller >= max_ctlr raise Fog::CloudSigma::Errors::Error.new("Max channel reached, cannot attach more") end end dev_channel = "#{controller}:#{controller_channel}" end else # no other channels specified dev_channel = '0:0' end end vol_id = volume.kind_of?(String) ? volume : volume.identity mountpoint_data = { 'drive' => vol_id, 'device' => device, 'dev_channel' => dev_channel, } if boot_order mountpoint_data['boot_order'] = boot_order end self.volumes = self.volumes << MountPoint.new(mountpoint_data) end def unmount_volume(volume_or_position) if volume_or_position.kind_of? Fixnum self.volumes.delete_at(volume_or_position) # assign to update attributes return self.volumes = self.volumes end vol_id = volume_or_position.kind_of?(String) ? volume_or_position : volume_or_position.identity self.volumes = self.volumes.reject do |v| if v.volume.kind_of? Hash v.volume['uuid'] == vol_id else v.volume == vol_id end end end def unmount_all_volumes self.volumes = [] end def add_nic(vlan=nil, ip_v4_conf=nil, ip_v6_conf=nil, model='virtio', boot_order=nil) nic_data = { 'model' => model, 'vlan' => vlan, 'ip_v4_conf' => ip_v4_conf, 'ip_v6_conf' => ip_v6_conf } if boot_order nic_data['boot_order'] = boot_order end self.nics = self.nics << Nic.new(nic_data) end def add_public_nic(ip_or_conf=:dhcp, model='virtio', boot_order=nil) case ip_or_conf when :dhcp add_nic(nil, {:conf => :dhcp}, nil, model, boot_order) when :manual add_nic(nil, {:conf => :manual}, nil, model, boot_order) else ip = ip_or_conf.kind_of?(String) ? ip_or_conf : ip_or_conf.identity add_nic(nil, {:conf => :static, :ip => ip}, nil, model, boot_order) end end def add_private_nic(vlan, model='virtio', boot_order=nil) vlan = vlan.kind_of?(String) ? vlan : vlan.identity add_nic(vlan, nil, nil, model, boot_order) end def remove_nic(mac_or_position) if mac_or_position.kind_of? Fixnum self.nics.delete_at(mac_or_position) # assign to update attributes return self.nics = self.nics end self.nics = self.nics.reject { |n| n.mac == mac_or_position } end def remove_all_nics self.nics = [] end end end end end fog-1.34.0/lib/fog/cloudsigma/models/usage_record.rb0000644000004100000410000000047012600047641022325 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' module Fog module Compute class CloudSigma class UsageRecord < Fog::CloudSigma::CloudsigmaModel attribute :burst, :type => :integer attribute :subscribed, :type => :integer attribute :using, :type => :integer end end end end fog-1.34.0/lib/fog/cloudsigma/models/price_record.rb0000644000004100000410000000212512600047641022322 0ustar www-datawww-datarequire 'fog/cloudsigma/nested_model' require 'bigdecimal' module Fog module Compute class CloudSigma class PriceRecord < Fog::CloudSigma::CloudsigmaModel attribute :resource, :type => :string attribute :multiplier, :type => :integer attribute :price, :type => :string attribute :level, :type => :integer attribute :currency, :type => :string attribute :unit, :type => :string def price if attributes[:price] BigDecimal(attributes[:price]) else nil end end def price=(new_price) attributes[:price] = new_price.kind_of?(String) ? new_price : new_price.to_s('F') end # The base price of the resource. # This is the price for the base API unit which is byte for memory, data, etc. and MHz for CPU. # Also the price is per second for time based resource (basically everything except data transfer which is not # limited in time) def base_price price / multiplier end end end end end fog-1.34.0/lib/fog/cloudsigma/models/vlans.rb0000644000004100000410000000103612600047641021005 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/cloudsigma/models/vlan' module Fog module Compute class CloudSigma class Vlans < Fog::Collection model Fog::Compute::CloudSigma::VLAN def all resp = service.list_vlans data = resp.body['objects'] load(data) end def get(vlan) resp = service.get_vlan(vlan) data = resp.body new(data) rescue Fog::CloudSigma::Errors::NotFound return nil end end end end end fog-1.34.0/lib/fog/cloudsigma/error.rb0000644000004100000410000000226412600047641017534 0ustar www-datawww-datamodule Fog module CloudSigma module Errors class Error < Fog::Errors::Error attr_accessor :type, :error_point def initialize(message, type='n/a', error_point=nil) @type = type @error_point = error_point super(message) end end class NotFound < Error; end class RequestError < Error; end class ServerError < Error; end def self.slurp_http_status_error(error) error_class = case error.response[:status] when 404 NotFound when 500..599 ServerError when 400..499 RequestError else Error end new_error = error_class.new(error.response[:body].first['error_message'], error.response[:body].first['error_type'], error.response[:body].first['error_point']) new_error.set_backtrace(error.backtrace) new_error.verbose = error.message new_error end end end end fog-1.34.0/lib/fog/cloudsigma/mock_data.rb0000644000004100000410000000255112600047641020324 0ustar www-datawww-datamodule Fog module Compute class CloudSigma class Mock def self.mock_data { :volumes => {}, :servers => {}, :vlans => {}, :ips => {}, :profile => { :login_sms => false, :town => "", :postcode => "", :reseller => "", :has_autotopup => false, :currency => "CHF", :state => "REGULAR", :uuid => "6c2203a1-a2e6-433f-aeab-b976b8cd3d18", :company => "", :api_https_only => false, :my_notes => "", :key_auth => false, :email => "MyFirstName.MyLasttName@MyCompany.com", :bank_reference => "mmlastname278", :first_name => "MyFirstName", :meta =>"", :phone => "", :language => "EN", :vat => "", :last_name => "MyLasttName", :title => "", :mailing_list => true, :autotopup_amount => 0.0, :country => "", :address => "" }, :subscriptions => {}, :current_usage => {}, :balance => { :balance => 100, :currency => 'CHF' } } end end end end end fog-1.34.0/lib/fog/cloudsigma/compute.rb0000644000004100000410000001260512600047641020057 0ustar www-datawww-datarequire 'fog/cloudsigma/core' require 'fog/cloudsigma/connection' module Fog module Compute class CloudSigma < Fog::Service requires :cloudsigma_password, :cloudsigma_username recognizes :cloudsigma_password, :cloudsigma_username, :cloudsigma_host model_path 'fog/cloudsigma/models' request_path 'fog/cloudsigma/requests' model :volume collection :volumes request :create_volume request :get_volume request :list_volumes request :update_volume request :delete_volume request :clone_volume model :lib_volume collection :lib_volumes request :get_lib_volume request :list_lib_volumes model :ipconf model :nic model :mountpoint model :server collection :servers request :create_server request :get_server request :list_servers request :update_server request :delete_server request :start_server request :stop_server request :open_vnc request :close_vnc request :clone_server model :ip collection :ips request :list_ips request :get_ip model :vlan collection :vlans request :list_vlans request :get_vlan request :update_vlan model :rule model :fwpolicy collection :fwpolicies request :list_fwpolicies model :subscription collection :subscriptions request :list_subscriptions request :get_subscription request :create_subscription request :extend_subscription model :price_calculation request :calculate_subscription_price model :profile request :get_profile request :update_profile model :balance request :get_balance model :current_usage request :get_current_usage model :pricing request :get_pricing module CommonMockAndReal def initialize(options={}) @init_options = options setup_connection(options) end def profile response = get_profile Profile.new(response.body) end def balance response = get_balance Balance.new(response.body) end def current_usage response = get_current_usage CurrentUsage.new(response.body['usage']) end def currency # Cache since currency does not change @currency ||= profile.currency end def pricing resp = get_princing(currency) resp.body['objects'] end def current_pricing_levels resp = get_pricing(currency) resp.body['current'] end def next_pricing_levels resp = get_pricing(currency) resp.body['next'] end def subscription_pricing resp = get_pricing(currency, true) current_levels = resp.body['current'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.find do |price| price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end def current_pricing resp = get_pricing(currency) current_levels = resp.body['current'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.find do |price| price['level'] == level && price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end def next_pricing resp = get_pricing(currency) current_levels = resp.body['next'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.find do |price| price['level'] == level && price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end end class Mock include Collections include CommonMockAndReal include Fog::CloudSigma::CloudSigmaConnection::Mock require 'fog/cloudsigma/mock_data' def self.data @data ||= Hash.new do |hash, key| hash[key] = mock_data end end def self.random_uuid # Insert '4' at 13th position and 'a' at 17th as per uuid4 spec hex = Fog::Mock.random_hex(30).insert(12,'4').insert(16, 'a') # Add dashes "#{hex[0...8]}-#{hex[8...12]}-#{hex[12...16]}-#{hex[16...20]}-#{hex[20..32]}" end def self.random_mac (0..5).map{Fog::Mock.random_hex(2)}.join(':') end def data self.class.data[:test] end end class Real include Collections include CommonMockAndReal include Fog::CloudSigma::CloudSigmaConnection::Real end end end end fog-1.34.0/lib/fog/dreamhost.rb0000644000004100000410000000003412600047641016233 0ustar www-datawww-datarequire 'fog/dreamhost/dns' fog-1.34.0/lib/fog/aws/0000755000004100000410000000000012600047641014515 5ustar www-datawww-datafog-1.34.0/lib/fog/aws/service_mapper.rb0000644000004100000410000001065312600047641020053 0ustar www-datawww-datamodule Fog module AWS # @api private # # This is a temporary lookup helper for extracting into external module. # # Cleaner provider/service registration will replace this code. # class ServiceMapper def self.class_for(key) case key when :auto_scaling Fog::AWS::AutoScaling when :beanstalk Fog::AWS::ElasticBeanstalk when :cdn Fog::CDN::AWS when :cloud_formation Fog::AWS::CloudFormation when :cloud_watch Fog::AWS::CloudWatch when :compute Fog::Compute::AWS when :data_pipeline Fog::AWS::DataPipeline when :ddb, :dynamodb Fog::AWS::DynamoDB when :dns Fog::DNS::AWS when :elasticache Fog::AWS::Elasticache when :elb Fog::AWS::ELB when :emr Fog::AWS::EMR when :glacier Fog::AWS::Glacier when :iam Fog::AWS::IAM when :redshift Fog::AWS::Redshift when :sdb, :simpledb Fog::AWS::SimpleDB when :ses Fog::AWS::SES when :sqs Fog::AWS::SQS when :eu_storage, :storage Fog::Storage::AWS when :rds Fog::AWS::RDS when :sns Fog::AWS::SNS when :sts Fog::AWS::STS else # @todo Replace most instances of ArgumentError with NotImplementedError # @todo For a list of widely supported Exceptions, see: # => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35 raise ArgumentError, "Unsupported #{self} service: #{key}" end end def self.[](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key when :auto_scaling Fog::AWS::AutoScaling.new when :beanstalk Fog::AWS::ElasticBeanstalk.new when :cdn Fog::Logger.warning("AWS[:cdn] is not recommended, use CDN[:aws] for portability") Fog::CDN.new(:provider => 'AWS') when :cloud_formation Fog::AWS::CloudFormation.new when :cloud_watch Fog::AWS::CloudWatch.new when :compute Fog::Logger.warning("AWS[:compute] is not recommended, use Compute[:aws] for portability") Fog::Compute.new(:provider => 'AWS') when :data_pipeline Fog::AWS::DataPipeline.new when :ddb, :dynamodb Fog::AWS::DynamoDB.new when :dns Fog::Logger.warning("AWS[:dns] is not recommended, use DNS[:aws] for portability") Fog::DNS.new(:provider => 'AWS') when :elasticache Fog::AWS::Elasticache.new when :elb Fog::AWS::ELB.new when :emr Fog::AWS::EMR.new when :glacier Fog::AWS::Glacier.new when :iam Fog::AWS::IAM.new when :redshift Fog::AWS::Redshift.new when :rds Fog::AWS::RDS.new when :eu_storage Fog::Storage.new(:provider => 'AWS', :region => 'eu-west-1') when :sdb, :simpledb Fog::AWS::SimpleDB.new when :ses Fog::AWS::SES.new when :sqs Fog::AWS::SQS.new when :storage Fog::Logger.warning("AWS[:storage] is not recommended, use Storage[:aws] for portability") Fog::Storage.new(:provider => 'AWS') when :sns Fog::AWS::SNS.new when :sts Fog::AWS::STS.new else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def self.services Fog::AWS.services end end end end fog-1.34.0/lib/fog/bin.rb0000644000004100000410000000513012600047641015017 0ustar www-datawww-datarequire 'fog/core/credentials' module Fog class << self def available_providers @available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort end def registered_providers @registered_providers ||= Fog.providers.values.sort end end class Bin class << self def available? availability = true for service in services begin service = self.class_for(service) availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) } rescue ArgumentError => e Fog::Logger.warning(e.message) availability = false rescue => e availability = false end end if availability for service in services for collection in self.class_for(service).collections unless self.respond_to?(collection) self.class_eval <<-EOS, __FILE__, __LINE__ def self.#{collection} self[:#{service}].#{collection} end EOS end end end end availability end def collections services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s} end end end end require 'fog/bin/atmos' require 'fog/bin/aws' require 'fog/bin/bluebox' require 'fog/bin/brightbox' require 'fog/bin/cloudstack' require 'fog/bin/clodo' require 'fog/bin/digitalocean' require 'fog/bin/dnsimple' require 'fog/bin/dnsmadeeasy' require 'fog/bin/fogdocker' require 'fog/bin/dreamhost' require 'fog/bin/dynect' require 'fog/bin/ecloud' require 'fog/bin/glesys' require 'fog/bin/go_grid' require 'fog/bin/google' require 'fog/bin/hp' require 'fog/bin/ibm' require 'fog/bin/internet_archive' require 'fog/bin/joyent' require 'fog/bin/linode' require 'fog/bin/local' require 'fog/bin/bare_metal_cloud' require 'fog/bin/ninefold' require 'fog/bin/rackspace' require 'fog/bin/rage4' require 'fog/bin/riakcs' require 'fog/bin/openstack' require 'fog/bin/ovirt' require 'fog/bin/powerdns' require 'fog/bin/profitbricks' require 'fog/bin/sakuracloud' require 'fog/bin/serverlove' require 'fog/bin/softlayer' require 'fog/bin/storm_on_demand' require 'fog/bin/terremark' require 'fog/bin/vcloud' require 'fog/bin/vcloud_director' require 'fog/bin/vmfusion' require 'fog/bin/vsphere' require 'fog/bin/voxel' require 'fog/bin/xenserver' require 'fog/bin/zerigo' require 'fog/bin/cloudsigma' require 'fog/bin/openvz' require 'fog/bin/opennebula' fog-1.34.0/lib/fog/zerigo/0000755000004100000410000000000012600047642015223 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/requests/0000755000004100000410000000000012600047642017076 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/requests/dns/0000755000004100000410000000000012600047642017662 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/requests/dns/create_host.rb0000644000004100000410000000750012600047642022511 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/create_host' # Create a new host in the specified zone # # ==== Parameters # * zone_id<~Integer> # * host_type<~String> # * data<~String> # * options<~Hash> - optional parameters # * hostname<~String> - Note: normally this is set/required!! # * notes<~String> # * priority<~Integer> - Note: required for MX or SRV records # * ttl<~Integer> # ==== Returns # * response<~Excon::Response>: # * body<~Hash> # * 'created-at'<~String> # * 'data'<~String> # * 'fqdn'<~String> # * 'host-type'<~String> # * 'hostname'<~String> # * 'id'<~Integer> # * 'notes'<~String> # * 'priority'<~Integer> # * 'ttl'<~Integer> # * 'updated-at'<~String> # * 'zone-id'<~String> # * 'status'<~Integer> - 201 if successful def create_host(zone_id, host_type, data, options = {}) optional_tags= '' options.each { |option, value| case option when :hostname optional_tags+= "#{value}" when :notes optional_tags+= "#{value}" when :priority optional_tags+= "#{value}" when :ttl optional_tags+= "#{value}" end } request( :body => %Q{#{host_type}#{data}#{optional_tags}}, :expects => 201, :method => 'POST', :parser => Fog::Parsers::DNS::Zerigo::CreateHost.new, :path => "/api/1.1/zones/#{zone_id}/hosts.xml" ) end end class Mock # :nodoc:all def valid_host_types %w[A AAAA CNAME GEO MX NS SPF SRV TXT URL PTR CNAME NS] end def create_host(zone_id, host_type, data, options = {}) zone = find_by_zone_id(zone_id) response = Excon::Response.new # Handle error cases. # Zone doesn't exist. unless zone response.status = 404 return response end # Bad host type. unless valid_host_types.include?(host_type) response.status = 422 response.body = { 'errors' => [ 'error' => 'Host type is not included in the list' ] } return response end # Missing or bad priority value for MX or SRV records. if %w[MX SRV].include?(host_type) && options['priority'].to_s !~ /\d+/ response.status = 422 response.body = { 'errors' => [ 'error' => 'Priority is not a number' ] } return response end # Successful case. now = Time.now host = { 'id' => rand(10000000), 'fqdn' => options[:hostname] ? "#{options[:hostname]}.#{zone['domain']}" : zone['domain'], 'data' => data, 'hostname' => options[:hostname], 'ttl' => options[:ttl].to_i, 'host-type' => host_type, 'created-at' => now, 'updated-at' => now, 'notes' => options[:notes], 'priority' => options[:priority].to_i, 'zone-id' => zone_id } zone['hosts'] << host response.status = 201 response.body = host response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/get_zone.rb0000644000004100000410000000365712600047642022034 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/get_zone' # Get details of a DNS zone. The response is similar to list_zones, with the # addition of hosts-count and possibly hosts. # # ==== Parameters # * zone<~String> - Either the zone ID or the zone name (ie sample-domain.com) # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'default-ttl'<~Integer> # * 'id'<~Integer> # * 'nx-ttl'<~Integer> # * 'hosts-count'<~Integer> # * 'created-at'<~String> # * 'custom-nameservers'<~String> # * 'custom-ns'<~String> # * 'domain'<~String> # * 'hostmaster'<~String> # * 'notes'<~String> # * 'ns1'<~String> # * 'ns-type'<~String> # * 'slave-nameservers'<~String> # * 'tag-list'<~String> # * 'updated-at'<~String> # * 'hosts'<~Array> - a list of all host records. For the format of host info, see get_host() # * 'axfr-ips'<~String> # * 'restrict-axfr'<~String> # * 'status'<~Integer> - 200 indicates success def get_zone(zone_id_or_domain) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::GetZone.new, :path => "/api/1.1/zones/#{zone_id_or_domain}.xml" ) end end class Mock # :nodoc:all def get_zone(zone_id_or_domain) zone = find_by_zone_id(zone_id_or_domain) || find_by_domain(zone_id_or_domain) response = Excon::Response.new if zone response.status = 200 response.body = zone else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/get_zone_stats.rb0000644000004100000410000000324712600047642023245 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/get_zone_stats' # returns current traffic statistics about this zone. Queries is measured from the # beginning of the current period through the time of the API call. # # ==== Parameters # * zone_id<~Integer> - the zone ID # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'domain'<~String> - domain name (ie example.com) # * 'id'<~Integer> - Id of the zone # * 'period-being'<~String> - date in following format 2010-07-01 # * 'period-end'<~String> - date # * 'queries'<~Integer> - # of queries for the zone during period # * 'status'<~Integer> - 200 indicates success def get_zone_stats(zone_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::GetZoneStats.new, :path => "/api/1.1/zones/#{zone_id}/stats.xml" ) end end class Mock # :nodoc:all def get_zone_stats(zone_id) zone = find_by_zone_id(zone_id) response = Excon::Response.new if zone response.status = 200 response.body = { 'id' => zone, 'domain' => zone['domain'], 'period-begin' => zone['created-at'].strftime("%F"), 'period-end' => Date.today.to_s, 'queries' => 0 } else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/create_zone.rb0000644000004100000410000001224112600047642022505 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/create_zone' # Create a new zone for Zerigo's DNS servers to serve/host # ==== Parameters # # * domain<~String> # * default_ttl<~Integer> # * ns_type<~String> # * options<~Hash> - optional paramaters # * ns1<~String> - required if ns_type == sec # * nx_ttl<~Integer> - # * slave_nameservers<~String> - required if ns_type == pri # * axfr_ips<~String> - comma-separated list of IPs or IP blocks allowed to perform AXFRs # * custom_nameservers<~String> - comma-separated list of custom nameservers # * custom_ns<~String> - indicates if vanity (custom) nameservers are enabled for this domain # * hostmaster<~String> - email of the DNS administrator or hostmaster # * notes<~String> - notes about the domain # * restrict_axfr<~String> - indicates if AXFR transfers should be restricted to IPs in axfr-ips # * tag_list<~String> - List of all tags associated with this domain # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'id'<~Integer> - zone ID to use for future calls # * 'default-ttl'<~Integer> # * 'nx-ttl'<~Integer> # * 'hosts-count'<~Integer> # * 'created-at'<~String> # * 'custom-nameservers'<~String> # * 'custom-ns'<~String> # * 'domain'<~String> # * 'hostmaster'<~String> # * 'notes'<~String> # * 'ns1'<~String> # * 'ns-type'<~String> # * 'slave-nameservers'<~String> # * 'tag-list'<~String> # * 'updated-at'<~String> # * 'hosts'<~String> # * 'axfr-ips'<~String> # * 'restrict-axfr'<~String> # * 'status'<~Integer> - 201 if successful def create_zone(domain, default_ttl, ns_type, options = {}) optional_tags= '' options.each { |option, value| case option when :ns1 optional_tags+= "#{value}" when :nx_ttl optional_tags+= "#{value}" when :slave_nameservers optional_tags+= "#{value}" when :axfr_ips optional_tags+= "#{value}" when :custom_nameservers optional_tags+= "#{value}" when :custom_ns optional_tags+= "#{value}" when :hostmaster optional_tags+= "#{value}" when :notes optional_tags+= "#{value}" when :restrict_axfr optional_tags+= "#{value}" when :tag_list optional_tags+= "#{value}" end } request( :body => %Q{#{domain}#{default_ttl}#{ns_type}#{optional_tags}}, :expects => 201, :method => 'POST', :parser => Fog::Parsers::DNS::Zerigo::CreateZone.new, :path => '/api/1.1/zones.xml' ) end end class Mock # :nodoc:all def create_zone(domain, default_ttl, ns_type, options = {}) now = Time.now zone = { 'id' => rand(10000000), 'domain' => domain, 'created-at' => now, 'updated-at' => now, 'ns1' => options[:ns1], 'nx-ttl' => options[:nx_ttl].to_i, 'default-ttl' => default_ttl.to_i, 'ns-type' => ns_type, 'hosts' => options[:hosts] || [], 'hosts-count' => (options[:hosts] || []).size, 'notes' => options[:notes], 'slave-nameservers' => options[:slave_nameservers], 'tag-list' => options[:tag_list] } response = Excon::Response.new if self.data[:zones].any? {|z| z['domain'] == zone['domain'] } response.status = 422 response.body = { 'errors' => [ 'error' => 'Domain is already associated to another account', 'error' => 'Domain already exists. If it was just deleted, wait a minute and try again' ] } else self.data[:zones] << zone response.status = 201 response.headers = { 'Location' => "http://ns.zerigo.com/api/1.1/zones/#{zone['id']}" } response.body = zone['hosts'].empty? ? zone.merge(:hosts => nil) : zone # Zerigo returns nil, not an empty list only on the create command. end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/delete_zone.rb0000644000004100000410000000155712600047642022514 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real # Delete a zone from Zerigo # # ==== Parameters # * zone_id<~Integer> - Id of zone to delete # ==== Returns # * response<~Excon::Response>: # * 'status'<~Integer> - 200 indicates success def delete_zone(zone_id) request( :expects => 200, :method => 'DELETE', :path => "/api/1.1/zones/#{zone_id}.xml" ) end end class Mock # :nodoc:all def delete_zone(zone_id) zone = find_by_zone_id(zone_id) response = Excon::Response.new if zone self.data[:zones].delete(zone) response.status = 200 else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/count_zones.rb0000644000004100000410000000172212600047642022557 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/count_zones' # Total number of zones hosted Zerigo for this account. It is the same value as provided # in the X-Query-Count header in the list_zones API method # # ==== Returns # * response<~Excon::Response>: # * body<~Hash> # * 'count'<~Integer> # * 'status'<~Integer> - 200 indicates success def count_zones request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::CountZones.new, :path => "/api/1.1/zones/count.xml" ) end end class Mock # :nodoc:all def count_zones response = Excon::Response.new response.status = 200 response.body = { 'count' => self.data[:zones].size } response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/list_zones.rb0000644000004100000410000000353412600047642022405 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/list_zones' # Get list of all DNS zones hosted on Slicehost (for this account) # # ==== Parameters # * options<~Hash> # * page<~Integer> - Indicates where to begin in your list of zones. # * per_page<~Integer> - The maximum number of zones to be included in the response body # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'zones'<~Array> # * 'default-ttl'<~Integer> # * 'id'<~Integer> # * 'nx-ttl'<~Integer> # * 'hosts-count'<~Integer> # * 'created-at'<~String> # * 'custom-nameservers'<~String> # * 'custom-ns'<~String> # * 'domain'<~String> # * 'hostmaster'<~String> # * 'notes'<~String> # * 'ns1'<~String> # * 'ns-type'<~String> # * 'slave-nameservers'<~String> # * 'tag-list'<~String> # * 'updated-at'<~String> # * 'hosts'<~String> # * 'axfr-ips'<~String> # * 'restrict-axfr'<~String> # * 'status'<~Integer> - 200 indicates success def list_zones(options = {}) request( :query => options, :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::ListZones.new, :path => '/api/1.1/zones.xml' ) end end class Mock # :nodoc:all def list_zones response = Excon::Response.new response.status = 200 response.body = { 'zones' => self.data[:zones] } response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/update_host.rb0000644000004100000410000000400212600047642022522 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real # Update a host record # # ==== Parameters # * host_id<~Integer> - host ID of the record to update # * options<~Hash> - optional paramaters # * host_type<~String> # * data<~String> # * hostname<~String> - Note: normally this is set/required!! # * notes<~String> # * priority<~Integer> - Note: required for MX or SRV records # * ttl<~Integer> # ==== Returns # * response<~Excon::Response>: # * 'status'<~Integer> - 200 for success # def update_host(host_id, options = {}) optional_tags= '' options.each { |option, value| case option when :host_type optional_tags+= "#{value}" when :data optional_tags+= "#{value}" when :hostname optional_tags+= "#{value}" when :notes optional_tags+= "#{value}" when :priority optional_tags+= "#{value}" when :ttl optional_tags+= "#{value}" end } request( :body => %Q{#{optional_tags}}, :expects => 200, :method => 'PUT', :path => "/api/1.1/hosts/#{host_id}.xml" ) end end class Mock # :nodoc:all def update_host(host_id, options = {}) host = find_host(host_id) response = Excon::Response.new if host options.each { |k, v| host[k.to_s] = v } # Deal with symbols in requests but strings in responses. host['updated-at'] = Time.now response.status = 200 else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/get_host.rb0000644000004100000410000000257212600047642022031 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/get_host' # get details about a given host record # # ==== Parameters # * host_id<~Integer> - ID of the host record to retrieve # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'created-at'<~String> # * 'data'<~String> # * 'fqdn'<~String> # * 'host-type'<~String> # * 'hostname'<~String> # * 'id'<~Integer> # * 'notes'<~String> # * 'priority'<~Integer> # * 'ttl'<~Integer> # * 'updated-at'<~String> # * 'zone-id'<~String> # * 'status'<~Integer> - 200 indicates success def get_host(host_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::GetHost.new, :path => "/api/1.1/hosts/#{host_id}.xml" ) end end class Mock # :nodoc:all def get_host(host_id) host = find_host(host_id) response = Excon::Response.new if host response.status = 200 response.body = host else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/update_zone.rb0000644000004100000410000000626112600047642022531 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real # Update the parameters of a zone # ==== Parameters # # * zone_id<~Integer> # * options<~Hash> - optional paramaters # * default_ttl<~Integer> # * ns_type<~String> # * ns1<~String> - required if ns_type == sec # * nx_ttl<~Integer> - # * slave_nameservers<~String> - required if ns_type == pri # * axfr_ips<~String> - comma-separated list of IPs or IP blocks allowed to perform AXFRs # * custom_nameservers<~String> - comma-separated list of custom nameservers # * custom_ns<~String> - indicates if vanity (custom) nameservers are enabled for this domain # * hostmaster<~String> - email of the DNS administrator or hostmaster # * notes<~String> - notes about the domain # * restrict_axfr<~String> - indicates if AXFR transfers should be restricted to IPs in axfr-ips # * tag_list<~String> - List of all tags associated with this domain # # ==== Returns # * response<~Excon::Response>: # * 'status'<~Integer> - 200 for success def update_zone(zone_id, options = {}) optional_tags= '' options.each { |option, value| case option when :default_ttl optional_tags+= "#{value}" when :ns_type optional_tags+= "#{value}" when :ns1 optional_tags+= "#{value}" when :nx_ttl optional_tags+= "#{value}" when :slave_nameservers optional_tags+= "#{value}" when :axfr_ips optional_tags+= "#{value}" when :custom_nameservers optional_tags+= "#{value}" when :custom_ns optional_tags+= "#{value}" when :hostmaster optional_tags+= "#{value}" when :notes optional_tags+= "#{value}" when :restrict_axfr optional_tags+= "#{value}" when :tag_list optional_tags+= "#{value}" end } request( :body => %Q{#{optional_tags}}, :expects => 200, :method => 'PUT', :path => "/api/1.1/zones/#{zone_id}.xml" ) end end class Mock # :nodoc:all def update_zone(zone_id, options = {}) zone = find_by_zone_id(zone_id) response = Excon::Response.new if zone options.each { |k, v| zone[k.to_s] = v } # Deal with symbols in requests but strings in responses. zone['updated-at'] = Time.now response.status = 200 else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/list_hosts.rb0000644000004100000410000000436712600047642022414 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require "fog/zerigo/parsers/dns/list_hosts" # Get list of all DNS zones hosted on Slicehost (for this account) # # ==== Parameters # * zone_id<~Integer> - the zone ID of the zone from which to get the host records for # * 'options'<~Hash> - optional parameters # * 'page' <~Integer> # * 'per_page' <~Integer> # * 'fqdn' <~String> # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'hosts'<~Array> # * 'created-at'<~String> # * 'data'<~String> # * 'fqdn'<~String> # * 'host-type'<~String> # * 'hostname'<~String> # * 'id'<~Integer> # * 'notes'<~String> # * 'priority'<~Integer> # * 'ttl'<~Integer> # * 'updated-at'<~String> # * 'zone-id'<~String> # * 'status'<~Integer> - 200 indicates success def list_hosts(zone_id, options={}) request( :query => options, :expects => 200, :method => "GET", :parser => Fog::Parsers::DNS::Zerigo::ListHosts.new, :path => "/api/1.1/zones/#{zone_id}/hosts.xml" ) end end class Mock # :nodoc:all def list_hosts(zone_id, options={}) zone = find_by_zone_id(zone_id) response = Excon::Response.new if zone if options.empty? response.status = 200 response.body = { "hosts" => zone["hosts"] } else hosts = zone["hosts"] hosts = hosts.select {|h| h["fqdn"] == options["fqdn"]} if options["fqdn"] hosts = options["per_page"] ? hosts.each_slice(options["per_page"] - 1).to_a : hosts.each_slice(100).to_a hosts = options["page"] ? hosts[options["page"]] : hosts[0] response.status = 200 response.body = { "hosts" => hosts } end else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/count_hosts.rb0000644000004100000410000000221512600047642022557 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/count_hosts' # total number of hosts available for the specified zone. It is the same value as provided # in the X-Query-Count header in the list_hosts API method # # ==== Returns # * response<~Excon::Response>: # * body<~Hash> # * 'count'<~Integer> # * 'status'<~Integer> - 200 indicates success def count_hosts(zone_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::CountHosts.new, :path => "/api/1.1/zones/#{zone_id}/hosts/count.xml" ) end end class Mock # :nodoc:all def count_hosts(zone_id) zone = find_by_zone_id(zone_id) response = Excon::Response.new if zone response.status = 200 response.body = { 'count' => zone['hosts'].size } else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/find_hosts.rb0000644000004100000410000000437012600047642022353 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real require 'fog/zerigo/parsers/dns/find_hosts' # Get list of all the host records that match the FQDN. If desired, can limit # search to a specific zone # # # ==== Parameters # * fqdn<~String> - domain to look for # * zone_id<~Integer> - if want to limit search to specific zone # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'hosts'<~Hash> # * 'created-at'<~String> # * 'data'<~String> # * 'fqdn'<~String> # * 'host-type'<~String> # * 'hostname'<~String> # * 'id'<~Integer> # * 'notes'<~String> # * 'priority'<~Integer> # * 'ttl'<~Integer> # * 'updated-at'<~String> # * 'zone-id'<~String> # * 'status'<~Integer> - 200 indicated success # def find_hosts(fqdn, zone_id = nil) if zone_id.nil? #look for matching host across all zones request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::FindHosts.new, :path => "/api/1.1/hosts.xml?fqdn=#{fqdn}" ) else #look for hosts in a specific zone request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::DNS::Zerigo::FindHosts.new, :path => "/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}" ) end end end class Mock # :nodoc:all def find_hosts(fqdn, zone_id = nil) response = Excon::Response.new zone = find_by_zone_id(zone_id) if zone_id && !zone response.status = 404 else hosts = zone ? zone['hosts'].select { |z| z['fqdn'] == fqdn } : self.data[:zones].map { |z| z['hosts'].find { |h| h['fqdn'] == fqdn } }.compact response.status = 200 response.body = { 'hosts' => hosts } end response end end end end end fog-1.34.0/lib/fog/zerigo/requests/dns/delete_host.rb0000644000004100000410000000163312600047642022511 0ustar www-datawww-datamodule Fog module DNS class Zerigo class Real # Delete a host record # # ==== Parameters # * host_id<~Integer> - Id of host record to delete # ==== Returns # * response<~Excon::Response>: # * 'status'<~Integer> - 200 indicates success def delete_host(host_id) request( :expects => 200, :method => 'DELETE', :path => "/api/1.1/hosts/#{host_id}.xml" ) end end class Mock # :nodoc:all def delete_host(host_id) host = find_host(host_id) response = Excon::Response.new if host zone = find_by_zone_id(host['zone-id']) zone['hosts'].delete(host) response.status = 200 else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/zerigo/parsers/0000755000004100000410000000000012600047642016702 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/parsers/dns/0000755000004100000410000000000012600047642017466 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/parsers/dns/create_host.rb0000644000004100000410000000113112600047642022307 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class CreateHost < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'id', 'zone-id' @response[name] = value.to_i when 'priority', 'ttl' @response[name] = value.to_i if value when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at' @response[name] = value end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/get_zone.rb0000644000004100000410000000325112600047642021626 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class GetZone < Fog::Parsers::Base def reset @host = {} @hosts = [] @response = {} @in_hosts = false end def start_element(name, attrs = []) super(name, attrs) #look out for start of section #needed as some of the tags have the same name as the parent section if name == 'hosts' @in_hosts= true end end def end_element(name) if (@in_hosts) #in hosts part of response case name when 'id', 'zone-id' @host[name] = value.to_i when 'priority', 'ttl' @host[name] = value.to_i if value when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at' @host[name] = value when 'host' @hosts << @host @host = {} when 'hosts' @response[name] = @hosts @in_hosts = false end else #in zone part of data case name when 'default-ttl', 'id', 'nx-ttl', 'hosts-count' @response[name] = value.to_i when 'created-at', 'custom-nameservers', 'custom-ns', 'domain', 'hostmaster', 'notes', 'ns1', 'ns-type', 'slave-nameservers', 'tag-list', 'updated-at', 'hosts', 'axfr-ips', 'restrict-axfr' @response[name] = value end end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/get_zone_stats.rb0000644000004100000410000000072312600047642023045 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class GetZoneStats < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'id', 'queries' @response[name] = value.to_i when 'domain', 'period-begin', 'period-end' @response[name] = value end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/create_zone.rb0000644000004100000410000000117712600047642022317 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class CreateZone < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'default-ttl', 'id', 'nx-ttl', 'hosts-count' @response[name] = value.to_i when 'created-at', 'custom-nameservers', 'custom-ns', 'domain', 'hostmaster', 'notes', 'ns1', 'ns-type', 'slave-nameservers', 'tag-list', 'updated-at', 'hosts', 'axfr-ips', 'restrict-axfr' @response[name] = value end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/count_zones.rb0000644000004100000410000000055312600047642022364 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class CountZones < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'count' @response[name] = value.to_i end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/list_zones.rb0000644000004100000410000000136712600047642022213 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class ListZones < Fog::Parsers::Base def reset @zone = {} @response = { 'zones' => [] } end def end_element(name) case name when 'default-ttl', 'id', 'nx-ttl', 'hosts-count' @zone[name] = value.to_i when 'created-at', 'custom-nameservers', 'custom-ns', 'domain', 'hostmaster', 'notes', 'ns1', 'ns-type', 'slave-nameservers', 'tag-list', 'updated-at', 'hosts', 'axfr-ips', 'restrict-axfr' @zone[name] = value when 'zone' @response['zones'] << @zone @zone = {} end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/get_host.rb0000644000004100000410000000112612600047642021627 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class GetHost < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'id', 'zone-id' @response[name] = value.to_i when 'priority', 'ttl' @response[name] = value.to_i if value when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at' @response[name] = value end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/list_hosts.rb0000644000004100000410000000131512600047642022206 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class ListHosts < Fog::Parsers::Base def reset @host = {} @response = { 'hosts' => [] } end def end_element(name) case name when 'id', 'zone-id' @host[name] = value.to_i when 'priority', 'ttl' @host[name] = value.to_i if value when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at' @host[name] = value when 'host' @response['hosts'] << @host @host = {} end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/count_hosts.rb0000644000004100000410000000055312600047642022366 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class CountHosts < Fog::Parsers::Base def reset @response = {} end def end_element(name) case name when 'count' @response[name] = value.to_i end end end end end end end fog-1.34.0/lib/fog/zerigo/parsers/dns/find_hosts.rb0000644000004100000410000000131512600047642022153 0ustar www-datawww-datamodule Fog module Parsers module DNS module Zerigo class FindHosts < Fog::Parsers::Base def reset @host = {} @response = { 'hosts' => [] } end def end_element(name) case name when 'id', 'zone-id' @host[name] = value.to_i when 'priority', 'ttl' @host[name] = value.to_i if value when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at' @host[name] = value when 'host' @response['hosts'] << @host @host = {} end end end end end end end fog-1.34.0/lib/fog/zerigo/dns.rb0000644000004100000410000000603012600047642016333 0ustar www-datawww-datarequire 'fog/zerigo/core' module Fog module DNS class Zerigo < Fog::Service requires :zerigo_email, :zerigo_token recognizes :host, :persistent, :port, :scheme, :timeout model_path 'fog/zerigo/models/dns' model :record collection :records model :zone collection :zones request_path 'fog/zerigo/requests/dns' request :count_hosts request :count_zones request :create_host request :create_zone request :delete_host request :delete_zone request :find_hosts request :get_host request :get_zone request :get_zone_stats request :list_zones request :list_hosts request :update_host request :update_zone class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = key == :zones ? [] : {} end end def self.reset @data = nil end def initialize(options={}) @zerigo_email = options[:zerigo_email] @zerigo_token = options[:zerigo_token] end def data self.class.data end def reset_data self.class.reset end def find_by_zone_id(zone_id) self.data[:zones].find { |z| z['id'] == zone_id } end def find_by_domain(domain) self.data[:zones].find { |z| z['domain'] == domain } end def find_host(host_id) self.data[:zones].map { |z| z['hosts'].find { |h| h['id'] == host_id } }.compact.first end end class Real def initialize(options={}) @zerigo_email = options[:zerigo_email] @zerigo_token = options[:zerigo_token] @connection_options = options[:connection_options] || {} @host = options[:host] || "ns.zerigo.com" @persistent = options[:persistent] || false @port = options[:port] || 80 @scheme = options[:scheme] || 'http' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload @connection.reset end def request(params) params[:headers] ||= {} key= "#{@zerigo_email}:#{@zerigo_token}" params[:headers].merge!({ 'Authorization' => "Basic #{Base64.encode64(key).delete("\r\n")}" }) case params[:method] when 'DELETE', 'GET', 'HEAD' params[:headers]['Accept'] = 'application/xml' when 'POST', 'PUT' params[:headers]['Content-Type'] = 'application/xml' end begin response = @connection.request(params) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::DNS::Zerigo::NotFound.slurp(error) else error end end response end end end end end fog-1.34.0/lib/fog/zerigo/core.rb0000644000004100000410000000017612600047642016504 0ustar www-datawww-datarequire 'fog/core' require 'fog/xml' module Fog module Zerigo extend Fog::Provider service(:dns, 'DNS') end end fog-1.34.0/lib/fog/zerigo/models/0000755000004100000410000000000012600047642016506 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/models/dns/0000755000004100000410000000000012600047642017272 5ustar www-datawww-datafog-1.34.0/lib/fog/zerigo/models/dns/zones.rb0000644000004100000410000000110012600047642020745 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/zerigo/models/dns/zone' module Fog module DNS class Zerigo class Zones < Fog::Collection model Fog::DNS::Zerigo::Zone def all(options = {}) data = service.list_zones(options).body['zones'] load(data) end def get(zone_id_or_domain) data = service.get_zone(zone_id_or_domain).body zone = new(data) zone.records.load(data['hosts']) zone rescue Fog::Service::NotFound nil end end end end end fog-1.34.0/lib/fog/zerigo/models/dns/record.rb0000644000004100000410000000315712600047642021103 0ustar www-datawww-datarequire 'fog/core/model' module Fog module DNS class Zerigo class Record < Fog::Model extend Fog::Deprecation deprecate :ip, :value deprecate :ip=, :value= identity :id attribute :created_at, :aliases => 'created-at' attribute :value, :aliases => 'data' attribute :domain, :aliases => 'fqdn' attribute :name, :aliases => 'hostname' attribute :description, :aliases => 'notes' attribute :priority attribute :ttl attribute :type, :aliases => 'host-type' attribute :updated_at, :aliases => 'updated-at' attribute :zone_id, :aliases => 'zone-id' def initialize(attributes={}) super end def destroy requires :identity service.delete_host(identity) true end def zone @zone end def save requires :zone, :type, :value options = {} options[:hostname] = name if name options[:notes] = description if description options[:priority] = priority if priority options[:ttl] = ttl if ttl if persisted? options[:host_type] = type options[:data] = value service.update_host(identity, options) else data = service.create_host(@zone.id, type, value, options) merge_attributes(data.body) end true end private def zone=(new_zone) @zone = new_zone end end end end end fog-1.34.0/lib/fog/zerigo/models/dns/zone.rb0000644000004100000410000000530212600047642020572 0ustar www-datawww-datarequire 'fog/core/model' require 'fog/zerigo/models/dns/records' module Fog module DNS class Zerigo class Zone < Fog::Model identity :id attribute :created_at, :aliases => 'created-at' attribute :domain attribute :ttl, :aliases => 'default-ttl' attribute :type, :aliases => 'ns-type' attribute :updated_at, :aliases => 'updated-at' # ns1.example.com,ns2.example.com # true # dnsadmin@example.com # # # # # one two # 1 def initialize(attributes={}) self.type ||= 'pri_sec' super end def destroy requires :identity service.delete_zone(identity) true end def records @records ||= begin Fog::DNS::Zerigo::Records.new( :zone => self, :service => service ) end end def nameservers [ 'a.ns.zerigo.net', 'b.ns.zerigo.net', 'c.ns.zerigo.net', 'd.ns.zerigo.net', 'e.ns.zerigo.net' ] end def save self.ttl ||= 3600 requires :domain, :type, :ttl options = {} # * options<~Hash> - optional paramaters # * ns1<~String> - required if ns_type == sec # * nx_ttl<~Integer> - # * slave_nameservers<~String> - required if ns_type == pri # * axfr_ips<~String> - comma-separated list of IPs or IP blocks allowed to perform AXFRs # * custom_nameservers<~String> - comma-separated list of custom nameservers # * custom_ns<~String> - indicates if vanity (custom) nameservers are enabled for this domain # * hostmaster<~String> - email of the DNS administrator or hostmaster # * notes<~String> - notes about the domain # * restrict_axfr<~String> - indicates if AXFR transfers should be restricted to IPs in axfr-ips # * tag_list<~String> - List of all tags associated with this domain data = unless identity service.create_zone(domain, ttl, type, options) else options[:default_ttl] = ttl options[:ns_type] = type service.update_zone(identity, options) end merge_attributes(data.body) true end end end end end fog-1.34.0/lib/fog/zerigo/models/dns/records.rb0000644000004100000410000000223312600047642021260 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/zerigo/models/dns/record' module Fog module DNS class Zerigo class Records < Fog::Collection attribute :zone model Fog::DNS::Zerigo::Record # List all domains # @param [Hash] options Options to pass to the underlying API call # @option options [String] :fqdn search for the given fqdn def all(options = {}) requires :zone if options[:fqdn] hosts = service.find_hosts(options[:fqdn], zone.id).body['hosts'] load(hosts) else parent = zone.collection.get(zone.identity) if parent merge_attributes(parent.records.attributes) load(parent.records.map {|record| record.attributes}) else nil end end end def get(record_id) data = service.get_host(record_id).body new(data) rescue Fog::Service::NotFound nil end def new(attributes = {}) requires :zone super({ :zone => zone }.merge!(attributes)) end end end end end fog-1.34.0/lib/fog/openstack/0000755000004100000410000000000012600047642015713 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/0000755000004100000410000000000012600047642017531 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/network/0000755000004100000410000000000012600047642021222 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/network/network_subnets_routers.rb0000644000004100000410000000435512600047642026575 0ustar www-datawww-datarequire 'fog/openstack' # # Quantum demo # # Create some routers, networks and subnets for # a couple of tenants. # # Needs Fog >= 1.11.0 # Needs OpenStack credentials in ~/.fog # def create_tenant_network( tenant_name, external_net, router_name = 'router1', subnet_range = '10.0.0.0/21', subnet_gateway = '10.0.0.1', private_network_name = 'private' ) network = Fog::Network[:openstack] id = Fog::Identity[:openstack] tenant = id.tenants.find { |t| t.name == tenant_name } # Create a router for the tenant router = network.routers.create :name => router_name, :tenant_id => tenant.id, :external_gateway_info => { 'network_id' => external_net.id } # Create a private network for the tenant net = network.networks.create :name => private_network_name, :tenant_id => tenant.id # Create a subnet for the previous network and associate it # with the tenant subnet = network.subnets.create :name => 'net_10', :network_id => net.id, :ip_version => 4, :gateway_ip => subnet_gateway, :cidr => subnet_range, :tenant_id => tenant.id, :enable_dhcp => true network.add_router_interface router.id, subnet.id end # Create a public shared network public_net = network.networks.create :name => 'nova', :router_external => true # Create the public subnet public_subnet = network.subnets.create :name => 'floating_ips_net', :network_id => public_net.id, :ip_version => 4, :cidr => '1.2.3.0/24', :enable_dhcp => false # Create tenant networks create_tenant_network 'admin@example.net', public_net create_tenant_network 'demo@example.net', public_net fog-1.34.0/lib/fog/openstack/examples/storage/0000755000004100000410000000000012600047642021175 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/storage/set-account-quota.rb0000644000004100000410000000424512600047642025103 0ustar www-datawww-datarequire 'fog' require 'pp' # # This example sets the account quota (in bytes) for the tenant demo@test.lan # using an admin account (admin has the reseller user role). # # Uses the account impersonation feature recently added to the # OpenStack Storage service in Fog (See https://github.com/fog/fog/pull/1632). # # Should be available in Fog 1.10.0+1. # # Setting account quotas is only supported in Swift 1.8.0+ # using the brand new account_quota middleware introduced in # OpenStack Grizzly (currently unreleased as of 2013/04/03). # # https://github.com/openstack/swift/blob/master/swift/common/middleware/account_quotas.py # auth_url = 'https://identity.test.lan/v2.0/tokens' user = 'admin@test.lan' password = 'secret' Excon.defaults[:ssl_verify_peer] = false # # We are going to use the Identity (Keystone) service # to retrieve the list of tenants available and find # the tenant we want to set the quotas for. # id = Fog::Identity.new :provider => 'OpenStack', :openstack_auth_url => auth_url, :openstack_username => user, :openstack_api_key => password # # Storage service (Swift) # st = Fog::Storage.new :provider => 'OpenStack', :openstack_auth_url => auth_url, :openstack_username => user, :openstack_api_key => password id.tenants.each do |t| # We want to set the account quota for tenant demo@test.lan next unless t.name == 'demo@test.lan' # We've found the tenant, impersonate the account # (the account prefix AUTH_ may be different for you, double check it). puts "Changing account to #{t.name}" st.change_account "AUTH_#{t.id}" # Now we're adding the required header to the demo@test.lan # tenant account, limiting the account bytes to 1048576 (1MB) # # Uploading more than 1MB will return 413: Request Entity Too Large st.request :method => 'POST', :headers => { 'X-Account-Meta-Quota-Bytes' => '1048576' } # We can list the account details to verify the new # header has been added pp st.request :method => 'HEAD' end # Restore the account we were using initially (admin@test.lan) st.reset_account_name fog-1.34.0/lib/fog/openstack/examples/identity/0000755000004100000410000000000012600047642021362 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/identity/basics.rb0000644000004100000410000000333612600047642023160 0ustar www-datawww-data# OpenStack Identity Service (Keystone) Example require 'fog' require 'pp' auth_url = "https://example.net/v2.0/tokens" username = 'admin@example.net' password = 'secret' keystone = Fog::Identity.new :provider => 'OpenStack', :openstack_auth_url => auth_url, :openstack_username => username, :openstack_api_key => password # Optional, self-signed certs #:connection_options => { :ssl_verify_peer => false } # # Listing keystone tenants # keystone.tenants.each do |tenant| # pp tenant end # # List users # keystone.users.each do |user| # # ... pp user end # # Create a new tenant # tenant = keystone.tenants.create :name => 'rubiojr@example.net', :description => 'My foo tenant' # # Create a new user # user = keystone.users.create :name => 'rubiojr@example.net', :tenant_id => tenant.id, :password => 'rubiojr@example.net', :email => 'rubiojr@example.net' # Find the recently created tenant tenant = keystone.tenants.find { |t| t.name == 'rubiojr@example.net' } # Destroy the tenant tenant.destroy # Find the recently created user user = keystone.users.find { |u| u.name == 'rubiojr@example.net' } # Destroy the user user.destroy fog-1.34.0/lib/fog/openstack/examples/compute/0000755000004100000410000000000012600047642021205 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/compute/basics.rb0000644000004100000410000000314712600047642023003 0ustar www-datawww-data# OpenStack Compute (Nova) Example require 'fog' auth_url = "https://example.net/v2.0/tokens" username = 'admin@example.net' password = 'secret' tenant = 'My Compute Tenant' # String compute_client ||= ::Fog::Compute.new(:provider => :openstack, :openstack_api_key => password , :openstack_username => username , :openstack_auth_url => auth_url , :openstack_tenant => tenant) # Create VM # Options include metadata, availability zone, etc... begin vm = compute_client.servers.create(:name => 'lucky', :image_ref => 'fcd8f8a9', :flavor_ref => 4) rescue => e puts JSON.parse(e.response.body)['badRequest']['message'] end # Destroy VM vm = compute_client.servers.get(vm.id) # Retrieve previously created vm by UUID floating_ips = vm.all_addresses # fetch and release its floating IPs floating_ips.each do |address| compute_client.disassociate_address(uuid, address['ip']) compute_client.release_address(address['id']) end vm.destroy # Images available at tenant image_names = compute_client.images.map { |image| image['name'] } # Floating IP address pools available at tenant compute_client.addresses.get_address_pools # response.body #=> { 'name' => 'pool1' }, { 'name' => 'pool2' } # VNC console vm.console.body # returns VNC url # "console" => { # "url" => "http://vmvncserver:6080/vnc_auto.html?token=231", # "type" => "novnc" # } fog-1.34.0/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb0000644000004100000410000000151712600047642026271 0ustar www-datawww-data# OpenStack Compute (Nova) Example require 'fog' require 'fog/openstack' auth_url = "https://example.net/v2.0/tokens" username = 'admin@example.net' password = 'secret' tenant = 'My Compute Tenant' # String compute_client ||= ::Fog::Compute.new( :provider => :openstack, :openstack_api_key => password, :openstack_username => username, :openstack_auth_url => auth_url, :openstack_tenant => tenant, ) vm = compute_client.servers.create( :name => name, :flavor_ref => flavor, :block_device_mapping_v2 => [ { :boot_index => 0 :device_name => "vda", :source_type => "volume", # Or "snapshot" :destination_type => "volume", :delete_on_termination => false, :uuid => cinder_uddi, } ] ) fog-1.34.0/lib/fog/openstack/examples/image/0000755000004100000410000000000012600047642020613 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/image/upload-test-image.rb0000644000004100000410000000531212600047642024462 0ustar www-datawww-datarequire 'securerandom' require 'rubygems/package' require 'zlib' require 'fog' # # Download CirrOS 0.3.0 image from launchpad (~6.5MB) to /tmp # and upload it to Glance (the OpenStack Image Service). # # You will need to source OpenStack credentials since the script # reads the following envionment variables: # # OS_PASSWORD # OS_USERNAME # OS_AUTH_URL # OS_TENANT_NAME # # Should work with Fog >= 1.9, ruby 1.8.7 and 2.0 # image_url = "https://launchpadlibrarian.net/83305869/cirros-0.3.0-x86_64-uec.tar.gz" image_out = File.open("/tmp/cirros-image-#{SecureRandom.hex}", 'wb') extract_path = "/tmp/cirros-#{SecureRandom.hex}-dir" ami = "#{extract_path}/cirros-0.3.0-x86_64-blank.img" aki = "#{extract_path}/cirros-0.3.0-x86_64-vmlinuz" ari = "#{extract_path}/cirros-0.3.0-x86_64-initrd" FileUtils.mkdir_p extract_path # Efficient image write puts "Downloading Cirros image..." streamer = lambda do |chunk, remaining_bytes, total_bytes| image_out.write chunk end Excon.get image_url, :response_block => streamer image_out.close puts "Image downloaded to #{image_out.path}" puts "Extracting image contents to #{extract_path}..." Gem::Package::TarReader.new(Zlib::GzipReader.open(image_out.path)).each do |entry| FileUtils.mkdir_p "#{extract_path}/#{File.dirname(entry.full_name)}" File.open "#{extract_path}/#{entry.full_name}", 'w' do |f| f.write entry.read end end image_service = Fog::Image.new({ :provider => 'OpenStack', :openstack_api_key => ENV['OS_PASSWORD'], :openstack_username => ENV["OS_USERNAME"], :openstack_auth_url => ENV["OS_AUTH_URL"] + "/tokens", :openstack_tenant => ENV["OS_TENANT_NAME"] }) puts "Uploading AKI..." aki = image_service.images.create :name => 'cirros-0.3.0-amd64-aki', :size => File.size(aki), :disk_format => 'aki', :container_format => 'aki', :location => aki puts "Uploading ARI..." ari = image_service.images.create :name => 'cirros-0.3.0-amd64-ari', :size => File.size(ari), :disk_format => 'ari', :container_format => 'ari', :location => ari puts "Uploading AMI..." image_service.images.create :name => 'cirros-0.3.0-amd64', :size => File.size(ami), :disk_format => 'ami', :container_format => 'ami', :location => ami, :properties => { 'kernel_id' => aki.id, 'ramdisk_id' => ari.id } fog-1.34.0/lib/fog/openstack/examples/planning/0000755000004100000410000000000012600047642021337 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/examples/planning/basics.rb0000644000004100000410000000156512600047642023137 0ustar www-datawww-data# OpenStack Planning Service (Tuskar) Example require 'fog' require 'pp' auth_url = "https://example.net/v2.0/tokens" username = 'admin@example.net' password = 'secret' tenant = 'My Compute Tenant' # String planning ||= ::Fog::Openstack.new( :service => :planning, :openstack_api_key => password, :openstack_username => username, :openstack_auth_url => auth_url, :openstack_tenant => tenant ) pp planning # # Listing of Tuskar roles # roles = planning.roles.each do |role| pp role end # # Listing of Tuskar plans # plans = planning.plans.each do |plan| pp plan end # # Creating new Tuskar plan # plan = planning.plans.new({ :name => 'New Plan Name', :description => 'New Plan Description' }) pp plan # # Assign role to plan # role_uuid = roles.first.uuid plan.add_role(role_uuid) # # Output Heat templates for plan # pp plan.templates fog-1.34.0/lib/fog/openstack/volume.rb0000644000004100000410000001306612600047642017555 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Volume class OpenStack < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/volume' model :volume collection :volumes model :availability_zone collection :availability_zones model :volume_type collection :volume_types model :transfer collection :transfers request_path 'fog/openstack/requests/volume' # Volume request :list_volumes request :list_volumes_detailed request :create_volume request :get_volume_details request :extend_volume request :delete_volume request :list_zones request :list_volume_types request :get_volume_type_details request :create_volume_snapshot request :list_snapshots request :list_snapshots_detailed request :get_snapshot_details request :delete_snapshot request :list_transfers request :list_transfers_detailed request :create_transfer request :get_transfer_details request :accept_transfer request :delete_transfer request :update_quota request :get_quota request :get_quota_defaults request :set_tenant class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :users => {}, :tenants => {}, :quota => { 'gigabytes' => 1000, 'volumes' => 10, 'snapshots' => 10 } } end end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 8776 management_url.path = '/v1' @openstack_management_url = management_url.to_s @data ||= { :users => {} } unless @data[:users].find {|u| u['name'] == options[:openstack_username]} id = Fog::Mock.random_numbers(6).to_s @data[:users][id] = { 'id' => id, 'name' => options[:openstack_username], 'email' => "#{options[:openstack_username]}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_management_url => @openstack_management_url } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['volume'] @openstack_service_name = options[:openstack_service_name] @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @connection_options = options[:connection_options] || {} authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}"#, })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/identity_v3.rb0000644000004100000410000001330012600047642020476 0ustar www-datawww-datarequire 'fog/openstack/core' require 'fog/openstack/identity' module Fog module Identity class OpenStack class V3 < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_endpoint_type, :openstack_region, :openstack_domain_id, :openstack_project_name, :openstack_domain_name, :openstack_user_domain, :openstack_project_domain, :openstack_user_domain_id, :openstack_project_domain_id, :openstack_api_key, :openstack_current_user_id, :openstack_userid, :openstack_username, :current_user, :current_user_id, :current_tenant, :provider model_path 'fog/openstack/models/identity_v3' model :domain collection :domains model :endpoint collection :endpoints model :project collection :projects model :service collection :services model :token collection :tokens model :user collection :users model :group collection :groups model :role collection :roles model :role_assignment collection :role_assignments model :os_credential collection :os_credentials model :policy collection :policies request_path 'fog/openstack/requests/identity_v3' request :list_users request :get_user request :create_user request :update_user request :delete_user request :list_user_groups request :list_user_projects request :list_groups request :get_group request :create_group request :update_group request :delete_group request :add_user_to_group request :remove_user_from_group request :group_user_check request :list_group_users request :list_roles request :list_role_assignments request :get_role request :create_role request :update_role request :delete_role request :auth_domains request :auth_projects request :list_domains request :get_domain request :create_domain request :update_domain request :delete_domain request :list_domain_user_roles request :grant_domain_user_role request :check_domain_user_role request :revoke_domain_user_role request :list_domain_group_roles request :grant_domain_group_role request :check_domain_group_role request :revoke_domain_group_role request :list_endpoints request :get_endpoint request :create_endpoint request :update_endpoint request :delete_endpoint request :list_projects request :get_project request :create_project request :update_project request :delete_project request :list_project_user_roles request :grant_project_user_role request :check_project_user_role request :revoke_project_user_role request :list_project_group_roles request :grant_project_group_role request :check_project_group_role request :revoke_project_group_role request :list_services request :get_service request :create_service request :update_service request :delete_service request :token_authenticate request :token_validate request :token_check request :token_revoke request :list_os_credentials request :get_os_credential request :create_os_credential request :update_os_credential request :delete_os_credential request :list_policies request :get_policy request :create_policy request :update_policy request :delete_policy class Mock include Fog::OpenStack::Core def initialize(options={}) end end def self.get_api_version uri, connection_options={} connection = Fog::Core::Connection.new(uri, false, connection_options) response = connection.request({ :expects => [200], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json'}, :method => 'GET' }) body = Fog::JSON.decode(response.body) version = nil unless body['version'].empty? version = body['version']['id'] end if version.nil? raise Fog::OpenStack::Errors::ServiceUnavailable.new( "No version available at #{uri}") end version end class Real include Fog::Identity::OpenStack::Common def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['identity_v3','identityv3','identity'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end end end end end end fog-1.34.0/lib/fog/openstack/identity_v2.rb0000644000004100000410000001447112600047642020507 0ustar www-datawww-datarequire 'fog/openstack/core' require 'fog/openstack/identity' module Fog module Identity class OpenStack class V2 < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/identity_v2' model :tenant collection :tenants model :user collection :users model :role collection :roles model :ec2_credential collection :ec2_credentials request_path 'fog/openstack/requests/identity_v2' request :check_token request :validate_token request :list_tenants request :create_tenant request :get_tenant request :get_tenants_by_id request :get_tenants_by_name request :update_tenant request :delete_tenant request :list_users request :create_user request :update_user request :delete_user request :get_user_by_id request :get_user_by_name request :add_user_to_tenant request :remove_user_from_tenant request :list_endpoints_for_token request :list_roles_for_user_on_tenant request :list_user_global_roles request :create_role request :delete_role request :delete_user_role request :create_user_role request :get_role request :list_roles request :set_tenant request :create_ec2_credential request :delete_ec2_credential request :get_ec2_credential request :list_ec2_credentials class Mock attr_reader :auth_token attr_reader :auth_token_expiration attr_reader :current_user attr_reader :current_tenant attr_reader :unscoped_token def self.data @users ||= {} @roles ||= {} @tenants ||= {} @ec2_credentials ||= Hash.new { |hash, key| hash[key] = {} } @user_tenant_membership ||= {} @data ||= Hash.new do |hash, key| hash[key] = { :users => @users, :roles => @roles, :tenants => @tenants, :ec2_credentials => @ec2_credentials, :user_tenant_membership => @user_tenant_membership } end end def self.reset! @data = nil @users = nil @roles = nil @tenants = nil @ec2_credentials = nil end def initialize(options={}) @openstack_username = options[:openstack_username] || 'admin' @openstack_tenant = options[:openstack_tenant] || 'admin' @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @openstack_management_url = @openstack_auth_uri.to_s @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 @admin_tenant = self.data[:tenants].values.find do |u| u['name'] == 'admin' end if @openstack_tenant @current_tenant = self.data[:tenants].values.find do |u| u['name'] == @openstack_tenant end unless @current_tenant @current_tenant_id = Fog::Mock.random_hex(32) @current_tenant = self.data[:tenants][@current_tenant_id] = { 'id' => @current_tenant_id, 'name' => @openstack_tenant } else @current_tenant_id = @current_tenant['id'] end else @current_tenant = @admin_tenant end @current_user = self.data[:users].values.find do |u| u['name'] == @openstack_username end @current_tenant_id = Fog::Mock.random_hex(32) unless @current_user @current_user_id = Fog::Mock.random_hex(32) @current_user = self.data[:users][@current_user_id] = { 'id' => @current_user_id, 'name' => @openstack_username, 'email' => "#{@openstack_username}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } else @current_user_id = @current_user['id'] end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials {:provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_management_url => @openstack_management_url, :openstack_current_user_id => @openstack_current_user_id, :current_user => @current_user, :current_tenant => @current_tenant} end end class Real include Fog::Identity::OpenStack::Common def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['identity'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end end end end end end fog-1.34.0/lib/fog/openstack/orchestration.rb0000644000004100000410000001367512600047642021140 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Orchestration class OpenStack < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/orchestration' model :stack collection :stacks model :resource collection :resources collection :resource_schemas model :event collection :events model :template collection :templates request_path 'fog/openstack/requests/orchestration' request :abandon_stack request :build_info request :create_stack request :delete_stack request :get_stack_template request :list_events request :list_resource_events request :list_resource_types request :list_resources request :list_stack_data request :list_stack_data_detailed request :list_stack_events request :preview_stack request :show_event_details request :show_resource_data request :show_resource_metadata request :show_resource_schema request :show_resource_template request :show_stack_details request :update_stack request :validate_template module Reflectable REFLECTION_REGEX = /\/stacks\/(\w+)\/([\w|-]+)\/resources\/(\w+)/ def resource @resource ||= service.resources.get(r[3], stack) end def stack @stack ||= service.stacks.get(r[1], r[2]) end private def reflection @reflection ||= REFLECTION_REGEX.match(self.links[0]['href']) end alias :r :reflection end class Mock attr_reader :auth_token attr_reader :auth_token_expiration attr_reader :current_user attr_reader :current_tenant def self.data @data ||= Hash.new do |hash, key| hash[key] = { :stacks => {} } end end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @current_tenant = options[:openstack_tenant] @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 8774 management_url.path = '/v1' @openstack_management_url = management_url.to_s identity_public_endpoint = URI.parse(options[:openstack_auth_url]) identity_public_endpoint.port = 5000 @openstack_identity_public_endpoint = identity_public_endpoint.to_s end def data self.class.data["#{@openstack_username}-#{@current_tenant}"] end def reset_data self.class.data.delete("#{@openstack_username}-#{@current_tenant}") end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_management_url => @openstack_management_url, :openstack_identity_endpoint => @openstack_identity_public_endpoint } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_identity_service_type = options[:openstack_identity_service_type] || 'identity' @openstack_service_type = options[:openstack_service_type] || ['orchestration'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token, 'X-Auth-User' => @openstack_username, 'X-Auth-Key' => @openstack_api_key }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}", :query => params[:query] })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # Bad Credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end if !response.body.empty? and response.get_header('Content-Type') =~ /application\/json/ then response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/identity.rb0000644000004100000410000000370012600047642020071 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Identity class OpenStack < Fog::Service # Fog::Identity::OpenStack.new() will return a Fog::Identity::OpenStack::V2 or a Fog::Identity::OpenStack::V3, # depending on whether the auth URL is for an OpenStack Identity V2 or V3 API endpoint def self.new(args = {}) if self.inspect == 'Fog::Identity::OpenStack' if args[:openstack_auth_url] @openstack_auth_uri = URI.parse(args[:openstack_auth_url]) if @openstack_auth_uri.path =~ /\/v3/ service = Fog::Identity::OpenStack::V3.new(args) end end service ||= Fog::Identity::OpenStack::V2.new(args) else service = Fog::Service.new(args) end service end module Common attr_reader :unscoped_token include Fog::OpenStack::Core def request(params) retried = false begin response = @connection.request(params.merge({ :headers => params.fetch(:headers,{}).merge({ 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }), :path => "#{@path}/#{params[:path]}" })) rescue Excon::Errors::Unauthorized => error raise if retried retried = true @openstack_must_reauthenticate = true authenticate retry rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Identity::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end end end end end fog-1.34.0/lib/fog/openstack/requests/0000755000004100000410000000000012600047642017566 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/identity_v3/0000755000004100000410000000000012600047642022027 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/identity_v3/update_os_credential.rb0000644000004100000410000000067012600047642026534 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_os_credential(id, credential) request( :expects => [200], :method => 'PATCH', :path => "credentials/#{id}", :body => Fog::JSON.encode(:credential => credential) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_group.rb0000644000004100000410000000062112600047642025032 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_group(group) request( :expects => [201], :method => 'POST', :path => "groups", :body => Fog::JSON.encode(:group => group) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_user.rb0000644000004100000410000000057412600047642024177 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_user(id) request( :expects => [200], :method => 'GET', :path => "users/#{id}" ) end end class Mock def get_user(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_role.rb0000644000004100000410000000053012600047642024635 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_role(id) request( :expects => [204], :method => 'DELETE', :path => "roles/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_service.rb0000644000004100000410000000063312600047642025341 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_service(service) request( :expects => [201], :method => 'POST', :path => "services", :body => Fog::JSON.encode(:service => service) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_domain.rb0000644000004100000410000000060212600047642024460 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_domain(id) request( :expects => [200], :method => 'GET', :path => "domains/#{id}" ) end end class Mock def get_domain(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_service.rb0000644000004100000410000000060512600047642024654 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_service(id) request( :expects => [200], :method => 'GET', :path => "projects/#{id}" ) end end class Mock def get_service(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_group_users.rb0000644000004100000410000000067512600047642025774 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_group_users(id, options={}) request( :expects => [200], :method => 'GET', :path => "groups/#{id}/users", :query => options ) end end class Mock def list_group_users end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/token_validate.rb0000644000004100000410000000070412600047642025346 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def token_validate(subject_token) request( :expects => [200], :method => 'GET', :path => "auth/tokens", :headers => {"X-Subject-Token" => subject_token, "X-Auth-Token" => auth_token} ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_domain.rb0000644000004100000410000000064112600047642025166 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_domain(id, domain) request( :expects => [200], :method => 'PATCH', :path => "domains/#{id}", :body => Fog::JSON.encode(:domain => domain) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_service.rb0000644000004100000410000000064612600047642025364 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_service(id, service) request( :expects => [200], :method => 'PATCH', :path => "services/#{id}", :body => Fog::JSON.encode(:service => service) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/grant_domain_group_role.rb0000644000004100000410000000063212600047642027254 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def grant_domain_group_role(id, group_id, role_id) request( :expects => [204], :method => 'PUT', :path => "domains/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_os_credential.rb0000644000004100000410000000065512600047642026520 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_os_credential(credential) request( :expects => [201], :method => 'POST', :path => "credentials", :body => Fog::JSON.encode(:credential => credential) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/token_authenticate.rb0000644000004100000410000000062012600047642026230 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def token_authenticate(auth) request( :expects => [201], :method => 'POST', :path => "auth/tokens", :body => Fog::JSON.encode(auth) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_project_user_roles.rb0000644000004100000410000000070612600047642027322 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_project_user_roles(id, user_id) request( :expects => [200], :method => 'GET', :path => "projects/#{id}/users/#{user_id}/roles" ) end end class Mock def list_project_user_roles(id, user_id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_user_projects.rb0000644000004100000410000000063712600047642026304 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_user_projects(user_id) request( :expects => [200], :method => 'GET', :path => "users/#{user_id}/projects" ) end end class Mock def list_user_projects end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/revoke_domain_group_role.rb0000644000004100000410000000063612600047642027440 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def revoke_domain_group_role(id, group_id, role_id) request( :expects => [204], :method => 'DELETE', :path => "domains/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_domain_user_roles.rb0000644000004100000410000000070312600047642027120 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_domain_user_roles(id, user_id) request( :expects => [200], :method => 'GET', :path => "domains/#{id}/users/#{user_id}/roles" ) end end class Mock def list_domain_user_roles(id, user_id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/grant_project_user_role.rb0000644000004100000410000000063012600047642027273 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def grant_project_user_role(id, user_id, role_id) request( :expects => [204], :method => 'PUT', :path => "projects/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_project.rb0000644000004100000410000000063312600047642025347 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_project(project) request( :expects => [201], :method => 'POST', :path => "projects", :body => Fog::JSON.encode(:project => project) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_endpoint.rb0000644000004100000410000000065312600047642025542 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_endpoint(id, endpoint) request( :expects => [200], :method => 'PATCH', :path => "endpoints/#{id}", :body => Fog::JSON.encode(:endpoint => endpoint) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/token_revoke.rb0000644000004100000410000000071312600047642025050 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def token_revoke(subject_token) request( :expects => [200, 204], :method => 'DELETE', :path => "auth/tokens", :headers => {"X-Subject-Token" => subject_token, "X-Auth-Token" => auth_token, } ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_endpoint.rb0000644000004100000410000000064012600047642025517 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_endpoint(endpoint) request( :expects => [201], :method => 'POST', :path => "endpoints", :body => Fog::JSON.encode(:endpoint => endpoint) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/add_user_to_group.rb0000644000004100000410000000060212600047642026056 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def add_user_to_group(group_id, user_id) request( :expects => [204], :method => 'PUT', :path => "groups/#{group_id}/users/#{user_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_os_credentials.rb0000644000004100000410000000071012600047642026403 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_os_credentials(options = {}) request( :expects => [200], :method => 'GET', :path => "credentials", :query => options ) end end class Mock def list_os_credentials(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_policy.rb0000644000004100000410000000053512600047642025200 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_policy(id) request( :expects => [204], :method => 'DELETE', :path => "policies/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_group.rb0000644000004100000410000000053212600047642025032 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_group(id) request( :expects => [204], :method => 'DELETE', :path => "groups/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_os_credential.rb0000644000004100000410000000062412600047642026030 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_os_credential(id) request( :expects => [200], :method => 'GET', :path => "credentials/#{id}" ) end end class Mock def get_os_credential(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_project.rb0000644000004100000410000000053612600047642025350 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_project(id) request( :expects => [204], :method => 'DELETE', :path => "projects/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/grant_project_group_role.rb0000644000004100000410000000063412600047642027455 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def grant_project_group_role(id, group_id, role_id) request( :expects => [204], :method => 'PUT', :path => "projects/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/revoke_domain_user_role.rb0000644000004100000410000000063212600047642027256 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def revoke_domain_user_role(id, user_id, role_id) request( :expects => [204], :method => 'DELETE', :path => "domains/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_domain.rb0000644000004100000410000000062612600047642025152 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_domain(domain) request( :expects => [201], :method => 'POST', :path => "domains", :body => Fog::JSON.encode(:domain => domain) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/check_domain_group_role.rb0000644000004100000410000000063312600047642027217 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def check_domain_group_role(id, group_id, role_id) request( :expects => [204], :method => 'HEAD', :path => "domains/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_policies.rb0000644000004100000410000000067112600047642025222 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_policies(options = {}) request( :expects => [200], :method => 'GET', :path => "policies", :query => options ) end end class Mock def list_policies(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/get_role.rb0000644000004100000410000000057412600047642024162 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_role(id) request( :expects => [200], :method => 'GET', :path => "roles/#{id}" ) end end class Mock def get_role(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_group.rb0000644000004100000410000000063412600047642025055 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_group(id, group) request( :expects => [200], :method => 'PATCH', :path => "groups/#{id}", :body => Fog::JSON.encode(:group => group) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_endpoints.rb0000644000004100000410000000067212600047642025417 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_endpoints(options = {}) request( :expects => [200], :method => 'GET', :path => "endpoints", :query => options ) end end class Mock def list_endpoints(options={}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/create_user.rb0000644000004100000410000000061412600047642024656 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_user(user) request( :expects => [201], :method => 'POST', :path => "users", :body => Fog::JSON.encode(:user => user) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/revoke_project_user_role.rb0000644000004100000410000000063412600047642027457 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def revoke_project_user_role(id, user_id, role_id) request( :expects => [204], :method => 'DELETE', :path => "projects/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_endpoint.rb0000644000004100000410000000061012600047642025030 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_endpoint(id) request( :expects => [200], :method => 'GET', :path => "endpoints/#{id}" ) end end class Mock def get_endpoint(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/group_user_check.rb0000644000004100000410000000060212600047642025701 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def group_user_check(group_id, user_id) request( :expects => [204], :method => 'HEAD', :path => "groups/#{group_id}/users/#{user_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_project.rb0000644000004100000410000000064412600047642024665 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_project(id, options=[]) request( :expects => [200], :method => 'GET', :path => "projects/#{id}?#{options.join '&'}" ) end end class Mock def get_domain(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/remove_user_from_group.rb0000644000004100000410000000061212600047642027145 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def remove_user_from_group(group_id, user_id) request( :expects => [204], :method => 'DELETE', :path => "groups/#{group_id}/users/#{user_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_users.rb0000644000004100000410000000066012600047642024552 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_users(options = {}) request( :expects => [200], :method => 'GET', :path => "users", :query => options ) end end class Mock def list_users(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/list_projects.rb0000644000004100000410000000121112600047642025233 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_projects(options = {}) user_id = options.delete('user_id') || options.delete(:user_id) if user_id path = "users/#{user_id}/projects" else path = "projects" end request( :expects => [200], :method => 'GET', :path => path, :query => options ) end end class Mock def list_projects(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/token_check.rb0000644000004100000410000000071012600047642024627 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def token_check(subject_token) request( :expects => [200, 204], :method => 'HEAD', :path => "auth/tokens", :headers => {"X-Subject-Token" => subject_token, "X-Auth-Token" => auth_token, } ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_project.rb0000644000004100000410000000064612600047642025372 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_project(id, project) request( :expects => [200], :method => 'PATCH', :path => "projects/#{id}", :body => Fog::JSON.encode(:project => project) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_groups.rb0000644000004100000410000000120112600047642024720 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_groups(options = {}) user_id = options.delete('user_id') || options.delete(:user_id) if user_id path = "users/#{user_id}groups" else path = "groups" end request( :expects => [200], :method => 'GET', :path => path, :query => options ) end end class Mock def list_groups(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/list_roles.rb0000644000004100000410000000066012600047642024535 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_roles(options = {}) request( :expects => [200], :method => 'GET', :path => "roles", :query => options ) end end class Mock def list_roles(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/grant_domain_user_role.rb0000644000004100000410000000062612600047642027101 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def grant_domain_user_role(id, user_id, role_id) request( :expects => [204], :method => 'PUT', :path => "domains/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_policy.rb0000644000004100000410000000062712600047642025203 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_policy(policy) request( :expects => [201], :method => 'POST', :path => "policies", :body => Fog::JSON.encode(:policy => policy) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_domains.rb0000644000004100000410000000066612600047642025051 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_domains(options = {}) request( :expects => [200], :method => 'GET', :path => "domains", :query => options ) end end class Mock def list_domains(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/update_policy.rb0000644000004100000410000000064212600047642025217 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_policy(id, policy) request( :expects => [200], :method => 'PATCH', :path => "policies/#{id}", :body => Fog::JSON.encode(:policy => policy) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_domain.rb0000644000004100000410000000053412600047642025147 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_domain(id) request( :expects => [204], :method => 'DELETE', :path => "domains/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_os_credential.rb0000644000004100000410000000054712600047642026517 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_os_credential(id) request( :expects => [204], :method => 'DELETE', :path => "credentials/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_services.rb0000644000004100000410000000067112600047642025236 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_services(options = {}) request( :expects => [200], :method => 'GET', :path => "services", :query => options ) end end class Mock def list_services(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/revoke_project_group_role.rb0000644000004100000410000000064012600047642027632 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def revoke_project_group_role(id, group_id, role_id) request( :expects => [204], :method => 'DELETE', :path => "projects/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_user.rb0000644000004100000410000000053012600047642024652 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_user(id) request( :expects => [204], :method => 'DELETE', :path => "users/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/check_domain_user_role.rb0000644000004100000410000000062712600047642027044 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def check_domain_user_role(id, user_id, role_id) request( :expects => [204], :method => 'HEAD', :path => "domains/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_endpoint.rb0000644000004100000410000000054012600047642025515 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_endpoint(id) request( :expects => [204], :method => 'DELETE', :path => "endpoints/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_domain_group_roles.rb0000644000004100000410000000071012600047642027274 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_domain_group_roles(id, group_id) request( :expects => [200], :method => 'GET', :path => "domains/#{id}/groups/#{group_id}/roles" ) end end class Mock def list_domain_user_roles(id, group_id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_group.rb0000644000004100000410000000057712600047642024360 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_group(id) request( :expects => [200], :method => 'GET', :path => "groups/#{id}" ) end end class Mock def get_group(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/check_project_group_role.rb0000644000004100000410000000063512600047642027420 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def check_project_group_role(id, group_id, role_id) request( :expects => [204], :method => 'HEAD', :path => "projects/#{id}/groups/#{group_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/update_role.rb0000644000004100000410000000062712600047642024664 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_role(id, role) request( :expects => [200], :method => 'PATCH', :path => "roles/#{id}", :body => Fog::JSON.encode(:role => role) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_role_assignments.rb0000644000004100000410000000207412600047642026766 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_role_assignments(options = {}) # Backwards compatibility name mapping, also serves as single pane of glass, since keystone broke # consistency in naming of options, just for this one API call name_mapping = { :group_id => 'group.id', :role_id => 'role.id', :domain_id => 'scope.domain.id', :project_id => 'scope.project.id', :user_id => 'user.id', } name_mapping.keys.each do |key| if (opt = options.delete(key)) options[name_mapping[key]] = opt end end request( :expects => [200], :method => 'GET', :path => "role_assignments", :query => options ) end end class Mock def list_role_assignments(options = {}) end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/update_user.rb0000644000004100000410000000062712600047642024701 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def update_user(id, user) request( :expects => [200], :method => 'PATCH', :path => "users/#{id}", :body => Fog::JSON.encode(:user => user) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/get_policy.rb0000644000004100000410000000060312600047642024511 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def get_policy(id) request( :expects => [200], :method => 'GET', :path => "policies/#{id}" ) end end class Mock def get_policy(id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/create_role.rb0000644000004100000410000000061412600047642024641 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def create_role(role) request( :expects => [201], :method => 'POST', :path => "roles", :body => Fog::JSON.encode(:role => role) ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/auth_domains.rb0000644000004100000410000000065512600047642025035 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def auth_domains(options={}) request( :expects => [200], :method => 'GET', :path => "auth/domains", :query => options ) end end class Mock def auth_domains end end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v3/list_project_group_roles.rb0000644000004100000410000000071312600047642027476 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_project_group_roles(id, group_id) request( :expects => [200], :method => 'GET', :path => "projects/#{id}/groups/#{group_id}/roles" ) end end class Mock def list_project_user_roles(id, group_id) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/check_project_user_role.rb0000644000004100000410000000063112600047642027236 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def check_project_user_role(id, user_id, role_id) request( :expects => [204], :method => 'HEAD', :path => "projects/#{id}/users/#{user_id}/roles/#{role_id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/list_user_groups.rb0000644000004100000410000000063112600047642025764 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def list_user_groups(user_id) request( :expects => [200], :method => 'GET', :path => "users/#{user_id}/groups" ) end end class Mock def list_user_groups end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/delete_service.rb0000644000004100000410000000053612600047642025342 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def delete_service(id) request( :expects => [204], :method => 'DELETE', :path => "services/#{id}" ) end end class Mock end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v3/auth_projects.rb0000644000004100000410000000066012600047642025230 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V3 class Real def auth_projects(options = {}) request( :expects => [200], :method => 'GET', :path => "auth/projects", :query => options ) end end class Mock def auth_projects end end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/0000755000004100000410000000000012600047642022452 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/orchestration/preview_stack.rb0000644000004100000410000000052512600047642025647 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def preview_stack(options = {}) request( :body => Fog::JSON.encode(options), :expects => [200], :method => 'POST', :path => 'stacks/preview' ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/validate_template.rb0000644000004100000410000000052312600047642026463 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def validate_template(options = {}) request( :body => Fog::JSON.encode(options), :expects => [200], :method => 'POST', :path => 'validate' ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_resources.rb0000644000004100000410000000342612600047642026051 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_resources(options = {}, options_deprecated = {}) if options.is_a?(Hash) if !options.key?(:stack) && !(options.key?(:stack_name) && options.key?(:stack_id)) raise(ArgumentError, "Missing required options keys: :stack or :stack_name and :stack_id, while calling "\ " .list_resources(options)") end stack = options.delete(:stack) stack_name = options.delete(:stack_name) stack_name ||= stack.stack_name if stack && stack.respond_to?(:stack_name) stack_id = options.delete(:stack_id) stack_id ||= stack.id if stack && stack.respond_to?(:id) path = "stacks/#{stack_name}/#{stack_id}/resources" params = options else Fog::Logger.deprecation('Calling OpenStack[:orchestration].list_resources(stack, options) is deprecated, '\ ' call .list_resources(:stack => stack) or '\ ' .list_resources(:stack_name => value, :stack_id => value) instead') path = "stacks/#{options.stack_name}/#{options.id}/resources" params = options_deprecated end request(:method => 'GET', :path => path, :expects => 200, :query => params) end end class Mock def list_resources(options = {}, options_deprecated = {}) resources = self.data[:resources].values Excon::Response.new( :body => { 'resources' => resources }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_resource_metadata.rb0000644000004100000410000000117012600047642027525 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_resource_metadata(stack, resource_name) request( :method => 'GET', :path => "stacks/#{stack.stack_name}/#{stack.id}/resources/#{resource_name}/metadata", :expects => 200 ) end end class Mock def show_resource_metadata(stack, resource_name) resources = self.data[:resources].values Excon::Response.new( :body => { 'resources' => resources }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/update_stack.rb0000644000004100000410000000450712600047642025454 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real # Update a stack. # # @param [Fog::Orchestration::OpenStack::Stack] the stack to update. # @param [Hash] options # * :template [String] Structure containing the template body. # or (one of the two Template parameters is required) # * :template_url [String] URL of file containing the template body. # * :parameters [Hash] Hash of providers to supply to template. # def update_stack(arg1, arg2 = nil, arg3 = nil) if arg1.is_a?(Stack) # Normal use, update_stack(stack, options = {}) stack = arg1 stack_name = stack.stack_name stack_id = stack.id params = arg2.nil? ? {} : arg2 else # Deprecated, update_stack(stack_id, stack_name, options = {}) Fog::Logger.deprecation("#update_stack(stack_id, stack_name, options) is deprecated, use #update_stack(stack, options) instead [light_black](#{caller.first})[/]") stack_id = arg1 stack_name = arg2 params = { :stack_name => stack_name }.merge(arg3.nil? ? {} : arg3) end request( :expects => 202, :path => "stacks/#{stack_name}/#{stack_id}", :method => 'PUT', :body => Fog::JSON.encode(params) ) end end class Mock def update_stack(arg1, arg2 = nil, arg3 = nil) if arg1.is_a?(Stack) # Normal use, update_stack(stack, options = {}) stack = arg1 stack_name = stack.stack_name stack_id = stack.id params = arg2.nil? ? {} : arg2 else # Deprecated, update_stack(stack_id, stack_name, options = {}) Fog::Logger.deprecation("#update_stack(stack_id, stack_name, options) is deprecated, use #update_stack(stack, options) instead [light_black](#{caller.first})[/]") stack_id = arg1 stack_name = arg2 params = { :stack_name => stack_name }.merge(arg3.nil? ? {} : arg3) end response = Excon::Response.new response.status = 202 response.body = {} response end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/abandon_stack.rb0000644000004100000410000000047112600047642025570 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def abandon_stack(stack) request( :expects => [200], :method => 'DELETE', :path => "stacks/#{stack.stack_name}/#{stack.id}/abandon" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_resource_types.rb0000644000004100000410000000107612600047642027111 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_resource_types(options = {}) request( :method => 'GET', :path => "resource_types", :expects => 200, :query => {} ) end end class Mock def list_resource_types resources = self.data[:resource_types].values Excon::Response.new( :body => { 'resource_types' => resources }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_resource_events.rb0000644000004100000410000000177612600047642027260 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_resource_events(stack, resource, options = {}) Fog::Logger.deprecation('Calling OpenStack[:orchestration].list_resource_events(stack, resource, options)'\ ' is deprecated, call .list_events(:stack => stack, :resource => resource) or '\ ' .list_events(:stack_name => value, :stack_id => value, :resource_name => value)'\ ' instead') uri = "stacks/#{stack.stack_name}/#{stack.id}/resources/#{resource.resource_name}/events" request(:method => 'GET', :path => uri, :expects => 200, :query => options) end end class Mock def list_resource_events(stack, resource, options={}) events = self.data[:events].values Excon::Response.new( :body => { 'events' => events }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/build_info.rb0000644000004100000410000000041012600047642025104 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def build_info request( :expects => [200], :method => 'GET', :path => 'build_info' ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/create_stack.rb0000644000004100000410000000534212600047642025433 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real # Create a stack. # # # * options [Hash]: # * :stack_name [String] Name of the stack to create. # * :template [String] Structure containing the template body. # or (one of the two Template parameters is required) # * :template_url [String] URL of file containing the template body. # * :disable_rollback [Boolean] Controls rollback on stack creation failure, defaults to false. # * :parameters [Hash] Hash of providers to supply to template # * :timeout_mins [Integer] Minutes to wait before status is set to CREATE_FAILED # # @see http://developer.openstack.org/api-ref-orchestration-v1.html def create_stack(arg1, arg2 = nil) if arg1.is_a?(Hash) # Normal use: create_stack(options) options = arg1 else # Deprecated: create_stack(stack_name, options = {}) Fog::Logger.deprecation("#create_stack(stack_name, options) is deprecated, use #create_stack(options) instead [light_black](#{caller.first})[/]") options = { :stack_name => arg1 }.merge(arg2.nil? ? {} : arg2) end request( :expects => 201, :path => 'stacks', :method => 'POST', :body => Fog::JSON.encode(options) ) end end class Mock def create_stack(arg1, arg2 = nil) if arg1.is_a?(Hash) # Normal use: create_stack(options) options = arg1 else # Deprecated: create_stack(stack_name, options = {}) Fog::Logger.deprecation("#create_stack(stack_name, options) is deprecated, use #create_stack(options) instead [light_black](#{caller.first})[/]") options = { :stack_name => arg1 }.merge(arg2.nil? ? {} : arg2) end stack_id = Fog::Mock.random_hex(32) stack = self.data[:stacks][stack_id] = { 'id' => stack_id, 'stack_name' => options[:stack_name], 'links' => [], 'description' => options[:description], 'stack_status' => 'CREATE_COMPLETE', 'stack_status_reason' => 'Stack successfully created', 'creation_time' => Time.now, 'updated_time' => Time.now } response = Excon::Response.new response.status = 201 response.body = { 'id' => stack_id, 'links'=>[{"href"=>"http://localhost:8004/v1/fake_tenant_id/stacks/#{options[:stack_name]}/#{stack_id}", "rel"=>"self"}]} response end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_events.rb0000644000004100000410000000302012600047642025331 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_events(options = {}) if !options.key?(:stack) && !(options.key?(:stack_name) && options.key?(:stack_id)) raise(ArgumentError, "Missing required options keys: :stack or :stack_name and :stack_id, while calling "\ " .list_events(options)") end stack = options.delete(:stack) stack_name = options.delete(:stack_name) stack_name ||= stack.stack_name if stack && stack.respond_to?(:stack_name) stack_id = options.delete(:stack_id) stack_id ||= stack.id if stack && stack.respond_to?(:id) resource = options.delete(:resource) resource_name = options.delete(:resource_name) resource_name ||= resource.resource_name if resource && resource.respond_to?(:resource_name) if resource_name path = "stacks/#{stack_name}/#{stack_id}/resources/#{resource_name}/events" else path = "stacks/#{stack_name}/#{stack_id}/events" end request(:method => 'GET', :path => path, :expects => 200, :query => options) end end class Mock def list_events(options = {}) events = self.data[:events].values Excon::Response.new( :body => { 'events' => events }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_stack_details.rb0000644000004100000410000000102212600047642026644 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_stack_details(name, id) request( :method => 'GET', :path => "stacks/#{name}/#{id}", :expects => 200 ) end end class Mock def show_stack_details(name, id) stack = self.data[:stack].values Excon::Response.new( :body => { 'stack' => stack }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_stack_events.rb0000644000004100000410000000154012600047642026523 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_stack_events(stack, options = {}) Fog::Logger.deprecation('Calling OpenStack[:orchestration].list_stack_events(stack, options)'\ ' is deprecated, call .list_events(:stack => stack) or '\ ' .list_events(:stack_name => value, :stack_id => value) instead') uri = "stacks/#{stack.stack_name}/#{stack.id}/events" request(:method => 'GET', :path => uri, :expects => 200, :query => options ) end end class Mock def list_stack_events(stack, options={}) events = self.data[:events].values Excon::Response.new( :body => { 'events' => events }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_stack_data.rb0000644000004100000410000000105312600047642026127 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_stack_data(options = {}) request( :method => 'GET', :path => 'stacks', :expects => 200, :query => options ) end end class Mock def list_stack_data(options = {}) stacks = self.data[:stacks].values Excon::Response.new( :body => { 'stacks' => stacks }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_resource_schema.rb0000644000004100000410000000044212600047642027206 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_resource_schema(name) request( :method => 'GET', :path => "resource_types/#{name}", :expects => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_resource_template.rb0000644000004100000410000000057612600047642027571 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_resource_template(name) request( :method => 'GET', :path => "resource_types/#{name}/template", :expects => 200 ) end end class Mock def show_resource_template(name) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_event_details.rb0000644000004100000410000000116412600047642026667 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_event_details(stack, resource, event_id) request( :method => 'GET', :path => "stacks/#{stack.stack_name}/#{stack.id}/resources/#{resource.resource_name}/events/#{event_id}", :expects => 200 ) end end class Mock def show_event_details(stack, event) events = self.data[:events].values Excon::Response.new( :body => { 'events' => events }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/show_resource_data.rb0000644000004100000410000000117712600047642026665 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def show_resource_data(stack_name, stack_id, resource_name) request( :method => 'GET', :path => "stacks/#{stack_name}/#{stack_id}/resources/#{resource_name}", :expects => 200 ) end end class Mock def show_resource_data(stack_name, stack_id, resource_name) resources = self.data[:resources].values Excon::Response.new( :body => { 'resources' => resources }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/get_stack_template.rb0000644000004100000410000000061012600047642026633 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def get_stack_template(stack) request( :method => 'GET', :path => "stacks/#{stack.stack_name}/#{stack.id}/template", :expects => 200 ) end end class Mock def get_stack_template(stack) end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/delete_stack.rb0000644000004100000410000000330512600047642025427 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real # Delete a stack. # # @param [Stack] Stack to be deleted # # @return [Excon::Response] # # @see http://developer.openstack.org/api-ref-orchestration-v1.html def delete_stack(arg1, arg2 = nil) if arg1.is_a?(Stack) # Normal use: delete_stack(stack) stack = arg1 stack_name = stack.stack_name stack_id = stack.id else # Deprecated: delete_stack(stack_name, stack_id) Fog::Logger.deprecation("#delete_stack(stack_name, stack_id) is deprecated, use #delete_stack(stack) instead [light_black](#{caller.first})[/]") stack_name = arg1 stack_id = arg2 end request( :expects => 204, :path => "stacks/#{stack_name}/#{stack_id}", :method => 'DELETE' ) end end class Mock def delete_stack(arg1, arg2 = nil) if arg1.is_a?(Stack) # Normal use: delete_stack(stack) stack = arg1 stack_name = stack.stack_name stack_id = stack.id else # Deprecated: delete_stack(stack_name, stack_id) Fog::Logger.deprecation("#delete_stack(stack_name, stack_id) is deprecated, use #delete_stack(stack) instead [light_black](#{caller.first})[/]") stack_name = arg1 stack_id = arg2 end self.data[:stacks].delete(stack_id) response = Excon::Response.new response.status = 204 response.body = {} response end end end end end fog-1.34.0/lib/fog/openstack/requests/orchestration/list_stack_data_detailed.rb0000644000004100000410000000407512600047642027771 0ustar www-datawww-datamodule Fog module Orchestration class OpenStack class Real def list_stack_data_detailed(options = {}) request( :method => 'GET', :path => 'stacks/detail', :expects => 200, :query => options ) end end class Mock def list_stack_data_detailed(options = {}) Excon::Response.new( :body => { 'stacks' => [{"parent" => nil, "disable_rollback" => true, "description" => "No description", "links" => [{"href"=>"http://192.0.2.1:8004/v1/ae084f19a7974d5b95703f633e57fd64/stacks/overcloud/9ea5226f-0bb3-40bf-924b-f89ea11bb69c", "rel"=>"self"}], "stack_status_reason" => "Stack CREATE completed successfully", "stack_name" => "overcloud", "stack_user_project_id" => "ae084f19a7974d5b95703f633e57fd64", "stack_owner" => "admin", "creation_time" => "2015-06-24T07:19:01Z", "capabilities" => [], "notification_topics" => [], "updated_time" => nil, "timeout_mins" => nil, "stack_status" => "CREATE_COMPLETE", "parameters" => {"Controller-1::SSLKey"=>"******", "Compute-1::RabbitClientUseSSL"=>"False", "Controller-1::KeystoneSSLCertificate"=>"", "Controller-1::CinderLVMLoopDeviceSize"=>"5000"}, "id" => "9ea5226f-0bb3-40bf-924b-f89ea11bb69c", "outputs" => [], "template_description" => "No description"}] }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/0000755000004100000410000000000012600047642021257 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/network/delete_quota.rb0000644000004100000410000000070512600047642024261 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_quota(tenant_id) request( :expects => 204, :method => 'DELETE', :path => "/quotas/#{tenant_id}" ) end end class Mock def delete_quota(tenant_id) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/associate_lb_health_monitor.rb0000644000004100000410000000200412600047642027324 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def associate_lb_health_monitor(pool_id, health_monitor_id) data = { 'health_monitor' => { 'id' => health_monitor_id, } } request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => "lb/pools/#{pool_id}/health_monitors" ) end end class Mock def associate_lb_health_monitor(pool_id, health_monitor_id) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['health_monitors'] << health_monitor_id self.data[:lb_pools][pool_id] = pool response.body = { 'health_monitor' => {} } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_lb_vip.rb0000644000004100000410000000377712600047642024420 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {}) data = { 'vip' => { 'subnet_id' => subnet_id, 'pool_id' => pool_id, 'protocol' => protocol, 'protocol_port' => protocol_port } } vanilla_options = [:name, :description, :address, :session_persistence, :connection_limit, :admin_state_up, :tenant_id] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['vip'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'lb/vips' ) end end class Mock def create_lb_vip(subnet_id, pool_id, protocol, protocol_port, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'subnet_id' => subnet_id, 'pool_id' => pool_id, 'protocol' => protocol, 'protocol_port' => protocol_port, 'name' => options[:name], 'description' => options[:description], 'address' => options[:address], 'port_id' => Fog::Mock.random_numbers(6).to_s, 'session_persistence' => options[:session_persistence], 'connection_limit' => options[:connection_limit], 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'tenant_id' => options[:tenant_id], } self.data[:lb_vips][data['id']] = data response.body = { 'vip' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_lb_member.rb0000644000004100000410000000222112600047642025067 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_lb_member(member_id, options = {}) data = { 'member' => {} } vanilla_options = [:pool_id, :weight, :admin_state_up] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['member'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "lb/members/#{member_id}" ) end end class Mock def update_lb_member(member_id, options = {}) response = Excon::Response.new if member = list_lb_members.body['members'].find { |_| _['id'] == member_id } member['pool_id'] = options[:pool_id] member['weight'] = options[:weight] member['admin_state_up'] = options[:admin_state_up] response.body = { 'member' => member } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_security_group.rb0000644000004100000410000000154012600047642026211 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Delete a security group # # ==== Parameters # * 'security_group_id'<~String> - UUID of the security group to delete def delete_security_group(security_group_id) request( :expects => 204, :method => 'DELETE', :path => "security-groups/#{security_group_id}" ) end end class Mock def delete_security_group(security_group_id) response = Excon::Response.new if self.data[:security_groups][security_group_id] self.data[:security_groups].delete(security_group_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_security_group_rules.rb0000644000004100000410000000347512600047642027145 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # List all security group rules # # ==== Parameters # * options<~Hash>: # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_group_rules'<~Array>: # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def list_security_group_rules(options = {}) request( :expects => 200, :method => 'GET', :path => 'security-group-rules', :query => options ) end end class Mock def list_security_group_rules(options = {}) response = Excon::Response.new sec_group_rules = [] sec_group_rules = self.data[:security_group_rules].values unless self.data[:security_group_rules].nil? response.status = 200 response.body = { 'security_group_rules' => sec_group_rules } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_quota.rb0000644000004100000410000000125312600047642024300 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_quota(tenant_id, options = {}) request( :body => Fog::JSON.encode({ 'quota' => options} ), :expects => 200, :method => 'PUT', :path => "/quotas/#{tenant_id}" ) end end class Mock def update_quota(tenant_id, options = {}) self.data[:quota_updated] = self.data[:quota].merge options response = Excon::Response.new response.status = 200 response.body = { 'quota' => self.data[:quota_updated] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_lb_pool.rb0000644000004100000410000000227412600047642024601 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_lb_pool(pool_id, options = {}) data = { 'pool' => {} } vanilla_options = [:name, :description, :lb_method, :admin_state_up] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['pool'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "lb/pools/#{pool_id}" ) end end class Mock def update_lb_pool(pool_id, options = {}) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['name'] = options[:name] pool['description'] = options[:description] pool['lb_method'] = options[:lb_method] pool['admin_state_up'] = options[:admin_state_up] response.body = { 'pool' => pool } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_quotas.rb0000644000004100000410000000075612600047642023767 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_quotas request( :expects => 200, :method => 'GET', :path => "/quotas" ) end end class Mock def get_quotas response = Excon::Response.new response.status = 200 response.body = { 'quotas' => self.data[:quotas] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_subnet.rb0000644000004100000410000000246312600047642023750 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_subnet(subnet_id) request( :expects => [200], :method => 'GET', :path => "subnets/#{subnet_id}" ) end end class Mock def get_subnet(subnet_id) response = Excon::Response.new if data = self.data[:subnets][subnet_id] response.status = 200 response.body = { "subnet" => { "id" => "2e4ec6a4-0150-47f5-8523-e899ac03026e", "name" => "subnet_1", "network_id" => "e624a36d-762b-481f-9b50-4154ceb78bbb", "cidr" => "10.2.2.0/24", "ip_version" => 4, "gateway_ip" => "10.2.2.1", "allocation_pools" => [ { "start" => "10.2.2.2", "end" => "10.2.2.254" } ], "dns_nameservers" => [], "host_routes" => [], "enable_dhcp" => true, "tenant_id" => "f8b26a6032bc47718a7702233ac708b9", } } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/set_tenant.rb0000644000004100000410000000054612600047642023755 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate set_api_path end end class Mock def set_tenant(tenant) true end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_security_group.rb0000644000004100000410000000430612600047642025531 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Get details about a security group # # ==== Parameters # * 'security_group_id'<~String> - UUID of the security group # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_group'<~Array>: # * 'id'<~String> - UUID of the security group # * 'name'<~String> - Name of the security group # * 'description'<~String> - Description of the security group # * 'tenant_id'<~String> - Tenant id that owns the security group # * 'security_group_rules'<~Array>: - Array of security group rules # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def get_security_group(security_group_id) request( :expects => 200, :method => "GET", :path => "security-groups/#{security_group_id}" ) end end class Mock def get_security_group(security_group_id) response = Excon::Response.new if sec_group = self.data[:security_groups][security_group_id] response.status = 200 response.body = {"security_group" => sec_group} response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_security_group_rule.rb0000644000004100000410000000363312600047642026562 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Get details about a security group rule # # ==== Parameters # * 'security_group_rule_id'<~String> - UUID of the security group rule # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_group_rule'<~Hash>: # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def get_security_group_rule(security_group_rule_id) request( :expects => 200, :method => "GET", :path => "security-group-rules/#{security_group_rule_id}" ) end end class Mock def get_security_group_rule(security_group_rule_id) response = Excon::Response.new if sec_group_rule = self.data[:security_group_rules][security_group_rule_id] response.status = 200 response.body = {"security_group_rule" => sec_group_rule} response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_lb_vip.rb0000644000004100000410000000114712600047642023721 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_lb_vip(vip_id) request( :expects => [200], :method => 'GET', :path => "lb/vips/#{vip_id}" ) end end class Mock def get_lb_vip(vip_id) response = Excon::Response.new if data = self.data[:lb_vips][vip_id] response.status = 200 response.body = { 'vip' => data } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_lb_pool_stats.rb0000644000004100000410000000146712600047642025317 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_lb_pool_stats(pool_id) request( :expects => [200], :method => 'GET', :path => "lb/pools/#{pool_id}/stats" ) end end class Mock def get_lb_pool_stats(pool_id) response = Excon::Response.new if data = self.data[:lb_pools][pool_id] stats = {} stats["active_connections"] = 0 stats["bytes_in"] = 0 stats["bytes_out"] = 0 stats["total_connections"] = 0 response.status = 200 response.body = { 'stats' => stats } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_lb_health_monitors.rb0000644000004100000410000000107312600047642026514 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_lb_health_monitors(filters = {}) request( :expects => 200, :method => 'GET', :path => 'lb/health_monitors', :query => filters ) end end class Mock def list_lb_health_monitors(filters = {}) Excon::Response.new( :body => { 'health_monitors' => self.data[:lb_health_monitors].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_floating_ip.rb0000644000004100000410000000253012600047642025422 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_floating_ip(floating_network_id, options = {}) data = { 'floatingip' => { 'floating_network_id' => floating_network_id } } vanilla_options = [:port_id, :tenant_id, :fixed_ip_address ] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['floatingip'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'floatingips' ) end end class Mock def create_floating_ip(floating_network_id, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => floating_network_id, 'floating_network_id' => floating_network_id, 'port_id' => options[:port_id], 'tenant_id' => options[:tenant_id], 'fixed_ip_address' => options[:fixed_ip_address], 'router_id' => nil, } self.data[:floating_ips][data['id']] = data response.body = { 'floatingip' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_security_groups.rb0000644000004100000410000000417312600047642026112 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # List all security groups # # ==== Parameters # * options<~Hash>: # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_groups'<~Array>: # * 'id'<~String> - UUID of the security group # * 'name'<~String> - Name of the security group # * 'description'<~String> - Description of the security group # * 'tenant_id'<~String> - Tenant id that owns the security group # * 'security_group_rules'<~Array>: - Array of security group rules # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def list_security_groups(options = {}) request( :expects => 200, :method => 'GET', :path => 'security-groups', :query => options ) end end class Mock def list_security_groups(options = {}) response = Excon::Response.new sec_groups = [] sec_groups = self.data[:security_groups].values unless self.data[:security_groups].nil? response.status = 200 response.body = { 'security_groups' => sec_groups } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_router.rb0000644000004100000410000000503212600047642024466 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Update Router # # Beyond the name and the administrative state, the only # parameter which can be updated with this operation is # the external gateway. # @see http://docs.openstack.org/api/openstack-network/2.0/content/router_update.html def update_router(router_id, options = {}) data = { 'router' => {} } [:name, :admin_state_up].each do |key| data['router'][key] = options[key] if options[key] end # remove this in a future egi = options[:external_gateway_info] if egi if egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" data['router'][:external_gateway_info] = { :network_id => egi.id } elsif egi.is_a?(Hash) and egi[:network_id] data['router'][:external_gateway_info] = egi else raise ArgumentError.new('Invalid external_gateway_info attribute') end end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "routers/#{router_id}.json" ) end end class Mock def update_router(router_id, options = {}) response = Excon::Response.new router = list_routers.body['routers'].find {|r| r[:id] == router_id} raise Fog::Network::OpenStack::NotFound unless router options.keys.each {|k| router[k] = options[k] } # remove this in a future egi = options[:external_gateway_info] if egi if egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" router[:external_gateway_info] = { :network_id => egi.id } else egi.is_a?(Hash) && egi[:network_id] router[:external_gateway_info] = egi end end response.body = { 'router' => router } response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_network.rb0000644000004100000410000000205612600047642024137 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_network(network_id) request( :expects => [200], :method => 'GET', :path => "networks/#{network_id}" ) end end class Mock def get_network(network_id) response = Excon::Response.new if data = self.data[:networks][network_id] response.status = 200 response.body = { 'network' => { 'id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb', 'name' => 'network_1', 'subnets' => [ '2e4ec6a4-0150-47f5-8523-e899ac03026e' ], 'shared' => false, 'status' => 'ACTIVE', 'admin_state_up' => true, 'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9', } } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_security_group.rb0000644000004100000410000001026612600047642026217 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Create a new security group # # ==== Parameters # * options<~Hash>: # * 'name'<~String> - Name of the security group # * 'description'<~String> - Description of the security group # * 'tenant_id'<~String> - TenantId different than the current user, that should own the security group. Only allowed if user has 'admin' role. # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_groups'<~Array>: # * 'id'<~String> - UUID of the security group # * 'name'<~String> - Name of the security group # * 'description'<~String> - Description of the security group # * 'tenant_id'<~String> - Tenant id that owns the security group # * 'security_group_rules'<~Array>: - Array of security group rules # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def create_security_group(options = {}) data = {"security_group" => {}} desired_options = [:name, :description, :tenant_id] selected_options = desired_options.select{|o| options[o]} selected_options.each { |key| data["security_group"][key] = options[key] } request( :body => Fog::JSON.encode(data), :expects => 201, :method => "POST", :path => "security-groups" ) end end class Mock def create_security_group(options = {}) # Spaces are NOT removed from name and description, as in case of compute sec groups tenant_id = Fog::Mock.random_numbers(14).to_s sec_group_id = Fog::UUID.uuid response = Excon::Response.new response.status = 201 # by default every security group will come setup with an egress rule to "allow all out" data = { "security_group_rules" => [ { "remote_group_id" => nil, "direction" => "egress", "remote_ip_prefix" => nil, "protocol" => nil, "ethertype" => "IPv4", "tenant_id" => tenant_id, "port_range_max" => nil, "port_range_min" => nil, "id" => Fog::UUID.uuid, "security_group_id" => sec_group_id }, { "remote_group_id" => nil, "direction" => "egress", "remote_ip_prefix" => nil, "protocol" => nil, "ethertype" => "IPv6", "tenant_id" => tenant_id, "port_range_max" => nil, "port_range_min" => nil, "id" => Fog::UUID.uuid, "security_group_id" => sec_group_id } ], "id" => sec_group_id, "tenant_id" => tenant_id, "name" => options[:name] || "", "description" => options[:description] || "" } self.data[:security_groups][data["id"]] = data response.body = {"security_group" => data} response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_lb_vip.rb0000644000004100000410000000255212600047642024425 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_lb_vip(vip_id, options = {}) data = { 'vip' => {} } vanilla_options = [:pool_id, :name, :description, :session_persistence, :connection_limit, :admin_state_up] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['vip'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "lb/vips/#{vip_id}" ) end end class Mock def update_lb_vip(vip_id, options = {}) response = Excon::Response.new if vip = list_lb_vips.body['vips'].find { |_| _['id'] == vip_id } vip['pool_id'] = options[:pool_id] vip['name'] = options[:name] vip['description'] = options[:description] vip['session_persistence'] = options[:session_persistence] vip['connection_limit'] = options[:connection_limit] vip['admin_state_up'] = options[:admin_state_up] response.body = { 'vip' => vip } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_lb_member.rb0000644000004100000410000000120212600047642024362 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_lb_member(member_id) request( :expects => [200], :method => 'GET', :path => "lb/members/#{member_id}" ) end end class Mock def get_lb_member(member_id) response = Excon::Response.new if data = self.data[:lb_members][member_id] response.status = 200 response.body = { 'member' => data } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_subnet.rb0000644000004100000410000000336112600047642024432 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_subnet(network_id, cidr, ip_version, options = {}) data = { 'subnet' => { 'network_id' => network_id, 'cidr' => cidr, 'ip_version' => ip_version } } vanilla_options = [:name, :gateway_ip, :allocation_pools, :dns_nameservers, :host_routes, :enable_dhcp, :tenant_id] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['subnet'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'subnets' ) end end class Mock def create_subnet(network_id, cidr, ip_version, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => options[:name], 'network_id' => network_id, 'cidr' => cidr, 'ip_version' => ip_version, 'gateway_ip' => options[:gateway_ip], 'allocation_pools' => options[:allocation_pools], 'dns_nameservers' => options[:dns_nameservers], 'host_routes' => options[:host_routes], 'enable_dhcp' => options[:enable_dhcp], 'tenant_id' => options[:tenant_id] } self.data[:subnets][data['id']] = data response.body = { 'subnet' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_floating_ip.rb0000644000004100000410000000227112600047642024740 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_floating_ip(floating_ip_id) request( :expects => [200], :method => 'GET', :path => "floatingips/#{floating_ip_id}" ) end end class Mock def get_floating_ip(floating_ip_id) response = Excon::Response.new if data = self.data[:floating_ips][floating_ip_id] response.status = 200 response.body = { "floatingip" => { "id" => "00000000-0000-0000-0000-000000000000", # changed # "floating_ip_id" => floating_ip_id, "port_id" => data["port_id"], "tenant_id" => data["tenant_id"], "fixed_ip_address" => data["fixed_ip_address"], "router_id" => "00000000-0000-0000-0000-000000000000", "floating_ip_address" => data["floating_ip_address"], } } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_port.rb0000644000004100000410000000316012600047642023427 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_port(port_id) request( :expects => [200], :method => 'GET', :path => "ports/#{port_id}" ) end end class Mock def get_port(port_id) response = Excon::Response.new if data = self.data[:ports][port_id] response.status = 200 response.body = { 'port' => { 'id' => '5c81d975-5fea-4674-9c1f-b8aa10bf9a79', 'name' => 'port_1', 'network_id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb', 'fixed_ips' => [ { 'ip_address' => '10.2.2.2', 'subnet_id' => '2e4ec6a4-0150-47f5-8523-e899ac03026e', } ], 'mac_address' => 'fa:16:3e:62:91:7f', 'status' => 'ACTIVE', 'admin_state_up' => true, 'device_id' => 'dhcp724fc160-2b2e-597e-b9ed-7f65313cd73f-e624a36d-762b-481f-9b50-4154ceb78bbb', 'device_owner' => 'network:dhcp', 'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9', 'security_groups' => ['3ddde803-e550-4737-b5de-0862401dc834'], 'allowed_address_pairs' => [ 'ip_address' => '10.1.1.1', 'mac_address' => 'fa:16:3e:3d:2a:cc' ] } } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_lb_health_monitor.rb0000644000004100000410000000140312600047642026615 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_lb_health_monitor(health_monitor_id) request( :expects => 204, :method => 'DELETE', :path => "lb/health_monitors/#{health_monitor_id}" ) end end class Mock def delete_lb_health_monitor(health_monitor_id) response = Excon::Response.new if list_lb_health_monitors.body['health_monitors'].map { |r| r['id'] }.include? health_monitor_id self.data[:lb_health_monitors].delete(health_monitor_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_lb_health_monitor.rb0000644000004100000410000000314312600047642026640 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_lb_health_monitor(health_monitor_id, options = {}) data = { 'health_monitor' => {} } vanilla_options = [:delay, :timeout, :max_retries, :http_method, :url_path, :expected_codes, :admin_state_up] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['health_monitor'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "lb/health_monitors/#{health_monitor_id}" ) end end class Mock def update_lb_health_monitor(health_monitor_id, options = {}) response = Excon::Response.new if health_monitor = list_lb_health_monitors.body['health_monitors'].find { |_| _['id'] == health_monitor_id } health_monitor['delay'] = options[:delay] health_monitor['timeout'] = options[:timeout] health_monitor['max_retries'] = options[:max_retries] health_monitor['http_method'] = options[:http_method] health_monitor['url_path'] = options[:url_path] health_monitor['expected_codes'] = options[:expected_codes] health_monitor['admin_state_up'] = options[:admin_state_up] response.body = { 'health_monitor' => health_monitor } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/remove_router_interface.rb0000644000004100000410000000154612600047642026527 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def remove_router_interface(router_id, subnet_id, options = {}) data = { 'subnet_id' => subnet_id, } request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "routers/#{router_id}/remove_router_interface" ) end end class Mock def remove_router_interface(router_id, subnet_id, options = {}) response = Excon::Response.new response.status = 201 data = { 'subnet_id' => 'a2f1f29d-571b-4533-907f-5803ab96ead1' } self.data[:routers][data['router_id']] = data response.body = { 'router' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_lb_pool.rb0000644000004100000410000000347612600047642024567 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_lb_pool(subnet_id, protocol, lb_method, options = {}) data = { 'pool' => { 'subnet_id' => subnet_id, 'protocol' => protocol, 'lb_method' => lb_method } } vanilla_options = [:name, :description, :admin_state_up, :tenant_id] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['pool'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'lb/pools' ) end end class Mock def create_lb_pool(subnet_id, protocol, lb_method, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'subnet_id' => subnet_id, 'protocol' => protocol, 'lb_method' => lb_method, 'name' => options[:name], 'description' => options[:description], 'health_monitors' => [], 'members' => [], 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'vip_id' => nil, 'tenant_id' => options[:tenant_id], 'active_connections' => nil, 'bytes_in' => nil, 'bytes_out' => nil, 'total_connections' => nil } self.data[:lb_pools][data['id']] = data response.body = { 'pool' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/associate_floating_ip.rb0000644000004100000410000000272712600047642026142 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def associate_floating_ip(floating_ip_id, port_id, options = {}) data = { 'floatingip' => { 'port_id' => port_id, } } vanilla_options = [:fixed_ip_address] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['floatingip'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "floatingips/#{floating_ip_id}" ) end end class Mock def associate_floating_ip(floating_ip_id, port_id, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => '00000000-0000-0000-0000-000000000000', 'router_id' => '00000000-0000-0000-0000-000000000000', 'tenant_id' => options["tenant_id"], 'floating_network_id' => options["floating_network_id"], 'fixed_ip_address' => options["fixed_ip_address"], 'floating_ip_address' => options["floating_ip_address"], 'port_id' => port_id, } self.data[:floating_ips][data['floating_ip_id']] = data response.body = { 'floatingip' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_floating_ip.rb0000644000004100000410000000132412600047642025421 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_floating_ip(floating_ip_id) request( :expects => 204, :method => 'DELETE', :path => "floatingips/#{floating_ip_id}" ) end end class Mock def delete_floating_ip(floating_ip_id) response = Excon::Response.new if list_floating_ips.body['floatingips'].map { |r| r['id'] }.include? floating_ip_id self.data[:floating_ips].delete(floating_ip_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_port.rb0000644000004100000410000000345212600047642024117 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_port(network_id, options = {}) data = { 'port' => { 'network_id' => network_id, } } vanilla_options = [:name, :fixed_ips, :mac_address, :admin_state_up, :device_owner, :device_id, :tenant_id, :security_groups, :allowed_address_pairs] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['port'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'ports' ) end end class Mock def create_port(network_id, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => options[:name], 'network_id' => network_id, 'fixed_ips' => options[:fixed_ips], 'mac_address' => options[:mac_address], 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'device_owner' => options[:device_owner], 'device_id' => options[:device_id], 'tenant_id' => options[:tenant_id], 'security_groups' => options[:security_groups], 'allowed_address_pairs' => options[:allowed_address_pairs], } self.data[:ports][data['id']] = data response.body = { 'port' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/add_router_interface.rb0000644000004100000410000000322712600047642025760 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def add_router_interface(router_id, subnet_id_or_options) if(subnet_id_or_options.is_a? String) data = { 'subnet_id' => subnet_id_or_options, } elsif subnet_id_or_options.is_a? Hash data = subnet_id_or_options else raise ArgumentError,'Please pass a subnet id or hash {subnet_id:xxx,port_id:xxx}' end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "routers/#{router_id}/add_router_interface" ) end end class Mock def add_router_interface(router_id, subnet_id, options = {}) response = Excon::Response.new response.status = 201 data = { 'status' => 'ACTIVE', 'name' => '', 'admin_state_up' => true, 'network_id' => '5307648b-e836-4658-8f1a-ff7536870c64', 'tenant_id' => '6b96ff0cb17a4b859e1e575d221683d3', 'device_owner' => 'network:router_interface', 'mac_address' => 'fa:16:3e:f7:d1:9c', 'fixed_ips' => { 'subnet_id' => 'a2f1f29d-571b-4533-907f-5803ab96ead1', 'ip_address' => '10.1.1.1' }, 'id' => '3a44f4e5-1694-493a-a1fb-393881c673a4', 'device_id' => '7177abc4-5ae9-4bb7-b0d4-89e94a4abf3b' } self.data[:routers][data['router_id']] = data response.body = { 'router' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/disassociate_lb_health_monitor.rb0000644000004100000410000000150512600047642030031 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def disassociate_lb_health_monitor(pool_id, health_monitor_id) request( :expects => [204], :method => 'DELETE', :path => "lb/pools/#{pool_id}/health_monitors/#{health_monitor_id}" ) end end class Mock def disassociate_lb_health_monitor(pool_id, health_monitor_id) response = Excon::Response.new if pool = list_lb_pools.body['pools'].find { |_| _['id'] == pool_id } pool['health_monitors'].delete(health_monitor_id) self.data[:lb_pools][pool_id] = pool response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_router.rb0000644000004100000410000000501012600047642024443 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_router(name, options = {}) data = { 'router' => { 'name' => name, } } vanilla_options = [ :admin_state_up, :tenant_id, :network_id, :status, :subnet_id ] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['router'][key] = options[key] end # remove this in a future egi = options[:external_gateway_info] if egi if egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" data['router'][:external_gateway_info] = { :network_id => egi.id } elsif egi.is_a?(Hash) && egi[:network_id] data['router'][:external_gateway_info] = egi else raise ArgumentError.new('Invalid external_gateway_info attribute') end end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'routers' ) end end class Mock def create_router(name, options = {}) response = Excon::Response.new response.status = 201 # remove this in a future egi = options[:external_gateway_info] if egi && egi.is_a?(Fog::Network::OpenStack::Network) Fog::Logger.deprecation "Passing a model objects into options[:external_gateway_info] is deprecated. \ Please pass external external gateway as follows options[:external_gateway_info] = { :network_id => NETWORK_ID }]" egi = { :network_id => egi.id } end data = { 'router' => { :id => Fog::Mock.random_numbers(6).to_s, :status => options[:status] || 'ACTIVE', :external_gateway_info => egi, :name => name, :admin_state_up => options[:admin_state_up], :tenant_id => '6b96ff0cb17a4b859e1e575d221683d3' } } self.data[:routers][data['router'][:id]] = data['router'] response.body = data response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_security_group_rule.rb0000644000004100000410000000741012600047642027243 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Create a new security group rule # # ==== Parameters # * 'security_group_id'<~String> - UUID of the parent security group # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * options<~Hash>: # * 'port_range_min'<~Integer> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~Integer> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'remote_group_id'<~String> - UUID of the remote security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - TenantId different than the current user, that should own the security group. Only allowed if user has 'admin' role. # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'security_group_rule'<~Hash>: # * 'id'<~String> - UUID of the security group rule # * 'direction'<~String> - Direction of traffic, must be in ['ingress', 'egress'] # * 'port_range_min'<~String> - Start port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'port_range_max'<~String> - End port for rule i.e. 22 (or -1 for ICMP wildcard) # * 'protocol'<~String> - IP protocol for rule, must be in ['tcp', 'udp', 'icmp'] # * 'ethertype'<~String> - Type of ethernet support, must be in ['IPv4', 'IPv6'] # * 'security_group_id'<~String> - UUID of the parent security group # * 'remote_group_id'<~String> - UUID of the source security group # * 'remote_ip_prefix'<~String> - IP cidr range address i.e. '0.0.0.0/0' # * 'tenant_id'<~String> - Tenant id that owns the security group rule def create_security_group_rule(security_group_id, direction, options = {}) data = {"security_group_rule" => {"security_group_id" => security_group_id, "direction" => direction}} desired_options = [ :port_range_min, :port_range_max, :protocol, :ethertype, :remote_group_id, :remote_ip_prefix, :tenant_id ] selected_options = desired_options.select{ |o| options[o] } selected_options.each { |key| data["security_group_rule"][key] = options[key] } request( :body => Fog::JSON.encode(data), :expects => 201, :method => "POST", :path => "security-group-rules" ) end end class Mock def create_security_group_rule(security_group_id, direction, options = {}) response = Excon::Response.new data = { "id" => Fog::UUID.uuid, "remote_group_id" => options[:remote_group_id], "direction" => direction, "remote_ip_prefix" => options[:remote_ip_prefix], "protocol" => options[:protocol], "ethertype" => options[:ethertype] || "IPv4", "tenant_id" => options[:tenant_id] || Fog::Mock.random_numbers(14).to_s, "port_range_max" => options[:port_range_max], "port_range_min" => options[:port_range_min], "security_group_id" => security_group_id } self.data[:security_group_rules][data["id"]] = data response.status = 201 response.body = {"security_group_rule" => data} response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_lb_member.rb0000644000004100000410000000125312600047642025053 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_lb_member(member_id) request( :expects => 204, :method => 'DELETE', :path => "lb/members/#{member_id}" ) end end class Mock def delete_lb_member(member_id) response = Excon::Response.new if list_lb_members.body['members'].map { |r| r['id'] }.include? member_id self.data[:lb_members].delete(member_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_lb_vips.rb0000644000004100000410000000100412600047642024270 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_lb_vips(filters = {}) request( :expects => 200, :method => 'GET', :path => 'lb/vips', :query => filters ) end end class Mock def list_lb_vips(filters = {}) Excon::Response.new( :body => { 'vips' => self.data[:lb_vips].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_port.rb0000644000004100000410000000121112600047642024105 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_port(port_id) request( :expects => 204, :method => 'DELETE', :path => "ports/#{port_id}" ) end end class Mock def delete_port(port_id) response = Excon::Response.new if list_ports.body['ports'].map { |r| r['id'] }.include? port_id self.data[:ports].delete(port_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_port.rb0000644000004100000410000000261012600047642024131 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_port(port_id, options = {}) data = { 'port' => {} } vanilla_options = [:name, :fixed_ips, :admin_state_up, :device_owner, :device_id, :security_groups] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['port'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "ports/#{port_id}.json" ) end end class Mock def update_port(port_id, options = {}) response = Excon::Response.new if port = list_ports.body['ports'].find { |_| _['id'] == port_id } port['name'] = options[:name] port['fixed_ips'] = options[:fixed_ips] || [] port['admin_state_up'] = options[:admin_state_up] port['device_owner'] = options[:device_owner] port['device_id'] = options[:device_id] port['security_groups'] = options[:security_groups] || [] response.body = { 'port' => port } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_subnets.rb0000644000004100000410000000100712600047642024320 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_subnets(filters = {}) request( :expects => 200, :method => 'GET', :path => 'subnets', :query => filters ) end end class Mock def list_subnets(filters = {}) Excon::Response.new( :body => { 'subnets' => self.data[:subnets].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_router.rb0000644000004100000410000000123112600047642024443 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_router(router_id) request( :expects => 204, :method => 'DELETE', :path => "routers/#{router_id}" ) end end class Mock def delete_router(router_id) response = Excon::Response.new if list_routers.body['routers'].find { |r| r[:id] == router_id } self.data[:routers].delete(router_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/disassociate_floating_ip.rb0000644000004100000410000000262712600047642026641 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def disassociate_floating_ip(floating_ip_id, options = {}) data = { 'floatingip' => { 'port_id' => nil, } } vanilla_options = [:fixed_ip_address] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['floatingip'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "floatingips/#{floating_ip_id}" ) end end class Mock def disassociate_floating_ip(floating_ip_id, options = {}) response = Excon::Response.new response.status = 200 data = { 'id' => '00000000-0000-0000-0000-000000000000', 'router_id' => nil, 'tenant_id' => options["tenant_id"], 'floating_network_id' => options["floating_network_id"], 'fixed_ip_address' => nil, 'floating_ip_address' => options["floating_ip_address"], 'port_id' => options["port_id"], } self.data[:floating_ips][data['floating_ip_id']] = data response.body = { 'floatingip' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_subnet.rb0000644000004100000410000000123712600047642024431 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_subnet(subnet_id) request( :expects => 204, :method => 'DELETE', :path => "subnets/#{subnet_id}" ) end end class Mock def delete_subnet(subnet_id) response = Excon::Response.new if list_subnets.body['subnets'].map { |r| r['id'] }.include? subnet_id self.data[:subnets].delete(subnet_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_lb_member.rb0000644000004100000410000000301112600047642025046 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_lb_member(pool_id, address, protocol_port, weight, options = {}) data = { 'member' => { 'pool_id' => pool_id, 'address' => address, 'protocol_port' => protocol_port, 'weight' => weight } } vanilla_options = [:admin_state_up, :tenant_id] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['member'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'lb/members' ) end end class Mock def create_lb_member(pool_id, address, protocol_port, weight, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'pool_id' => pool_id, 'address' => address, 'protocol_port' => protocol_port, 'weight' => weight, 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'tenant_id' => options[:tenant_id], } self.data[:lb_members][data['id']] = data response.body = { 'member' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_security_group_rule.rb0000644000004100000410000000164112600047642027242 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real # Delete a security group rule # # ==== Parameters # * 'security_group_rule_id'<~String> - UUID of the security group rule to delete def delete_security_group_rule(security_group_rule_id) request( :expects => 204, :method => "DELETE", :path => "security-group-rules/#{security_group_rule_id}" ) end end class Mock def delete_security_group_rule(security_group_rule_id) response = Excon::Response.new if self.data[:security_group_rules][security_group_rule_id] self.data[:security_group_rules].delete(security_group_rule_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_network.rb0000644000004100000410000000125212600047642024617 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_network(network_id) request( :expects => 204, :method => 'DELETE', :path => "networks/#{network_id}" ) end end class Mock def delete_network(network_id) response = Excon::Response.new if list_networks.body['networks'].map { |r| r['id'] }.include? network_id self.data[:networks].delete(network_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_lb_members.rb0000644000004100000410000000102312600047642024742 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_lb_members(filters = {}) request( :expects => 200, :method => 'GET', :path => 'lb/members', :query => filters ) end end class Mock def list_lb_members(filters = {}) Excon::Response.new( :body => { 'members' => self.data[:lb_members].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_lb_pool.rb0000644000004100000410000000116012600047642024067 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_lb_pool(pool_id) request( :expects => [200], :method => 'GET', :path => "lb/pools/#{pool_id}" ) end end class Mock def get_lb_pool(pool_id) response = Excon::Response.new if data = self.data[:lb_pools][pool_id] response.status = 200 response.body = { 'pool' => data } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_subnet.rb0000644000004100000410000000270212600047642024447 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_subnet(subnet_id, options = {}) data = { 'subnet' => {} } vanilla_options = [:name, :gateway_ip, :allocation_pools, :dns_nameservers, :host_routes, :enable_dhcp] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['subnet'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "subnets/#{subnet_id}" ) end end class Mock def update_subnet(subnet_id, options = {}) response = Excon::Response.new if subnet = list_subnets.body['subnets'].find { |_| _['id'] == subnet_id } subnet['name'] = options[:name] subnet['gateway_ip'] = options[:gateway_ip] subnet['dns_nameservers'] = options[:dns_nameservers] || [] subnet['host_routes'] = options[:host_routes] || [] subnet['allocation_pools'] = options[:allocation_pools] || [] subnet['enable_dhcp'] = options[:enable_dhcp] response.body = { 'subnet' => subnet } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_lb_vip.rb0000644000004100000410000000121212600047642024375 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_lb_vip(vip_id) request( :expects => 204, :method => 'DELETE', :path => "lb/vips/#{vip_id}" ) end end class Mock def delete_lb_vip(vip_id) response = Excon::Response.new if list_lb_vips.body['vips'].map { |r| r['id'] }.include? vip_id self.data[:lb_vips].delete(vip_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_network.rb0000644000004100000410000000625212600047642024625 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_network(options = {}) data = { 'network' => {} } vanilla_options = [ :name, :shared, :admin_state_up, :tenant_id ] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['network'][key] = options[key] end # Advanced Features through API Extensions # # Not strictly required but commonly found in OpenStack # installs with Quantum networking. # # @see http://docs.openstack.org/trunk/openstack-network/admin/content/provider_attributes.html provider_options = [ :router_external, :provider_network_type, :provider_segmentation_id, :provider_physical_network ] # Map Fog::Network::OpenStack::Network # model attributes to OpenStack provider attributes aliases = { :provider_network_type => 'provider:network_type', # Not applicable to the "local" or "gre" network types :provider_physical_network => 'provider:physical_network', :provider_segmentation_id => 'provider:segmentation_id', :router_external => 'router:external' } provider_options.reject{ |o| options[o].nil? }.each do |key| aliased_key = aliases[key] || key data['network'][aliased_key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'networks' ) end end class Mock def create_network(options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'name' => options[:name], 'shared' => options[:shared], 'subnets' => [], 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'tenant_id' => options[:tenant_id], } # Add provider specific attributes when found # provider_options = [ :router_external, :provider_network_type, :provider_segmentation_id, :provider_physical_network ] aliases = { :provider_network_type => 'provider:network_type', # Not applicable to the "local" or "gre" network types :provider_physical_network => 'provider:physical_network', :provider_segmentation_id => 'provider:segmentation_id', :router_external => 'router:external' } provider_options.reject{ |o| options[o].nil? }.each do |key| aliased_key = aliases[key] || key data[aliased_key] = options[key] end self.data[:networks][data['id']] = data response.body = { 'network' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_lb_pools.rb0000644000004100000410000000101112600047642024441 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_lb_pools(filters = {}) request( :expects => 200, :method => 'GET', :path => 'lb/pools', :query => filters ) end end class Mock def list_lb_pools(filters = {}) Excon::Response.new( :body => { 'pools' => self.data[:lb_pools].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_ports.rb0000644000004100000410000000077512600047642024017 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_ports(filters = {}) request( :expects => 200, :method => 'GET', :path => 'ports', :query => filters ) end end class Mock def list_ports(filters = {}) Excon::Response.new( :body => { 'ports' => self.data[:ports].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/create_lb_health_monitor.rb0000644000004100000410000000335012600047642026621 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def create_lb_health_monitor(type, delay, timeout, max_retries, options = {}) data = { 'health_monitor' => { 'type' => type, 'delay' => delay, 'timeout' => timeout, 'max_retries' => max_retries } } vanilla_options = [:http_method, :url_path, :expected_codes, :admin_state_up, :tenant_id] vanilla_options.reject{ |o| options[o].nil? }.each do |key| data['health_monitor'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [201], :method => 'POST', :path => 'lb/health_monitors' ) end end class Mock def create_lb_health_monitor(type, delay, timeout, max_retries, options = {}) response = Excon::Response.new response.status = 201 data = { 'id' => Fog::Mock.random_numbers(6).to_s, 'type' => type, 'delay' => delay, 'timeout' => timeout, 'max_retries' => max_retries, 'http_method' => options[:http_method], 'url_path' => options[:url_path], 'expected_codes' => options[:expected_codes], 'status' => 'ACTIVE', 'admin_state_up' => options[:admin_state_up], 'tenant_id' => options[:tenant_id], } self.data[:lb_health_monitors][data['id']] = data response.body = { 'health_monitor' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_lb_health_monitor.rb0000644000004100000410000000131212600047642026131 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_lb_health_monitor(health_monitor_id) request( :expects => [200], :method => 'GET', :path => "lb/health_monitors/#{health_monitor_id}" ) end end class Mock def get_lb_health_monitor(health_monitor_id) response = Excon::Response.new if data = self.data[:lb_health_monitors][health_monitor_id] response.status = 200 response.body = { 'health_monitor' => data } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_routers.rb0000644000004100000410000000100712600047642024340 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_routers(filters = {}) request( :expects => 200, :method => 'GET', :path => 'routers', :query => filters ) end end class Mock def list_routers(filters = {}) Excon::Response.new( :body => { 'routers' => self.data[:routers].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_quota.rb0000644000004100000410000000105412600047642023574 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_quota(tenant_id) request( :expects => 200, :method => 'GET', :path => "/quotas/#{tenant_id}" ) end end class Mock def get_quota(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota' => (self.data[:quota_updated] or self.data[:quota]) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_networks.rb0000644000004100000410000000101412600047642024507 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_networks(filters = {}) request( :expects => 200, :method => 'GET', :path => 'networks', :query => filters ) end end class Mock def list_networks(filters = {}) Excon::Response.new( :body => { 'networks' => self.data[:networks].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/get_router.rb0000644000004100000410000000125712600047642023770 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def get_router(router_id) request( :expects => [200], :method => 'GET', :path => "routers/#{router_id}" ) end end class Mock def get_router(router_id) response = Excon::Response.new if data = (self.data[:routers].find { |id,value| id == router_id }) response.status = 200 response.body = { 'router' => data[1], } response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/delete_lb_pool.rb0000644000004100000410000000122512600047642024554 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def delete_lb_pool(pool_id) request( :expects => 204, :method => 'DELETE', :path => "lb/pools/#{pool_id}" ) end end class Mock def delete_lb_pool(pool_id) response = Excon::Response.new if list_lb_pools.body['pools'].map { |r| r['id'] }.include? pool_id self.data[:lb_pools].delete(pool_id) response.status = 204 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/network/list_floating_ips.rb0000644000004100000410000000103612600047642025315 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def list_floating_ips(filters = {}) request( :expects => 200, :method => 'GET', :path => 'floatingips', :query => filters ) end end class Mock def list_floating_ips(filters = {}) Excon::Response.new( :body => { 'floatingips' => self.data[:floating_ips].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/network/update_network.rb0000644000004100000410000000223112600047642024635 0ustar www-datawww-datamodule Fog module Network class OpenStack class Real def update_network(network_id, options = {}) data = { 'network' => {} } vanilla_options = [:name, :shared, :admin_state_up] vanilla_options.select{ |o| options.key?(o) }.each do |key| data['network'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "networks/#{network_id}.json" ) end end class Mock def update_network(network_id, options = {}) response = Excon::Response.new if network = list_networks.body['networks'].find { |_| _['id'] == network_id } network['name'] = options[:name] network['shared'] = options[:shared] network['admin_state_up'] = options[:admin_state_up] response.body = { 'network' => network } response.status = 200 response else raise Fog::Network::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/0000755000004100000410000000000012600047642021232 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/storage/get_container.rb0000644000004100000410000000326412600047642024405 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get details for container and total bytes stored # # ==== Parameters # * container<~String> - Name of container to retrieve info for # * options<~String>: # * 'limit'<~String> - Maximum number of objects to return # * 'marker'<~String> - Only return objects whose name is greater than marker # * 'prefix'<~String> - Limits results to those starting with prefix # * 'path'<~String> - Return objects nested in the pseudo path # # ==== Returns # * response<~Excon::Response>: # * headers<~Hash>: # * 'X-Account-Container-Count'<~String> - Count of containers # * 'X-Account-Bytes-Used'<~String> - Bytes used # * body<~Array>: # * 'bytes'<~Integer> - Number of bytes used by container # * 'count'<~Integer> - Number of items in container # * 'name'<~String> - Name of container # * item<~Hash>: # * 'bytes'<~String> - Size of object # * 'content_type'<~String> Content-Type of object # * 'hash'<~String> - Hash of object (etag?) # * 'last_modified'<~String> - Last modified timestamp # * 'name'<~String> - Name of object def get_container(container, options = {}) options = options.reject {|key, value| value.nil?} request( :expects => 200, :method => 'GET', :path => Fog::OpenStack.escape(container), :query => {'format' => 'json'}.merge!(options) ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/put_object.rb0000644000004100000410000000250712600047642023721 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Create a new object # # When passed a block, it will make a chunked request, calling # the block for chunks until it returns an empty string. # In this case the data parameter is ignored. # # ==== Parameters # * container<~String> - Name for container, should be < 256 bytes and must not contain '/' # * object<~String> - Name for object # * data<~String|File> - data to upload # * options<~Hash> - config headers for object. Defaults to {}. # * block<~Proc> - chunker # def put_object(container, object, data, options = {}, &block) if block_given? params = { :request_block => block } headers = options else data = Fog::Storage.parse_data(data) headers = data[:headers].merge!(options) params = { :body => data[:body] } end params.merge!( :expects => 201, :idempotent => !params[:request_block], :headers => headers, :method => 'PUT', :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" ) request(params) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/put_container.rb0000644000004100000410000000127512600047642024436 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Create a new container # # ==== Parameters # * name<~String> - Name for container, should be < 256 bytes and must not contain '/' # def put_container(name, options={}) headers = options[:headers] || {} headers['X-Container-Read'] = '.r:*' if options[:public] headers['X-Remove-Container-Read'] = 'x' if options[:public] == false request( :expects => [201, 202], :method => 'PUT', :path => Fog::OpenStack.escape(name), :headers => headers ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/head_object.rb0000644000004100000410000000104112600047642024002 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get headers for object # # ==== Parameters # * container<~String> - Name of container to look in # * object<~String> - Name of object to look for # def head_object(container, object) request({ :expects => 200, :method => 'HEAD', :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" }, false) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/get_containers.rb0000644000004100000410000000175012600047642024566 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # List existing storage containers # # ==== Parameters # * options<~Hash>: # * 'limit'<~Integer> - Upper limit to number of results returned # * 'marker'<~String> - Only return objects with name greater than this value # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # * container<~Hash>: # * 'bytes'<~Integer>: - Number of bytes used by container # * 'count'<~Integer>: - Number of items in container # * 'name'<~String>: - Name of container def get_containers(options = {}) options = options.reject {|key, value| value.nil?} request( :expects => [200, 204], :method => 'GET', :path => '', :query => {'format' => 'json'}.merge!(options) ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/put_object_manifest.rb0000644000004100000410000000057712600047642025614 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Create a new dynamic large object manifest # # This is an alias for {#put_dynamic_obj_manifest} for backward compatibility. def put_object_manifest(container, object, options = {}) put_dynamic_obj_manifest(container, object, options) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/delete_container.rb0000644000004100000410000000065612600047642025072 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Delete an existing container # # ==== Parameters # * name<~String> - Name of container to delete # def delete_container(name) request( :expects => 204, :method => 'DELETE', :path => Fog::OpenStack.escape(name) ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb0000644000004100000410000000210612600047642027203 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Set the account wide Temp URL Key. This is a secret key that's # used to generate signed expiring URLs. # # Once the key has been set with this request you should create new # Storage objects with the :openstack_temp_url_key option then use # the get_object_https_url method to generate expiring URLs. # # *** CAUTION *** changing this secret key will invalidate any expiring # URLS generated with old keys. # # ==== Parameters # * key<~String> - The new Temp URL Key # # ==== Returns # * response<~Excon::Response> # # ==== See Also # http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Account_Metadata-d1a4460.html def post_set_meta_temp_url_key(key) request( :expects => [201, 202, 204], :method => 'POST', :headers => {'X-Account-Meta-Temp-Url-Key' => key} ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/put_dynamic_obj_manifest.rb0000644000004100000410000000423012600047642026612 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Create a new dynamic large object manifest # # Creates an object with a +X-Object-Manifest+ header that specifies the common prefix ("/") # for all uploaded segments. Retrieving the manifest object streams all segments matching this prefix. # Segments must sort in the order they should be concatenated. Note that any future objects stored in the container # along with the segments that match the prefix will be included when retrieving the manifest object. # # All segments must be stored in the same container, but may be in a different container than the manifest object. # The default +X-Object-Manifest+ header is set to "+container+/+object+", but may be overridden in +options+ # to specify the prefix and/or the container where segments were stored. # If overridden, names should be CGI escaped (excluding spaces) if needed (see {Fog::OpenStack.escape}). # # @param container [String] Name for container where +object+ will be stored. Should be < 256 bytes and must not contain '/' # @param object [String] Name for manifest object. # @param options [Hash] Config headers for +object+. # @option options [String] 'X-Object-Manifest' ("container/object") "/" for segment objects. # # @raise [Fog::Storage::OpenStack::NotFound] HTTP 404 # @raise [Excon::Errors::BadRequest] HTTP 400 # @raise [Excon::Errors::Unauthorized] HTTP 401 # @raise [Excon::Errors::HTTPStatusError] # # @see http://docs.openstack.org/api/openstack-object-storage/1.0/content/dynamic-large-object-creation.html def put_dynamic_obj_manifest(container, object, options = {}) path = "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" headers = {'X-Object-Manifest' => path}.merge(options) request( :expects => 201, :headers => headers, :method => 'PUT', :path => path ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/delete_static_large_object.rb0000644000004100000410000000362412600047642027075 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Delete a static large object. # # Deletes the SLO manifest +object+ and all segments that it references. # The server will respond with +200 OK+ for all requests. # +response.body+ must be inspected for actual results. # # @param container [String] Name of container. # @param object [String] Name of the SLO manifest object. # @param options [Hash] Additional request headers. # # @return [Excon::Response] # * body [Hash] - Results of the operation. # * "Number Not Found" [Integer] - Number of missing segments. # * "Response Status" [String] - Response code for the subrequest of the last failed operation. # * "Errors" [Array] # * object_name [String] - Object that generated an error when the delete was attempted. # * response_status [String] - Response status from the subrequest for object_name. # * "Number Deleted" [Integer] - Number of segments deleted. # * "Response Body" [String] - Response body for Response Status. # # @see http://docs.openstack.org/api/openstack-object-storage/1.0/content/static-large-objects.html def delete_static_large_object(container, object, options = {}) response = request({ :expects => 200, :method => 'DELETE', :headers => options.merge('Content-Type' => 'text/plain', 'Accept' => 'application/json'), :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}", :query => { 'multipart-manifest' => 'delete' } }, false) response.body = Fog::JSON.decode(response.body) response end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/get_object_http_url.rb0000644000004100000410000000125612600047642025611 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get an expiring object http url # # ==== Parameters # * container<~String> - Name of container containing object # * object<~String> - Name of object to get expiring url for # * expires<~Time> - An expiry time for this url # # ==== Returns # * response<~Excon::Response>: # * body<~String> - url for object def get_object_http_url(container, object, expires, options = {}) create_temp_url(container, object, expires, "GET", {:port => 80}.merge(options).merge(:scheme => "http")) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/copy_object.rb0000644000004100000410000000170712600047642024064 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Copy object # # ==== Parameters # * source_container_name<~String> - Name of source bucket # * source_object_name<~String> - Name of source object # * target_container_name<~String> - Name of bucket to create copy in # * target_object_name<~String> - Name for new copy of object # * options<~Hash> - Additional headers def copy_object(source_container_name, source_object_name, target_container_name, target_object_name, options={}) headers = { 'X-Copy-From' => "/#{source_container_name}/#{source_object_name}" }.merge(options) request({ :expects => 201, :headers => headers, :method => 'PUT', :path => "#{Fog::OpenStack.escape(target_container_name)}/#{Fog::OpenStack.escape(target_object_name)}" }) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/public_url.rb0000644000004100000410000000117612600047642023724 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get public_url for an object # # ==== Parameters # * container<~String> - Name of container to look in # * object<~String> - Name of object to look for # def public_url(container=nil, object=nil) return nil if container.nil? u = "#{url}/#{Fog::OpenStack.escape(container)}" u << "/#{Fog::OpenStack.escape(object)}" unless object.nil? u end private def url "#{@scheme}://#{@host}:#{@port}#{@path}" end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/delete_object.rb0000644000004100000410000000103412600047642024345 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Delete an existing object # # ==== Parameters # * container<~String> - Name of container to delete # * object<~String> - Name of object to delete # def delete_object(container, object) request( :expects => 204, :method => 'DELETE', :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/head_containers.rb0000644000004100000410000000113512600047642024705 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # List number of containers and total bytes stored # # ==== Returns # * response<~Excon::Response>: # * headers<~Hash>: # * 'X-Account-Container-Count'<~String> - Count of containers # * 'X-Account-Bytes-Used'<~String> - Bytes used def head_containers request( :expects => 200..299, :method => 'HEAD', :path => '', :query => {'format' => 'json'} ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/get_object_https_url.rb0000644000004100000410000000620212600047642025770 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get an expiring object https url from Cloud Files # # ==== Parameters # * container<~String> - Name of container containing object # * object<~String> - Name of object to get expiring url for # * expires<~Time> - An expiry time for this url # # ==== Returns # * response<~Excon::Response>: # * body<~String> - url for object def get_object_https_url(container, object, expires, options = {}) create_temp_url(container, object, expires, "GET", {:port => 443}.merge(options).merge(:scheme => "https")) end # creates a temporary url # # ==== Parameters # * container<~String> - Name of container containing object # * object<~String> - Name of object to get expiring url for # * expires<~Time> - An expiry time for this url # * method<~String> - The method to use for accessing the object (GET, PUT, HEAD) # * options<~Hash> - An optional options hash # * 'scheme'<~String> - The scheme to use (http, https) # * 'host'<~String> - The host to use # * 'port'<~Integer> - The port to use # # ==== Returns # * response<~Excon::Response>: # * body<~String> - url for object # # ==== See Also # http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html def create_temp_url(container, object, expires, method, options = {}) raise ArgumentError, "Insufficient parameters specified." unless (container && object && expires && method) raise ArgumentError, "Storage must be instantiated with the :openstack_temp_url_key option" if @openstack_temp_url_key.nil? scheme = options[:scheme] || @scheme host = options[:host] || @host port = options[:port] || @port # POST not allowed allowed_methods = %w{GET PUT HEAD} unless allowed_methods.include?(method) raise ArgumentError.new("Invalid method '#{method}' specified. Valid methods are: #{allowed_methods.join(', ')}") end expires = expires.to_i object_path_escaped = "#{@path}/#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object,"/")}" object_path_unescaped = "#{@path}/#{Fog::OpenStack.escape(container)}/#{object}" string_to_sign = "#{method}\n#{expires}\n#{object_path_unescaped}" hmac = Fog::HMAC.new('sha1', @openstack_temp_url_key) sig = sig_to_hex(hmac.sign(string_to_sign)) temp_url_options = { :scheme => scheme, :host => host, :port => port, :path => object_path_escaped, :query => "temp_url_sig=#{sig}&temp_url_expires=#{expires}" } URI::Generic.build(temp_url_options).to_s end private def sig_to_hex(str) str.unpack("C*").map { |c| c.to_s(16) }.map { |h| h.size == 1 ? "0#{h}" : h }.join end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/head_container.rb0000644000004100000410000000135412600047642024525 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # List number of objects and total bytes stored # # ==== Parameters # * container<~String> - Name of container to retrieve info for # # ==== Returns # * response<~Excon::Response>: # * headers<~Hash>: # * 'X-Container-Object-Count'<~String> - Count of containers # * 'X-Container-Bytes-Used'<~String> - Bytes used def head_container(container) request( :expects => 204, :method => 'HEAD', :path => Fog::OpenStack.escape(container), :query => {'format' => 'json'} ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/put_static_obj_manifest.rb0000644000004100000410000000534312600047642026463 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Create a new static large object manifest. # # A static large object is similar to a dynamic large object. Whereas a GET for a dynamic large object manifest # will stream segments based on the manifest's +X-Object-Manifest+ object name prefix, a static large object # manifest streams segments which are defined by the user within the manifest. Information about each segment is # provided in +segments+ as an Array of Hash objects, ordered in the sequence which the segments should be streamed. # # When the SLO manifest is received, each segment's +etag+ and +size_bytes+ will be verified. # The +etag+ for each segment is returned in the response to {#put_object}, but may also be calculated. # e.g. +Digest::MD5.hexdigest(segment_data)+ # # The maximum number of segments for a static large object is 1000, and all segments (except the last) must be # at least 1 MiB in size. Unlike a dynamic large object, segments are not required to be in the same container. # # @example # segments = [ # { :path => 'segments_container/first_segment', # :etag => 'md5 for first_segment', # :size_bytes => 'byte size of first_segment' }, # { :path => 'segments_container/second_segment', # :etag => 'md5 for second_segment', # :size_bytes => 'byte size of second_segment' } # ] # put_static_obj_manifest('my_container', 'my_large_object', segments) # # @param container [String] Name for container where +object+ will be stored. # Should be < 256 bytes and must not contain '/' # @param object [String] Name for manifest object. # @param segments [Array] Segment data for the object. # @param options [Hash] Config headers for +object+. # # @raise [Fog::Storage::OpenStack::NotFound] HTTP 404 # @raise [Excon::Errors::BadRequest] HTTP 400 # @raise [Excon::Errors::Unauthorized] HTTP 401 # @raise [Excon::Errors::HTTPStatusError] # # @see http://docs.openstack.org/api/openstack-object-storage/1.0/content/static-large-objects.html def put_static_obj_manifest(container, object, segments, options = {}) request( :expects => 201, :method => 'PUT', :headers => options, :body => Fog::JSON.encode(segments), :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}", :query => { 'multipart-manifest' => 'put' } ) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/get_object.rb0000644000004100000410000000122712600047642023666 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Get details for object # # ==== Parameters # * container<~String> - Name of container to look in # * object<~String> - Name of object to look for # def get_object(container, object, &block) params = { :expects => 200, :method => 'GET', :path => "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}" } if block_given? params[:response_block] = block end request(params, false) end end end end end fog-1.34.0/lib/fog/openstack/requests/storage/delete_multiple_objects.rb0000644000004100000410000000612412600047642026450 0ustar www-datawww-datamodule Fog module Storage class OpenStack class Real # Deletes multiple objects or containers with a single request. # # To delete objects from a single container, +container+ may be provided # and +object_names+ should be an Array of object names within the container. # # To delete objects from multiple containers or delete containers, # +container+ should be +nil+ and all +object_names+ should be prefixed with a container name. # # Containers must be empty when deleted. +object_names+ are processed in the order given, # so objects within a container should be listed first to empty the container. # # Up to 10,000 objects may be deleted in a single request. # The server will respond with +200 OK+ for all requests. # +response.body+ must be inspected for actual results. # # @example Delete objects from a container # object_names = ['object', 'another/object'] # conn.delete_multiple_objects('my_container', object_names) # # @example Delete objects from multiple containers # object_names = ['container_a/object', 'container_b/object'] # conn.delete_multiple_objects(nil, object_names) # # @example Delete a container and all it's objects # object_names = ['my_container/object_a', 'my_container/object_b', 'my_container'] # conn.delete_multiple_objects(nil, object_names) # # @param container [String,nil] Name of container. # @param object_names [Array] Object names to be deleted. # @param options [Hash] Additional request headers. # # @return [Excon::Response] # * body [Hash] - Results of the operation. # * "Number Not Found" [Integer] - Number of missing objects or containers. # * "Response Status" [String] - Response code for the subrequest of the last failed operation. # * "Errors" [Array] # * object_name [String] - Object that generated an error when the delete was attempted. # * response_status [String] - Response status from the subrequest for object_name. # * "Number Deleted" [Integer] - Number of objects or containers deleted. # * "Response Body" [String] - Response body for "Response Status". def delete_multiple_objects(container, object_names, options = {}) body = object_names.map do |name| object_name = container ? "#{ container }/#{ name }" : name URI.encode(object_name) end.join("\n") response = request({ :expects => 200, :method => 'DELETE', :headers => options.merge('Content-Type' => 'text/plain', 'Accept' => 'application/json'), :body => body, :query => { 'bulk-delete' => true } }, false) response.body = Fog::JSON.decode(response.body) response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/0000755000004100000410000000000012600047642021075 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/volume/list_volume_types.rb0000644000004100000410000000176112600047642025215 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_volume_types(options = {}) request( :expects => 200, :method => 'GET', :path => 'types', :query => options ) end end class Mock def list_volume_types(options = {}) response = Excon::Response.new response.status = 200 self.data[:volume_types] ||= [ { "id" => "1", "name" => "type 1", "extra_specs" => { "volume_backend_name" => "type 1 backend name" } }, { "id" => "2", "name" => "type 2", "extra_specs" => { "volume_backend_name" => "type 2 backend name" } } ] response.body = { 'volume_types' => self.data[:volume_types] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/update_quota.rb0000644000004100000410000000133112600047642024113 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def update_quota(tenant_id, options = {}) options['tenant_id'] = tenant_id request( :body => Fog::JSON.encode({ 'quota_set' => options }), :expects => 200, :method => 'PUT', :path => "/os-quota-sets/#{tenant_id}" ) end end class Mock def update_quota(tenant_id, options = {}) self.data[:quota_updated] = self.data[:quota].merge options response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => self.data[:quota_updated] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/create_volume_snapshot.rb0000644000004100000410000000223412600047642026174 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def create_volume_snapshot(volume_id, name, description, force=false) data = { 'snapshot' => { 'volume_id' => volume_id, 'display_name' => name, 'display_description' => description, 'force' => force } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "snapshots" ) end end class Mock def create_volume_snapshot(volume_id, name, description, force=false) response = Excon::Response.new response.status = 202 response.body = { "snapshot"=> { "status"=>"creating", "display_name"=>name, "created_at"=>Time.now, "display_description"=>description, "volume_id"=>volume_id, "id"=>"5", "size"=>1 } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/set_tenant.rb0000644000004100000410000000057512600047642023575 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate end end class Mock def set_tenant(tenant) true end end end # class OpenStack end # module Volume end # module Fog fog-1.34.0/lib/fog/openstack/requests/volume/get_quota_defaults.rb0000644000004100000410000000111512600047642025277 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def get_quota_defaults(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}/defaults" ) end end class Mock def get_quota_defaults(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => self.data[:quota].merge({'id' => tenant_id}) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_transfers_detailed.rb0000644000004100000410000000057612600047642026327 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def list_transfers_detailed(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-volume-transfer/detail', :query => options ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_snapshots.rb0000644000004100000410000000237012600047642024501 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_snapshots(options = true, options_deprecated = {}) if options.is_a?(Hash) path = 'snapshots' query = options else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if options Fog::Logger.deprecation('Calling OpenStack[:volume].list_snapshots(true) is deprecated, use .list_snapshots_detailed instead') else Fog::Logger.deprecation('Calling OpenStack[:volume].list_snapshots(false) is deprecated, use .list_snapshots({}) instead') end path = options ? 'snapshots/detail' : 'snapshots' query = options_deprecated end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end end class Mock def list_snapshots(detailed=true, options={}) response = Excon::Response.new response.status = 200 response.body = { 'snapshots' => [get_snapshot_details.body["snapshot"]] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_volumes_detailed.rb0000644000004100000410000000264512600047642026011 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_volumes_detailed(options = {}) request( :expects => 200, :method => 'GET', :path => 'volumes/detail', :query => options ) end end class Mock def list_volumes_detailed(options = {}) response = Excon::Response.new response.status = 200 self.data[:volumes] ||= [ { "status" => "available", "display_description" => "test 1 desc", "availability_zone" => "nova", "display_name" => "Volume1", "attachments" => [{}], "volume_type" => nil, "snapshot_id" => nil, "size" => 1, "id" => 1, "created_at" => Time.now, "metadata" => {} }, { "status" => "available", "display_description" => "test 2 desc", "availability_zone" => "nova", "display_name" => "Volume2", "attachments" => [{}], "volume_type" => nil, "snapshot_id" => nil, "size" => 1, "id" => 2, "created_at" => Time.now, "metadata" => {} } ] response.body = { 'volumes' => self.data[:volumes] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/get_snapshot_details.rb0000644000004100000410000000157712600047642025637 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def get_snapshot_details(snapshot_id) request( :expects => 200, :method => 'GET', :path => "snapshots/#{snapshot_id}" ) end end class Mock def get_snapshot_details(detailed=true) response = Excon::Response.new response.status = 200 response.body = { 'snapshot' => { 'id' => '1', 'display_name' => 'Snapshot1', 'display_description' => 'Volume1 snapshot', 'size' => 1, 'volume_id' => '1', 'status' => 'available', 'created_at' => Time.now } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/create_volume.rb0000644000004100000410000000330612600047642024256 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def create_volume(name, description, size, options={}) data = { 'volume' => { 'display_name' => name, 'display_description' => description, 'size' => size } } vanilla_options = [:snapshot_id, :imageRef, :volume_type, :source_volid, :availability_zone, :metadata] vanilla_options.select{|o| options[o]}.each do |key| data['volume'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "volumes" ) end end class Mock def create_volume(name, description, size, options={}) response = Excon::Response.new response.status = 202 response.body = { 'volume' => { 'id' => Fog::Mock.random_numbers(2), 'display_name' => name, 'display_description' => description, 'metadata' => options['metadata'] || {}, 'size' => size, 'status' => 'creating', 'snapshot_id' => options[:snapshot_id] || nil, 'image_id' => options[:imageRef] || nil, 'volume_type' => nil, 'availability_zone' => 'nova', 'created_at' => Time.now, 'attachments' => [] } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/accept_transfer.rb0000644000004100000410000000101612600047642024563 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def accept_transfer(transfer_id, auth_key) data = { 'accept' => { 'auth_key' => auth_key } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "os-volume-transfer/#{transfer_id}/accept" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/delete_volume.rb0000644000004100000410000000070612600047642024256 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def delete_volume(volume_id) request( :expects => 202, :method => 'DELETE', :path => "volumes/#{volume_id}" ) end end class Mock def delete_volume(volume_id) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_transfers.rb0000644000004100000410000000055212600047642024466 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def list_transfers(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-volume-transfer', :query => options ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/delete_snapshot.rb0000644000004100000410000000072212600047642024604 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def delete_snapshot(snapshot_id) request( :expects => 202, :method => 'DELETE', :path => "snapshots/#{snapshot_id}" ) end end class Mock def delete_snapshot(snapshot_id) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/get_volume_type_details.rb0000644000004100000410000000134112600047642026335 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def get_volume_type_details(volume_type_id) request( :expects => 200, :method => 'GET', :path => "types/#{volume_type_id}" ) end end class Mock def get_volume_details(volume_type_id) response = Excon::Response.new response.status = 200 response.body = { "volume_type" => { "id" => "1", "name" => "type 1", "extra_specs" => { "volume_backend_name" => "type 1 backend name" } } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_zones.rb0000644000004100000410000000127012600047642023613 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_zones(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-availability-zone.json', :query => options ) end end class Mock def list_zones(options = {}) Excon::Response.new( :body => { "availabilityZoneInfo" => [ { "zoneState" => { "available" => true }, "zoneName" => "nova" } ] }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/get_volume_details.rb0000644000004100000410000000205012600047642025272 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def get_volume_details(volume_id) request( :expects => 200, :method => 'GET', :path => "volumes/#{volume_id}" ) end end class Mock def get_volume_details(detailed=true) response = Excon::Response.new response.status = 200 response.body = { 'volume' => { 'id' => '1', 'display_name' => Fog::Mock.random_letters(rand(8) + 5), 'display_description' => Fog::Mock.random_letters(rand(12) + 10), 'size' => 3, 'volume_type' => nil, 'snapshot_id' => '4', 'status' => 'online', 'availability_zone' => 'nova', 'created_at' => Time.now, 'attachments' => [] } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_volumes.rb0000644000004100000410000000406512600047642024154 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_volumes(options = true, options_deprecated = {}) if options.is_a?(Hash) path = 'volumes' query = options else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if options Fog::Logger.deprecation('Calling OpenStack[:volume].list_volumes(true) is deprecated, use .list_volumes_detailed instead') else Fog::Logger.deprecation('Calling OpenStack[:volume].list_volumes(false) is deprecated, use .list_volumes({}) instead') end path = options ? 'volumes/detail' : 'volumes' query = options_deprecated end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end end class Mock def list_volumes(options = true, options_deprecated = {}) response = Excon::Response.new response.status = 200 self.data[:volumes] ||= [ { "status" => "available", "display_description" => "test 1 desc", "availability_zone" => "nova", "display_name" => "Volume1", "attachments" => [{}], "volume_type" => nil, "snapshot_id" => nil, "size" => 1, "id" => 1, "created_at" => Time.now, "metadata" => {} }, { "status" => "available", "display_description" => "test 2 desc", "availability_zone" => "nova", "display_name" => "Volume2", "attachments" => [{}], "volume_type" => nil, "snapshot_id" => nil, "size" => 1, "id" => 2, "created_at" => Time.now, "metadata" => {} } ] response.body = { 'volumes' => self.data[:volumes] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/list_snapshots_detailed.rb0000644000004100000410000000114612600047642026334 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def list_snapshots_detailed(options = {}) request( :expects => 200, :method => 'GET', :path => 'snapshots/detail', :query => options ) end end class Mock def list_snapshots_detailed(options = {}) response = Excon::Response.new response.status = 200 response.body = { 'snapshots' => [get_snapshot_details.body["snapshot"]] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/create_transfer.rb0000644000004100000410000000114012600047642024565 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def create_transfer(volume_id, options={}) data = { 'transfer' => { 'volume_id' => volume_id } } if options[:name] data['transfer']['name'] = options[:name] end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => 'os-volume-transfer' ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/get_quota.rb0000644000004100000410000000112112600047642023405 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def get_quota(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}" ) end end class Mock def get_quota(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => (self.data[:quota_updated] or self.data[:quota]).merge({'id' => tenant_id}) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/extend_volume.rb0000644000004100000410000000110312600047642024273 0ustar www-datawww-datamodule Fog module Volume class OpenStack class Real def extend_volume(volume_id, size) body = { 'os-extend' => { 'new_size' => size } } request( :expects => 202, :method => 'POST', :path => "volumes/#{volume_id}/action", :body => Fog::JSON.encode(body) ) end end class Mock def extend_volume(volume_id, size) response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/delete_transfer.rb0000644000004100000410000000053312600047642024571 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def delete_transfer(transfer_id) request( :expects => 202, :method => 'DELETE', :path => "os-volume-transfer/#{transfer_id}" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/volume/get_transfer_details.rb0000644000004100000410000000054012600047642025611 0ustar www-datawww-datamodule Fog module Volume class OpenStack # no Mock needed, test coverage in RSpec class Real def get_transfer_details(transfer_id) request( :expects => 200, :method => 'GET', :path => "os-volume-transfer/#{transfer_id}" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/metering/0000755000004100000410000000000012600047642021400 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/metering/list_resources.rb0000644000004100000410000000123212600047642024770 0ustar www-datawww-datamodule Fog module Metering class OpenStack class Real def list_resources(options = {}) request( :expects => 200, :method => 'GET', :path => 'resources' ) end end class Mock def list_resources(options = {}) response = Excon::Response.new response.status = 200 response.body = [{ 'resource_id'=>'glance', 'project_id'=>'d646b40dea6347dfb8caee2da1484c56', 'user_id'=>'1d5fd9eda19142289a60ed9330b5d284', 'metadata'=>{}}] response end end end end end fog-1.34.0/lib/fog/openstack/requests/metering/list_meters.rb0000644000004100000410000000205512600047642024261 0ustar www-datawww-datamodule Fog module Metering class OpenStack class Real def list_meters(options=[]) data = { 'q' => Array.new } options.each do |opt| filter = {} ['field', 'op', 'value'].each do |key| filter[key] = opt[key] if opt[key] end data['q'] << filter unless filter.empty? end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'GET', :path => 'meters' ) end end class Mock def list_meters(options={}) response = Excon::Response.new response.status = 200 response.body = [{ 'user_id'=>'1d5fd9eda19142289a60ed9330b5d284', 'name'=>'image.size', 'resource_id'=>'glance', 'project_id'=>'d646b40dea6347dfb8caee2da1484c56', 'type'=>'gauge', 'unit'=>'bytes'}] response end end end end end fog-1.34.0/lib/fog/openstack/requests/metering/get_samples.rb0000644000004100000410000000247012600047642024233 0ustar www-datawww-datamodule Fog module Metering class OpenStack class Real def get_samples(meter_id, options=[]) data = { 'q' => Array.new } options.each do |opt| filter = {} ['field', 'op', 'value'].each do |key| filter[key] = opt[key] if opt[key] end data['q'] << filter unless filter.empty? end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'GET', :path => "meters/#{meter_id}" ) end end class Mock def get_samples(meter_id) response = Excon::Response.new response.status = 200 response.body = [{ 'counter_name'=>'image.size', 'user_id'=>'1d5fd9eda19142289a60ed9330b5d284', 'resource_id'=>'glance', 'timestamp'=>'2013-04-03T23:44:21', 'resource_metadata'=>{}, 'source'=>'artificial', 'counter_unit'=>'bytes', 'counter_volume'=>10.0, 'project_id'=>'d646b40dea6347dfb8caee2da1484c56', 'message_id'=>'14e4a902-9cf3-11e2-a054-003048f5eafc', 'counter_type'=>'gauge'}] response end end end end end fog-1.34.0/lib/fog/openstack/requests/metering/get_resource.rb0000644000004100000410000000124112600047642024411 0ustar www-datawww-datamodule Fog module Metering class OpenStack class Real def get_resource(resource_id) request( :expects => 200, :method => 'GET', :path => "resources/#{resource_id}" ) end end class Mock def get_resource(resource_id) response = Excon::Response.new response.status = 200 response.body = { 'resource_id'=>'glance', 'project_id'=>'d646b40dea6347dfb8caee2da1484c56', 'user_id'=>'1d5fd9eda19142289a60ed9330b5d284', 'metadata'=>{}} response end end end end end fog-1.34.0/lib/fog/openstack/requests/metering/get_statistics.rb0000644000004100000410000000247312600047642024764 0ustar www-datawww-datamodule Fog module Metering class OpenStack class Real def get_statistics(meter_id, options={}) data = { 'period' => options['period'], 'q' => Array.new } options['q'].each do |opt| filter = {} ['field', 'op', 'value'].each do |key| filter[key] = opt[key] if opt[key] end data['q'] << filter unless filter.empty? end if options['q'].is_a? Array request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'GET', :path => "meters/#{meter_id}/statistics" ) end end class Mock def get_statistics(meter_id, options={}) response = Excon::Response.new response.status = 200 response.body = [{ 'count'=>143, 'duration_start'=>'2013-04-03T23:44:21', 'min'=>10.0, 'max'=>10.0, 'duration_end'=>'2013-04-04T23:24:21', 'period'=>0, 'period_end'=>'2013-04-04T23:24:21', 'duration'=>85200.0, 'period_start'=>'2013-04-03T23:44:21', 'avg'=>10.0, 'sum'=>1430.0}] response end end end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/0000755000004100000410000000000012600047642022026 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/identity_v2/get_tenants_by_id.rb0000644000004100000410000000056712600047642026044 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_tenants_by_id(tenant_id) request( :expects => [200], :method => 'GET', :path => "tenants/#{tenant_id}" ) end end class Mock end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/create_tenant.rb0000644000004100000410000000203212600047642025164 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def create_tenant(attributes) request( :expects => [200], :method => 'POST', :path => "tenants", :body => Fog::JSON.encode({'tenant' => attributes}) ) end # def create_tenant end # class Real class Mock def create_tenant(attributes) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { 'tenant' => { 'id' => "df9a815161eba9b76cc748fd5c5af73e", 'description' => attributes[:description] || 'normal tenant', 'enabled' => true, 'name' => attributes[:name] || 'default' } } response end # def create_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/delete_role.rb0000644000004100000410000000130612600047642024636 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def delete_role(role_id) request( :expects => [200, 204], :method => 'DELETE', :path => "/OS-KSADM/roles/#{role_id}" ) end end class Mock def delete_role(role_id) response = Excon::Response.new if self.data[:roles][role_id] self.data[:roles].delete(role_id) response.status = 204 response else raise Fog::Identity::OpenStack::NotFound end end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/add_user_to_tenant.rb0000644000004100000410000000217212600047642026216 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def add_user_to_tenant(tenant_id, user_id, role_id) request( :expects => 200, :method => 'PUT', :path => "/tenants/#{tenant_id}/users/#{user_id}/roles/OS-KSADM/#{role_id}" ) end end # class Real class Mock def add_user_to_tenant(tenant_id, user_id, role_id) role = self.data[:roles][role_id] self.data[:user_tenant_membership][tenant_id] ||= {} self.data[:user_tenant_membership][tenant_id][user_id] ||= [] self.data[:user_tenant_membership][tenant_id][user_id].push(role['id']).uniq! response = Excon::Response.new response.status = 200 response.body = { 'role' => { 'id' => role['id'], 'name' => role['name'] } } response end # def add_user_to_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_ec2_credentials.rb0000644000004100000410000000354012600047642026436 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real ## # List EC2 credentials for a user. Requires administrator # credentials. # # ==== Parameters hash # * :user_id<~String>: The id of the user to retrieve the credential # for # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'credentials'<~Array>: The user's EC2 credentials # * 'access'<~String>: The access key # * 'secret'<~String>: The secret key # * 'user_id'<~String>: The user id # * 'tenant_id'<~String>: The tenant id def list_ec2_credentials(options = {}) if options.is_a?(Hash) user_id = options.delete(:user_id) query = options else Fog::Logger.deprecation('Calling OpenStack[:identity].list_ec2_credentials(user_id) is deprecated, use .list_ec2_credentials(:user_id => value)') user_id = options query = {} end request( :expects => [200, 202], :method => 'GET', :path => "users/#{user_id}/credentials/OS-EC2", :query => query ) end end class Mock def list_ec2_credentials(options = {}) if options.is_a?(Hash) user_id = options.delete(:user_id) else user_id = options end ec2_credentials = self.data[:ec2_credentials][user_id].values response = Excon::Response.new response.status = 200 response.body = {'credentials' => ec2_credentials} response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/update_tenant.rb0000644000004100000410000000156412600047642025214 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def update_tenant(id, attributes) request( :expects => [200], :method => 'PUT', :path => "tenants/#{id}", :body => Fog::JSON.encode({'tenant' => attributes}) ) end # def create_tenant end # class Real class Mock def update_tenant(id, attributes) response = Excon::Response.new response.status = [200, 204][rand(1)] attributes = {'enabled' => true, 'id' => '1'}.merge(attributes) response.body = { 'tenant' => attributes } response end # def create_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_endpoints_for_token.rb0000644000004100000410000000061312600047642027457 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_endpoints_for_token(token_id) request( :expects => [200, 203], :method => 'HEAD', :path => "tokens/#{token_id}/endpoints" ) end end class Mock end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/set_tenant.rb0000644000004100000410000000067512600047642024527 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate end end class Mock def set_tenant(tenant) true end end end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/delete_tenant.rb0000644000004100000410000000162312600047642025170 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def delete_tenant(id) request( :expects => [200, 204], :method => 'DELETE', :path => "tenants/#{id}" ) end # def create_tenant end # class Real class Mock def delete_tenant(attributes) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { 'tenant' => { 'id' => '1', 'description' => 'Has access to everything', 'enabled' => true, 'name' => 'admin' } } response end # def create_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_user_by_name.rb0000644000004100000410000000125212600047642025662 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_user_by_name(name) request( :expects => [200, 203], :method => 'GET', :path => "users?name=#{name}" ) end end class Mock def get_user_by_name(name) response = Excon::Response.new response.status = 200 user = self.data[:users].values.select { |user| user['name'] == name }[0] response.body = { 'user' => user } response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_roles_for_user_on_tenant.rb0000644000004100000410000000204012600047642030477 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_roles_for_user_on_tenant(tenant_id, user_id) request( :expects => [200], :method => 'GET', :path => "tenants/#{tenant_id}/users/#{user_id}/roles" ) end # def list_roles_for_user_on_tenant end # class Real class Mock def list_roles_for_user_on_tenant(tenant_id, user_id) self.data[:user_tenant_membership][tenant_id] ||= {} self.data[:user_tenant_membership][tenant_id][user_id] ||= [] roles = self.data[:user_tenant_membership][tenant_id][user_id].map do |role_id| self.data[:roles][role_id] end Excon::Response.new( :body => {'roles' => roles}, :status => 200 ) end # def list_roles_for_user_on_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/check_token.rb0000644000004100000410000000074512600047642024636 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def check_token(token_id, tenant_id=nil) request( :expects => [200, 203], :method => 'HEAD', :path => "tokens/#{token_id}"+(tenant_id ? "?belongsTo=#{tenant_id}" : '') ) end end class Mock def check_token(token_id, tenant_id=nil) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v2/delete_ec2_credential.rb0000644000004100000410000000230012600047642026533 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real ## # Destroy an EC2 credential for a user. Requires administrator # credentials. # # ==== Parameters # * user_id<~String>: The id of the user to delete the credential # for # * access<~String>: The access key of the credential to destroy # # ==== Returns # * response<~Excon::Response>: # * body<~String>: Empty string def delete_ec2_credential(user_id, access) request( :expects => [200, 204], :method => 'DELETE', :path => "users/#{user_id}/credentials/OS-EC2/#{access}" ) end end class Mock def delete_ec2_credential(user_id, access) raise Fog::Identity::OpenStack::NotFound unless self.data[:ec2_credentials][user_id][access] self.data[:ec2_credentials][user_id].delete access response = Excon::Response.new response.status = 204 response rescue end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/create_ec2_credential.rb0000644000004100000410000000334712600047642026550 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real ## # Create an EC2 credential for a user in a tenant. Requires # administrator credentials. # # ==== Parameters # * user_id<~String>: The id of the user to create an EC2 credential # for # * tenant_id<~String>: The id of the tenant to create the credential # in # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'credential'<~Hash>: Created EC2 credential # * 'access'<~String>: The access key # * 'secret'<~String>: The secret key # * 'user_id'<~String>: The user id # * 'tenant_id'<~String>: The tenant id def create_ec2_credential(user_id, tenant_id) data = {'tenant_id' => tenant_id} request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "users/#{user_id}/credentials/OS-EC2" ) end end class Mock def create_ec2_credential(user_id, tenant_id) response = Excon::Response.new response.status = 200 data = { 'access' => Fog::Mock.random_hex(32), 'secret' => Fog::Mock.random_hex(32), 'tenant_id' => tenant_id, 'user_id' => user_id, } self.data[:ec2_credentials][user_id][data['access']] = data response.body = {'credential' => data} response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_tenant.rb0000644000004100000410000000155412600047642024510 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_tenant(id) request( :expects => [200, 204], :method => 'GET', :path => "tenants/#{id}" ) end end # class Real class Mock def get_tenant(id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { 'tenant' => { 'id' => id, 'description' => 'Has access to everything', 'enabled' => true, 'name' => 'admin' } } response end # def list_tenants end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_role.rb0000644000004100000410000000135512600047642024157 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_role(id) request( :expects => [200, 204], :method => 'GET', :path => "/OS-KSADM/roles/#{id}" ) end end class Mock def get_role(id) response = Excon::Response.new if data = self.data[:roles][id] response.status = 200 response.body = {'role' => data} response else raise Fog::Identity::OpenStack::NotFound end end end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/create_user.rb0000644000004100000410000000233712600047642024661 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def create_user(name, password, email, tenantId=nil, enabled=true) data = { 'user' => { 'name' => name, 'password' => password, 'tenantId' => tenantId, 'email' => email, 'enabled' => enabled, } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => '/users' ) end end class Mock def create_user(name, password, email, tenantId=nil, enabled=true) response = Excon::Response.new response.status = 200 data = { 'id' => Fog::Mock.random_hex(32), 'name' => name, 'email' => email, 'tenantId' => tenantId, 'enabled' => enabled } self.data[:users][data['id']] = data response.body = {'user' => data} response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/create_user_role.rb0000644000004100000410000000121312600047642025672 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def create_user_role(tenant_id, user_id, role_id) request( :expects => 200, :method => 'PUT', :path => "/tenants/#{tenant_id}/users/#{user_id}/roles/OS-KSADM/#{role_id}" ) end end class Mock def create_user_role(tenant_id, user_id, role_id) Excon::Response.new( :body => {'role' => self.data[:roles][role_id]}, :status => 200 ) end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_tenants.rb0000644000004100000410000000346312600047642025070 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_tenants(options = nil, marker = nil) if options.is_a?(Hash) params = options else Fog::Logger.deprecation('Calling OpenStack[:identity].list_tenants(limit, marker) is deprecated, use'\ ' .list_ec2_credentials(:limit => value, :marker => value)') params = {} params['limit'] = options if options params['marker'] = marker if marker end request( :expects => [200, 204], :method => 'GET', :path => "tenants", :query => params ) end end # class Real class Mock def list_tenants(options = nil, marker = nil) Excon::Response.new( :body => { 'tenants_links' => [], 'tenants' => [ {'id' => '1', 'description' => 'Has access to everything', 'enabled' => true, 'name' => 'admin'}, {'id' => '2', 'description' => 'Normal tenant', 'enabled' => true, 'name' => 'default'}, {'id' => '3', 'description' => 'Disabled tenant', 'enabled' => false, 'name' => 'disabled'} ] }, :status => [200, 204][rand(1)] ) end # def list_tenants end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_users.rb0000644000004100000410000000244212600047642024551 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_users(options = {}) if options.is_a?(Hash) tenant_id = options.delete(:tenant_id) query = options else Fog::Logger.deprecation('Calling OpenStack[:identity].list_users(tenant_id) is deprecated, use .list_users(:tenant_id => value)') tenant_id = options query = {} end path = tenant_id ? "tenants/#{tenant_id}/users" : 'users' request( :expects => [200, 204], :method => 'GET', :path => path, :query => query ) end end # class Real class Mock def list_users(options = {}) tenant_id = options[:tenant_id] users = self.data[:users].values if tenant_id users = users.select { |user| user['tenantId'] == tenant_id } end Excon::Response.new( :body => {'users' => users}, :status => 200 ) end end # class Mock end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_roles.rb0000644000004100000410000000150712600047642024535 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_roles(options = {}) request( :expects => 200, :method => 'GET', :path => '/OS-KSADM/roles', :query => options ) end end class Mock def list_roles(options = {}) if self.data[:roles].empty? ['admin', 'Member'].each do |name| id = Fog::Mock.random_hex(32) self.data[:roles][id] = {'id' => id, 'name' => name} end end Excon::Response.new( :body => {'roles' => self.data[:roles].values}, :status => 200 ) end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/remove_user_from_tenant.rb0000644000004100000410000000116012600047642027300 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def remove_user_from_tenant(tenant_id, user_id, role_id) request( :expects => [200, 204], :method => 'DELETE', :path => "/tenants/#{tenant_id}/users/#{user_id}/roles/OS-KSADM/#{role_id}" ) end end # class Real class Mock def remove_user_from_tenant(tenant_id, user_id, role_id) end # def remove_user_from_tenant end # class Mock end # class V2 end # class OpenStack end # module Identity end fog-1.34.0/lib/fog/openstack/requests/identity_v2/list_user_global_roles.rb0000644000004100000410000000057412600047642027116 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def list_user_global_roles(user_id) request( :expects => [200], :method => 'GET', :path => "users/#{user_id}/roles" ) end end class Mock end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/delete_user.rb0000644000004100000410000000130312600047642024650 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def delete_user(user_id) request( :expects => [200, 204], :method => 'DELETE', :path => "users/#{user_id}" ) end end class Mock def delete_user(user_id) self.data[:users].delete( list_users.body['users'].find { |x| x['id'] == user_id }['id']) response = Excon::Response.new response.status = 204 response rescue raise Fog::Identity::OpenStack::NotFound end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/validate_token.rb0000644000004100000410000000075212600047642025350 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def validate_token(token_id, tenant_id=nil) request( :expects => [200, 203], :method => 'GET', :path => "tokens/#{token_id}"+(tenant_id ? "?belongsTo=#{tenant_id}" : '') ) end end class Mock def validate_token(token_id, tenant_id=nil) end end end end end endfog-1.34.0/lib/fog/openstack/requests/identity_v2/delete_user_role.rb0000644000004100000410000000114112600047642025671 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def delete_user_role(tenant_id, user_id, role_id) request( :expects => 204, :method => 'DELETE', :path => "/tenants/#{tenant_id}/users/#{user_id}/roles/OS-KSADM/#{role_id}" ) end end class Mock def delete_user_role(tenant_id, user_id, role_id) response = Excon::Response.new response.status = 204 response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_ec2_credential.rb0000644000004100000410000000307112600047642026056 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real ## # Retrieves an EC2 credential for a user. Requires administrator # credentials. # # ==== Parameters # * user_id<~String>: The id of the user to retrieve the credential # for # * access<~String>: The access key of the credential to retrieve # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'credential'<~Hash>: The EC2 credential # * 'access'<~String>: The access key # * 'secret'<~String>: The secret key # * 'user_id'<~String>: The user id # * 'tenant_id'<~String>: The tenant id def get_ec2_credential(user_id, access) request( :expects => [200, 202], :method => 'GET', :path => "users/#{user_id}/credentials/OS-EC2/#{access}" ) rescue Excon::Errors::Unauthorized raise Fog::Identity::OpenStack::NotFound end end class Mock def get_ec2_credential(user_id, access) ec2_credential = self.data[:ec2_credentials][user_id][access] raise Fog::OpenStack::Identity::NotFound unless ec2_credential response = Excon::Response.new response.status = 200 response.body = {'credential' => ec2_credential} response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/update_user.rb0000644000004100000410000000156212600047642024677 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def update_user(user_id, options = {}) url = options.delete('url') || "/users/#{user_id}" request( :body => Fog::JSON.encode({'user' => options}), :expects => 200, :method => 'PUT', :path => url ) end end class Mock def update_user(user_id, options) response = Excon::Response.new if user = self.data[:users][user_id] if options['name'] user['name'] = options['name'] end response.status = 200 response else raise Fog::Identity::OpenStack::NotFound end end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/create_role.rb0000644000004100000410000000153712600047642024645 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def create_role(name) data = { 'role' => { 'name' => name } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => '/OS-KSADM/roles' ) end end class Mock def create_role(name) data = { 'id' => Fog::Mock.random_hex(32), 'name' => name } self.data[:roles][data['id']] = data Excon::Response.new( :body => {'role' => data}, :status => 202 ) end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_user_by_id.rb0000644000004100000410000000153512600047642025342 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_user_by_id(user_id) request( :expects => [200, 203], :method => 'GET', :path => "users/#{user_id}" ) end end class Mock def get_user_by_id(user_id) response = Excon::Response.new response.status = 200 existing_user = self.data[:users].find do |u| u[0] == user_id || u[1]['name'] == 'mock' end existing_user = existing_user[1] if existing_user response.body = { 'user' => existing_user || create_user('mock', 'mock', 'mock@email.com').body['user'] } response end end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/identity_v2/get_tenants_by_name.rb0000644000004100000410000000056412600047642026365 0ustar www-datawww-datamodule Fog module Identity class OpenStack class V2 class Real def get_tenants_by_name(name) request( :expects => [200], :method => 'GET', :path => "tenants?name=#{name}" ) end end class Mock end end # class V2 end end end fog-1.34.0/lib/fog/openstack/requests/compute/0000755000004100000410000000000012600047642021242 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/compute/update_aggregate_metadata.rb0000644000004100000410000000146212600047642026722 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_aggregate_metadata(uuid, metadata = {}) data = {'set_metadata' => {'metadata' => metadata}} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end end class Mock def update_aggregate_metadata(uuid, metadata = {}) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/disable_service.rb0000644000004100000410000000177312600047642024722 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def disable_service(host, binary, optional_params = nil) data = {"host" => host, "binary" => binary} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI::encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/disable", :query => optional_params ) end end class Mock def disable_service(host, binary, optional_params = nil) response = Excon::Response.new response.status = 200 response.body = { "service" => { "host" => "host1", "binary" => "nova-compute", "status" => "disabled" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/pause_server.rb0000644000004100000410000000115012600047642024267 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Pause the server. # # === Parameters # * server_id <~String> - The ID of the server to pause. # === Returns # * success <~Boolean> def pause_server(server_id) body = { 'pause' => nil } server_action(server_id, body).status == 202 end # def pause_server end # class Real class Mock def pause_server(server_id) true end # def pause_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/create_key_pair.rb0000644000004100000410000000456512600047642024727 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_key_pair(key_name, public_key = nil) data = { 'keypair' => { 'name' => key_name } } data['keypair']['public_key'] = public_key unless public_key.nil? request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'os-keypairs.json' ) end end class Mock def create_key_pair(key_name, public_key = nil) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-c373a42c-2825-4e60-8d34-99416ea850be", "Content-Type" => "application/json", "Content-Length" => "1289", "Date" => Date.new} response.body = { "keypair" => { "public_key" => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCdAZLjljntJbLVVkNHjWFSoKen2nZbk39ZfqhZJOMdeFdz02GWBS45rcuboeGg/gozKRwsLu4N6NLPlYtbK/NapJIvgO/djBp+FQG1QZNtLPsx7j4hVJac3yISGms+Xtu4cEv6j5sFDzAgTQbWez0Z1+9qOq9ngdaoW+YClfQ== vagrant@nova\n", "private_key" => "-----BEGIN RSA PRIVATE KEY-----\nMIICXgIBAAKBgQDCdAZLjljn1tJbLVVkNHjWFSoKen2nZbk39ZfqhZJOMdeFdz02\nGWBS45rcuHboeGg/gozKRwsLu4N6NLPlYtbK/NapJIvgO/djBp+FQG1QZNtLPsx7\nj4hVJac3yISGms+Xtu4cEv6j5sFDzAgTQbWez0Z1+9qOq9ngdaoW+YClfQIDAQAB\nAoGBALBoT9m1vuQ82EONQf2RONqHAsfUzi/SMhEZRgOlv9AemXZkcWyl4uPvxmtd\nEcreiTystAtCHjw7lhCExXthipevUjtIAAt+b3pMn6Oyjad3IRvde6atMdjrje43\n/nftYtuXYyJTsvwEvLYqSioLQ0Nn/XDKhOpcM5tejDHOH35lAkEA+H4r7y9X521u\nIABVAezBWaT/wvdMjx5cwfyYEQjnI1bxfRIqkgoY5gDDBdVbT75UTsHHbHLORQcw\nRjRvS2zgewJBAMhT6eyMonJvHHvC5RcchcY+dWkscIKoOzeyUKMb+7tERQa9/UN2\njYb+jdM0VyL0ruLFwYtl2m34gfmhcXgIvGcCQGzKMEnjHEUBr7jq7EyPbobkqeSd\niDMQQ+PZxmmO0EK0ib0L+v881HG926PuKK/cz+Q7Cif8iznFT+ksg50t6YkCQQC9\nwfcAskqieSuS9A9LcCIrojhXctf0e+T0Ij2N89DlF4sHEuqXf/IZ4IB5gsfTfdE3\nUDnAkK9yogaEbu/r0uKbAkEAy5kl71bIqvKTKsY2mES9ziVxfftl/9UIi5LI+QHb\nmC/c6cTrGVCM71fi2GMxGgBeEea4+7xwoWTL4CxA00kmTg==\n-----END RSA PRIVATE KEY-----\n", "user_id" => "admin", "name" => key_name, "fingerprint" => "97:86:f4:15:68:0c:7b:a7:e5:8f:f0:bd:1f:27:65:ad" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/create_flavor.rb0000644000004100000410000000566112600047642024413 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # PARAMETERS # # name = Name of flavor # ram = Memory in MB # vcpus = Number of VCPUs # disk = Size of local disk in GB # swap = Swap space in MB # rxtx_factor = RX/TX factor def create_flavor(attributes) # Get last flavor id flavor_ids = Array.new flavors = list_flavors_detail.body['flavors'] + list_flavors_detail(:is_public => false).body['flavors'] flavors.each do |flavor| flavor_ids << flavor['id'].to_i end # Set flavor id attributes[:flavor_id] = attributes[:flavor_id] || ((flavor_ids.length > 0) ? (flavor_ids.sort.last) + 1 : 1) data = { 'flavor' => { 'name' => attributes[:name], 'ram' => attributes[:ram], 'vcpus' => attributes[:vcpus], 'disk' => attributes[:disk], 'id' => attributes[:flavor_id], 'swap' => attributes[:swap], 'OS-FLV-EXT-DATA:ephemeral' => attributes[:ephemeral], 'os-flavor-access:is_public' => attributes[:is_public], 'rxtx_factor' => attributes[:rxtx_factor] } } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'flavors' ) end end class Mock def create_flavor(attributes) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = { "flavor" => { "vcpus" => attributes[:vcpus], "disk" => attributes[:disk], "name" => attributes[:name], "links" => [ { "href" => "http://192.168.27.100:8774/v1.1/6733e93c5f5c4eb1bcabc6902ba208d6/flavors/11", "rel" => "self" }, { "href" => "http://192.168.27.100:8774/6733e93c5f5c4eb1bcabc6902ba208d6/flavors/11", "rel" => "bookmark" } ], "rxtx_factor" => attributes[:rxtx_factor] || 1.0, "OS-FLV-EXT-DATA:ephemeral" => attributes[:ephemeral] || 0, "os-flavor-access:is_public" => attributes[:is_public] || false, "OS-FLV-DISABLED:disabled" => attributes[:disabled] || false, "ram" => attributes[:ram], "id" => "11", "swap" => attributes[:swap] || "" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/get_host_details.rb0000644000004100000410000000366012600047642025115 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_host_details(host) request( :expects => [200, 203], :method => 'GET', :path => "os-hosts/#{host}.json" ) end end class Mock def get_host_details(host) response = Excon::Response.new response.status = 200 response.body = { "host" => [ { "resource" => { "project" => "(total)", "memory_mb" => 64427, "host" => "cn28.la-1-3.morphcloud.net", "cpu" => 12, "disk_gb" => 1608 } }, { "resource" => { "project" => "(used_now)", "memory_mb" => 1753, "host" => "cn28.la-1-3.morphcloud.net", "cpu" => 3, "disk_gb" => 33 } }, { "resource" => { "project" => "(used_max)", "memory_mb" => 7168, "host" => "cn28.la-1-3.morphcloud.net", "cpu" => 3, "disk_gb" => 45 } }, { "resource" => { "project" => "bf8301f5164f4790889a1bc2bfb16d99", "memory_mb" => 5120, "host" => "cn28.la-1-3.morphcloud.net", "cpu" => 2, "disk_gb" => 35 } }, { "resource" => { "project" => "3bb4d0301c5f47d5b4d96a361fcf96f4", "memory_mb" => 2048, "host" => "cn28.la-1-3.morphcloud.net", "cpu" => 1, "disk_gb" => 10 } } ] } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/get_console_output.rb0000644000004100000410000000077312600047642025517 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_console_output(server_id, log_length) body = { 'os-getConsoleOutput' => { 'length' => log_length } } server_action(server_id, body) end end class Mock def get_console_output(server_id, log_length) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/shelve_server.rb0000644000004100000410000000116212600047642024443 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Shelve the server. # # === Parameters # * server_id <~String> - The ID of the server to be shelved # === Returns # * success <~Boolean> def shelve_server(server_id) body = { 'shelve' => nil } server_action(server_id, body).status == 202 end # def shelve_server end # class Real class Mock def shelve_server(server_id) true end # def shelve_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_security_group.rb0000644000004100000410000000144712600047642026202 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_security_group(security_group_id) request( :expects => 202, :method => 'DELETE', :path => "os-security-groups/#{security_group_id}" ) end end class Mock def delete_security_group(security_group_id) self.data[:security_groups].delete security_group_id.to_s response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {} response end end # mock end # openstack end # compute end #fog fog-1.34.0/lib/fog/openstack/requests/compute/get_vnc_console.rb0000644000004100000410000000230312600047642024734 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Get a vnc console for an instance. # # === Parameters # * server_id <~String> - The ID of the server. # * console_type <~String> - Type of vnc console to get ('novnc' or 'xvpvnc'). # === Returns # * response <~Excon::Response>: # * body <~Hash>: # * url <~String> # * type <~String> def get_vnc_console(server_id, console_type) body = { 'os-getVNCConsole' => { 'type' => console_type } } server_action(server_id, body) end # def get_vnc_console end # class Real class Mock def get_vnc_console(server_id, console_type) response = Excon::Response.new response.status = 200 response.body = { "console" => { "url" => "http://192.168.27.100:6080/vnc_auto.html?token=c3606020-d1b7-445d-a88f-f7af48dd6a20", "type" => "novnc" } } response end # def get_vnc_console end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/remove_aggregate_host.rb0000644000004100000410000000143612600047642026133 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def remove_aggregate_host(uuid, host_uuid) data = {'remove_host' => {'host' => host_uuid}} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end end class Mock def remove_aggregate_host(uuid, host_uuid) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/create_image.rb0000644000004100000410000000272712600047642024204 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_image(server_id, name, metadata={}) body = { 'createImage' => { 'name' => name, 'metadata' => metadata }} data = server_action(server_id, body) image_id = data.headers["Location"].scan(/.*\/(.*)/).flatten[0] get_image_details(image_id) end end class Mock def create_image(server_id, name, metadata={}) response = Excon::Response.new response.status = 202 img_id=Fog::Mock.random_numbers(6).to_s data = { 'id' => img_id, 'server' => {"id"=>"3", "links"=>[{"href"=>"http://nova1:8774/admin/servers/#{server_id}", "rel"=>"bookmark"}]}, 'links' => [{"href"=>"http://nova1:8774/v1.1/admin/images/#{img_id}", "rel"=>"self"}, {"href"=>"http://nova1:8774/admin/images/#{img_id}", "rel"=>"bookmark"}], 'metadata' => metadata || {}, 'name' => name || "server_#{rand(999)}", 'progress' => 0, 'status' => 'SAVING', 'minDisk' => 0, 'minRam' => 0, 'updated' => "", 'created' => "" } self.data[:last_modified][:images][data['id']] = Time.now self.data[:images][data['id']] = data response.body = { 'image' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/confirm_resize_server.rb0000644000004100000410000000064112600047642026174 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def confirm_resize_server(server_id) body = { 'confirmResize' => nil } server_action(server_id, body, 204) end end class Mock def confirm_resize_server(server_id) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/add_aggregate_host.rb0000644000004100000410000000142512600047642025364 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def add_aggregate_host(uuid, host_uuid) data = {'add_host' => {'host' => host_uuid}} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end end class Mock def add_aggregate_host(uuid, host_uuid) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/revert_resize_server.rb0000644000004100000410000000130312600047642026042 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def revert_resize_server(server_id) body = { 'revertResize' => nil } server_action(server_id, body) end end class Mock def revert_resize_server(server_id) response = Excon::Response.new response.status = 202 self.data[:servers][server_id]['flavorId'] = self.data[:servers][server_id]['old_flavorId'] self.data[:servers][server_id].delete('old_flavorId') self.data[:last_modified][:servers][server_id] = Time.now self.data[:servers][server_id]['status'] = 'ACTIVE' response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_metadata.rb0000644000004100000410000000102212600047642024664 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_metadata(collection_name, parent_id, key) request( :expects => 204, :method => 'DELETE', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end end class Mock def delete_metadata(collection_name, parent_id, key) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/resume_server.rb0000644000004100000410000000116312600047642024456 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Resume the server. # # === Parameters # * server_id <~String> - The ID of the server to be resumed. # === Returns # * success <~Boolean> def resume_server(server_id) body = { 'resume' => nil } server_action(server_id, body).status == 202 end # def resume_server end # class Real class Mock def resume_server(server_id) true end # def resume_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/update_quota.rb0000644000004100000410000000133212600047642024261 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_quota(tenant_id, options = {}) options['tenant_id'] = tenant_id request( :body => Fog::JSON.encode({ 'quota_set' => options }), :expects => 200, :method => 'PUT', :path => "/os-quota-sets/#{tenant_id}" ) end end class Mock def update_quota(tenant_id, options = {}) self.data[:quota_updated] = self.data[:quota].merge options response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => self.data[:quota_updated] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_flavors.rb0000644000004100000410000000244512600047642024303 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_flavors(options = {}) request( :expects => [200, 203], :method => 'GET', :path => 'flavors.json', :query => options ) end end class Mock def list_flavors(options = {}) response = Excon::Response.new response.status = 200 response.body = { 'flavors' => [ { 'name' => '256 server', 'id' => '1', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '512 server', 'id' => '2', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '1GB server', 'id' => '3', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '2GB server', 'id' => '4', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '4GB server', 'id' => '5', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '8GB server', 'id' => '6', 'links' => ['https://itdoesntmatterwhatshere.heh'] }, { 'name' => '15.5GB server', 'id' => '7', 'links' => ['https://itdoesntmatterwhatshere.heh'] } ] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_volume_snapshot.rb0000644000004100000410000000224012600047642026336 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_volume_snapshot(volume_id, name, description, force=false) data = { 'snapshot' => { 'volume_id' => volume_id, 'display_name' => name, 'display_description' => description, 'force' => force } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "os-snapshots" ) end end class Mock def create_volume_snapshot(volume_id, name, description, force=false) response = Excon::Response.new response.status = 202 response.body = { "snapshot"=> { "status"=>"creating", "display_name"=>name, "created_at"=>Time.now, "display_description"=>description, "volume_id"=>volume_id, "id"=>"5", "size"=>1 } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/update_meta.rb0000644000004100000410000000217312600047642024062 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_meta(collection_name, parent_id, key, value) request( :body => Fog::JSON.encode({ 'meta' => {key => value}}), :expects => 200, :method => 'PUT', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end end class Mock def update_meta(collection_name, parent_id, key, value) if collection_name == "images" then if not list_images_detail.body['images'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end if collection_name == "servers" then if not list_servers_detail.body['servers'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end #FIXME join w/ existing metadata here response = Excon::Response.new response.body = { "metadata" => {key => value} } response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_flavor_details.rb0000644000004100000410000000353112600047642025426 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_flavor_details(flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}.json" ) end end class Mock def get_flavor_details(flavor_ref) response = Excon::Response.new flavor = { '1' => { 'id' => '1', 'name' => '256 server', 'ram' => 256, 'disk' => 10, 'swap' => '1', 'vcpus' => 1, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '2' => { 'id' => '2', 'name' => '512 server', 'ram' => 512, 'disk' => 20, 'swap' => '1', 'vcpus' => 2, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '3' => { 'id' => '3', 'name' => '1GB server', 'ram' => 1024, 'disk' => 40, 'swap' => '2', 'vcpus' => 2, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '4' => { 'id' => '4', 'name' => '2GB server', 'ram' => 2048, 'disk' => 80, 'swap' => '4', 'vcpus' => 4, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '5' => { 'id' => '5', 'name' => '4GB server', 'ram' => 4096, 'disk' => 160, 'swap' => '8', 'vcpus' => 8, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '6' => { 'id' => '6', 'name' => '8GB server', 'ram' => 8192, 'disk' => 320, 'swap' => '16', 'vcpus' => 16, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, '7' => { 'id' => '7', 'name' => '15.5GB server', 'ram' => 15872, 'disk' => 620, 'swap' => '32', 'vcpus' => 32, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] } }[flavor_ref] if flavor response.status = 200 response.body = { 'flavor' => flavor } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/set_tenant.rb0000644000004100000410000000057712600047642023744 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate end end class Mock def set_tenant(tenant) true end end end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/get_security_group.rb0000644000004100000410000000214612600047642025514 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_security_group(security_group_id) request( :expects => [200], :method => 'GET', :path => "os-security-groups/#{security_group_id}" ) end end class Mock def get_security_group(security_group_id) security_group = self.data[:security_groups][security_group_id.to_s] response = Excon::Response.new if security_group response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-63a90344-7c4d-42e2-936c-fd748bced1b3", "Content-Type" => "application/json", "Content-Length" => "167", "Date" => Date.new } response.body = { "security_group" => security_group } else raise Fog::Compute::OpenStack::NotFound, "Security group #{security_group_id} does not exist" end response end end # mock end # openstack end #compute end #fog fog-1.34.0/lib/fog/openstack/requests/compute/get_address.rb0000644000004100000410000000173612600047642024062 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_address(address_id) request( :expects => [200], :method => 'GET', :path => "os-floating-ips/#{address_id}" ) end end class Mock def get_address(address_id) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26", "Content-Type" => "application/json", "Content-Length" => "105", "Date"=> Date.new } response.body = { "floating_ip" => { "instance_id" => nil, "ip" => "192.168.27.129", "fixed_ip" => nil, "id" => 1, "pool" => "nova" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/get_security_group_rule.rb0000644000004100000410000000240512600047642026541 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_security_group_rule(security_group_rule_id) request( :expects => [200], :method => 'GET', :path => "os-security-group-rules/#{security_group_rule_id}" ) end end class Mock def get_security_group_rule(security_group_rule_id) security_group_rule = nil self.data[:security_groups].find{|id, sg| security_group_rule = sg["rules"].find{ |sgr| sgr["id"].to_s == security_group_rule_id.to_s }} response = Excon::Response.new if security_group_rule response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-63a90344-7c4d-42e2-936c-fd748bced1b3", "Content-Type" => "application/json", "Content-Length" => "167", "Date" => Date.new } response.body = { "security_group_rule" => security_group_rule } else raise Fog::Compute::OpenStack::NotFound, "Security group rule #{security_group_rule_id} does not exist" end response end end # mock end # openstack end #compute end #fog fog-1.34.0/lib/fog/openstack/requests/compute/remove_fixed_ip.rb0000644000004100000410000000145212600047642024735 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Remove an IP address. # # === Parameters # * server_id <~String> - The ID of the server in which to remove an IP from. # * address <~String> - The IP address to be removed. # === Returns # * success <~Boolean> def remove_fixed_ip(server_id, address) body = { 'removeFixedIp' => { 'address' => address } } server_action(server_id, body).status == 202 end # def remove_fixed_ip end # class Real class Mock def remove_fixed_ip(server_id, address) true end # def remove_fixed_ip end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/get_quota_defaults.rb0000644000004100000410000000111612600047642025445 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_quota_defaults(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}/defaults" ) end end class Mock def get_quota_defaults(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => self.data[:quota].merge({'id' => tenant_id}) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_aggregate.rb0000644000004100000410000000111312600047642024350 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_aggregate(uuid) request( :expects => [200], :method => 'GET', :path => "os-aggregates/#{uuid}" ) end end class Mock def get_aggregate(uuid) response = Excon::Response.new response.status = 2040 response.body = {'aggregate' => self.data[:aggregates].first.merge({ "hosts" => []})} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_server.rb0000644000004100000410000000165012600047642024421 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_server(server_id) request( :expects => 204, :method => 'DELETE', :path => "servers/#{server_id}" ) end end class Mock def delete_server(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} if server['status'] == 'BUILD' response.status = 409 raise(Excon::Errors.status_error({:expects => 204}, response)) else self.data[:last_modified][:servers].delete(server_id) self.data[:servers].delete(server_id) response.status = 204 end response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/enable_service.rb0000644000004100000410000000177012600047642024542 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def enable_service(host, binary, optional_params = nil) data = {"host" => host, "binary" => binary} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI::encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/enable", :query => optional_params ) end end class Mock def enable_service(host, binary, optional_params = nil) response = Excon::Response.new response.status = 200 response.body = { "service" => { "host" => "host1", "binary" => "nova-compute", "status" => "enabled" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_snapshots_detail.rb0000644000004100000410000000114612600047642026170 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_snapshots_detail(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-snapshots/detail', :query => options ) end end class Mock def list_snapshots_detail(options = {}) response = Excon::Response.new response.status = 200 response.body = { 'snapshots' => [get_snapshot_details.body["snapshot"]] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_snapshots.rb0000644000004100000410000000231412600047642024644 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_snapshots(options = true) if options.is_a?(Hash) path = 'os-snapshots' query = options else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if options Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(true) is deprecated, use .list_snapshots_detail instead') else Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(false) is deprecated, use .list_snapshots({}) instead') end path = options ? 'os-snapshots/detail' : 'os-snapshots' query = {} end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end end class Mock def list_snapshots(options = true) response = Excon::Response.new response.status = 200 response.body = { 'snapshots' => [get_snapshot_details.body["snapshot"]] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_images.rb0000644000004100000410000000126712600047642024075 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_images request( :expects => [200, 203], :method => 'GET', :path => 'images.json' ) end end class Mock def list_images response = Excon::Response.new data = list_images_detail.body['images'] images = [] for image in data images << image.reject { |key, value| !['id', 'name', 'links'].include?(key) } end response.status = [200, 203][rand(1)] response.body = { 'images' => images } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_security_groups.rb0000644000004100000410000000404012600047642026066 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_security_groups(options = {}) path = "os-security-groups.json" if options.is_a?(Hash) server_id = options.delete(:server_id) query = options else # Backwards compatibility layer, only server_id was passed as first parameter previously Fog::Logger.deprecation('Calling OpenStack[:compute].list_security_groups(server_id) is deprecated, use .list_security_groups(:server_id => value) instead') server_id = options query = {} end if server_id path = "servers/#{server_id}/#{path}" end request( :expects => [200], :method => 'GET', :path => path, :query => query ) end end class Mock def list_security_groups(options = {}) if options.is_a?(Hash) server_id = options.delete(:server_id) query = options else server_id = options query = {} end security_groups = self.data[:security_groups].values groups = if server_id then server_group_names = Array(self.data[:server_security_group_map][server_id]) server_group_names.map do |name| security_groups.find do |sg| sg['name'] == name end end.compact else security_groups end Excon::Response.new( :body => { 'security_groups' => groups }, :headers => { "X-Compute-Request-Id" => "req-#{Fog::Mock.random_base64(36)}", "Content-Type" => "application/json", "Date" => Date.new }, :status => 200 ) end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_aggregates.rb0000644000004100000410000000162212600047642024734 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_aggregates(options = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-aggregates', :query => options ) end end class Mock def list_aggregates(options = {}) response = Excon::Response.new response.status = 200 response.body = {'aggregates' => [{ "availability_zone" => "nova", "created_at" => "2012-11-16T06:22:23.032493", "deleted" => false, "deleted_at" => nil, "metadata" => { "availability_zone" => "nova" }, "id" => 1, "name" => "name", "updated_at" => nil }]} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_volumes_detail.rb0000644000004100000410000000104312600047642025634 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_volumes_detail(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-volumes/detail', :query => options ) end end class Mock def list_volumes_detail(options = {}) Excon::Response.new( :body => { 'volumes' => self.data[:volumes].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_security_group.rb0000644000004100000410000000316112600047642026176 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_security_group(name, description) data = { 'security_group' => { 'name' => name, 'description' => description } } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'os-security-groups.json' ) end end class Mock def create_security_group(name, description) Fog::Identity::OpenStack.new(:openstack_auth_url => credentials[:openstack_auth_url]) tenant_id = Fog::Identity::OpenStack::V2::Mock.data[current_tenant][:tenants].keys.first security_group_id = Fog::Mock.random_numbers(2).to_i + 1 self.data[:security_groups][security_group_id.to_s] = { 'tenant_id' => tenant_id, 'rules' => [], 'id' => security_group_id, 'name' => name, 'description' => description } response = Excon::Response.new response.status = 200 response.headers = { 'X-Compute-Request-Id' => "req-#{Fog::Mock.random_hex(32)}", 'Content-Type' => 'application/json', 'Content-Length' => Fog::Mock.random_numbers(3).to_s, 'Date' => Date.new} response.body = { 'security_group' => self.data[:security_groups][security_group_id.to_s] } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_metadata.rb0000644000004100000410000000104412600047642024401 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_metadata(collection_name, parent_id) request( :expects => [200, 203], :method => 'GET', :path => "/#{collection_name}/#{parent_id}/metadata.json" ) end end class Mock def list_metadata(collection_name, parent_id) response = Excon::Response.new response.status = 200 response.body = {} response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_usage.rb0000644000004100000410000000373612600047642023543 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_usage(tenant_id, date_start, date_end) params = Hash.new params[:start] = date_start.utc.iso8601.chop! params[:end] = date_end.utc.iso8601.chop! request( :expects => [200, 203], :method => 'GET', :path => "os-simple-tenant-usage/#{tenant_id}", :query => params ) end end class Mock def get_usage(tenant_id, date_start, date_end) response = Excon::Response.new response.status = 200 response.body = {"tenant_usage"=> {"total_memory_mb_usage" => 0.0, "total_vcpus_usage" => 0.0, "total_hours" => 0.0, "tenant_id" => tenant_id, "stop" => date_start, "start" => date_end, "total_local_gb_usage" => 0.0, "server_usages" =>[{ "hours" => 0.0, "uptime" => 69180, "local_gb" => 0, "ended_at" => nil, "name" => "test server", "tenant_id" => tenant_id, "vcpus" => 1, "memory_mb" => 512, "state" => "active", "flavor" => "m1.tiny", "started_at" => "2012-03-05 09:11:44" } ] } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_flavor_metadata.rb0000644000004100000410000000117212600047642025560 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_flavor_metadata(flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}/os-extra_specs" ) end end class Mock def get_flavor_metadata(flavor_ref) response = Excon::Response.new response.status = 200 response.body = { "extra_specs" => { "cpu_arch" => "x86_64" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/add_flavor_access.rb0000644000004100000410000000142712600047642025215 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def add_flavor_access(flavor_ref, tenant_id) request( :body => Fog::JSON.encode({ "addTenantAccess" => { "tenant" => tenant_id } }), :expects => [200, 203], :method => 'POST', :path => "flavors/#{flavor_ref}/action.json" ) end end class Mock def add_flavor_access(flavor_ref, tenant_id) response = Excon::Response.new response.status = 200 response.body = { "flavor_access" => [{ "tenant_id" => tenant_id.to_s, "flavor_id" => flavor_ref.to_s }] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_usages.rb0000644000004100000410000000305412600047642024113 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_usages(date_start = nil, date_end = nil, detailed=false) params = Hash.new params[:start] = date_start.iso8601.gsub(/\+.*/, '') if date_start params[:end] = date_end.iso8601.gsub(/\+.*/, '') if date_end params[:detailed] = (detailed ? '1' : '0') if detailed request( :expects => [200, 203], :method => 'GET', :path => 'os-simple-tenant-usage', :query => params ) end end class Mock def list_usages(date_start = nil, date_end = nil, detailed=false) params = Hash.new response = Excon::Response.new response.status = 200 response.body = {"tenant_usages"=>[{ "total_memory_mb_usage" => 0.00036124444444444445, "total_vcpus_usage" => 7.055555555555556e-07, "start" => "2012-03-06 05:05:56.349001", "tenant_id" => "b97c8abba0c44a0987c63b858a4823e5", "stop" => "2012-03-06 05:05:56.349255", "total_hours" => 7.055555555555556e-07, "total_local_gb_usage" => 0.0 } ] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/stop_server.rb0000644000004100000410000000115112600047642024140 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Stop the server. # # === Parameters # * server_id <~String> - The ID of the server to be stopped. # === Returns # * success <~Boolean> def stop_server(server_id) body = { 'os-stop' => nil } server_action(server_id, body).status == 202 end # def stop_server end # class Real class Mock def stop_server(server_id) true end # def stop_server end # class Mock end # class OpenStack end # module Compute end # module Fogfog-1.34.0/lib/fog/openstack/requests/compute/unshelve_server.rb0000644000004100000410000000120012600047642024777 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Unshelve the server. # # === Parameters # * server_id <~String> - The ID of the server to be unshelved # === Returns # * success <~Boolean> def unshelve_server(server_id) body = { 'unshelve' => nil } server_action(server_id, body).status == 202 end # def unshelve_server end # class Real class Mock def unshelve_server(server_id) true end # def unshelve_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/allocate_address.rb0000644000004100000410000000203112600047642025054 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def allocate_address(pool = nil) request( :body => Fog::JSON.encode({'pool' => pool}), :expects => [200, 202], :method => 'POST', :path => 'os-floating-ips.json' ) end end class Mock def allocate_address(pool = nil) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26", "Content-Type" => "application/json", "Content-Length" => "105", "Date"=> Date.new } response.body = { "floating_ip" => { "instance_id" => nil, "ip" => "192.168.27.132", "fixed_ip" => nil, "id" => 4, "pool"=>"nova" } } response end end # mock end # openstack end #compute end fog-1.34.0/lib/fog/openstack/requests/compute/set_metadata.rb0000644000004100000410000000210512600047642024220 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def set_metadata(collection_name, parent_id, metadata = {}) request( :body => Fog::JSON.encode({ 'metadata' => metadata }), :expects => 200, :method => 'PUT', :path => "#{collection_name}/#{parent_id}/metadata" ) end end class Mock def set_metadata(collection_name, parent_id, metadata = {}) if collection_name == "images" then if not list_images_detail.body['images'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end if collection_name == "servers" then if not list_servers_detail.body['servers'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end response = Excon::Response.new response.body = { "metadata" => metadata } response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/suspend_server.rb0000644000004100000410000000116612600047642024642 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Suspend the server. # # === Parameters # * server_id <~String> - The ID of the server to suspend. # === Returns # * success <~Boolean> def suspend_server(server_id) body = { 'suspend' => nil } server_action(server_id, body).status == 202 end # def suspend_server end # class Real class Mock def suspend_server(server_id) true end # def suspend_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/live_migrate_server.rb0000644000004100000410000000122512600047642025624 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def live_migrate_server(server_id, host, block_migration, disk_over_commit) body = { 'os-migrateLive' => { 'host' => host, 'block_migration' => block_migration, 'disk_over_commit' => disk_over_commit, } } server_action(server_id, body) end end class Mock def live_migrate_server(server_id, host, block_migration, disk_over_commit) response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/add_security_group.rb0000644000004100000410000000070512600047642025464 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def add_security_group(server_id, group_name) body = {'addSecurityGroup' => { "name" => group_name } } server_action(server_id, body) end end class Mock def add_security_group(server_id, group_name) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_snapshot_details.rb0000644000004100000410000000165512600047642026001 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_snapshot_details(snapshot_id) request( :expects => 200, :method => 'GET', :path => "os-snapshots/#{snapshot_id}" ) end end class Mock def get_snapshot_details(snapshot_id) response = Excon::Response.new response.status = 200 response.body = { 'snapshot' => { 'id' => '1', 'display_name' => Fog::Mock.random_letters(rand(8) + 5), 'display_description' => Fog::Mock.random_letters(rand(12) + 10), 'size' => 3, 'volume_id' => '4', 'status' => 'online', 'created_at' => Time.now } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_volume.rb0000644000004100000410000000311512600047642024421 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_volume(name, description, size, options={}) data = { 'volume' => { 'display_name' => name, 'display_description' => description, 'size' => size } } vanilla_options = ['snapshot_id', 'availability_zone'] vanilla_options.select{|o| options[o]}.each do |key| data['volume'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "os-volumes" ) end end class Mock def create_volume(name, description, size, options={}) response = Excon::Response.new response.status = 202 data = { 'id' => Fog::Mock.random_numbers(2), 'displayName' => name, 'displayDescription' => description, 'size' => size, 'status' => 'creating', 'snapshotId' => nil, 'volumeType' => 'None', 'availabilityZone' => 'nova', 'createdAt' => Time.now.strftime('%FT%T.%6N'), 'attachments' => [], 'metadata' => {} } self.data[:volumes][data['id']] = data response.body = { 'volume' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/unpause_server.rb0000644000004100000410000000116612600047642024641 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Unpause the server. # # === Parameters # * server_id <~String> - The ID of the server to unpause. # === Returns # * success <~Boolean> def unpause_server(server_id) body = { 'unpause' => nil } server_action(server_id, body).status == 202 end # def unpause_server end # class Real class Mock def unpause_server(server_id) true end # def unpause_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/resize_server.rb0000644000004100000410000000066612600047642024466 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def resize_server(server_id, flavor_ref) body = { 'resize' => { 'flavorRef' => flavor_ref }} server_action(server_id, body) end end class Mock def resize_server(server_id, flavor_ref) response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_servers_detail.rb0000644000004100000410000000220312600047642025632 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Available filters: name, status, image, flavor, changes_since, reservation_id def list_servers_detail(options = {}) params = options.dup if params[:all_tenants] params['all_tenants'] = 'True' params.delete(:all_tenants) end request( :expects => [200, 203], :method => 'GET', :path => 'servers/detail.json', :query => params ) end end class Mock def list_servers_detail(filters = {}) response = Excon::Response.new servers = self.data[:servers].values for server in servers case server['status'] when 'BUILD' if Time.now - self.data[:last_modified][:servers][server['id']] > Fog::Mock.delay * 2 server['status'] = 'ACTIVE' end end end response.status = [200, 203][rand(1)] response.body = { 'servers' => servers } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/server_actions.rb0000644000004100000410000000133212600047642024614 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Retrieve server actions. # # === Parameters # * server_id <~String> - The ID of the server to query for available actions. # === Returns # * actions <~Array> def server_actions(server_id) request( :expects => 200, :method => 'GET', :path => "servers/#{server_id}/actions" ).body['actions'] end # def server_actions end # class Real class Mock def server_actions(server_id) Array.new end # def server_actions end # class Mock end # class OpenStack end # module Compute end # moduel Fog fog-1.34.0/lib/fog/openstack/requests/compute/remove_flavor_access.rb0000644000004100000410000000134412600047642025760 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def remove_flavor_access(flavor_ref, tenant_id) request( :body => Fog::JSON.encode({ "removeTenantAccess" => { "tenant" => tenant_id.to_s } }), :expects => [200, 203], :method => 'POST', :path => "flavors/#{flavor_ref}/action.json" ) end end class Mock def remove_flavor_access(flavor_ref, tenant_id) response = Excon::Response.new response.status = 200 response.body = { "flavor_access" => [] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_flavor_metadata.rb0000644000004100000410000000176312600047642026252 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_flavor_metadata(flavor_ref, metadata) data = { 'extra_specs' => metadata } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => "flavors/#{flavor_ref}/os-extra_specs" ) end end class Mock def create_flavor_metadata(flavor_ref, metadata) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = { "extra_specs" => { "cpu_arch" => "x86_64" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/add_fixed_ip.rb0000644000004100000410000000147312600047642024173 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Add an IP address on a network. # # === Parameters # * server_id <~String> - The ID of the server in which to add an IP to. # * network_id <~String> - The ID of the network the IP should be on. # === Returns # * success <~Boolean> def add_fixed_ip(server_id, network_id) body = { 'addFixedIp' => { 'networkId' => network_id } } server_action(server_id, body).status == 202 end # def add_fixed_ip end # class Real class Mock def add_fixed_ip(server_id, network_id) true end # def add_fixed_ip end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_volume.rb0000644000004100000410000000124212600047642024417 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_volume(volume_id) request( :expects => 202, :method => 'DELETE', :path => "os-volumes/#{volume_id}" ) end end class Mock def delete_volume(volume_id) response = Excon::Response.new if list_volumes.body['volumes'].map { |v| v['id'] }.include? volume_id self.data[:volumes].delete(volume_id) response.status = 204 response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_meta.rb0000644000004100000410000000167512600047642024050 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_meta(collection_name, parent_id, key) request( :expects => 204, :method => 'DELETE', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end end class Mock def delete_meta(collection_name, parent_id, key) if collection_name == "images" then if not list_images_detail.body['images'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end if collection_name == "servers" then if not list_servers_detail.body['servers'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/disassociate_address.rb0000644000004100000410000000116212600047642025747 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def disassociate_address(server_id, ip_address) body = { "removeFloatingIp" => {"address" => ip_address}} server_action(server_id, body) end end class Mock def disassociate_address(server_id, ip_address) response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html, charset=UTF-8", "Content-Length" => "0", "Date"=> Date.new } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_tenants_with_flavor_access.rb0000644000004100000410000000123512600047642030224 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_tenants_with_flavor_access(flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}/os-flavor-access.json" ) end end class Mock def list_tenants_with_flavor_access(flavor_ref) response = Excon::Response.new response.status = 200 response.body = { "flavor_access" => [{ "tenant_id" => Fog::Mock.random_hex(33), "flavor_id" => flavor_ref.to_s }] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/rescue_server.rb0000644000004100000410000000115412600047642024444 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Rescue the server. # # === Parameters # * server_id <~String> - The ID of the server to be rescued. # === Returns # * success <~Boolean> def rescue_server(server_id) body = { 'rescue' => nil } server_action(server_id, body) == 202 end # def rescue_server end # class Real class Mock def rescue_server(server_id) true end # def rescue_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_snapshot.rb0000644000004100000410000000072612600047642024755 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_snapshot(snapshot_id) request( :expects => 202, :method => 'DELETE', :path => "os-snapshots/#{snapshot_id}" ) end end class Mock def delete_snapshot(snapshot_id) response = Excon::Response.new response.status = 204 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_security_group_rule.rb0000644000004100000410000000355212600047642027231 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id=nil) data = { 'security_group_rule' => { 'parent_group_id' => parent_group_id, 'ip_protocol' => ip_protocol, 'from_port' => from_port, 'to_port' => to_port, 'cidr' => cidr, 'group_id' => group_id } } request( :expects => 200, :method => 'POST', :body => Fog::JSON.encode(data), :path => 'os-security-group-rules.json' ) end end class Mock def create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id=nil) parent_group_id = parent_group_id.to_i response = Excon::Response.new response.status = 200 response.headers = { 'X-Compute-Request-Id' => "req-#{Fog::Mock.random_hex(32)}", 'Content-Type' => 'application/json', 'Content-Length' => Fog::Mock.random_numbers(3).to_s, 'Date' => Date.new } rule = { 'id' => Fog::Mock.random_numbers(2).to_i, 'from_port' => from_port, 'group' => group_id || {}, 'ip_protocol' => ip_protocol, 'to_port' => to_port, 'parent_group_id' => parent_group_id, 'ip_range' => { 'cidr' => cidr } } self.data[:security_groups][parent_group_id.to_s]['rules'].push(rule) response.body = { 'security_group_rule' => rule } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/update_server.rb0000644000004100000410000000146612600047642024446 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_server(server_id, options = {}) request( :body => Fog::JSON.encode({ 'server' => options }), :expects => 200, :method => 'PUT', :path => "servers/#{server_id}.json" ) end end class Mock def update_server(server_id, options = {}) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} if options['name'] server['name'] = options['name'] end response.status = 200 response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_zones.rb0000644000004100000410000000140012600047642023753 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_zones(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-availability-zone.json', :query => options ) end end class Mock def list_zones(options = {}) Excon::Response.new( :body => { "availabilityZoneInfo" => [ { "zoneState" => { "available" => true }, "hosts" => nil, "zoneName" => "nova" } ] }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/start_server.rb0000644000004100000410000000115712600047642024316 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Start the server. # # === Parameters # * server_id <~String> - The ID of the server to be started. # === Returns # * success <~Boolean> def start_server(server_id) body = { 'os-start' => nil } server_action(server_id, body).status == 202 end # def start_server end # class Real class Mock def start_server(server_id) true end # def start_server end # class Mock end # class OpenStack end # module Compute end # module Fogfog-1.34.0/lib/fog/openstack/requests/compute/update_aggregate.rb0000644000004100000410000000200012600047642025047 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_aggregate(uuid, options = {}) vanilla_options = ['name', 'availability_zone'] data = {'aggregate' => {}} vanilla_options.select{|o| options[o]}.each do |key| data['aggregate'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "os-aggregates/#{uuid}" ) end end class Mock def update_aggregate(uuid, options = {}) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {'aggregate' => self.data[:aggregates].first} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_images_detail.rb0000644000004100000410000000200512600047642025406 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_images_detail(filters = {}) request( :expects => [200, 203], :method => 'GET', :path => 'images/detail.json', :query => filters ) end end class Mock def list_images_detail(filters = {}) response = Excon::Response.new images = self.data[:images].values for image in images case image['status'] when 'SAVING' if Time.now - self.data[:last_modified][:images][image['id']] >= Fog::Mock.delay image['status'] = 'ACTIVE' end end end response.status = [200, 203][rand(1)] response.body = { 'images' => images.map {|image| image.reject {|key, value| !['id', 'name', 'links', 'minRam', 'minDisk', 'metadata', 'status', 'updated'].include?(key)}} } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_volume_details.rb0000644000004100000410000000121212600047642025436 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_volume_details(volume_id) request( :expects => 200, :method => 'GET', :path => "os-volumes/#{volume_id}" ) end end class Mock def get_volume_details(volume_id) response = Excon::Response.new if data = self.data[:volumes][volume_id] response.status = 200 response.body = { 'volume' => data } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_zones_detailed.rb0000644000004100000410000000343412600047642025617 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_zones_detailed(options = {}) request( :expects => 200, :method => 'GET', :path => 'os-availability-zone/detail.json', :query => options ) end end class Mock def list_zones_detailed(options = {}) Excon::Response.new( :body => { "availabilityZoneInfo" => [ { "zoneState" => { "available" => true}, "hosts" => { "instack.localdomain" => { "nova-conductor" => { "available" => true, "active" => true, "updated_at" => "2015-07-22T07:40:08.000000"}, "nova-scheduler" => { "available" => true, "active" => true, "updated_at" => "2015-07-22T07:40:04.000000"}, "nova-consoleauth" => { "available" => true, "active" => true, "updated_at" => "2015-07-22T07:40:09.000000"}}}, "zoneName" => "internal" }, { "zoneState" => { "available" => true}, "hosts" => { "instack.localdomain" => { "nova-compute" => { "available" => true, "active" => true, "updated_at" => "2015-07-22T07:40:04.000000"}}}, "zoneName" => "nova"}]}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_hosts.rb0000644000004100000410000000124212600047642023761 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_hosts(options = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-hosts.json', :query => options ) end end class Mock def list_hosts(options = {}) response = Excon::Response.new response.status = 200 response.body = { "hosts" => [ {"host_name" => "host.test.net", "service"=>"compute", "zone" => "az1"} ] } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_servers.rb0000644000004100000410000000163612600047642024321 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_servers(options = {}) params = options.dup if params[:all_tenants] params['all_tenants'] = 'True' params.delete(:all_tenants) end request( :expects => [200, 203], :method => 'GET', :path => 'servers.json', :query => params ) end end class Mock def list_servers(options = {}) response = Excon::Response.new data = list_servers_detail.body['servers'] servers = [] for server in data servers << server.reject { |key, value| !['id', 'name', 'links'].include?(key) } end response.status = [200, 203][rand(1)] response.body = { 'servers' => servers } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/reset_server_state.rb0000644000004100000410000000074312600047642025503 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def reset_server_state(server_id, status) body = { 'os-resetState' => { 'state' => status } } server_action(server_id, body, 202) end end class Mock def reset_server_state(server_id, status) response = get_server_details(server_id) response.body['server']['status'] = status.upcase response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/update_metadata.rb0000644000004100000410000000220112600047642024704 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def update_metadata(collection_name, parent_id, metadata = {}) request( :body => Fog::JSON.encode({ 'metadata' => metadata }), :expects => 200, :method => 'POST', :path => "#{collection_name}/#{parent_id}/metadata.json" ) end end class Mock def update_metadata(collection_name, parent_id, metadata = {}) if collection_name == "images" then if not list_images_detail.body['images'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end if collection_name == "servers" then if not list_servers_detail.body['servers'].find {|_| _['id'] == parent_id} raise Fog::Compute::OpenStack::NotFound end end #FIXME join w/ existing metadata here response = Excon::Response.new response.body = { "metadata" => metadata } response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_addresses.rb0000644000004100000410000000133012600047642024574 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips.json" ) end end class Mock def list_addresses(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} response.status = [200, 203][rand(1)] response.body = { 'addresses' => server['addresses'] } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_tenants.rb0000644000004100000410000000252112600047642024276 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_tenants response = @identity_connection.request({ :expects => [200, 204], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token}, :method => 'GET', :path => '/v2.0/tenants' }) response.body = Fog::JSON.decode(response.body) response end end class Mock def list_tenants response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { 'tenants_links' => [], 'tenants' => [ {'id' => '1', 'description' => 'Has access to everything', 'enabled' => true, 'name' => 'admin'}, {'id' => '2', 'description' => 'Normal tenant', 'enabled' => true, 'name' => 'default'}, {'id' => '3', 'description' => 'Disabled tenant', 'enabled' => false, 'name' => 'disabled'} ] } response end end # class Mock end #class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_image.rb0000644000004100000410000000173012600047642024174 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_image(image_id) request( :expects => 204, :method => 'DELETE', :path => "images/#{image_id}" ) end end class Mock def delete_image(image_id) response = Excon::Response.new if image = list_images_detail.body['images'].find {|_| _['id'] == image_id} if image['status'] == 'SAVING' response.status = 409 raise(Excon::Errors.status_error({:expects => 202}, response)) else self.data[:last_modified][:images].delete(image_id) self.data[:images].delete(image_id) response.status = 202 end response else response.status = 400 raise(Excon::Errors.status_error({:expects => 202}, response)) end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_security_group_rule.rb0000644000004100000410000000175212600047642027230 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_security_group_rule(security_group_rule_id) request( :expects => 202, :method => 'DELETE', :path => "os-security-group-rules/#{security_group_rule_id}" ) end end class Mock def delete_security_group_rule(security_group_rule_id) security_group = self.data[:security_groups].values.find{|sg| sg["rules"].find{ |sgr| sgr["id"].to_s == security_group_rule_id.to_s }} security_group["rules"].reject! { |sgr| sgr["id"] == security_group_rule_id } response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_volumes.rb0000644000004100000410000000217512600047642024321 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_volumes(options = true) if options.is_a?(Hash) path = 'os-volumes' query = options else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if options Fog::Logger.deprecation('Calling OpenStack[:compute].list_volumes(true) is deprecated, use .list_volumes_detail instead') else Fog::Logger.deprecation('Calling OpenStack[:compute].list_volumes(false) is deprecated, use .list_volumes({}) instead') end path = options ? 'os-volumes/detail' : 'os-volumes' query = {} end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end end class Mock def list_volumes(options = true) Excon::Response.new( :body => { 'volumes' => self.data[:volumes].values }, :status => 200 ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/rebuild_server.rb0000644000004100000410000000206212600047642024603 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil) body = { 'rebuild' => { 'imageRef' => image_ref, 'name' => name }} body['rebuild']['adminPass'] = admin_pass if admin_pass body['rebuild']['metadata'] = metadata if metadata if personality body['rebuild']['personality'] = [] for file in personality body['rebuild']['personality'] << { 'contents' => Base64.encode64(file['contents']), 'path' => file['path'] } end end server_action(server_id, body, 202) end end class Mock def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil) response = get_server_details(server_id) response.body['server']['status'] = "REBUILD" response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/associate_address.rb0000644000004100000410000000160112600047642025245 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def associate_address(server_id, ip_address) body = { "addFloatingIp" => {"address" => ip_address}} server_action(server_id, body) end end class Mock def associate_address(server_id, ip_address) server = data[:servers][server_id] server["addresses"]['mocknet'] ||= [] ip_hash = {"OS-EXT-IPS-MAC:mac_addr"=>"fa:16:3e:85:47:40", "version"=>4, "addr"=>ip_address, "OS-EXT-IPS:type"=>"floating"} server["addresses"]['mocknet'] << ip_hash response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html, charset=UTF-8", "Content-Length" => "0", "Date"=> Date.new } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_server.rb0000644000004100000410000001656412600047642024434 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_server(name, image_ref, flavor_ref, options = {}) data = { 'server' => { 'flavorRef' => flavor_ref, 'imageRef' => image_ref, 'name' => name } } vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6', 'availability_zone', 'user_data', 'key_name', 'adminPass', 'config_drive', 'min_count', 'max_count', 'return_reservation_id' ] vanilla_options.select{|o| options[o]}.each do |key| data['server'][key] = options[key] end if options['security_groups'] # security names requires a hash with a name prefix data['server']['security_groups'] = Array(options['security_groups']).map do |sg| name = if sg.is_a?(Fog::Compute::OpenStack::SecurityGroup) then sg.name else sg end { :name => name } end end if options['personality'] data['server']['personality'] = [] for file in options['personality'] data['server']['personality'] << { 'contents' => Base64.encode64(file['contents'] || file[:contents]), 'path' => file['path'] || file[:path] } end end if options['nics'] data['server']['networks'] = Array(options['nics']).map do |nic| neti = { 'uuid' => (nic['net_id'] || nic[:net_id]) } neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil? neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil? neti end end if options['os:scheduler_hints'] data['os:scheduler_hints'] = options['os:scheduler_hints'] end if (block_device_mapping = options['block_device_mapping_v2']) data['server']['block_device_mapping_v2'] = [block_device_mapping].flatten.collect do |mapping| { 'boot_index' => mapping[:boot_index], 'delete_on_termination' => mapping[:delete_on_termination], 'destination_type' => mapping[:destination_type], 'device_name' => mapping[:device_name], 'source_type' => mapping[:source_type], 'uuid' => mapping[:uuid], 'volume_size' => mapping[:volume_size], } end elsif (block_device_mapping = options['block_device_mapping']) data['server']['block_device_mapping'] = [block_device_mapping].flatten.collect do |mapping| { 'delete_on_termination' => mapping[:delete_on_termination], 'device_name' => mapping[:device_name], 'volume_id' => mapping[:volume_id], 'volume_size' => mapping[:volume_size], } end end path = block_device_mapping ? 'os-volumes_boot.json' : 'servers.json' request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => path ) end end class Mock def create_server(name, image_ref, flavor_ref, options = {}) response = Excon::Response.new response.status = 202 server_id = Fog::Mock.random_numbers(6).to_s identity = Fog::Identity::OpenStack.new :openstack_auth_url => credentials[:openstack_auth_url] user = identity.users.find { |u| u.name == @openstack_username } user_id = if user then user.id else response = identity.create_user(@openstack_username, 'password', "#{@openstack_username}@example.com") response.body["user"]["id"] end mock_data = { 'addresses' => {"Private" => [{"addr" => Fog::Mock.random_ip }]}, 'flavor' => {"id" => flavor_ref, "links"=>[{"href"=>"http://nova1:8774/admin/flavors/1", "rel"=>"bookmark"}]}, 'id' => server_id, 'image' => {"id" => image_ref, "links"=>[{"href"=>"http://nova1:8774/admin/images/#{image_ref}", "rel"=>"bookmark"}]}, 'links' => [{"href"=>"http://nova1:8774/v1.1/admin/servers/5", "rel"=>"self"}, {"href"=>"http://nova1:8774/admin/servers/5", "rel"=>"bookmark"}], 'hostId' => "123456789ABCDEF01234567890ABCDEF", 'metadata' => options['metadata'] || {}, 'name' => name || "server_#{rand(999)}", 'accessIPv4' => options['accessIPv4'] || "", 'accessIPv6' => options['accessIPv6'] || "", 'progress' => 0, 'status' => 'BUILD', 'created' => '2012-09-27T00:04:18Z', 'updated' => '2012-09-27T00:04:27Z', 'user_id' => @openstack_username, 'config_drive' => options['config_drive'] || '', } if nics = options['nics'] nics.each do |nic| mock_data["addresses"].merge!( "Public" => [{ 'addr' => Fog::Mock.random_ip }] ) end end response_data = {} if options['return_reservation_id'] == 'True' then response_data = { 'reservation_id' => "r-#{Fog::Mock.random_numbers(6).to_s}" } else response_data = { 'adminPass' => 'password', 'id' => server_id, 'links' => mock_data['links'], } end if block_devices = options["block_device_mapping_v2"] block_devices.each { |bd| compute.volumes.get(bd[:uuid]).attach(server_id, bd[:device_name]) } elsif block_device = options["block_device_mapping"] compute.volumes.get(block_device[:volume_id]).attach(server_id, block_device[:device_name]) end self.data[:last_modified][:servers][server_id] = Time.now self.data[:servers][server_id] = mock_data if security_groups = options['security_groups'] then groups = Array(options['security_groups']).map do |sg| if sg.is_a?(Fog::Compute::OpenStack::SecurityGroup) then sg.name else sg end end self.data[:server_security_group_map][server_id] = groups response_data['security_groups'] = groups end self.data[:last_modified][:servers][server_id] = Time.now self.data[:servers][server_id] = mock_data if options['return_reservation_id'] == 'True' then response.body = response_data else response.body = { 'server' => response_data } end response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_metadata.rb0000644000004100000410000000107312600047642024207 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_metadata(collection_name, parent_id, key) request( :expects => [200, 203], :method => 'GET', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end end class Mock def get_metadata(collection_name, parent_id, key) response = Excon::Response.new response.status = 200 response.body = { 'meta' => {} } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/shelve_offload_server.rb0000644000004100000410000000133212600047642026134 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Shelve Off load the server. Data and resource associations are deleted. # # === Parameters # * server_id <~String> - The ID of the server to be shelve off loaded # === Returns # * success <~Boolean> def shelve_offload_server(server_id) body = { 'shelveOffload' => nil } server_action(server_id, body).status == 202 end # def shelve_off_load_server end # class Real class Mock def shelve_offload_server(server_id) true end # def shelve_off_load_server end # class Mock end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/list_all_addresses.rb0000644000004100000410000000325112600047642025430 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_all_addresses(options = {}) request( :expects => [200, 203], :method => 'GET', :path => "os-floating-ips.json", :query => options ) end end class Mock def list_all_addresses(options = {}) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26", "Content-Type" => "application/json", "Content-Length" => "378", "Date"=> Date.new } response.body = { "floating_ips" => [ { "instance_id" => nil, "ip" => "192.168.27.129", "fixed_ip" => nil, "id" => 1, "pool" => "nova" }, { "instance_id" => nil, "ip" => "192.168.27.130", "fixed_ip" => nil, "id" => 2, "pool" => "nova" }, { "instance_id" => nil, "ip" => "192.168.27.131", "fixed_ip" => nil, "id" => 3, "pool" => "nova" }, { "instance_id" => nil, "ip" => "192.168.27.132", "fixed_ip" => nil, "id" => 4, "pool" => "nova" } ] } response end end # mock end # openstack end # Compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/get_server_volumes.rb0000644000004100000410000000135712600047642025514 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_server_volumes(server_id) request( :expects => 200, :method => 'GET', :path => "/servers/#{server_id}/os-volume_attachments" ) end end class Mock def get_server_volumes(server_id) response = Excon::Response.new response.status = 200 data = self.data[:volumes].values.select do |vol| vol['attachments'].find { |attachment| attachment["serverId"] == server_id } end response.body = { 'volumeAttachments' => data.map! { |vol| vol['attachments'] }.flatten(1) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_key_pair.rb0000644000004100000410000000126512600047642024720 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_key_pair(key_name) request( :expects => 202, :method => 'DELETE', :path => "os-keypairs/#{key_name}" ) end end class Mock def delete_key_pair(key_name) response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_key_pairs.rb0000644000004100000410000000237312600047642024615 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_key_pairs(options = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-keypairs.json', :query => options ) end end class Mock def list_key_pairs(options = {}) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-c373a42c-2825-4e60-8d34-99416ea850be", "Content-Type" => "application/json", "Content-Length" => "360", "Date" => Date.new} response.body = { "keypairs" => [{ "keypair" => { "public_key" => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDCdAZLjln1tJbLVVkNHjWFSoKen2nZbk39ZfqhZJOMdeFdz02GWBS4rcuHboeGg/gozKRwsLu4N6NLPlYtbK/NapJIvgO/djBp+FG1QZNtLPsx7j4hVJac3yISGms+Xtu4cEv6j5sFDzAgTQbWz0Z1+9qOq9ngdaoW+YClfQ== vagrant@nova\n", "name" => "test_key", "fingerprint" => "97:86:f4:15:68:0c:7b:a7:e5:8f:f0:bd:1f:27:65:ad" } }] } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/get_image_details.rb0000644000004100000410000000130012600047642025207 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_image_details(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}.json" ) end end class Mock def get_image_details(image_id) response = Excon::Response.new if image = list_images_detail.body['images'].find {|_| _['id'] == image_id} response.status = [200, 203][rand(1)] response.body = { 'image' => image } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_limits.rb0000644000004100000410000000571412600047642023736 0ustar www-datawww-datamodule Fog module Compute class OpenStack # http://docs.openstack.org/api/openstack-compute/2/content/ProgramaticLimits.html # class Real def get_limits request( :expects => 200, :method => 'GET', :path => '/limits.json' ) end end class Mock def get_limits rate_limits = [ { 'regex' => '.*', 'limit' => [ { 'next-available' => '2012-11-22T16:13:44Z', 'unit' => 'MINUTE', 'verb' => 'POST', 'remaining' => 9, 'value' => 10 }, { 'next-available' => '2012-11-23T00:46:14Z', 'unit' => 'MINUTE', 'verb' => 'PUT', 'remaining' => 10, 'value' => 10 }, { 'next-available' => '2012-11-22T16:14:30Z', 'unit' => 'MINUTE', 'verb' => 'DELETE', 'remaining' => 99, 'value' => 100 } ], 'uri' => '*' }, { 'regex' => '^/servers', 'limit' => [ { 'next-available' => '2012-11-23T00:46:14Z', 'unit' => 'DAY', 'verb' => 'POST', 'remaining' => 50, 'value' => 50} ], 'uri'=>'*/servers' }, { 'regex' => '.*changes-since.*', 'limit' => [ { 'next-available' => '2012-11-23T00:46:14Z', 'unit' => 'MINUTE', 'verb' => 'GET', 'remaining' => 3, 'value' => 3 } ], 'uri' => '*changes-since*' } ] absolute_limits = { # Max 'maxServerMeta' => 128, 'maxTotalInstances' => 10, 'maxPersonality' => 5, 'maxImageMeta' => 128, 'maxPersonalitySize' => 10240, 'maxSecurityGroupRules' => 20, 'maxTotalKeypairs' => 100, 'maxSecurityGroups' => 10, 'maxTotalCores' => 20, 'maxTotalFloatingIps' => 10, 'maxTotalRAMSize' => 51200, # Used 'totalCoresUsed' => -1, 'totalRAMUsed' => -2048, 'totalInstancesUsed' => -1, 'totalSecurityGroupsUsed' => 0, 'totalFloatingIpsUsed' => 0 } Excon::Response.new( :status => 200, :body => { 'limits' => { 'rate' => rate_limits, 'absolute' => absolute_limits } } ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_services.rb0000644000004100000410000000403612600047642024450 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_services(parameters=nil) if parameters query = parameters.each { |k, v| parameters[k] = URI::encode(v) } else query = {} end request( :expects => [200, 203], :method => 'GET', :path => 'os-services', :query => query ) end end class Mock def list_services(parameters=nil) response = Excon::Response.new response.status = 200 response.body = { "services" => [{ "id" => 1, "binary" => "nova-scheduler", "host" => "host1", "state" => "up", "status" => "disabled", "updated_at" => "2012-10-29T13:42:02.000000", "zone" => "internal", "disabled_reason" => "test2" }, { "id" => 2, "binary" => "nova-compute", "host" => "host1", "state" => "up", "status" => "disabled", "updated_at" => "2012-10-29T13:42:05.000000", "zone" => "nova", "disabled_reason" => "test2" }, { "id" => 3, "binary" => "nova-scheduler", "host" => "host2", "state" => "down", "status" => "enabled", "updated_at" => "2012-09-19T06:55:34.000000", "zone" => "internal", "disabled_reason" => "nil" }, { "id" => 4, "binary" => "nova-compute", "host" => "host2", "state" => "down", "status" => "disabled", "updated_at" => "2012-09-18T08:03:38.000000", "zone" => "nova", "disabled_reason" => "test2" }] } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_address_pools.rb0000644000004100000410000000107512600047642025466 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_address_pools request( :expects => [200, 203], :method => 'GET', :path => "os-floating-ip-pools" ) end end class Mock def list_address_pools response = Excon::Response.new response.status = 200 response.body = { 'floating_ip_pools' => [ { 'name' => 'nova' } ] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/remove_security_group.rb0000644000004100000410000000071612600047642026233 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def remove_security_group(server_id, group_name) body = {'removeSecurityGroup' => { "name" => group_name } } server_action(server_id, body) end end class Mock def remove_security_group(server_id, group_name) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_flavor.rb0000644000004100000410000000122312600047642024400 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_flavor(flavor_id) request( :expects => 202, :method => 'DELETE', :path => "flavors/#{flavor_id}" ) end end class Mock def delete_flavor(flavor_id) response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/detach_volume.rb0000644000004100000410000000142512600047642024410 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def detach_volume(server_id, attachment_id) request( :expects => 202, :method => 'DELETE', :path => "servers/%s/os-volume_attachments/%s" % [server_id, attachment_id] ) end end class Mock def detach_volume(server_id, attachment_id) response = Excon::Response.new if self.data[:volumes][attachment_id] && self.data[:volumes][attachment_id]['attachments'].reject! { |attachment| attachment['serverId'] == server_id } response.status = 202 response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/create_aggregate.rb0000644000004100000410000000207212600047642025041 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def create_aggregate(name, options = {}) data = { 'aggregate' => { 'name' => name } } vanilla_options = ["availability_zone"] vanilla_options.select{|o| options[o]}.each do |key| data['aggregate'][key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates" ) end end class Mock def create_aggregate(name, options = {}) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {'aggregate' => self.data[:aggregates].first} response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/list_flavors_detail.rb0000644000004100000410000000330512600047642025621 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_flavors_detail(options = {}) request( :expects => [200, 203], :method => 'GET', :path => 'flavors/detail.json', :query => options ) end end class Mock def list_flavors_detail(options = {}) response = Excon::Response.new response.status = 200 response.body = { 'flavors' => [ { 'id' => '1', 'name' => '256 server', 'ram' => 256, 'disk' => 10, 'swap' => '1', 'vcpus' => 1, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '2', 'name' => '512 server', 'ram' => 512, 'disk' => 20, 'swap' => '1', 'vcpus' => 2, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '3', 'name' => '1GB server', 'ram' => 1024, 'disk' => 40, 'swap' => '2', 'vcpus' => 2, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '4', 'name' => '2GB server', 'ram' => 2048, 'disk' => 80, 'swap' => '4', 'vcpus' => 4, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '5', 'name' => '4GB server', 'ram' => 4096, 'disk' => 160, 'swap' => '8', 'vcpus' => 8, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '6', 'name' => '8GB server', 'ram' => 8192, 'disk' => 320, 'swap' => '16', 'vcpus' => 16, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] }, { 'id' => '7', 'name' => '15.5GB server', 'ram' => 15872, 'disk' => 620, 'swap' => '32', 'vcpus' => 32, 'OS-FLV-EXT-DATA:ephemeral' => 1, 'links' => [] } ] } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/reboot_server.rb0000644000004100000410000000066112600047642024452 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def reboot_server(server_id, type = 'SOFT') body = { 'reboot' => { 'type' => type }} server_action(server_id, body) end end class Mock def reboot_server(server_id, type = 'SOFT') response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_quota.rb0000644000004100000410000000112212600047642023553 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_quota(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}" ) end end class Mock def get_quota(tenant_id) response = Excon::Response.new response.status = 200 response.body = { 'quota_set' => (self.data[:quota_updated] or self.data[:quota]).merge({'id' => tenant_id}) } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/server_diagnostics.rb0000644000004100000410000000125112600047642025463 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real # Retrieve server diagnostics. # # === Parameters # * server_id <~String> - The ID of the server to retrieve diagnostics. # === Returns # * actions <~Array> def server_diagnostics(server_id) request( :method => 'GET', :path => "servers/#{server_id}/diagnostics" ) end # def server_diagnostics end # class Real class Mock def server_diagnostics(server_id) end # def server_diagnostics end # class Real end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/delete_aggregate.rb0000644000004100000410000000123112600047642025034 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_aggregate(uuid) request( :expects => [200, 202, 204], :method => 'DELETE', :path => "os-aggregates/#{uuid}" ) end end class Mock def delete_aggregate(uuid) response = Excon::Response.new response.status = 200 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/change_server_password.rb0000644000004100000410000000073412600047642026330 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def change_server_password(server_id, admin_password) body = { 'changePassword' => { 'adminPass' => admin_password }} server_action(server_id, body) end end class Mock def change_server_password(server_id, admin_password) response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_public_addresses.rb0000644000004100000410000000136412600047642026141 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_public_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips/public.json" ) end end class Mock def list_public_addresses(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} response.status = [200, 203][rand(1)] response.body = { 'public' => server['addresses']['public'] } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/attach_volume.rb0000644000004100000410000000201112600047642024414 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def attach_volume(volume_id, server_id, device) data = { 'volumeAttachment' => { 'volumeId' => volume_id.to_s, 'device' => device } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "servers/%s/os-volume_attachments" % [server_id] ) end end class Mock def attach_volume(volume_id, server_id, device) response = Excon::Response.new response.status = 200 data = { 'id' => volume_id, 'volumeId' => volume_id, 'serverId' => server_id, 'device' => device } self.data[:volumes][volume_id]['attachments'] << data response.body = { 'volumeAttachment' => data } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/boot_from_snapshot.rb0000644000004100000410000000241312600047642025474 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def boot_from_snapshot(name, image_ref, flavor_ref, options={}) data = { 'server' => { 'flavorRef' => flavor_ref, 'imageRef' => image_ref, 'name' => name } } vanilla_options = ['metadata', 'accessIPv4', 'accessIPv6', 'availability_zone', 'user_data', 'block_device_mapping', 'key_name', 'security_groups'] vanilla_options.select{|o| options[o]}.each do |key| data['server'][key] = options[key] end if options['personality'] data['server']['personality'] = [] for file in options['personality'] data['server']['personality'] << { 'contents' => Base64.encode64(file['contents']), 'path' => file['path'] } end end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => '/os-volumes_boot.json' ) end end end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/compute/release_address.rb0000644000004100000410000000124512600047642024716 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def release_address(address_id) request( :expects => [200, 202], :method => 'DELETE', :path => "os-floating-ips/#{address_id}" ) end end class Mock def release_address(address_id) response = Excon::Response.new response.status = 202 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response.body = {} response end end # mock end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_server_details.rb0000644000004100000410000000131412600047642025440 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_server_details(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}.json" ) end end class Mock def get_server_details(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} response.status = [200, 203][rand(1)] response.body = { 'server' => server } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/list_private_addresses.rb0000644000004100000410000000137112600047642026333 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def list_private_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips/private.json" ) end end class Mock def list_private_addresses(server_id) response = Excon::Response.new if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id} response.status = [200, 203][rand(1)] response.body = { 'private' => server['addresses']['private'] } response else raise Fog::Compute::OpenStack::NotFound end end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb0000644000004100000410000000174712600047642027123 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def get_hypervisor_statistics(tenant_id) request( :expects => 200, :method => 'GET', :path => "os-hypervisors/statistics" ) end end class Mock def get_hypervisor_statistics(tenant_id) response = Excon::Response.new response.status = 200 response.body = { "hypervisor_statistics" => { "count" => 1, "current_workload" => 0, "disk_available_least" => 0, "free_disk_gb" => 1028, "free_ram_mb" => 7680, "local_gb" => 1028, "local_gb_used" => 0, "memory_mb" => 8192, "memory_mb_used" => 512, "running_vms" => 0, "vcpus" => 1, "vcpus_used" => 0 } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/disable_service_log_reason.rb0000644000004100000410000000225512600047642027126 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def disable_service_log_reason(host, binary, disabled_reason, optional_params = nil) data = {"host" => host, "binary" => binary, "disabled_reason" => disabled_reason} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI::encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/disable-log-reason", :query => optional_params ) end end class Mock def disable_service_log_reason(host, binary, disabled_reason, optional_params = nil) response = Excon::Response.new response.status = 200 response.body = { "service" => { "host" => "host1", "binary" => "nova-compute", "status" => "disabled", "disabled_reason" => "test2" } } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/compute/server_action.rb0000644000004100000410000000056612600047642024441 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def server_action(server_id, body, expects=[200,202]) request( :body => Fog::JSON.encode(body), :expects => expects, :method => 'POST', :path => "servers/#{server_id}/action.json" ) end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/migrate_server.rb0000644000004100000410000000061012600047642024602 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def migrate_server(server_id) body = { 'migrate' => nil } server_action(server_id, body) end end class Mock def migrate_server(server_id) response = Excon::Response.new response.status = 202 response end end end end end fog-1.34.0/lib/fog/openstack/requests/compute/delete_service.rb0000644000004100000410000000157712600047642024563 0ustar www-datawww-datamodule Fog module Compute class OpenStack class Real def delete_service(uuid, optional_params = nil) # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI::encode(v) } if optional_params request( :expects => [202, 204], :method => 'DELETE', :path => "os-services/#{uuid}", :query => optional_params ) end end class Mock def delete_service(host, binary, optional_params = nil) response = Excon::Response.new response.status = 204 response.headers = { "Content-Type" => "text/html; charset=UTF-8", "Content-Length" => "0", "Date" => Date.new } response end end # mock end # openstack end # compute end # fog fog-1.34.0/lib/fog/openstack/requests/image/0000755000004100000410000000000012600047642020650 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/image/get_image_by_id.rb0000644000004100000410000000162412600047642024267 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def get_image_by_id(image_id) request( :expects => [200, 204], :method => 'GET', :path => "images/#{image_id}" ) end end # class Real class Mock def get_image_by_id(image_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "images"=>[{ "name"=>"mock-image-name", "size"=>25165824, "disk_format"=>"ami", "container_format"=>"ami", "id"=>"0e09fbd6-43c5-448a-83e9-0d3d05f9747e", "checksum"=>"2f81976cae15c16ef0010c51e3a6c163"}] } response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/list_public_images_detailed.rb0000644000004100000410000000222612600047642026670 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def list_public_images_detailed(options = {}, query_deprecated = nil) if options.is_a?(Hash) query = options elsif options Fog::Logger.deprecation("Calling OpenStack[:glance].list_public_images_detailed(attribute, query) format"\ " is deprecated, call .list_public_images_detailed(attribute => query) instead") query = { options => query_deprecated } else query = {} end request( :expects => [200, 204], :method => 'GET', :path => 'images/detail', :query => query ) end end # class Real class Mock def list_public_images_detailed(options = {}, query_deprecated = nil) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = {'images' => self.data[:images].values} response end # def list_public_images_detailed end # class Mock end # class OpenStack end # module Image end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/create_image.rb0000644000004100000410000000571412600047642023611 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def create_image(attributes) data = { 'Content-Type' =>'application/octet-stream', 'x-image-meta-name' => attributes[:name], 'x-image-meta-disk-format' => attributes[:disk_format], 'x-image-meta-container-format' => attributes[:container_format], 'x-image-meta-size' => attributes[:size], 'x-image-meta-is-public' => attributes[:is_public], 'x-image-meta-min-ram' => attributes[:min_ram], 'x-image-meta-min-disk' => attributes[:min_disk], 'x-image-meta-checksum' => attributes[:checksum], 'x-image-meta-owner' => attributes[:owner], 'x-glance-api-copy-from' => attributes[:copy_from] }.reject {|k,v| v.nil? } body = String.new if attributes[:location] body = File.open(attributes[:location], "rb") # Make sure the image file size is always present data['x-image-meta-size'] = File.size(body) end unless attributes[:properties].nil? attributes[:properties].each do |key,value| data["x-image-meta-property-#{key}"] = value end end request( :headers => data, :body => body, :expects => 201, :method => 'POST', :path => "images" ) ensure body.close if body.respond_to?(:close) end end class Mock def create_image(attributes) response = Excon::Response.new response.status = 201 image_id = Fog::Mock.random_hex(32) image = self.data[:images][image_id] = { 'name' => attributes[:name], 'size' => attributes[:size] || Fog::Mock.random_numbers(8).to_i, 'min_disk' => attributes[:min_disk] || 0, 'disk_format' => attributes[:disk_format] || 'raw', 'created_at' => Time.now.strftime('%FT%T.%6N'), 'container_format' => attributes[:container_format] || 'bare', 'deleted_at' => nil, 'updated_at' => Time.now.strftime('%FT%T.%6N'), 'checksum' => attributes[:checksum] || Fog::Mock.random_hex(32), 'id' => image_id, 'deleted' => false, 'protected' => false, 'is_public' => attributes[:is_public].to_s == 'true', 'status' => 'queued', 'min_ram' => attributes[:min_ram] || 0, 'owner' => attributes[:owner], 'properties' => attributes[:properties] || {} } response.body = { 'image'=> image } response end end end end end fog-1.34.0/lib/fog/openstack/requests/image/set_tenant.rb0000644000004100000410000000057512600047642023350 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate end end class Mock def set_tenant(tenant) true end end end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/get_image_members.rb0000644000004100000410000000141512600047642024631 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def get_image_members(image_id) request( :expects => [200, 204], :method => 'GET', :path => "images/#{image_id}/members" ) end end # class Real class Mock def get_image_members(image_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "members"=>[ {"member_id"=>"ff528b20431645ebb5fa4b0a71ca002f", "can_share"=>false} ] } response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/get_shared_images.rb0000644000004100000410000000142412600047642024630 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def get_shared_images(tenant_id) request( :expects => [200, 204], :method => 'GET', :path => "shared-images/#{tenant_id}" ) end end # class Real class Mock def get_shared_images(tenant_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "shared_images"=>[ {"image_id"=>"ff528b20431645ebb5fa4b0a71ca002f", "can_share"=>false} ] } response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/update_image_members.rb0000644000004100000410000000211112600047642025326 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def update_image_members(image_id, members) # Sample members # [ # {'member_id' => 'tenant1', 'can_share' => true }, # {'member_id' => 'tenant2', 'can_share' => false } # ] data = { 'memberships' => members } request( :body => Fog::JSON.encode(data), :expects => [204], :method => 'PUT', :path => "images/#{image_id}/members" ) end end # class Real class Mock def update_image_members(image_id, members) response = Excon::Response.new response.status = 204 response.body = { 'members' => [ { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => false }, { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => true } ] } response end end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/remove_member_from_image.rb0000644000004100000410000000116412600047642026210 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def remove_member_from_image(image_id, member_id) request( :expects => [200, 204], :method => 'DELETE', :path => "images/#{image_id}/members/#{member_id}" ) end end # class Real class Mock def remove_member_from_image(image_id, member_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/get_image.rb0000644000004100000410000000424512600047642023123 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def get_image(image_id) request( :expects => [200, 204], :method => 'HEAD', :path => "images/#{image_id}" ) end end # class Real class Mock def get_image(image_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.headers= {"X-Image-Meta-Is_public"=>"True", "X-Image-Meta-Min_disk"=>"0", "X-Image-Meta-Property-Ramdisk_id"=>"b45aa128-cd36-4ad9-a026-1a1c2bfd8fdc", "X-Image-Meta-Disk_format"=>"ami", "X-Image-Meta-Created_at"=>"2012-02-21T07:32:26", "X-Image-Meta-Container_format"=>"ami", "Etag"=>"2f81976cae15c16ef0010c51e3a6c163", "Location"=>"http://192.168.27.100:9292/v1/images/0e09fbd6-43c5-448a-83e9-0d3d05f9747e", "X-Image-Meta-Protected"=>"False", "Date"=>"Fri, 24 Feb 2012 02:14:25 GMT", "X-Image-Meta-Name"=>"cirros-0.3.0-x86_64-blank", "X-Image-Meta-Min_ram"=>"0", "Content-Type"=>"text/html; charset=UTF-8", "X-Image-Meta-Updated_at"=>"2012-02-21T07:32:29", "X-Image-Meta-Property-Kernel_id"=>"cd28951e-e1c2-4bc5-95d3-f0495abbcdc5", "X-Image-Meta-Size"=>"25165824", "X-Image-Meta-Checksum"=>"2f81976cae15c16ef0010c51e3a6c163", "X-Image-Meta-Deleted"=>"False", "Content-Length"=>"0", "X-Image-Meta-Owner"=>"ff528b20431645ebb5fa4b0a71ca002f", "X-Image-Meta-Status"=>"active", "X-Image-Meta-Id"=>"0e09fbd6-43c5-448a-83e9-0d3d05f9747e"} response.body = "" response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/delete_image.rb0000644000004100000410000000067712600047642023613 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def delete_image(image_id) request( :expects => 200, :method => 'DELETE', :path => "images/#{image_id}" ) end end class Mock def delete_image(image_id) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/image/add_member_to_image.rb0000644000004100000410000000114712600047642025123 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def add_member_to_image(image_id, tenant_id) request( :expects => [200, 204], :method => 'PUT', :path => "images/#{image_id}/members/#{tenant_id}" ) end end # class Real class Mock def add_member_to_image(image_id, tenant_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/image/update_image.rb0000644000004100000410000000476712600047642023637 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def update_image(attributes) data = { 'x-image-meta-name' => attributes[:name], 'x-image-meta-disk-format' => attributes[:disk_format], 'x-image-meta-container-format' => attributes[:container_format], 'x-image-meta-size' => attributes[:size], 'x-image-meta-is-public' => attributes[:is_public], 'x-image-meta-min-ram' => attributes[:min_ram], 'x-image-meta-min-disk' => attributes[:min_disk], 'x-image-meta-checksum' => attributes[:checksum], 'x-image-meta-owner' => attributes[:owner] }.reject {|k,v| v.nil? } unless attributes[:properties].nil? attributes[:properties].each do |key,value| data["x-image-meta-property-#{key}"] = value end end request( :headers => data, :expects => 200, :method => 'PUT', :path => "images/#{attributes[:id]}" ) end end class Mock def update_image(attributes) response = Excon::Response.new response.status = 200 image = self.images.last response.body = { 'image'=> { 'name' => attributes[:name] || image.name, 'size' => image.size, 'min_disk' => (attributes[:min_disk] || image.min_disk).to_i, 'disk_format' => attributes[:disk_format] || image.disk_format, 'created_at' => image.created_at, 'container_format' => attributes[:container_format] || image.container_format, 'deleted_at' => nil, 'updated_at' => Time.now.to_s, 'checksum' => image.checksum, 'id' => attributes[:id], 'deleted' => false, 'protected' => false, 'is_public' => attributes[:is_public] || image.is_public, 'status' => image.status, 'min_ram' => (attributes[:min_ram] || image.min_ram).to_i, 'owner' => attributes[:owner] || image.owner, 'properties' => attributes[:properties] || image.properties } } response end end end end end fog-1.34.0/lib/fog/openstack/requests/image/list_public_images.rb0000644000004100000410000000176412600047642025043 0ustar www-datawww-datamodule Fog module Image class OpenStack class Real def list_public_images(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'images', :query => options ) end end # class Real class Mock def list_public_images(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "images"=>[{ "name" => Fog::Mock.random_letters(10), "size" => Fog::Mock.random_numbers(8).to_i, "disk_format" => "iso", "container_format" => "bare", "id" => Fog::Mock.random_hex(36), "checksum" => Fog::Mock.random_hex(32)}] } response end # def list_tenants end # class Mock end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/0000755000004100000410000000000012600047642021374 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/planning/create_plan.rb0000644000004100000410000000165012600047642024200 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def create_plan(parameters) request( :expects => [201], :method => 'POST', :path => "plans", :body => Fog::JSON.encode(parameters) ) end end # class Real class Mock def create_plan(parameters) response = Excon::Response.new response.status = [201][rand(1)] response.body = { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [], "roles" => [], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } response end # def create_plans end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/add_role_to_plan.rb0000644000004100000410000000243612600047642025213 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def add_role_to_plan(plan_uuid, role_uuid) request( :expects => [201], :method => 'POST', :path => "plans/#{plan_uuid}/roles", :body => Fog::JSON.encode({'uuid' => role_uuid}) ) end end # class Real class Mock def add_role_to_plan(plan_uuid, role_uuid) response = Excon::Response.new response.status = [201][rand(1)] response.body = { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [], "roles" => [ { "description" => "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name" => "compute", "uuid" => "f72c0656-5696-4c66-81a5-d6d88a48e385", "version" => 1 } ], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } response end # def add_role_to_plans end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/list_plans.rb0000644000004100000410000000356412600047642024101 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def list_plans(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'plans', :query => options ) end end # class Real class Mock def list_plans(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = [ { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [ { "default" => "guest", "description" => "The password for RabbitMQ", "hidden" => true, "label" => nil, "name" => "compute-1 => =>RabbitPassword", "value" => "secret-password" }, { "default" => "default", "description" => "description", "hidden" => true, "label" => nil, "name" => "name", "value" => "value" }, ], "roles" => [ { "description" => "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name" => "compute", "uuid" => "b7b1583c-5c80-481f-a25b-708ed4a39734", "version" => 1 } ], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } ] response end # def list_plans end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/get_plan.rb0000644000004100000410000000337312600047642023520 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def get_plan(plan_uuid) request( :expects => [200, 204], :method => 'GET', :path => "plans/#{plan_uuid}" ) end end # class Real class Mock def get_plan(parameters=nil) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [ { "default" => "guest", "description" => "The password for RabbitMQ", "hidden" => true, "label" => nil, "name" => "compute-1 => =>RabbitPassword", "value" => "secret-password" }, { "default" => "default", "description" => "description", "hidden" => true, "label" => nil, "name" => "name", "value" => "value" }, ], "roles" => [ { "description" => "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name" => "compute", "uuid" => "b7b1583c-5c80-481f-a25b-708ed4a39734", "version" => 1 } ], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } response end # def get_plan end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/patch_plan.rb0000644000004100000410000000307312600047642024035 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def patch_plan(plan_uuid, parameters) request( :expects => [201], :method => 'PATCH', :path => "plans/#{plan_uuid}", :body => Fog::JSON.encode(parameters) ) end end # class Real class Mock def patch_plan(plan_uuid, parameters) response = Excon::Response.new response.status = [201][rand(1)] response.body = { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [ { "default" => "guest", "description" => "The password for RabbitMQ", "hidden" => true, "label" => nil, "name" => "compute-1::RabbitPassword", "value" => "secret-password" } ], "roles" => [ { "description" => "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name" => "compute", "uuid" => "b7b1583c-5c80-481f-a25b-708ed4a39734", "version" => 1 } ], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } response end # def patch_plans end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/delete_plan.rb0000644000004100000410000000105212600047642024173 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def delete_plan(plan_uuid) request( :expects => [204], :method => 'DELETE', :path => "plans/#{plan_uuid}" ) end end # class Real class Mock def delete_plan(plan_uuid) response = Excon::Response.new response.status = [204][rand(1)] response end # def delete_plans end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/remove_role_from_plan.rb0000644000004100000410000000171012600047642026273 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def remove_role_from_plan(plan_uuid, role_uuid) request( :expects => [200], :method => 'DELETE', :path => "plans/#{plan_uuid}/roles/#{role_uuid}" ) end end # class Real class Mock def remove_role_from_plan(plan_uuid, role_uuid) response = Excon::Response.new response.status = [200][rand(1)] response.body = { "created_at" => "2014-09-26T20:23:14.222815", "description" => "Development testing cloud", "name" => "dev-cloud", "parameters" => [], "roles" => [], "updated_at" => nil, "uuid" => "53268a27-afc8-4b21-839f-90227dd7a001" } response end # def remove_role_from_plan end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/list_roles.rb0000644000004100000410000000161312600047642024101 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def list_roles(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'roles', :query => options ) end end # class Real class Mock def list_roles(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = [ { "description" => "OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name" => "compute", "uuid" => "f72c0656-5696-4c66-81a5-d6d88a48e385", "version" => 1 } ] response end # def list_nodes end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/planning/get_plan_templates.rb0000644000004100000410000000151012600047642025565 0ustar www-datawww-datamodule Fog module Openstack class Planning class Real def get_plan_templates(plan_uuid) request( :expects => [200, 204], :method => 'GET', :path => "plans/#{plan_uuid}/templates" ) end end # class Real class Mock def get_plan_templates(plan_uuid) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "environment.yaml" => "... content of template file ...", "plan.yaml" => "... content of template file ...", "provider-compute-1.yaml" => "... content of template file ..." } response end # def get_plan_templates end # class Mock end # class Planning end # module Openstack end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/0000755000004100000410000000000012600047642021522 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/requests/baremetal/set_node_maintenance.rb0000644000004100000410000000172712600047642026220 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def set_node_maintenance(node_uuid, parameters=nil) if parameters query = parameters.each { |k, v| parameters[k] = URI::encode(v) } else query = {} end request( :expects => [200, 202, 204], :method => 'PUT', :path => "nodes/#{node_uuid}/maintenance", :query => query ) end end class Mock def set_node_maintenance(node_uuid, parameters=nil) response = Excon::Response.new response.status = 202 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/delete_chassis.rb0000644000004100000410000000106312600047642025026 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def delete_chassis(chassis_uuid) data = { :chassis_uuid => chassis_uuid } request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'chassis' ) end end class Mock def delete_chassis(chassis_uuid) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/baremetal/list_drivers.rb0000644000004100000410000000122012600047642024553 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_drivers(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'drivers', :query => options ) end end # class Real class Mock def list_drivers(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "drivers" => self.data[:drivers] } response end # def list_drivers end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/list_chassis_detailed.rb0000644000004100000410000000127512600047642026377 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_chassis_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'chassis/detail', :query => options ) end end # class Real class Mock def list_chassis_detailed(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "chassis" => self.data[:chassis_collection] } response end # def list_chassis_detailed end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/create_node.rb0000644000004100000410000000347412600047642024327 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Create a new node # # === Attributes === # chassis_uuid = UUID of the chassis that this node belongs to # driver = Driver used to control the node [REQUIRED] # driver_info = Key/value pairs used by the driver, such as out-of-band management credentials. Can be # specified multiple times # extra = Record arbitrary key/value metadata. Can be specified multiple times # uuid = Unique UUID for the node # properties = Key/value pairs describing the physical characteristics of the node. This is exported to # Nova and used by the scheduler. Can be specified multiple times def create_node(attributes) desired_options = [ :chassis_uuid, :driver, :driver_info, :extra, :uuid, :properties ] # Filter only allowed creation attributes data = attributes.select { |key, value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200,201], :method => 'POST', :path => 'nodes' ) end end class Mock def create_node(attributes) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:nodes].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/get_node.rb0000644000004100000410000000113312600047642023631 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def get_node(node_id) request( :expects => [200, 204], :method => 'GET', :path => "nodes/#{node_id}" ) end end # class Real class Mock def get_node(node_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = self.data[:nodes].first response end # def get_node end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/create_chassis.rb0000644000004100000410000000241412600047642025030 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Create a new chassis # # === Attributes === # description = Free text description of the chassis # extra = Record arbitrary key/value metadata. Can be specified multiple times def create_chassis(attributes) desired_options = [ :description, :extra ] # Filter only allowed creation attributes data = attributes.select { |key, value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200,201], :method => 'POST', :path => 'chassis' ) end end class Mock def create_chassis(attributes) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:chassis_collection].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/get_chassis.rb0000644000004100000410000000120212600047642024336 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def get_chassis(chassis_uuid) request( :expects => [200, 204], :method => 'GET', :path => "chassis/#{chassis_uuid}" ) end end # class Real class Mock def get_chassis(chassis_uuid) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = self.data[:chassis_collection].first response end # def get_chassis end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/patch_port.rb0000644000004100000410000000240212600047642024210 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Patch a port # # parameter example: # [{:op=> 'replace', :path => "/driver_info/ipmi_address", :value => "192.0.2.1"}] # # === Patch parameter, list of jsonpatch === # op = Operations: 'add', 'replace' or 'remove' # path = Attributes to add/replace or remove (only PATH is necessary on remove), # e.g. /driver_info/ipmi_address # value = Value to set def patch_port(port_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "ports/#{port_uuid}" ) end end class Mock def patch_port(port_uuid, patch) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:ports].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/get_port.rb0000644000004100000410000000113312600047642023670 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def get_port(port_id) request( :expects => [200, 204], :method => 'GET', :path => "ports/#{port_id}" ) end end # class Real class Mock def get_port(port_id) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = self.data[:ports].first response end # def get_port end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/set_node_provision_state.rb0000644000004100000410000000206312600047642027160 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def set_node_provision_state(node_id, provision_state) data = { 'target' => provision_state } request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'PUT', :path => "nodes/#{node_id}/states/provision", :headers => { :'X-OpenStack-Ironic-API-Version' => 'latest' } ) end end class Mock def set_node_provision_state(node_id, provision_state) response = Excon::Response.new response.status = 202 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:nodes].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/get_driver_properties.rb0000644000004100000410000000324512600047642026461 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def get_driver_properties(driver_name) data = { :driver_name => driver_name } request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'GET', :path => "drivers/properties" ) end end # class Real class Mock def get_driver_properties(driver_name) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "pxe_deploy_ramdisk" => "UUID (from Glance) of the ramdisk.", "ipmi_transit_address" => "transit address for bridged request.", "ipmi_terminal_port" => "node's UDP port to connect to.", "ipmi_target_channel" => "destination channel for bridged request.", "ipmi_transit_channel" => "transit channel for bridged request.", "ipmi_local_address" => "local IPMB address for bridged requests. ", "ipmi_username" => "username; default is NULL user. Optional.", "ipmi_address" => "IP address or hostname of the node. Required.", "ipmi_target_address" => "destination address for bridged request.", "ipmi_password" => "password. Optional.", "pxe_deploy_kernel" => "UUID (from Glance) of the deployment kernel.", "ipmi_priv_level" => "privilege level; default is ADMINISTRATOR. ", "ipmi_bridging" => "bridging_type." } response end # def get_driver_properties end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/create_port.rb0000644000004100000410000000247012600047642024361 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Create a new port # # === Attributes === # address = MAC Address for this port # extra = Record arbitrary key/value metadata. Can be specified multiple times # node_uuid = UUID of the node that this port belongs to def create_port(attributes) desired_options = [ :address, :extra, :node_uuid ] # Filter only allowed creation attributes data = attributes.select { |key, value| desired_options.include?(key.to_sym) } request( :body => Fog::JSON.encode(data), :expects => [200,201], :method => 'POST', :path => 'ports' ) end end class Mock def create_port(attributes) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:ports].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/set_node_power_state.rb0000644000004100000410000000165212600047642026267 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def set_node_power_state(node_id, power_state) data = { 'target' => power_state } request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'PUT', :path => "nodes/#{node_id}/states/power" ) end end class Mock def set_node_power_state(node_id, power_state) response = Excon::Response.new response.status = 202 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:nodes].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/patch_node.rb0000644000004100000410000000235612600047642024161 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Patch a node # # parameter example: # [{:op=> 'replace', :path => "/driver", :value => "pxe_ssh"}] # # === Patch parameter, list of jsonpatch === # op = Operations: 'add', 'replace' or 'remove' # path = Attributes to add/replace or remove (only PATH is necessary on remove), # e.g. /driver_info/ipmi_address # value = Value to set def patch_node(node_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "nodes/#{node_uuid}" ) end end class Mock def patch_node(node_uuid, patch) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:nodes].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/delete_node.rb0000644000004100000410000000103712600047642024317 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def delete_node(node_uuid) data = { :node_uuid => node_uuid } request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'nodes' ) end end class Mock def delete_node(node_uuid) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/baremetal/list_nodes_detailed.rb0000644000004100000410000000123512600047642026046 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_nodes_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'nodes/detail', :query => options ) end end # class Real class Mock def list_nodes_detailed(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "nodes" => self.data[:nodes] } response end # def list_nodes end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/delete_port.rb0000644000004100000410000000103712600047642024356 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def delete_port(port_uuid) data = { :port_uuid => port_uuid } request( :body => Fog::JSON.encode(data), :expects => [200, 204], :method => 'DELETE', :path => 'ports' ) end end class Mock def delete_port(port_uuid) response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/openstack/requests/baremetal/list_nodes.rb0000644000004100000410000000166212600047642024217 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_nodes(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'nodes', :query => options ) end end # class Real class Mock def list_nodes(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "nodes" => [{ "instance_uuid" => Fog::UUID.uuid, "maintenance" => false, "power_state" => "power on", "provision_state" => "active", "uuid" => Fog::UUID.uuid, "links" => [] }] } response end # def list_nodes end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/list_ports_detailed.rb0000644000004100000410000000123512600047642026105 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_ports_detailed(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'ports/detail', :query => options ) end end # class Real class Mock def list_ports_detailed(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "ports" => self.data[:ports] } response end # def list_ports end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/list_chassis.rb0000644000004100000410000000232412600047642024540 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_chassis(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'chassis', :query => options ) end end # class Real class Mock def list_chassis(parameters=nil) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "chassis" => [ { "description" => "Sample chassis", "links" => [ { "href" => "http =>//localhost:6385/v1/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89", "rel" => "self" }, { "href" => "http =>//localhost:6385/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89", "rel" => "bookmark" } ], "uuid" => Fog::UUID.uuid } ] } response end # def list_chassis end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/list_ports.rb0000644000004100000410000000224712600047642024256 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def list_ports(options = {}) request( :expects => [200, 204], :method => 'GET', :path => 'ports', :query => options ) end end # class Real class Mock def list_ports(options = {}) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = { "ports" => [ { "address" => "fe:54:00:77:07:d9", "links" => [ { "href" => "http://localhost:6385/v1/ports/27e3153e-d5bf-4b7e-b517-fb518e17f34c", "rel" => "self" }, { "href" => "http://localhost:6385/ports/27e3153e-d5bf-4b7e-b517-fb518e17f34c", "rel" => "bookmark" } ], "uuid" => Fog::UUID.uuid } ] } response end # def list_ports end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/get_driver.rb0000644000004100000410000000116112600047642024200 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def get_driver(driver_name) request( :expects => [200, 204], :method => 'GET', :path => "drivers/#{driver_name}" ) end end # class Real class Mock def get_driver(driver_name) response = Excon::Response.new response.status = [200, 204][rand(1)] response.body = self.data[:drivers].first response end # def get_driver end # class Mock end # class OpenStack end # module Baremetal end # module Fog fog-1.34.0/lib/fog/openstack/requests/baremetal/patch_chassis.rb0000644000004100000410000000242212600047642024663 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real # Patch a chassis # # parameter example: # [{:op=> 'replace', :path => "/extra/placement", :value => "somewhere"}] # # === Patch parameter, list of jsonpatch === # op = Operations: 'add', 'replace' or 'remove' # path = Attributes to add/replace or remove (only PATH is necessary on remove), # e.g. /extra/placement # value = Value to set def patch_chassis(chassis_uuid, patch) request( :body => Fog::JSON.encode(patch), :expects => 200, :method => 'PATCH', :path => "chassis/#{chassis_uuid}" ) end end class Mock def patch_chassis(chassis_uuid, patch) response = Excon::Response.new response.status = 200 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response.body = self.data[:chassis_collection].first response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/requests/baremetal/unset_node_maintenance.rb0000644000004100000410000000173612600047642026563 0ustar www-datawww-datamodule Fog module Baremetal class OpenStack class Real def unset_node_maintenance(node_uuid, parameters=nil) if parameters query = parameters.each { |k, v| parameters[k] = URI::encode(v) } else query = {} end request( :expects => [200, 202, 204], :method => 'DELETE', :path => "nodes/#{node_uuid}/maintenance", :query => query ) end end class Mock def unset_node_maintenance(node_uuid, parameters=nil) response = Excon::Response.new response.status = 202 response.headers = { "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf", "Content-Type" => "application/json", "Content-Length" => "356", "Date" => Date.new } response end end # mock end # openstack end # baremetal end # fog fog-1.34.0/lib/fog/openstack/network.rb0000644000004100000410000002160212600047642017732 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Network class OpenStack < Fog::Service SUPPORTED_VERSIONS = /v2(\.0)*/ requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id ## MODELS # model_path 'fog/openstack/models/network' model :network collection :networks model :port collection :ports model :subnet collection :subnets model :floating_ip collection :floating_ips model :router collection :routers model :lb_pool collection :lb_pools model :lb_member collection :lb_members model :lb_health_monitor collection :lb_health_monitors model :lb_vip collection :lb_vips model :security_group collection :security_groups model :security_group_rule collection :security_group_rules ## REQUESTS # request_path 'fog/openstack/requests/network' # Network CRUD request :list_networks request :create_network request :delete_network request :get_network request :update_network # Port CRUD request :list_ports request :create_port request :delete_port request :get_port request :update_port # Subnet CRUD request :list_subnets request :create_subnet request :delete_subnet request :get_subnet request :update_subnet # FloatingIp CRUD request :list_floating_ips request :create_floating_ip request :delete_floating_ip request :get_floating_ip request :associate_floating_ip request :disassociate_floating_ip # Router CRUD request :list_routers request :create_router request :delete_router request :get_router request :update_router request :add_router_interface request :remove_router_interface # LBaaS Pool CRUD request :list_lb_pools request :create_lb_pool request :delete_lb_pool request :get_lb_pool request :get_lb_pool_stats request :update_lb_pool # LBaaS Member CRUD request :list_lb_members request :create_lb_member request :delete_lb_member request :get_lb_member request :update_lb_member # LBaaS Health Monitor CRUD request :list_lb_health_monitors request :create_lb_health_monitor request :delete_lb_health_monitor request :get_lb_health_monitor request :update_lb_health_monitor request :associate_lb_health_monitor request :disassociate_lb_health_monitor # LBaaS VIP CRUD request :list_lb_vips request :create_lb_vip request :delete_lb_vip request :get_lb_vip request :update_lb_vip # Security Group request :create_security_group request :delete_security_group request :get_security_group request :list_security_groups # Security Group Rules request :create_security_group_rule request :delete_security_group_rule request :get_security_group_rule request :list_security_group_rules # Tenant request :set_tenant # Quota request :get_quotas request :get_quota request :update_quota request :delete_quota class Mock def self.data @data ||= Hash.new do |hash, key| network_id = Fog::UUID.uuid subnet_id = Fog::UUID.uuid tenant_id = Fog::Mock.random_hex(8) hash[key] = { :networks => { network_id => { 'id' => network_id, 'name' => 'Public', 'subnets' => [subnet_id], 'shared' => true, 'status' => 'ACTIVE', 'tenant_id' => tenant_id, 'provider_network_type' => 'vlan', 'router:external' => false, 'admin_state_up' => true, } }, :ports => {}, :subnets => { subnet_id => { 'id' => subnet_id, 'name' => "Public", 'network_id' => network_id, 'cidr' => "192.168.0.0/22", 'ip_version' => 4, 'gateway_ip' => Fog::Mock.random_ip, 'allocation_pools' => [], 'dns_nameservers' => [Fog::Mock.random_ip, Fog::Mock.random_ip], 'host_routes' => [Fog::Mock.random_ip], 'enable_dhcp' => true, 'tenant_id' => tenant_id, } }, :floating_ips => {}, :routers => {}, :lb_pools => {}, :lb_members => {}, :lb_health_monitors => {}, :lb_vips => {}, :quota => { "subnet" => 10, "router" => 10, "port" => 50, "network" => 10, "floatingip" => 50 }, :quotas => [ { "subnet" => 10, "network" => 10, "floatingip" => 50, "tenant_id" => tenant_id, "router" => 10, "port" => 30 } ], :security_groups => {}, :security_group_rules => {}, } end end def self.reset @data = nil end include Fog::OpenStack::Core def initialize(options={}) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 initialize_identity options end def data self.class.data["#{@openstack_username}-#{@openstack_tenant}"] end def reset_data self.class.data.delete("#{@openstack_username}-#{@openstack_tenant}") end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['network'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate set_api_path @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}"#, })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Network::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end def set_api_path @path.sub!(/\/$/, '') unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS, @openstack_management_uri, @auth_token, @connection_options) end end end end end end fog-1.34.0/lib/fog/openstack/baremetal.rb0000644000004100000410000002467112600047642020206 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Baremetal class OpenStack < Fog::Service SUPPORTED_VERSIONS = /(.)*/ requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id ## MODELS # model_path 'fog/openstack/models/baremetal' model :chassis collection :chassis_collection model :driver collection :drivers model :node collection :nodes model :port collection :ports ## REQUESTS # request_path 'fog/openstack/requests/baremetal' # Node requests request :create_node request :delete_node request :get_node request :list_nodes request :list_nodes_detailed request :patch_node request :set_node_power_state request :set_node_provision_state request :set_node_maintenance request :unset_node_maintenance # Chassis requests request :create_chassis request :delete_chassis request :get_chassis request :list_chassis request :list_chassis_detailed request :patch_chassis # Driver requests request :get_driver request :get_driver_properties request :list_drivers # Port requests request :create_port request :delete_port request :get_port request :list_ports request :list_ports_detailed request :patch_port ## TODO not implemented API requests: ## Chassis # request :list_chassis_nodes # request :list_chassis_nodes_details ## Node requests # request :validate_node # request :get_boot_device # request :set_boot_device # request :list_supported_boot_devices # request :list_node_states # request :get_console_info # request :change_console_state # request :get_vendor_passthru_methods ## Driver requests # request :get_vendor_passthru_methods class Mock def self.data @data ||= Hash.new do |hash, key| chassis_uuid = Fog::UUID.uuid instance_uuid = Fog::UUID.uuid node_uuid = Fog::UUID.uuid hash[key] = { :chassis_collection => [ { "created_at" => "2000-01-01T12:00:00", "description" => "Sample chassis", "extra" => {}, "links" => [ { "href" => "http://localhost:6385/v1/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89", "rel" => "self" }, { "href" => "http://localhost:6385/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89", "rel" => "bookmark" } ], "nodes" => [ { "href" => "http://localhost:6385/v1/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89/nodes", "rel" => "self" }, { "href" => "http://localhost:6385/chassis/eaaca217-e7d8-47b4-bb41-3f99f20eed89/nodes", "rel" => "bookmark" } ], "updated_at" => "2000-01-01T12:00:00", "uuid" => chassis_uuid } ], :drivers => [ { "hosts" => [ "fake-host" ], "name" => "sample-driver" } ], :nodes => [{ "chassis_uuid" => chassis_uuid, "console_enabled" => false, "created_at" => "2000-01-01T12:00:00", "driver" => "sample-driver", "driver_info" => {}, "extra" => {}, "instance_info" => {}, "instance_uuid" => instance_uuid, "last_error" => nil, "links" => [ { "href" => "http://localhost:6385/v1/nodes/1be26c0b-03f2-4d2e-ae87-c02d7f33c123", "rel" => "self" }, { "href" => "http://localhost:6385/nodes/1be26c0b-03f2-4d2e-ae87-c02d7f33c123", "rel" => "bookmark" } ], "maintenance" => false, "maintenance_reason" => nil, "ports" => [ { "href" => "http://localhost:6385/v1/nodes/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ports", "rel" => "self" }, { "href" => "http://localhost:6385/nodes/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ports", "rel" => "bookmark" } ], "power_state" => "power on", "properties" => { "cpus" => "1", "local_gb" => "10", "memory_mb" => "1024" }, "provision_state" => "active", "provision_updated_at" => "2000-01-01T12:00:00", "reservation" => nil, "target_power_state" => nil, "target_provision_state" => nil, "updated_at" => "2000-01-01T12:00:00", "uuid" => node_uuid }], :ports => [{ "address" => "fe:54:00:77:07:d9", "created_at" => "2014-12-23T19:35:30.734116", "extra" => { "foo" => "bar" }, "links" => [ { "href" => "http://localhost:6385/v1/ports/27e3153e-d5bf-4b7e-b517-fb518e17f34c", "rel" => "self" }, { "href" => "http://localhost:6385/ports/27e3153e-d5bf-4b7e-b517-fb518e17f34c", "rel" => "bookmark" } ], "node_uuid" => "7ae81bb3-dec3-4289-8d6c-da80bd8001ae", "updated_at" => "2014-12-23T19:35:30.734119", "uuid" => "27e3153e-d5bf-4b7e-b517-fb518e17f34c" }] } end end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 9292 management_url.path = '/v1' @openstack_management_url = management_url.to_s @data ||= { :users => {} } unless @data[:users].find {|u| u['name'] == options[:openstack_username]} id = Fog::Mock.random_numbers(6).to_s @data[:users][id] = { 'id' => id, 'name' => options[:openstack_username], 'email' => "#{options[:openstack_username]}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_region => @openstack_region, :openstack_management_url => @openstack_management_url } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['baremetal'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS, @openstack_management_uri, @auth_token, @connection_options) end @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}"#, })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/docs/0000755000004100000410000000000012600047642016643 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/docs/planning.md0000644000004100000410000001412612600047642020777 0ustar www-datawww-data# Planning This document explains how to get started using OpenStack Tuskar with Fog. ## Starting irb console Start by executing the following command: ```bash irb ``` Once `irb` has launched you need to require the Fog library. If using Ruby 1.8.x execute: ```ruby require 'rubygems' require 'fog' ``` If using Ruby 1.9.x execute: ```ruby require 'fog' ``` ## Create Service Next, create a connection to Tuskar: ```ruby service = Fog::Openstack.new({ :service => :planning, # OpenStack Fog service :openstack_username => USERNAME, # Your OpenStack Username :openstack_api_key => PASSWORD, # Your OpenStack Password :openstack_auth_url => 'http://YOUR_OPENSTACK_ENDPOINT:PORT/v2.0/tokens' :connection_options => {} # Optional }) ``` ### Optional Connection Parameters Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
Key Description
:connect_timeout Connection timeout (default: 60 seconds)
:read_timeout Read timeout for connection (default: 60 seconds)
:write_timeout Write timeout for connection (default: 60 seconds)
:proxy Proxy for HTTP and HTTPS connections
:ssl_ca_path Path to SSL certificate authorities
:ssl_ca_file SSL certificate authority file
:ssl_verify_peer SSL verify peer (default: true)
## Fog Abstractions Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface. ### Request Layer The `Fog::Openstack[:planning]` object supports a number of methods that wrap individual HTTP requests to the Tuskar API. To see a list of requests supported by the planning service: ```ruby service.requests ``` This returns: ```ruby [ :list_roles, :list_plans, :get_plan_templates, :get_plan, :patch_plan, :create_plan, :delete_plan, :add_role_to_plan, :remove_role_from_plan ] ``` #### Example Request To request a list of plans: ```ruby response = service.list_plans ``` This returns in the following `Excon::Response`: ```ruby # [ { "created_at"=>"2014-09-26T20:23:14.222815", "description"=>"Development testing cloud", "name"=>"dev-cloud", "parameters"=> [ { "default"=>"guest", "description"=>"The password for RabbitMQ", "hidden"=>true, "label"=>nil, "name"=>"compute-1 => =>RabbitPassword", "value"=>"secret-password" }, { "default"=>"default", "description"=>"description", "hidden"=>true, "label"=>nil, "name"=>"name", "value"=>"value" } ], "roles"=> [ { "description"=>"OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.\n", "name"=>"compute", "uuid"=>"b7b1583c-5c80-481f-a25b-708ed4a39734", "version"=>1 } ], "updated_at"=>nil, "uuid"=>"53268a27-afc8-4b21-839f-90227dd7a001" } ], :headers=>{}, :status=>200 }, @body="", @headers={}, @status=nil, @remote_ip=nil, @local_port=nil, @local_address=nil > ``` To view the status of the response: ```ruby response.status ``` **Note**: Fog is aware of the valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception. To view response headers: ```ruby response.headers ``` This will return hash similar to: ```ruby { "X-Account-Bytes-Used"=>"2563554", "Date"=>"Thu, 21 Feb 2013 21:57:02 GMT", "X-Account-Meta-Temp-Url-Key"=>"super_secret_key", "X-Timestamp"=>"1354552916.82056", "Content-Length"=>"0", "Content-Type"=>"application/json; charset=utf-8", "X-Trans-Id"=>"txe934924374a744c8a6c40dd8f29ab94a", "Accept-Ranges"=>"bytes", "X-Account-Container-Count"=>"7", "X-Account-Object-Count"=>"5" } ``` [//]: # (TODO: Specify URL to rubydoc.info when OpenStack Planning service is part of release and pages are built) To learn more about `Fog::Openstack[:planning]` request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon). ### Model Layer Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors. Here is a summary of common model methods:
Method Description
create Accepts hash of attributes and creates object.
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
save Saves object.
Note: not all objects support updating object.
destroy Destroys object.
Note: this is a non-blocking call and object deletion might not be instantaneous.
reload Updates object with latest state from service.
attributes Returns a hash containing the list of model attributes and values.
identity Returns the identity of the object.
Note: This might not always be equal to object.id.
The remainder of this document details the model abstraction. ## Additional Resources * [fog.io](http://fog.io/) * [Fog rdoc](http://rubydoc.info/gems/fog/) * [Fog Github repo](https://github.com/fog/fog) * [Fog Github Issues](https://github.com/fog/fog/issues) * [Excon Github repo](https://github.com/geemus/excon) * [Tuskar API](http://docs.openstack.org/developer/tuskar/) ## Support and Feedback Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues). fog-1.34.0/lib/fog/openstack/docs/compute.md0000644000004100000410000007516412600047642020656 0ustar www-datawww-data#Compute (Nova) This document explains how to get started using OpenStack Compute (Nova) with Fog. It assumes you have read the [Getting Started with Fog and the OpenStack](getting_started.md) document. ## Starting irb console Start by executing the following command: irb Once `irb` has launched you need to require the Fog library by executing: require 'fog' ## Create Service Next, create a connection to the Compute Service: service = Fog::Compute.new({ :provider => 'openstack', # OpenStack Fog provider :openstack_auth_url => 'http://KEYSTONE_HOST:KEYSTONE_PORT/v2.0/tokens', # OpenStack Keystone endpoint :openstack_username => OPEN_STACK_USER, # Your OpenStack Username :openstack_tenant => OPEN_STACK_TENANT, # Your tenant id :openstack_api_key => OPEN_STACK_PASSWORD, # Your OpenStack Password :connection_options => {} # Optional }) **Note** `openstack_username` and `openstack_tenant` default to `admin` if omitted. ### Optional Connection Parameters Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
Key Description
:connect_timeout Connection timeout (default: 60 seconds)
:read_timeout Read timeout for connection (default: 60 seconds)
:write_timeout Write timeout for connection (default: 60 seconds)
:proxy Proxy for HTTP and HTTPS connections
:ssl_ca_path Path to SSL certificate authorities
:ssl_ca_file SSL certificate authority file
:ssl_verify_peer SSL verify peer (default: true)
## Fog Abstractions Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface. ### Request Layer The request abstraction maps directly to the [OpenStack Compute API](http://docs.openstack.org/api/openstack-compute/2/content/). It provides the most efficient interface to the OpenStack Compute service. To see a list of requests supported by the service: service.requests This returns: :list_servers, :list_servers_detail, :create_server, :get_server_details, :update_server, :delete_server, :server_actions, :server_action, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :pause_server, :unpause_server, :suspend_server, :resume_server, :rescue_server, :change_server_password, :add_fixed_ip, :remove_fixed_ip, :server_diagnostics, :boot_from_snapshot, :reset_server_state, :get_console_output, :get_vnc_console, :live_migrate_server, :migrate_server, :list_images, :list_images_detail, :create_image, :get_image_details, :delete_image, :list_flavors, :list_flavors_detail, :get_flavor_details, :create_flavor, :delete_flavor, :add_flavor_access, :remove_flavor_access, :list_tenants_with_flavor_access, :list_metadata, :get_metadata, :set_metadata, :update_metadata, :delete_metadata, :delete_meta, :update_meta, :list_addresses, :list_address_pools, :list_all_addresses, :list_private_addresses, :list_public_addresses, :get_address, :allocate_address, :associate_address, :release_address, :disassociate_address, :list_security_groups, :get_security_group, :create_security_group, :create_security_group_rule, :delete_security_group, :delete_security_group_rule, :get_security_group_rule, :list_key_pairs, :create_key_pair, :delete_key_pair, :list_tenants, :set_tenant, :get_limits, :list_volumes, :create_volume, :get_volume_details, :delete_volume, :attach_volume, :detach_volume, :get_server_volumes, :create_volume_snapshot, :list_snapshots, :get_snapshot_details, :delete_snapshot, :list_usages, :get_usage, :get_quota, :get_quota_defaults, :update_quota, :list_hosts, :get_host_details #### Example Request To request a list of flavors: response = service.list_flavors This returns in the following `Excon::Response`: #{"flavors"=>[{"id"=>"1", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}], "name"=>"m1.tiny"}, {"id"=>"2", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"bookmark"}], "name"=>"m1.small"}, {"id"=>"3", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3", "rel"=>"bookmark"}], "name"=>"m1.medium"}, {"id"=>"4", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4", "rel"=>"bookmark"}], "name"=>"m1.large"}, {"id"=>"42", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42", "rel"=>"bookmark"}], "name"=>"m1.nano"}, {"id"=>"5", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5", "rel"=>"bookmark"}], "name"=>"m1.xlarge"}, {"id"=>"84", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84", "rel"=>"bookmark"}], "name"=>"m1.micro"}]}, :headers=>{"Content-Type"=>"application/json", "Content-Length"=>"1748", "X-Compute-Request-Id"=>"req-ae3bcf11-deab-493b-a2d8-1432dead3f7a", "Date"=>"Thu, 09 Jan 2014 17:01:15 GMT"}, :status=>200, :remote_ip=>"localhost"}, @body="{\"flavors\": [{\"id\": \"1\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1\", \"rel\": \"bookmark\"}], \"name\": \"m1.tiny\"}, {\"id\": \"2\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2\", \"rel\": \"bookmark\"}], \"name\": \"m1.small\"}, {\"id\": \"3\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3\", \"rel\": \"bookmark\"}], \"name\": \"m1.medium\"}, {\"id\": \"4\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4\", \"rel\": \"bookmark\"}], \"name\": \"m1.large\"}, {\"id\": \"42\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42\", \"rel\": \"bookmark\"}], \"name\": \"m1.nano\"}, {\"id\": \"5\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5\", \"rel\": \"bookmark\"}], \"name\": \"m1.xlarge\"}, {\"id\": \"84\", \"links\": [{\"href\": \"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84\", \"rel\": \"self\"}, {\"href\": \"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84\", \"rel\": \"bookmark\"}], \"name\": \"m1.micro\"}]}", @headers={"Content-Type"=>"application/json", "Content-Length"=>"1748", "X-Compute-Request-Id"=>"req-ae3bcf11-deab-493b-a2d8-1432dead3f7a", "Date"=>"Thu, 09 Jan 2014 17:01:15 GMT"}, @status=200, @remote_ip="localhost"> To view the status of the response: response.status **Note**: Fog is aware of valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception. To view response body: response.body This will return: {"flavors"=>[{"id"=>"1", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}], "name"=>"m1.tiny"}, {"id"=>"2", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"bookmark"}], "name"=>"m1.small"}, {"id"=>"3", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/3", "rel"=>"bookmark"}], "name"=>"m1.medium"}, {"id"=>"4", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/4", "rel"=>"bookmark"}], "name"=>"m1.large"}, {"id"=>"42", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/42", "rel"=>"bookmark"}], "name"=>"m1.nano"}, {"id"=>"5", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/5", "rel"=>"bookmark"}], "name"=>"m1.xlarge"}, {"id"=>"84", "links"=>[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/84", "rel"=>"bookmark"}], "name"=>"m1.micro"}]} To learn more about Compute request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Compute/Openstack/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon). ### Model Layer Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors. Here is a summary of common model methods:
Method Description
create Accepts hash of attributes and creates object.
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
save Saves object.
Note: not all objects support updating object.
persisted? Returns true if the object has been persisted.
destroy Destroys object.
Note: this is a non-blocking call and object deletion might not be instantaneous.
reload Updates object with latest state from service.
ready? Returns true if object is in a ready state and able to perform actions. This method will raise an exception if object is in an error state.
attributes Returns a hash containing the list of model attributes and values.
identity Returns the identity of the object.
Note: This might not always be equal to object.id.
wait_for This method periodically reloads model and then yields to specified block until block returns true or a timeout occurs.
The remainder of this document details the model abstraction. ## List Images To retrieve a list of available images: service.images This returns a collection of `Fog::Compute::OpenStack::Image` models: , ] >, links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"bookmark"}, {"href"=>"http://localhost:9292/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}] >, , links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/images/e21af7e2-a181-403a-84a4-fd9df36cb963", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/e21af7e2-a181-403a-84a4-fd9df36cb963", "rel"=>"bookmark"}, {"href"=>"http://localhost:9292/b5bf8e689bc64844b1d08094a2f2bdd5/images/e21af7e2-a181-403a-84a4-fd9df36cb963", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}] >, … ## Get Image To retrieve individual image: service.images.get "821e2b73-5aed-4f9d-aaa7-2f4f297779f3" This returns an `Fog::Compute::OpenStack::Image` instance: , ] >, links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"bookmark"}, {"href"=>"http://localhost:9292/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "type"=>"application/vnd.openstack.image", "rel"=>"alternate"}] > ## List Flavors To retrieve a list of available flavors: service.flavors This returns a collection of `Fog::Compute::OpenStack::Flavor` models: "http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}], swap="", rxtx_factor=1.0, ephemeral=0, is_public=true, disabled=false >, "http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/2", "rel"=>"bookmark"}], swap="", rxtx_factor=1.0, ephemeral=0, is_public=true, disabled=false >, … ## Get Flavor To retrieve individual flavor: service.flavor.get 1 This returns a `Fog::Compute::OpenStack::Flavor` instance: "http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}], swap="", rxtx_factor=1.0, ephemeral=0, is_public=true, disabled=false > ## List Servers To retrieve a list of available servers: service.servers This returns a collection of `Fog::Compute::OpenStack::Servers` models: [{"OS-EXT-IPS-MAC:mac_addr"=>"fa:16:3e:14:34:b8", "version"=>4, "addr"=>"10.0.0.5", "OS-EXT-IPS:type"=>"fixed"}]}, flavor={"id"=>"1", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}]}, host_id="bb705edc279c520d97ad6fbd0b8e75a5c716388616f58e527d0ff633", image={"id"=>"821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"bookmark"}]}, metadata= , links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/servers/4572529c-0cfc-433e-8dbf-7cc383ed5b7c", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/servers/4572529c-0cfc-433e-8dbf-7cc383ed5b7c", "rel"=>"bookmark"}], name="doc-test", personality=nil, progress=0, accessIPv4="", accessIPv6="", availability_zone="nova", user_data_encoded=nil, state="ACTIVE", created=2013-10-10 18:17:46 UTC, updated=2013-10-10 18:17:56 UTC, tenant_id="b5bf8e689bc64844b1d08094a2f2bdd5", user_id="dbee88bc901b4593867c105b2b1ad15b", key_name=nil, fault=nil, config_drive="", os_dcf_disk_config="MANUAL", os_ext_srv_attr_host="devstack", os_ext_srv_attr_hypervisor_hostname="devstack", os_ext_srv_attr_instance_name="instance-00000016", os_ext_sts_power_state=1, os_ext_sts_task_state=nil, os_ext_sts_vm_state="active" >, … ## Get Server To return an individual server: service.servers.get "4572529c-0cfc-433e-8dbf-7cc383ed5b7c" This returns a `Fog::Compute::OpenStack::Server` instance: [{"OS-EXT-IPS-MAC:mac_addr"=>"fa:16:3e:14:34:b8", "version"=>4, "addr"=>"10.0.0.5", "OS-EXT-IPS:type"=>"fixed"}]}, flavor={"id"=>"1", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}]}, host_id="bb705edc279c520d97ad6fbd0b8e75a5c716388616f58e527d0ff633", image={"id"=>"821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"bookmark"}]}, metadata= , links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/servers/4572529c-0cfc-433e-8dbf-7cc383ed5b7c", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/servers/4572529c-0cfc-433e-8dbf-7cc383ed5b7c", "rel"=>"bookmark"}], name="doc-test", personality=nil, progress=0, accessIPv4="", accessIPv6="", availability_zone="nova", user_data_encoded=nil, state="ACTIVE", created=2013-10-10 18:17:46 UTC, updated=2013-10-10 18:17:56 UTC, tenant_id="b5bf8e689bc64844b1d08094a2f2bdd5", user_id="dbee88bc901b4593867c105b2b1ad15b", key_name=nil, fault=nil, config_drive="", os_dcf_disk_config="MANUAL", os_ext_srv_attr_host="devstack", os_ext_srv_attr_hypervisor_hostname="devstack", os_ext_srv_attr_instance_name="instance-00000016", os_ext_sts_power_state=1, os_ext_sts_task_state=nil, os_ext_sts_vm_state="active" > ## Create Server If you are interested in creating a server utilizing ssh key authentication, you are recommended to use [bootstrap](#bootstrap) method. To create a server: flavor = service.flavors.first image = service.images.first server = service.servers.create(:name => 'fog-doc', :flavor_ref => flavor.id, :image_ref => image.id) **Note**: The `:name`, `:flavor_ref`, and `image_ref` attributes are required for server creation. This will return a `Fog::Compute::OpenStack::Server` instance: , links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/servers/81746324-94ab-44fb-9aa9-ee0b4d95fa34", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/servers/81746324-94ab-44fb-9aa9-ee0b4d95fa34", "rel"=>"bookmark"}], name="fog-doc", personality=nil, progress=nil, accessIPv4=nil, accessIPv6=nil, availability_zone=nil, user_data_encoded=nil, state=nil, created=nil, updated=nil, tenant_id=nil, user_id=nil, key_name=nil, fault=nil, config_drive=nil, os_dcf_disk_config="MANUAL", os_ext_srv_attr_host=nil, os_ext_srv_attr_hypervisor_hostname=nil, os_ext_srv_attr_instance_name=nil, os_ext_sts_power_state=nil, os_ext_sts_task_state=nil, os_ext_sts_vm_state=nil > Notice that your server contains several `nil` attributes. To see the latest status, reload the instance as follows: server.reload You can see that the server is currently being built: [{"OS-EXT-IPS-MAC:mac_addr"=>"fa:16:3e:71:0d:c4", "version"=>4, "addr"=>"10.0.0.2", "OS-EXT-IPS:type"=>"fixed"}]}, flavor={"id"=>"1", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/flavors/1", "rel"=>"bookmark"}]}, host_id="bb705edc279c520d97ad6fbd0b8e75a5c716388616f58e527d0ff633", image={"id"=>"821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "links"=>[{"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/images/821e2b73-5aed-4f9d-aaa7-2f4f297779f3", "rel"=>"bookmark"}]}, metadata= , links=[{"href"=>"http://localhost:8774/v2/b5bf8e689bc64844b1d08094a2f2bdd5/servers/5f50aeff-a745-4cbc-9f8b-0356142e6f95", "rel"=>"self"}, {"href"=>"http://localhost:8774/b5bf8e689bc64844b1d08094a2f2bdd5/servers/5f50aeff-a745-4cbc-9f8b-0356142e6f95", "rel"=>"bookmark"}], name="fog-doc", personality=nil, progress=0, accessIPv4="", accessIPv6="", availability_zone="nova", user_data_encoded=nil, state="BUILD", created=2014-01-09 19:43:52 UTC, updated=2014-01-09 19:43:58 UTC, tenant_id="b5bf8e689bc64844b1d08094a2f2bdd5", user_id="dbee88bc901b4593867c105b2b1ad15b", key_name=nil, fault=nil, config_drive="", os_dcf_disk_config="MANUAL", os_ext_srv_attr_host="devstack", os_ext_srv_attr_hypervisor_hostname="devstack", os_ext_srv_attr_instance_name="instance-00000018", os_ext_sts_power_state=0, os_ext_sts_task_state="spawning", os_ext_sts_vm_state="building" > You will be unable to perform any actions to this server until it reaches an `ACTIVE` state. Since this is true for most server actions, Fog provides the convenience method `wait_for`. Fog can wait for the server to become ready as follows: server.wait_for { ready? } **Note**: The `Fog::Compute::OpenStack::Server` instance returned from the create method contains a `password` attribute. The `password` attribute will NOT be present in subsequent retrievals either through `service.servers` or `service.servers.get my_server_id`. ### Additional Parameters The `create` method also supports the following key values:
Key Description
:metadata Hash containing server metadata.
:personality Array of files to be injected onto the server. Please refer to the Fog personality API documentation for further information.
## Bootstrap In addition to the `create` method, Fog provides a `bootstrap` method which creates a server and then performs the following actions via ssh: 1. Create `ROOT_USER/.ssh/authorized_keys` file using the ssh key specified in `:public_key_path`. 2. Lock password for root user using `passwd -l root`. 3. Create `ROOT_USER/attributes.json` file with the contents of `server.attributes`. 4. Create `ROOT_USER/metadata.json` file with the contents of `server.metadata`. **Note**: Unlike the `create` method, `bootstrap` is blocking method call. If non-blocking behavior is desired, developers should use the `:personality` parameter on the `create` method. The following example demonstrates bootstraping a server: service.servers.bootstrap :name => 'bootstrap-server', :flavor_id => service.flavors.first.id, :image_id => service.images.find {|img| img.name =~ /Ubuntu/}.id, :public_key_path => '~/.ssh/fog_rsa.pub', :private_key_path => '~/.ssh/fog_rsa' **Note**: The `:name`, `:flavor_ref`, `:image_ref`, `:public_key_path`, `:private_key_path` are required for the `bootstrap` method. The `bootstrap` method uses the same additional parameters as the `create` method. Refer to the [Additional Parameters](#additional-parameters) section for more information. ## SSH Once a server has been created and set up for ssh key authentication, fog can execute remote commands as follows: result = server.ssh ['pwd'] This will return the following: [#] **Note**: SSH key authentication can be set up using `bootstrap` method or by using the `:personality` attribute on the `:create` method. See [Bootstrap](#bootstrap) or [Create Server](#create-server) for more information. ## Delete Server To delete a server: server.destroy **Note**: The server is not immediately destroyed, but it does occur shortly there after. ## Change Admin Password To change the administrator password: server.change_password "superSecure" ## Reboot To perform a soft reboot: server.reboot To perform a hard reboot: server.reboot 'HARD' ## Rebuild Rebuild removes all data on the server and replaces it with the specified image. The id and all IP addresses remain the same. The rebuild method has the following method signature: def rebuild(image_ref, name, admin_pass=nil, metadata=nil, personality=nil) A basic server build is as follows: image = service.images.first server.rebuild(image.id, name) ## Resize Resizing a server allows you to change the resources dedicated to the server. To resize a server: flavor = service.flavor[2] server.resize flavor.id During the resize process the server will have a state of `RESIZE`. Once a server has completed resizing it will be in a `VERIFY_RESIZE` state. You can use Fog's `wait_for` method to wait for this state as follows: server.wait_for { server.status == 'VERIFY_RESIZE' } In this case, `wait_for` is waiting for the server to become `VERIFY_READY` and will raise an exception if we enter an `ACTIVE` or `ERROR` state. Once a server enters the `VERIFY_RESIZE` we will need to call `confirm_resize` to confirm the server was properly resized or `revert_resize` to rollback to the old size/flavor. **Note:** A server will automatically confirm resize after 24 hours. To confirm resize: server.confirm_resize To revert to previous size/flavor: server.revert_resize ## Create Image To create an image of your server: response = server.create_image "back-image-#{server.name}", :metadata => { :environment => 'development' } You can use the second parameter to specify image metadata. This is an optional parameter.` During the imaging process, the image state will be `SAVING`. The image is ready for use when when state `ACTIVE` is reached. Fog can use `wait_for` to wait for an active state as follows: image_id = response.body["image"]["id"] image = service.images.get image_id image.wait_for { ready? } ## List Attached Volumes To list Cloud Block Volumes attached to server: server.volume_attachments ## Attach Volume To attach volume using the volume id: server.attach_volume "0e7a706c-340d-48b3-802d-192850387f93", "/dev/xvdb" If the volume id is unknown you can look it up as follows: volume = service.volumes.first server.attach_volume volume.id, "/dev/xvdb" **Note** Valid device names are `/dev/xvd[a-p]`. ## Detach Volume To detach a volume: server.detach_volume volume.id ## Examples Example code using Compute can be found [here](https://github.com/fog/fog/tree/master/lib/fog/openstack/examples/compute). ## Additional Resources * [fog.io](http://fog.io/) * [Fog rdoc](http://rubydoc.info/gems/fog/) * [Fog Github repo](https://github.com/fog/fog) * [Fog Github Issues](https://github.com/fog/fog/issues) * [Excon Github repo](https://github.com/geemus/excon) * [OpenStack Compute API](http://docs.openstack.org/api/openstack-compute/2/content/) ## Support and Feedback Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues). fog-1.34.0/lib/fog/openstack/docs/orchestration.md0000644000004100000410000003300212600047642022047 0ustar www-datawww-data# OpenStack Orchestration The mission of the OpenStack Orchestration program is to create a human- and machine-accessible service for managing the entire lifecycle of infrastructure and applications within OpenStack clouds. ## Heat Heat is the main project in the OpenStack Orchestration program. It implements an orchestration engine to launch multiple composite cloud applications based on templates in the form of text files that can be treated like code. A native Heat template format is evolving, but Heat also endeavours to provide compatibility with the AWS CloudFormation template format, so that many existing CloudFormation templates can be launched on OpenStack. Heat provides both an OpenStack-native ReST API and a CloudFormation-compatible Query API. *Why ‘Heat’? It makes the clouds rise!* **How it works** * A Heat template describes the infrastructure for a cloud application in a text file that is readable and writable by humans, and can be checked into version control, diffed, &c. * Infrastructure resources that can be described include: servers, floating ips, volumes, security groups, users, etc. * Heat also provides an autoscaling service that integrates with Ceilometer, so you can include a scaling group as a resource in a template. * Templates can also specify the relationships between resources (e.g. this volume is connected to this server). This enables Heat to call out to the OpenStack APIs to create all of your infrastructure in the correct order to completely launch your application. * Heat manages the whole lifecycle of the application - when you need to change your infrastructure, simply modify the template and use it to update your existing stack. Heat knows how to make the necessary changes. It will delete all of the resources when you are finished with the application, too. * Heat primarily manages infrastructure, but the templates integrate well with software configuration management tools such as Puppet and Chef. The Heat team is working on providing even better integration between infrastructure and software. _Source: [OpenStack Wiki](https://wiki.openstack.org/wiki/Heat)_ # OpenStack Orchestration (Heat) Client [Full OpenStack Orchestration/Heat API Docs](http://developer.openstack.org/api-ref-orchestration-v1.html) ## Orchestration Service Get a handle on the Orchestration service: ```ruby service = Fog::Orchestration::OpenStack.new({ :openstack_auth_url => 'http://KEYSTONE_HOST:KEYSTONE_PORT/v2.0/tokens', # OpenStack Keystone endpoint :openstack_username => OPEN_STACK_USER, # Your OpenStack Username :openstack_tenant => OPEN_STACK_TENANT, # Your tenant id :openstack_api_key => OPEN_STACK_PASSWORD, # Your OpenStack Password :connection_options => {} # Optional }) ``` We will use this `service` to interact with the Orchestration resources, `stack`, `event`, `resource`, and `template` ## Stacks Get a list of stacks you own: ```ruby service.stacks ``` This returns a list of stacks with minimum attributes, leaving other attributes empty ```ruby => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/stack4/0b8e4060-419b-416b-a927-097d4afbf26d", "rel"=>"self"}], notification_topics=nil, outputs=nil, parameters=nil, stack_name="stack4", stack_status="UPDATE_COMPLETE", stack_status_reason="Stack successfully updated", template_description=nil, timeout_mins=nil, creation_time="2014-08-27T21:25:56Z", updated_time="2015-01-30T20:10:43Z" >, ... ``` Create a new `stack` with a [Heat Template (HOT)](http://docs.openstack.org/developer/heat/template_guide/hot_guide.html) or an AWS CloudFormation Template (CFN): ```ruby raw_template = File.read(TEMPLATE_FILE) service.stacks.new.save({ :stack_name => "a_name_for_stack", :template => raw_template, :parameters => {"flavor" => "m1.small", "image" => "cirror"} }) ``` This returns a JSON blob filled with information about our new stack: ```ruby {"id"=>"53b35fbe-34f7-4837-b0f8-8863b7263b7d", "links"=>[{"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/a_name_for_stack/53b35fbe-34f7-4837-b0f8-8863b7263b7d", "rel"=>"self"}]} ``` We can get a reference to the stack using its `stack_name` and `id`: ```ruby stack = service.stacks.get("stack4", "0b8e4060-419b-416b-a927-097d4afbf26d") ``` This returns a stack with all attributes filled ```ruby => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/stack4/0b8e4060-419b-416b-a927-097d4afbf26d", "rel"=>"self"}], notification_topics=[], outputs=[], parameters={"AWS::StackId"=>"arn:openstack:heat::5d139d95546240748508b2a518aa5bef:stacks/stack4/0b8e4060-419b-416b-a927-097d4afbf26d", "AWS::Region"=>"ap-southeast-1", "AWS::StackName"=>"stack4"}, stack_name="stack4", stack_status="UPDATE_COMPLETE", stack_status_reason="Stack successfully updated", template_description="Simple template to deploy a single compute instance", timeout_mins=60, creation_time="2014-08-27T21:25:56Z", updated_time="2015-01-30T20:10:43Z" > ``` It can be also obtained through the details method of a simple stack object ```ruby stack.details ``` A stack knows about related `events`: ```ruby stack.events => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/a_name_for_stack/53b35fbe-34f7-4837-b0f8-8863b7263b7d/resources/my_instance/events/251", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/a_name_for_stack/53b35fbe-34f7-4837-b0f8-8863b7263b7d/resources/my_instance", "rel"=>"resource"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/a_name_for_stack/53b35fbe-34f7-4837-b0f8-8863b7263b7d", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_IN_PROGRESS", resource_status_reason="state changed", physical_resource_id=nil >, ``` A stack knows about related `resources`: ```ruby stack.resources => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_COMPLETE", updated_time="2014-09-12T20:44:06Z", required_by=[], resource_status_reason="state changed", resource_type="OS::Nova::Server" > ] > ``` You can get a stack's `template` ```ruby stack.template => #"", :headers=>{"Content-Type"=>"text/html; charset=UTF-8", "Content-Length"=>"0", "Date"=>"Wed, 21 Jan 2015 20:38:00 GMT"}, :status=>204, :reason_phrase=>"No Content", :remote_ip=>"10.8.96.4", :local_port=>59628, :local_address=>"10.17.68.186"}, @body="", @headers={"Content-Type"=>"text/html; charset=UTF-8", "Content-Length"=>"0", "Date"=>"Wed, 21 Jan 2015 20:38:00 GMT"}, @status=204, @remote_ip="10.8.96.4", @local_port=59628, @local_address="10.17.68.186"> ``` Reload any object by calling `reload` on it: ```ruby stacks.reload => ``` ## Events You can list `Events` of a `stack`: ```ruby stack.events => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance/events/15", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance", "rel"=>"resource"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_IN_PROGRESS", resource_status_reason="state changed", physical_resource_id=nil >, ``` `Event` can be got through corresponding `resource` ```ruby event = service.events.get(stack, resource, event_id) => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance/events/15", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance", "rel"=>"resource"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_IN_PROGRESS", resource_status_reason="state changed", physical_resource_id=nil > ``` An `event` knows about its associated `stack`: ```ruby event.stack => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"self"}], stack_status_reason="Stack create completed successfully", stack_name="progenerated", creation_time="2014-09-12T20:43:58Z", updated_time="2014-09-12T20:44:06Z" > ``` An `event` has an associated `resource`: ```ruby resource = event.resource => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_COMPLETE", updated_time="2014-09-12T20:44:06Z", required_by=[], resource_status_reason="state changed", resource_type="OS::Nova::Server" > ``` ## Resource `resources` might be nested: ```ruby service.resources.all(stack, {:nested_depth => 1}) => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9/resources/my_instance", "rel"=>"self"}, {"href"=>"http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"stack"}], logical_resource_id="my_instance", resource_status="CREATE_COMPLETE", updated_time="2014-09-12T20:44:06Z", required_by=[], resource_status_reason="state changed", resource_type="OS::Nova::Server" > ] > ``` A `resource` knows about its associated `stack`: ```ruby resource.stack => "http://10.8.96.4:8004/v1/5d139d95546240748508b2a518aa5bef/stacks/progenerated/0c9ee370-ef64-4a80-a6cc-65d2277caeb9", "rel"=>"self"}], stack_status_reason="Stack create completed successfully", stack_name="progenerated", creation_time="2014-09-12T20:43:58Z", updated_time="2014-09-12T20:44:06Z" > ``` Resource metadata is visible: ```ruby irb: resource.metadata => {} ``` A `resource's` template is visible (if one exists) ```ruby irb: resource.template => nil ``` ## Validation You can validate a template (either HOT or CFN) before using it: ```ruby service.templates.validate(:template => content) => ``` fog-1.34.0/lib/fog/openstack/docs/storage.md0000644000004100000410000002554712600047642020646 0ustar www-datawww-data# Storage This document explains how to get started using OpenStack Swift with Fog. ## Starting irb console Start by executing the following command: irb Once `irb` has launched you need to require the Fog library. If using Ruby 1.8.x execute: ```ruby require 'rubygems' require 'fog' ``` If using Ruby 1.9.x execute: ```ruby require 'fog' ``` ## Create Service Next, create a connection to Swift: ```ruby service = Fog::Storage.new({ :provider => 'OpenStack', # OpenStack Fog provider :openstack_username => USERNAME, # Your OpenStack Username :openstack_api_key => PASSWORD, # Your OpenStack Password :openstack_auth_url => 'http://YOUR_OPENSTACK_ENDPOINT:PORT/v2.0/tokens' }) ``` Alternative regions are specified using the key `:openstack_region `. A list of regions available for Swift can be found by executing the following: ### Optional Service Parameters The Storage service supports the following additional parameters:
Key Description
:persistent If set to true, the service will use a persistent connection.
:openstack_service_name
:openstack_service_type
:openstack_tenant
:openstack_region
:openstack_temp_url_key
### Optional Connection Parameters Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
Key Description
:connect_timeout Connection timeout (default: 60 seconds)
:write_timeout Write timeout for connection (default: 60 seconds)
:proxy Proxy for HTTP and HTTPS connections
:ssl_ca_path Path to SSL certificate authorities
:ssl_ca_file SSL certificate authority file
:ssl_verify_peer SSL verify peer (default: true)
## Fog Abstractions Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface. ### Request Layer The Fog::Storage object supports a number of methods that wrap individual HTTP requests to the Swift API. To see a list of requests supported by the storage service: service.requests This returns: [:copy_object, :delete_container, :delete_object, :delete_multiple_objects, :delete_static_large_object, :get_container, :get_containers, :get_object, :get_object_http_url, :get_object_https_url, :head_container, :head_containers, :head_object, :put_container, :put_object, :put_object_manifest, :put_dynamic_obj_manifest, :put_static_obj_manifest, :post_set_meta_temp_url_key] #### Example Request To request a view account details: ```ruby response = service.head_containers ``` This returns in the following `Excon::Response`: ``` #"2563554", "Date"=>"Thu, 21 Feb 2013 21:57:02 GMT", "X-Account-Meta-Temp-Url-Key"=>"super_secret_key", "X-Timestamp"=>"1354552916.82056", "Content-Length"=>"0", "Content-Type"=>"application/json; charset=utf-8", "X-Trans-Id"=>"txe934924374a744c8a6c40dd8f29ab94a", "Accept-Ranges"=>"bytes", "X-Account-Container-Count"=>"7", "X-Account-Object-Count"=>"5"}, @status=204, @body=""> ``` To view the status of the response: ```ruby response.status ``` **Note**: Fog is aware of the valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception. To view response headers: ```ruby response.headers ``` This will return: ``` {"X-Account-Bytes-Used"=>"2563554", "Date"=>"Thu, 21 Feb 2013 21:57:02 GMT", "X-Account-Meta-Temp-Url-Key"=>"super_secret_key", "X-Timestamp"=>"1354552916.82056", "Content-Length"=>"0", "Content-Type"=>"application/json; charset=utf-8", "X-Trans-Id"=>"txe934924374a744c8a6c40dd8f29ab94a", "Accept-Ranges"=>"bytes", "X-Account-Container-Count"=>"7", "X-Account-Object-Count"=>"5"} ``` To learn more about `Fog::Storage` request methods refer to [rdoc](http://rubydoc.info/gems/fog/Fog/Storage/OpenStack/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon). ### Model Layer Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors. Here is a summary of common model methods:
Method Description
create Accepts hash of attributes and creates object.
Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
save Saves object.
Note: not all objects support updating object.
destroy Destroys object.
Note: this is a non-blocking call and object deletion might not be instantaneous.
reload Updates object with latest state from service.
attributes Returns a hash containing the list of model attributes and values.
identity Returns the identity of the object.
Note: This might not always be equal to object.id.
The remainder of this document details the model abstraction. **Note:** Fog sometimes refers to Swift containers as directories. ## List Directories To retrieve a list of directories: ```ruby service.directories ``` This returns a collection of `Fog::Storage::OpenStack::Directory` models: ## Get Directory To retrieve a specific directory: ```ruby service.directories.get "blue" ``` This returns a `Fog::Storage::OpenStack::Directory` instance: ## Create Directory To create a directory: ```ruby service.directories.create :key => 'backups' ``` ### Additional Parameters The `create` method also supports the following key values:
Key Description
:metadata Hash containing directory metadata.
## Delete Directory To delete a directory: ```ruby directory.destroy ``` **Note**: Directory must be empty before it can be deleted. ## Directory URL To get a directory's URL: ```ruby directory.public_url ``` ## List Files To list files in a directory: ```ruby directory.files ``` **Note**: File contents is not downloaded until `body` attribute is called. ## Upload Files To upload a file into a directory: ```ruby file = directory.files.create :key => 'space.jpg', :body => File.open "space.jpg" ``` **Note**: For files larger than 5 GB please refer to the [Upload Large Files](#upload_large_files) section. ### Additional Parameters The `create` method also supports the following key values:
Key Description
:content_type The content type of the object. Cloud Files will attempt to auto detect this value if omitted.
:access_control_allow_origin URLs can make Cross Origin Requests. Format is http://www.example.com. Separate URLs with a space. An asterisk (*) allows all. Please refer to CORS Container Headers for more information.
:origin The origin is the URI of the object's host.
:etag The MD5 checksum of your object's data. If specified, Cloud Files will validate the integrity of the uploaded object.
:metadata Hash containing file metadata.
## Upload Large Files Swift requires files larger than 5 GB (the Swift default limit) to be uploaded into segments along with an accompanying manifest file. All of the segments must be uploaded to the same container. ```ruby SEGMENT_LIMIT = 5368709119.0 # 5GB -1 BUFFER_SIZE = 1024 * 1024 # 1MB File.open(file_name) do |file| segment = 0 until file.eof? segment += 1 offset = 0 # upload segment to cloud files segment_suffix = segment.to_s.rjust(10, '0') service.put_object("my_container", "large_file/#{segment_suffix}", nil) do if offset <= SEGMENT_LIMIT - BUFFER_SIZE buf = file.read(BUFFER_SIZE).to_s offset += buf.size buf else '' end end end end # write manifest file service.put_object_manifest("my_container", "large_file", 'X-Object-Manifest' => "my_container/large_file/") ``` Segmented files are downloaded like ordinary files. See [Download Files](#download-files) section for more information. ## Download Files The most efficient way to download files from a private or public directory is as follows: ```ruby File.open('downloaded-file.jpg', 'w') do | f | directory.files.get("my_big_file.jpg") do | data, remaining, content_length | f.syswrite data end end ``` This will download and save the file in 1 MB chunks. The chunk size can be changed by passing the parameter `:chunk_size` into the `:connection_options` hash in the service constructor. **Note**: The `body` attribute of file will be empty if a file has been downloaded using this method. If a file object has already been loaded into memory, you can save it as follows: ```ruby File.open('germany.jpg', 'w') {|f| f.write(file_object.body) } ``` **Note**: This method is more memory intensive as the entire object is loaded into memory before saving the file as in the example above. ## File URL To get a file's URL: ```ruby file.public_url ``` ## Metadata You can access metadata as an attribute on `Fog::Storage::Rackspace::File`. ```ruby file.metadata[:environment] ``` File metadata is set when the file is saved: ```ruby file.save ``` Metadata is reloaded when directory or file is reloaded: ```ruby file.reload ``` ## Copy File Cloud Files supports copying files. To copy files into a container named "trip" with a name of "europe.jpg" do the following: ```ruby file.copy("trip", "europe.jpg") ``` To move or rename a file, perform a copy operation and then delete the old file: ```ruby file.copy("trip", "germany.jpg") file.destroy ``` ## Delete File To delete a file: ```ruby file.destroy ``` ## Additional Resources * [fog.io](http://fog.io/) * [Fog rdoc](http://rubydoc.info/gems/fog/) * [Fog Github repo](https://github.com/fog/fog) * [Fog Github Issues](https://github.com/fog/fog/issues) * [Excon Github repo](https://github.com/geemus/excon) * [Swift API](http://docs.openstack.org/api/openstack-object-storage/1.0/content/index.html) ## Support and Feedback Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues). fog-1.34.0/lib/fog/openstack/docs/getting_started.md0000644000004100000410000000456012600047642022361 0ustar www-datawww-data# Getting Started with Fog and OpenStack This document explains how to get started using Fog with [OpenStack](http://openstack.org) ## Requirements ### Ruby Fog officially supports Ruby 2.0.0, 1.9.3, 1.9.2, and 1.8.7 (also known as Matz Ruby Interpreter or MRI). While not officially supported, fog has been known to work with Rubinus and JRuby. Ruby 2.0.0 is suggested for new projects. For information on installing Ruby please refer to the [Ruby download page](http://www.ruby-lang.org/en/downloads/). ### RubyGems RubyGems is required to access the Fog gem. For information on installing RubyGems, please refer to [RubyGems download page](http://rubygems.org/pages/download). ### Bundler (optional) Bundler helps manage gem dependencies and is recommended for new projects. For more information about bundler, please refer to the [bundler documentation](http://gembundler.com/). ## Installation To install Fog via RubyGems run the following command: $ gem install fog To install Fog via Bundler add `gem 'fog'` to your `Gemfile`. This is a sample `Gemfile` to install Fog: ```ruby source 'https://rubygems.org' gem 'fog' ``` After creating your `Gemfile` execute the following command to install the libraries: bundle install ## Next Steps Now that you have installed Fog and obtained your credentials, you are ready to begin exploring the capabilities of the Rackspace Open Cloud and Fog using `irb`. Start by executing the following command: irb Once `irb` has launched you will need to require the Fog library. If using Ruby 1.8.x execute the following command: ```ruby require 'rubygems' require 'fog' ``` If using Ruby 1.9.x execute the following command: ```ruby require 'fog' ``` You should now be able to execute the following command to see a list of services Fog provides for the Rackspace Open Cloud: ```ruby Fog::OpenStack.services ``` These services can be explored in further depth in the following documents: * [Compute](compute.md) * [Storage (Swift)](storage.md) ## Additional Resources * [fog.io](http://fog.io) * [Fog rdoc](http://rubydoc.info/gems/fog) * [Fog Github repo](https://github.com/fog/fog) * [Release Notes](https://github.com/fog/fog/blob/master/changelog.txt) ## Support and Feedback Your feedback is appreciated! If you have specific issues with the **fog** SDK, you should file an [issue via Github](https://github.com/fog/fog/issues). fog-1.34.0/lib/fog/openstack/metering.rb0000644000004100000410000001141512600047642020054 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Metering class OpenStack < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/metering' model :resource collection :resources request_path 'fog/openstack/requests/metering' # Metering request :get_resource request :get_samples request :get_statistics request :list_meters request :list_resources class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :users => {}, :tenants => {} } end end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 8776 management_url.path = '/v1' @openstack_management_url = management_url.to_s @data ||= { :users => {} } unless @data[:users].find {|u| u['name'] == options[:openstack_username]} id = Fog::Mock.random_numbers(6).to_s @data[:users][id] = { 'id' => id, 'name' => options[:openstack_username], 'email' => "#{options[:openstack_username]}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_management_url => @openstack_management_url } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['metering'] @openstack_service_name = options[:openstack_service_name] @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @connection_options = options[:connection_options] || {} authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/v2/#{params[:path]}"#, # Causes errors for some requests like tenants?limit=1 # :query => ('ignore_awful_caching' << Time.now.to_i.to_s) })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/core.rb0000644000004100000410000005432112600047642017175 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module OpenStack extend Fog::Provider module Errors class ServiceError < Fog::Errors::Error attr_reader :response_data def self.slurp(error) if error.response.body.empty? data = nil message = nil else data = Fog::JSON.decode(error.response.body) message = data['message'] if message.nil? and !data.values.first.nil? message = data.values.first['message'] end end new_error = super(error, message) new_error.instance_variable_set(:@response_data, data) new_error end end class ServiceUnavailable < ServiceError; end class BadRequest < ServiceError attr_reader :validation_errors def self.slurp(error) new_error = super(error) unless new_error.response_data.nil? or new_error.response_data['badRequest'].nil? new_error.instance_variable_set(:@validation_errors, new_error.response_data['badRequest']['validationErrors']) end new_error end end class InterfaceNotImplemented < Fog::Errors::Error; end end service(:compute , 'Compute') service(:image, 'Image') service(:identity, 'Identity') service(:network, 'Network') service(:storage, 'Storage') service(:volume, 'Volume') service(:metering, 'Metering') service(:orchestration, 'Orchestration') service(:baremetal, 'Baremetal') service(:planning, 'Planning') module Core attr_accessor :auth_token attr_reader :auth_token_expiration attr_reader :current_user attr_reader :current_user_id attr_reader :current_tenant attr_reader :openstack_domain_name attr_reader :openstack_user_domain attr_reader :openstack_project_domain attr_reader :openstack_domain_id attr_reader :openstack_user_domain_id attr_reader :openstack_project_domain_id def initialize_identity options # Create @openstack_* instance variables from all :openstack_* options options.select{|x|x.to_s.start_with? 'openstack'}.each do |openstack_param, value| instance_variable_set "@#{openstack_param}".to_sym, value end @auth_token ||= options[:openstack_auth_token] @openstack_identity_public_endpoint = options[:openstack_identity_endpoint] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @openstack_must_reauthenticate = false @openstack_endpoint_type = options[:openstack_endpoint_type] || 'publicURL' unless @auth_token missing_credentials = Array.new missing_credentials << :openstack_api_key unless @openstack_api_key unless @openstack_username || @openstack_userid missing_credentials << 'openstack_username or openstack_userid' end raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty? end @current_user = options[:current_user] @current_user_id = options[:current_user_id] @current_tenant = options[:current_tenant] end def credentials options = { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_identity_endpoint => @openstack_identity_public_endpoint, :current_user => @current_user, :current_user_id => @current_user_id, :current_tenant => @current_tenant, :unscoped_token => @unscoped_token} openstack_options.merge options end def reload @connection.reset end private def openstack_options options={} # Create a hash of (:openstack_*, value) of all the @openstack_* instance variables self.instance_variables.select{|x|x.to_s.start_with? '@openstack'}.each do |openstack_param| option_name = openstack_param.to_s[1..-1] options[option_name.to_sym] = instance_variable_get openstack_param end options end def authenticate if !@openstack_management_url || @openstack_must_reauthenticate options = openstack_options options[:openstack_auth_token] = @openstack_must_reauthenticate ? nil : @openstack_auth_token credentials = Fog::OpenStack.authenticate(options, @connection_options) @current_user = credentials[:user] @current_user_id = credentials[:current_user_id] @current_tenant = credentials[:tenant] @openstack_must_reauthenticate = false @auth_token = credentials[:token] @openstack_management_url = credentials[:server_management_url] @unscoped_token = credentials[:unscoped_token] else @auth_token = @openstack_auth_token end @openstack_management_uri = URI.parse(@openstack_management_url) @host = @openstack_management_uri.host @path = @openstack_management_uri.path @path.sub!(/\/$/, '') @port = @openstack_management_uri.port @scheme = @openstack_management_uri.scheme # Not all implementations have identity service in the catalog if @openstack_identity_public_endpoint || @openstack_management_url @identity_connection = Fog::Core::Connection.new( @openstack_identity_public_endpoint || @openstack_management_url, false, @connection_options) end true end end def self.authenticate(options, connection_options = {}) case options[:openstack_auth_uri].path when /v1(\.\d+)?/ authenticate_v1(options, connection_options) when /v2(\.\d+)?/ authenticate_v2(options, connection_options) when /v3(\.\d+)?/ authenticate_v3(options, connection_options) else authenticate_v2(options, connection_options) end end # legacy v1.0 style auth def self.authenticate_v1(options, connection_options = {}) uri = options[:openstack_auth_uri] connection = Fog::Core::Connection.new(uri.to_s, false, connection_options) @openstack_api_key = options[:openstack_api_key] @openstack_username = options[:openstack_username] response = connection.request({ :expects => [200, 204], :headers => { 'X-Auth-Key' => @openstack_api_key, 'X-Auth-User' => @openstack_username }, :method => 'GET', :path => (uri.path and not uri.path.empty?) ? uri.path : 'v1.0' }) return { :token => response.headers['X-Auth-Token'], :server_management_url => response.headers['X-Server-Management-Url'] || response.headers['X-Storage-Url'], :identity_public_endpoint => response.headers['X-Keystone'] } end # Keystone Style Auth def self.authenticate_v2(options, connection_options = {}) uri = options[:openstack_auth_uri] tenant_name = options[:openstack_tenant] service_type = options[:openstack_service_type] service_name = options[:openstack_service_name] identity_service_type = options[:openstack_identity_service_type] endpoint_type = (options[:openstack_endpoint_type] || 'publicURL').to_s openstack_region = options[:openstack_region] body = retrieve_tokens_v2(options, connection_options) service = get_service(body, service_type, service_name) options[:unscoped_token] = body['access']['token']['id'] unless service unless tenant_name response = Fog::Core::Connection.new( "#{uri.scheme}://#{uri.host}:#{uri.port}/v2.0/tenants", false, connection_options).request({ :expects => [200, 204], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => body['access']['token']['id']}, :method => 'GET' }) body = Fog::JSON.decode(response.body) if body['tenants'].empty? raise Fog::Errors::NotFound.new('No Tenant Found') else options[:openstack_tenant] = body['tenants'].first['name'] end end body = retrieve_tokens_v2(options, connection_options) service = get_service(body, service_type, service_name) end service['endpoints'] = service['endpoints'].select do |endpoint| endpoint['region'] == openstack_region end if openstack_region if service['endpoints'].empty? raise Fog::Errors::NotFound.new("No endpoints available for region '#{openstack_region}'") end if openstack_region unless service available = body['access']['serviceCatalog'].map { |endpoint| endpoint['type'] }.sort.join ', ' missing = service_type.join ', ' message = "Could not find service #{missing}. Have #{available}" raise Fog::Errors::NotFound, message end if service['endpoints'].count > 1 regions = service["endpoints"].map{ |e| e['region'] }.uniq.join(',') raise Fog::Errors::NotFound.new("Multiple regions available choose one of these '#{regions}'") end identity_service = get_service(body, identity_service_type) if identity_service_type tenant = body['access']['token']['tenant'] user = body['access']['user'] management_url = service['endpoints'].find{|s| s[endpoint_type]}[endpoint_type] identity_url = identity_service['endpoints'].find{|s| s['publicURL']}['publicURL'] if identity_service { :user => user, :tenant => tenant, :identity_public_endpoint => identity_url, :server_management_url => management_url, :token => body['access']['token']['id'], :expires => body['access']['token']['expires'], :current_user_id => body['access']['user']['id'], :unscoped_token => options[:unscoped_token] } end # Keystone Style Auth def self.authenticate_v3(options, connection_options = {}) uri = options[:openstack_auth_uri] project_name = options[:openstack_project_name] service_type = options[:openstack_service_type] service_name = options[:openstack_service_name] identity_service_type = options[:openstack_identity_service_type] endpoint_type = map_endpoint_type(options[:openstack_endpoint_type] || 'publicURL') openstack_region = options[:openstack_region] token, body = retrieve_tokens_v3 options, connection_options service = get_service_v3(body, service_type, service_name, openstack_region) options[:unscoped_token] = token unless service unless project_name request_body = { :expects => [200], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => token}, :method => 'GET' } user_id = body['token']['user']['id'] response = Fog::Core::Connection.new( "#{uri.scheme}://#{uri.host}:#{uri.port}/v3/users/#{user_id}/projects", false, connection_options).request(request_body) projects_body = Fog::JSON.decode(response.body) if projects_body['projects'].empty? options[:openstack_domain_id] = body['token']['user']['domain']['id'] else options[:openstack_project_name] = projects_body['projects'].first['name'] options[:openstack_domain_id] = projects_body['projects'].first['domain_id'] end end token, body = retrieve_tokens_v3(options, connection_options) service = get_service_v3(body, service_type, service_name, openstack_region) end unless service available_services = body['token']['catalog'].map { |service| service['type'] }.sort.join ', ' available_regions = body['token']['catalog'].map { |service| service['endpoints'].map { |endpoint| endpoint['region'] }.uniq }.uniq.sort.join ', ' missing = service_type.join ', ' message = "Could not find service #{missing}#{(' in region '+openstack_region) if openstack_region}."+ " Have #{available_services}#{(' in regions '+available_regions) if openstack_region}" raise Fog::Errors::NotFound, message end service['endpoints'] = service['endpoints'].select do |endpoint| endpoint['region'] == openstack_region && endpoint['interface'] == endpoint_type end if openstack_region if service['endpoints'].empty? raise Fog::Errors::NotFound.new("No endpoints available for region '#{openstack_region}'") end if openstack_region regions = service["endpoints"].map { |e| e['region'] }.uniq if regions.count > 1 raise Fog::Errors::NotFound.new("Multiple regions available choose one of these '#{regions.join(',')}'") end identity_service = get_service_v3(body, identity_service_type, nil, nil, :endpoint_path_matches => /\/v3/) if identity_service_type management_url = service['endpoints'].find { |e| e['interface']==endpoint_type }['url'] identity_url = identity_service['endpoints'].find { |e| e['interface']=='public' }['url'] if identity_service if body['token']['project'] tenant = body['token']['project']['name'] else tenant = body['token']['user']['project']['name'] if body['token']['user']['project'] end return { :user => body['token']['user']['name'], :tenant => tenant, :identity_public_endpoint => identity_url, :server_management_url => management_url, :token => token, :expires => body['token']['expires_at'], :current_user_id => body['token']['user']['id'], :unscoped_token => options[:unscoped_token] } end def self.get_service(body, service_type=[], service_name=nil) if not body['access'].nil? body['access']['serviceCatalog'].find do |s| if service_name.nil? or service_name.empty? service_type.include?(s['type']) else service_type.include?(s['type']) and s['name'] == service_name end end elsif not body['token']['catalog'].nil? body['token']['catalog'].find do |s| if service_name.nil? or service_name.empty? service_type.include?(s['type']) else service_type.include?(s['type']) and s['name'] == service_name end end end end def self.retrieve_tokens_v2(options, connection_options = {}) api_key = options[:openstack_api_key].to_s username = options[:openstack_username].to_s tenant_name = options[:openstack_tenant].to_s auth_token = options[:openstack_auth_token] || options[:unscoped_token] uri = options[:openstack_auth_uri] connection = Fog::Core::Connection.new(uri.to_s, false, connection_options) request_body = {:auth => Hash.new} if auth_token request_body[:auth][:token] = { :id => auth_token } else request_body[:auth][:passwordCredentials] = { :username => username, :password => api_key } end request_body[:auth][:tenantName] = tenant_name if tenant_name response = connection.request({ :expects => [200, 204], :headers => {'Content-Type' => 'application/json'}, :body => Fog::JSON.encode(request_body), :method => 'POST', :path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0' }) Fog::JSON.decode(response.body) end def self.retrieve_tokens_v3(options, connection_options = {}) api_key = options[:openstack_api_key].to_s username = options[:openstack_username].to_s userid = options[:openstack_userid] domain_id = options[:openstack_domain_id] domain_name = options[:openstack_domain_name] project_domain = options[:openstack_project_domain] project_domain_id = options[:openstack_project_domain_id] user_domain = options[:openstack_user_domain] user_domain_id = options[:openstack_user_domain_id] project_name = options[:openstack_project_name] project_id = options[:openstack_project_id] auth_token = options[:openstack_auth_token] || options[:unscoped_token] uri = options[:openstack_auth_uri] connection = Fog::Core::Connection.new(uri.to_s, false, connection_options) request_body = {:auth => {}} scope = {} if project_name || project_id scope[:project] = if project_id.nil? then if project_domain || project_domain_id {:name => project_name, :domain => project_domain_id.nil? ? {:name => project_domain} : {:id => project_domain_id}} else {:name => project_name, :domain => domain_id.nil? ? {:name => domain_name} : {:id => domain_id}} end else {:id => project_id} end elsif domain_name || domain_id scope[:domain] = domain_id.nil? ? {:name => domain_name} : {:id => domain_id} else # unscoped token end if auth_token request_body[:auth][:identity] = { :methods => %w{token}, :token => { :id => auth_token } } else request_body[:auth][:identity] = { :methods => %w{password}, :password => { :user => { :password => api_key } } } if userid request_body[:auth][:identity][:password][:user][:id] = userid else if user_domain || user_domain_id request_body[:auth][:identity][:password][:user].merge! :domain => user_domain_id.nil? ? {:name => user_domain} : {:id => user_domain_id} elsif domain_name || domain_id request_body[:auth][:identity][:password][:user].merge! :domain => domain_id.nil? ? {:name => domain_name} : {:id => domain_id} end request_body[:auth][:identity][:password][:user][:name] = username end end request_body[:auth][:scope] = scope unless scope.empty? puts "request_body: #{request_body}" if user_domain=='Default2' response = connection.request({ :expects => [201], :headers => {'Content-Type' => 'application/json'}, :body => Fog::JSON.encode(request_body), :method => 'POST', :path => (uri.path and not uri.path.empty?) ? uri.path : 'v2.0' }) puts "response.body: #{response.body}" if user_domain=='Default2' [response.headers["X-Subject-Token"], Fog::JSON.decode(response.body)] end def self.get_service_v3(hash, service_type=[], service_name=nil, region=nil, options={}) # Find all services matching any of the types in service_type, filtered by service_name if it's non-nil services = hash['token']['catalog'].find_all do |s| if service_name.nil? or service_name.empty? service_type.include?(s['type']) else service_type.include?(s['type']) and s['name'] == service_name end end if hash['token']['catalog'] # Filter the found services by region (if specified) and whether the endpoint path matches the given regex (e.g. /\/v3/) services.find do |s| s['endpoints'].any? { |ep| endpoint_region?(ep, region) && endpoint_path_match?(ep, options[:endpoint_path_matches])} end if services end def self.endpoint_region?(endpoint, region) region.nil? || endpoint['region'] == region end def self.endpoint_path_match?(endpoint, match_regex) match_regex.nil? || URI(endpoint['url']).path =~ match_regex end def self.get_supported_version(supported_versions, uri, auth_token, connection_options = {}) connection = Fog::Core::Connection.new("#{uri.scheme}://#{uri.host}:#{uri.port}", false, connection_options) response = connection.request({ :expects => [200, 204, 300], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => auth_token}, :method => 'GET' }) body = Fog::JSON.decode(response.body) version = nil unless body['versions'].empty? supported_version = body['versions'].find do |x| x["id"].match(supported_versions) && (x["status"] == "CURRENT" || x["status"] == "SUPPORTED") end version = supported_version["id"] if supported_version end if version.nil? raise Fog::OpenStack::Errors::ServiceUnavailable.new( "OpenStack service only supports API versions #{supported_versions.inspect}") end version end # CGI.escape, but without special treatment on spaces def self.escape(str, extra_exclude_chars = '') str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase end end def self.map_endpoint_type type case type when "publicURL" "public" when "internalURL" "internal" when "adminURL" "admin" end end end end fog-1.34.0/lib/fog/openstack/models/0000755000004100000410000000000012600047642017176 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/identity_v3/0000755000004100000410000000000012600047642021437 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/identity_v3/endpoints.rb0000644000004100000410000000141412600047642023767 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/service' module Fog module Identity class OpenStack class V3 class Endpoints < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Endpoint def all(options = {}) load_response(service.list_endpoints(options), 'endpoints') end def find_by_id(id) cached_endpoint = self.find { |endpoint| endpoint.id == id } return cached_endpoint if cached_endpoint endpoint_hash = service.get_endpoint(id).body['endpoint'] Fog::Identity::OpenStack::V3::Endpoint.new( endpoint_hash.merge(:service => service)) end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/domain.rb0000644000004100000410000000157312600047642023241 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Domain < Fog::OpenStack::Model identity :id attribute :description attribute :enabled attribute :name attribute :links def to_s self.name end def destroy requires :id service.delete_domain(self.id) true end def update(attr = nil) requires :id, :name merge_attributes( service.update_domain(self.id, attr || attributes).body['domain']) self end def create requires :name merge_attributes( service.create_domain(attributes).body['domain']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/tokens.rb0000644000004100000410000000222212600047642023265 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/service' module Fog module Identity class OpenStack class V3 class Tokens < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Token def authenticate(auth) response = service.token_authenticate(auth) token_hash = response.body['token'] Fog::Identity::OpenStack::V3::Token.new( token_hash.merge(:service => service, :value => response.headers['X-Subject-Token'])) end def validate(subject_token) response = service.token_validate(subject_token) token_hash = response.body['token'] Fog::Identity::OpenStack::V3::Token.new( token_hash.merge(:service => service, :value => response.headers['X-Subject-Token'])) end def check(subject_token) service.token_check(subject_token) return true end def revoke(subject_token) service.token_revoke(subject_token) return true end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/project.rb0000644000004100000410000000477312600047642023445 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Project < Fog::OpenStack::Model identity :id attribute :domain_id attribute :description attribute :enabled attribute :name attribute :links attribute :parent_id attribute :subtree attribute :parents def to_s self.name end def destroy requires :id service.delete_project(self.id) true end def update(attr = nil) requires :id merge_attributes( service.update_project(self.id, attr || attributes).body['project']) self end def create merge_attributes( service.create_project(attributes).body['project']) self end def user_roles(user_id) requires :id service.list_project_user_roles(self.id, user_id).body['roles'] end def grant_role_to_user(role_id, user_id) requires :id service.grant_project_user_role(self.id, user_id, role_id) end def check_user_role(user_id, role_id) requires :id begin service.check_project_user_role(self.id, user_id, role_id) rescue Fog::Identity::OpenStack::NotFound return false end return true end def revoke_role_from_user(role_id, user_id) requires :id service.revoke_project_user_role(self.id, user_id, role_id) end def group_roles(group_id) requires :id service.list_project_group_roles(self.id, group_id).body['roles'] end def grant_role_to_group(role_id, group_id) requires :id service.grant_project_group_role(self.id, group_id, role_id) end def check_group_role(group_id, role_id) requires :id begin service.check_project_group_role(self.id, group_id, role_id) rescue Fog::Identity::OpenStack::NotFound return false end return true end def revoke_role_from_group(role_id, group_id) requires :id service.revoke_project_group_role(self.id, group_id, role_id) end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/os_credentials.rb0000644000004100000410000000165512600047642024771 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/os_credential' module Fog module Identity class OpenStack class V3 class OsCredentials < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::OsCredential def all(options = {}) load_response(service.list_os_credentials(options), 'credentials') end def find_by_id(id) cached_credential = self.find { |credential| credential.id == id } return cached_credential if cached_credential credential_hash = service.get_os_credential(id).body['credential'] Fog::Identity::OpenStack::V3::Credential.new( credential_hash.merge(:service => service)) end def destroy(id) credential = self.find_by_id(id) credential.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/roles.rb0000644000004100000410000000252612600047642023115 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/role' module Fog module Identity class OpenStack class V3 class Roles < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Role def all(options = {}) load_response(service.list_roles(options), 'roles') end def assignments(options = {}) # TODO(lsmola) this method doesn't make much sense, it should be moved to role.rb and automatically add # role.id filter. Otherwise it's just duplication. Fog::Logger.deprecation("Calling OpenStack[:keystone].roles.assignments(options) method which"\ " deprecated, call OpenStack[:keystone].role_assignments.all(options) instead") load(service.list_role_assignments(options).body['role_assignments']) end def find_by_id(id) cached_role = self.find { |role| role.id == id } return cached_role if cached_role role_hash = service.get_role(id).body['role'] Fog::Identity::OpenStack::V3::role.new( role_hash.merge(:service => service)) end def destroy(id) role = self.find_by_id(id) role.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/role.rb0000644000004100000410000000141712600047642022730 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Role < Fog::OpenStack::Model identity :id attribute :name attribute :links def to_s self.name end def destroy requires :id service.delete_role(self.id) true end def update(attr = nil) requires :id merge_attributes( service.update_role(self.id, attr || attributes).body['role']) self end def create merge_attributes( service.create_role(attributes).body['role']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/policy.rb0000644000004100000410000000154512600047642023270 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Policy < Fog::OpenStack::Model identity :id attribute :type attribute :blob attribute :links def to_s self.name end def destroy requires :id service.delete_policy(self.id) true end def update(attr = nil) requires :id, :blob, :type merge_attributes( service.update_policy(self.id, attr || attributes).body['policy']) self end def create requires :blob, :type merge_attributes( service.create_policy(attributes).body['policy']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/os_credential.rb0000644000004100000410000000312012600047642024573 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class OsCredential < Fog::OpenStack::Model identity :id attribute :project_id attribute :type attribute :blob attribute :user_id attribute :links def to_s self.name end def destroy requires :id service.delete_os_credential(self.id) @parsed_blob = nil true end def update(attr = nil) requires :id merge_attributes( service.update_os_credential(self.id, attr || attributes).body['credential']) @parsed_blob = nil self end def save requires :blob, :type @parsed_blob = nil identity ? update : create end def create merge_attributes( service.create_os_credential(attributes).body['credential']) @parsed_blob = nil self end def parsed_blob @parsed_blob = ::JSON.parse(blob) unless @parsed_blob @parsed_blob end def name parsed_blob['name'] if blob end def public_key parsed_blob['public_key'] if blob end def fingerprint parsed_blob['fingerprint'] if blob end def private_key parsed_blob['private_key'] if blob end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/projects.rb0000644000004100000410000000317412600047642023622 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/project' module Fog module Identity class OpenStack class V3 class Projects < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Project def all(options = {}) load_response(service.list_projects(options), 'projects') end def auth_projects(options = {}) load(service.auth_projects(options).body['projects']) end def find_by_id(id, options=[]) # options can include :subtree_as_ids, :subtree_as_list, :parents_as_ids, :parents_as_list if options.is_a? Symbol # Deal with a single option being passed on its own options = [options] end cached_project = self.find { |project| project.id == id } if options.empty? return cached_project if cached_project project_hash = service.get_project(id, options).body['project'] top_project = project_from_hash(project_hash, service) if options.include? :subtree_as_list top_project.subtree.map! {|proj_hash| project_from_hash(proj_hash['project'], service)} end if options.include? :parents_as_list top_project.parents.map! {|proj_hash| project_from_hash(proj_hash['project'], service)} end return top_project end private def project_from_hash(project_hash, service) Fog::Identity::OpenStack::V3::Project.new(project_hash.merge(:service => service)) end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/role_assignment.rb0000644000004100000410000000062012600047642025153 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class RoleAssignment < Fog::OpenStack::Model attribute :scope attribute :role attribute :user attribute :group attribute :links def to_s self.links['assignment'] end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/user.rb0000644000004100000410000000373112600047642022746 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class User < Fog::OpenStack::Model identity :id attribute :default_project_id attribute :description attribute :domain_id attribute :email attribute :enabled attribute :name attribute :links attribute :password def to_s self.name end def groups requires :id service.list_user_groups(self.id).body['groups'] end def projects requires :id service.list_user_projects(self.id).body['projects'] end def roles requires :id, :domain_id service.list_domain_user_roles(self.domain_id, self.id).body['roles'] end def grant_role(role_id) requires :id, :domain_id service.grant_domain_user_role(self.domain_id, self.id, role_id) end def check_role(role_id) requires :id, :domain_id begin service.check_domain_user_role(self.domain_id, self.id, role_id) rescue Fog::Identity::OpenStack::NotFound return false end return true end def revoke_role(role_id) requires :id, :domain_id service.revoke_domain_user_role(self.domain_id, self.id, role_id) end def destroy requires :id service.delete_user(self.id) true end def update(attr = nil) requires :id merge_attributes( service.update_user(self.id, attr || attributes).body['user']) self end def create merge_attributes( service.create_user(attributes).body['user']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/services.rb0000644000004100000410000000155512600047642023615 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/service' module Fog module Identity class OpenStack class V3 class Services < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Service def all(options = {}) load_response(service.list_services(options), 'services') end def find_by_id(id) cached_service = self.find { |service| service.id == id } return cached_service if cached_service service_hash = service.get_service(id).body['service'] Fog::Identity::OpenStack::V3::Service.new( service_hash.merge(:service => service)) end def destroy(id) service = self.find_by_id(id) service.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/endpoint.rb0000644000004100000410000000173612600047642023613 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Endpoint < Fog::OpenStack::Model identity :id attribute :description attribute :interface attribute :service_id attribute :name attribute :region attribute :url attribute :links def to_s self.name end def destroy requires :id service.delete_endpoint(self.id) true end def update(attr = nil) requires :id, :name merge_attributes( service.update_endpoint(self.id, attr || attributes).body['endpoint']) self end def create requires :name merge_attributes( service.create_endpoint(attributes).body['endpoint']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/domains.rb0000644000004100000410000000172412600047642023422 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/domain' module Fog module Identity class OpenStack class V3 class Domains < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Domain def all(options = {}) load_response(service.list_domains(options), 'domains') end def auth_domains(options = {}) load(service.auth_domains(options).body['domains']) end def find_by_id(id) cached_domain = self.find { |domain| domain.id == id } return cached_domain if cached_domain domain_hash = service.get_domain(id).body['domain'] Fog::Identity::OpenStack::V3::Domain.new( domain_hash.merge(:service => service)) end def destroy(id) domain = self.find_by_id(id) domain.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/group.rb0000644000004100000410000000445412600047642023127 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Group < Fog::OpenStack::Model identity :id attribute :description attribute :domain_id attribute :name attribute :links def to_s self.name end def destroy requires :id service.delete_group(self.id) true end def update(attr = nil) requires :id, :name merge_attributes( service.update_group(self.id, attr || attributes).body['group']) self end def create requires :name merge_attributes( service.create_group(attributes).body['group']) self end def add_user user_id requires :id service.add_user_to_group(self.id, user_id) end def remove_user user_id requires :id service.remove_user_from_group(self.id, user_id) end def contains_user? user_id requires :id begin service.group_user_check(self.id, user_id) rescue Fog::Identity::OpenStack::NotFound return false end return true end def roles requires :id, :domain_id service.list_domain_group_roles(self.domain_id, self.id).body['roles'] end def grant_role(role_id) requires :id, :domain_id service.grant_domain_group_role(self.domain_id, self.id, role_id) end def check_role(role_id) requires :id, :domain_id begin service.check_domain_group_role(self.domain_id, self.id, role_id) rescue Fog::Identity::OpenStack::NotFound return false end return true end def revoke_role(role_id) requires :id, :domain_id service.revoke_domain_group_role(self.domain_id, self.id, role_id) end def users(attr = {}) requires :id service.list_group_users(self.id, attr).body['users'] end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/groups.rb0000644000004100000410000000151312600047642023303 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/group' module Fog module Identity class OpenStack class V3 class Groups < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Group def all(options = {}) load_response(service.list_groups(options), 'groups') end def find_by_id(id) cached_group = self.find { |group| group.id == id } return cached_group if cached_group group_hash = service.get_group(id).body['group'] Fog::Identity::OpenStack::V3::group.new( group_hash.merge(:service => service)) end def destroy(id) group = self.find_by_id(id) group.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/policies.rb0000644000004100000410000000153712600047642023601 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/policy' module Fog module Identity class OpenStack class V3 class Policies < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::Policy def all(options = {}) load_response(service.list_policies(options), 'policies') end def find_by_id(id) cached_policy = self.find { |policy| policy.id == id } return cached_policy if cached_policy policy_hash = service.get_policy(id).body['policy'] Fog::Identity::OpenStack::V3::Policy.new( policy_hash.merge(:service => service)) end def destroy(id) policy = self.find_by_id(id) policy.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/role_assignments.rb0000644000004100000410000000153412600047642025343 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/role' module Fog module Identity class OpenStack class V3 class RoleAssignments < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::RoleAssignment def all(options = {}) load_response(service.list_role_assignments(options), 'role_assignments') end def filter_by(options = {}) Fog::Logger.deprecation("Calling OpenStack[:keystone].role_assignments.filter_by(options) method which"\ " is not part of standard interface and is deprecated, call "\ " .role_assignments.all(options) or .role_assignments.summary(options) instead.") all(options) end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/users.rb0000644000004100000410000000165612600047642023135 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v3/domain' module Fog module Identity class OpenStack class V3 class Users < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V3::User def all(options = {}) load_response(service.list_users(options), 'users') end def find_by_id(id) cached_user = self.find { |user| user.id == id } return cached_user if cached_user user_hash = service.get_user(id).body['user'] Fog::Identity::OpenStack::V3::User.new( user_hash.merge(:service => service)) end def find_by_name(name) load(service.list_users(:name => name).body['users']) end def destroy(id) user = self.find_by_id(id) user.destroy end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/token.rb0000644000004100000410000000073312600047642023107 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Token < Fog::OpenStack::Model attribute :value attribute :catalog attribute :expires_at attribute :issued_at attribute :methods attribute :project attribute :roles attribute :user def to_s self.value end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v3/service.rb0000644000004100000410000000170012600047642023422 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V3 class Service < Fog::OpenStack::Model identity :id attribute :description attribute :type attribute :name attribute :links def to_s self.name end def destroy requires :id service.delete_service(self.id) true end def update(attr = nil) requires :id merge_attributes( service.update_service(self.id, attr || attributes).body['service']) self end def save requires :name identity ? update : create end def create merge_attributes( service.create_service(attributes).body['service']) self end end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/0000755000004100000410000000000012600047642022062 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/orchestration/stacks.rb0000644000004100000410000000355712600047642023711 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/orchestration/stack' module Fog module Orchestration class OpenStack class Stacks < Fog::OpenStack::Collection model Fog::Orchestration::OpenStack::Stack def all(options = {}) # TODO(lsmola) we can uncomment this when https://bugs.launchpad.net/heat/+bug/1468318 is fixed, till then # we will use non detailed list # data = service.list_stack_data_detailed(options).body['stacks'] data = service.list_stack_data(options) load_response(data, 'stacks') end def summary(options = {}) data = service.list_stack_data(options) load_response(data, 'stacks') end # Deprecated def find_by_id(id) Fog::Logger.deprecation("#find_by_id(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]") self.find {|stack| stack.id == id} end def get(arg1, arg2 = nil) if arg2.nil? # Deprecated: get(id) Fog::Logger.deprecation("#get(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]") return find_by_id(arg1) end # Normal use: get(name, id) name = arg1 id = arg2 data = service.show_stack_details(name, id).body['stack'] new(data) rescue Fog::Compute::OpenStack::NotFound nil end def adopt(options={}) service.create_stack(options) end def create(options={}) service.create_stack(options).body['stack'] end def preview(options={}) data = service.preview_stack(options).body['stack'] new(data) end def build_info service.build_info.body end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/stack.rb0000644000004100000410000000717012600047642023521 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Orchestration class OpenStack class Stack < Fog::OpenStack::Model identity :id %w{capabilities description disable_rollback links notification_topics outputs parameters stack_name stack_status stack_status_reason template_description timeout_mins parent creation_time updated_time stack_user_project_id stack_owner}.each do |a| attribute a.to_sym end def save(options={}) if persisted? service.update_stack(self, default_options.merge(options)).body['stack'] else service.stacks.create(default_options.merge(options)) end end # Deprecated def create Fog::Logger.deprecation("#create is deprecated, use #save(options) instead [light_black](#{caller.first})[/]") requires :stack_name service.stacks.create(default_options) end # Deprecated def update Fog::Logger.deprecation("#update is deprecated, use #save(options) instead [light_black](#{caller.first})[/]") requires :stack_name service.update_stack(self, default_options).body['stack'] end def delete service.delete_stack(self) end alias_method :destroy, :delete def details @details ||= service.stacks.get(self.stack_name, self.id) end def resources(options={}) @resources ||= service.resources.all({:stack => self}.merge(options)) end def events(options={}) @events ||= service.events.all(self, options) end def template @template ||= service.templates.get(self) end def abandon service.abandon_stack(self) end # Deprecated def template_url Fog::Logger.deprecation("#template_url is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]") @template_url end # Deprecated def template_url=(url) Fog::Logger.deprecation("#template_url= is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]") @template_url = url end # Deprecated def template=(content) Fog::Logger.deprecation("#template=(content) is deprecated, use it in options for #save(options) instead [light_black](#{caller.first})[/]") @template = content end # Deprecated def timeout_in_minutes Fog::Logger.deprecation("#timeout_in_minutes is deprecated, set timeout_mins in options for save(options) instead [light_black](#{caller.first})[/]") timeout_mins end # Deprecated def timeout_in_minutes=(minutes) Fog::Logger.deprecation("#timeout_in_minutes=(minutes) is deprecated, set timeout_mins in options for save(options) instead [light_black](#{caller.first})[/]") timeout_mins = minutes end # build options to create or update stack def default_options template_content = if template && template.is_a?(Fog::Orchestration::OpenStack::Template) template.content else template end { :stack_name => stack_name, :disable_rollback => disable_rollback, :template_url => @template_url, :template => template_content, :timeout_mins => timeout_mins } end private :default_options end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/event.rb0000644000004100000410000000062312600047642023531 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Orchestration class OpenStack class Event < Fog::OpenStack::Model include Reflectable identity :id %w{resource_name event_time links logical_resource_id resource_status resource_status_reason physical_resource_id}.each do |a| attribute a.to_sym end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/resources.rb0000644000004100000410000000207312600047642024423 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/orchestration/resource' module Fog module Orchestration class OpenStack class Resources < Fog::OpenStack::Collection model Fog::Orchestration::OpenStack::Resource def types service.list_resource_types.body['resource_types'].sort end def all(options = {}, deprecated_options = {}) data = service.list_resources(options, deprecated_options) load_response(data, 'resources') end def get(resource_name, stack=nil) stack = self.first.stack if stack.nil? data = service.show_resource_data(stack.stack_name, stack.id, resource_name).body['resource'] new(data) rescue Fog::Compute::OpenStack::NotFound nil end def metadata(stack_name, stack_id, resource_name) service.show_resource_metadata(stack_name, stack_id, resource_name).body['resource'] rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/resource.rb0000644000004100000410000000137512600047642024244 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Orchestration class OpenStack class Resource < Fog::OpenStack::Model include Reflectable identity :id %w{resource_name description links logical_resource_id physical_resource_id resource_status updated_time required_by resource_status_reason resource_type}.each do |a| attribute a.to_sym end def events(options={}) @events ||= service.events.all(self, options) end def metadata @metadata ||= service.show_resource_metadata(stack, self.resource_name).body['metadata'] end def template @template ||= service.templates.get(self) end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/resource_schemas.rb0000644000004100000410000000053512600047642025744 0ustar www-datawww-datarequire 'fog/openstack/models/collection' module Fog module Orchestration class OpenStack class ResourceSchemas < Fog::OpenStack::Collection def get(resource_type) service.show_resource_schema(resource_type).body rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/events.rb0000644000004100000410000000166512600047642023723 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/orchestration/event' module Fog module Orchestration class OpenStack class Events < Fog::OpenStack::Collection model Fog::Orchestration::OpenStack::Event def all(options = {}, options_deprecated = {}) data = if options.is_a?(Stack) service.list_stack_events(options, options_deprecated) elsif options.is_a?(Hash) service.list_events(options) else service.list_resource_events(options.stack, options, options_deprecated) end load_response(data, 'events') end def get(stack, resource, event_id) data = service.show_event_details(stack, resource, event_id).body['event'] new(data) rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/templates.rb0000644000004100000410000000256012600047642024410 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/orchestration/template' module Fog module Orchestration class OpenStack class Templates < Fog::OpenStack::Collection model Fog::Orchestration::OpenStack::Template def get(obj) data = if obj.is_a?(Stack) service.get_stack_template(obj).body else service.show_resource_template(obj.resource_name).body end if data.has_key?('AWSTemplateFormatVersion') data['content'] = data.to_json data['format'] = 'CFN' data['template_version'] = data.delete('AWSTemplateFormatVersion') data['description'] = data.delete('Description') data['parameter'] = data.delete('Parameters') data['resources'] = data.delete('Resources') else data['content'] = data.to_yaml data['format'] = 'HOT' data['template_version'] = data.delete('heat_template_version') end new(data) rescue Fog::Compute::OpenStack::NotFound nil end def validate(options={}) data = service.validate_template(options).body temp = new temp.parameters = data['Parameters'] temp.description = data['Description'] temp end end end end end fog-1.34.0/lib/fog/openstack/models/orchestration/template.rb0000644000004100000410000000045112600047642024222 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Orchestration class OpenStack class Template < Fog::OpenStack::Model %w{format description template_version parameters resources content}.each do |a| attribute a.to_sym end end end end end fog-1.34.0/lib/fog/openstack/models/network/0000755000004100000410000000000012600047642020667 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/network/lb_pools.rb0000644000004100000410000000133312600047642023025 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/lb_pool' module Fog module Network class OpenStack class LbPools < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::LbPool def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_lb_pools(filters), 'pools') end def get(pool_id) if pool = service.get_lb_pool(pool_id).body['pool'] new(pool) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/security_group_rules.rb0000644000004100000410000000153312600047642025513 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/security_group_rule' module Fog module Network class OpenStack class SecurityGroupRules < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::SecurityGroupRule def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_security_group_rules(filters), 'security_group_rules') end def get(sec_group_rule_id) if sec_group_rule = service.get_security_group_rule(sec_group_rule_id).body['security_group_rule'] new(sec_group_rule) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_health_monitor.rb0000644000004100000410000000323712600047642024712 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class LbHealthMonitor < Fog::OpenStack::Model identity :id attribute :type attribute :delay attribute :timeout attribute :max_retries attribute :http_method attribute :url_path attribute :expected_codes attribute :status attribute :admin_state_up attribute :tenant_id def create requires :type, :delay, :timeout, :max_retries merge_attributes(service.create_lb_health_monitor(self.type, self.delay, self.timeout, self.max_retries, self.attributes).body['health_monitor']) self end def update requires :id, :type, :delay, :timeout, :max_retries merge_attributes(service.update_lb_health_monitor(self.id, self.attributes).body['health_monitor']) self end def destroy requires :id service.delete_lb_health_monitor(self.id) true end def associate_to_pool(pool_id) requires :id service.associate_lb_health_monitor(pool_id, self.id) true end def disassociate_from_pool(pool_id) requires :id service.disassociate_lb_health_monitor(pool_id, self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/router.rb0000644000004100000410000000313512600047642022536 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack # The Layer-3 Networking Extensions (router) # # A logical entity for forwarding packets across internal # subnets and NATting them on external networks through # an appropriate external gateway. # # @see http://docs.openstack.org/api/openstack-network/2.0/content/router_ext.html class Router < Fog::OpenStack::Model identity :id attribute :name attribute :admin_state_up attribute :tenant_id attribute :external_gateway_info attribute :status def create requires :name response = service.create_router(self.name, options) merge_attributes(response.body['router']) self end def update requires :id response = service.update_router(self.id, options) merge_attributes(response.body['router']) self end def destroy requires :id service.delete_router(self.id) true end private def options options = self.attributes.dup if options[:external_gateway_info] if options[:external_gateway_info].is_a?(Fog::Network::OpenStack::Network) options[:external_gateway_info] = { :network_id => options[:external_gateway_info].id } else options[:external_gateway_info] = { :network_id => options[:external_gateway_info]} end end options end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_member.rb0000644000004100000410000000230712600047642023142 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class LbMember < Fog::OpenStack::Model identity :id attribute :pool_id attribute :address attribute :protocol_port attribute :weight attribute :status attribute :admin_state_up attribute :tenant_id def create requires :pool_id, :address, :protocol_port, :weight merge_attributes(service.create_lb_member(self.pool_id, self.address, self.protocol_port, self.weight, self.attributes).body['member']) self end def update requires :id, :pool_id, :address, :protocol_port, :weight merge_attributes(service.update_lb_member(self.id, self.attributes).body['member']) self end def destroy requires :id service.delete_lb_member(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/security_group.rb0000644000004100000410000000150312600047642024276 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class SecurityGroup < Fog::OpenStack::Model identity :id attribute :name attribute :description attribute :security_group_rules attribute :tenant_id def destroy requires :id service.delete_security_group(id) true end def security_group_rules Fog::Network::OpenStack::SecurityGroupRules.new(:service => service).load(attributes[:security_group_rules]) end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? merge_attributes(service.create_security_group(attributes).body['security_group']) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/floating_ip.rb0000644000004100000410000000156612600047642023517 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class FloatingIp < Fog::OpenStack::Model identity :id attribute :floating_network_id attribute :port_id attribute :tenant_id attribute :fixed_ip_address attribute :floating_ip_address def initialize(attributes) @connection = attributes[:connection] super end def create requires :floating_network_id merge_attributes(service.create_floating_ip(self.floating_network_id, self.attributes).body['floatingip']) self end def update self end def destroy requires :id service.delete_floating_ip(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_health_monitors.rb0000644000004100000410000000150712600047642025073 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/lb_health_monitor' module Fog module Network class OpenStack class LbHealthMonitors < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::LbHealthMonitor def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_lb_health_monitors(filters), 'health_monitors') end def get(health_monitor_id) if health_monitor = service.get_lb_health_monitor(health_monitor_id).body['health_monitor'] new(health_monitor) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/subnets.rb0000644000004100000410000000134412600047642022701 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/subnet' module Fog module Network class OpenStack class Subnets < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::Subnet def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_subnets(filters), 'subnets') end def get(subnet_id) if subnet = service.get_subnet(subnet_id).body['subnet'] new(subnet) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/security_groups.rb0000644000004100000410000000147212600047642024466 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/security_group' module Fog module Network class OpenStack class SecurityGroups < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::SecurityGroup def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_security_groups(filters), 'security_groups') end def get(security_group_id) if security_group = service.get_security_group(security_group_id).body['security_group'] new(security_group) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/network.rb0000644000004100000410000000223312600047642022705 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class Network < Fog::OpenStack::Model identity :id attribute :name attribute :subnets attribute :shared attribute :status attribute :admin_state_up attribute :tenant_id attribute :provider_network_type, :aliases => 'provider:network_type' attribute :provider_physical_network, :aliases => 'provider:physical_network' attribute :provider_segmentation_id, :aliases => 'provider:segmentation_id' attribute :router_external, :aliases => 'router:external' def subnets service.subnets.select {|s| s.network_id == self.id } end def create merge_attributes(service.create_network(self.attributes).body['network']) self end def update requires :id merge_attributes(service.update_network(self.id, self.attributes).body['network']) self end def destroy requires :id service.delete_network(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/routers.rb0000644000004100000410000000134412600047642022721 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/router' module Fog module Network class OpenStack class Routers < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::Router def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_routers(filters), 'routers') end def get(router_id) if router = service.get_router(router_id).body['router'] new(router) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/subnet.rb0000644000004100000410000000224112600047642022513 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class Subnet < Fog::OpenStack::Model identity :id attribute :name attribute :network_id attribute :cidr attribute :ip_version attribute :gateway_ip attribute :allocation_pools attribute :dns_nameservers attribute :host_routes attribute :enable_dhcp attribute :tenant_id def create requires :network_id, :cidr, :ip_version merge_attributes(service.create_subnet(self.network_id, self.cidr, self.ip_version, self.attributes).body['subnet']) self end def update requires :id merge_attributes(service.update_subnet(self.id, self.attributes).body['subnet']) self end def destroy requires :id service.delete_subnet(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_vips.rb0000644000004100000410000000132012600047642022646 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/lb_vip' module Fog module Network class OpenStack class LbVips < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::LbVip def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_lb_vips(filters), 'vips') end def get(vip_id) if vip = service.get_lb_vip(vip_id).body['vip'] new(vip) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/floating_ips.rb0000644000004100000410000000144112600047642023672 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/floating_ip' module Fog module Network class OpenStack class FloatingIps < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::FloatingIp def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_floating_ips(filters), 'floatingips') end def get(floating_network_id) if floating_ip = service.get_floating_ip(floating_network_id).body['floatingip'] new(floating_ip) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/port.rb0000644000004100000410000000200512600047642022175 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class Port < Fog::OpenStack::Model identity :id attribute :name attribute :network_id attribute :fixed_ips attribute :mac_address attribute :status attribute :admin_state_up attribute :device_owner attribute :device_id attribute :tenant_id attribute :security_groups def create requires :network_id merge_attributes(service.create_port(self.network_id, self.attributes).body['port']) self end def update requires :id, :network_id merge_attributes(service.update_port(self.id, self.attributes).body['port']) self end def destroy requires :id service.delete_port(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_members.rb0000644000004100000410000000136112600047642023324 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/lb_member' module Fog module Network class OpenStack class LbMembers < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::LbMember def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_lb_members(filters), 'members') end def get(member_id) if member = service.get_lb_member(member_id).body['member'] new(member) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/security_group_rule.rb0000644000004100000410000000156612600047642025336 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class SecurityGroupRule < Fog::OpenStack::Model identity :id attribute :security_group_id attribute :direction attribute :protocol attribute :port_range_min attribute :port_range_max attribute :remote_ip_prefix attribute :ethertype attribute :remote_group_id attribute :tenant_id def destroy requires :id service.delete_security_group_rule(id) true end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? merge_attributes(service.create_security_group_rule(security_group_id, direction, attributes).body['security_group_rule']) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/ports.rb0000644000004100000410000000131612600047642022364 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/port' module Fog module Network class OpenStack class Ports < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::Port def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_ports(filters), 'ports') end def get(port_id) if port = service.get_port(port_id).body['port'] new(port) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_vip.rb0000644000004100000410000000255612600047642022477 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class LbVip < Fog::OpenStack::Model identity :id attribute :subnet_id attribute :pool_id attribute :protocol attribute :protocol_port attribute :name attribute :description attribute :address attribute :port_id attribute :session_persistence attribute :connection_limit attribute :status attribute :admin_state_up attribute :tenant_id def create requires :subnet_id, :pool_id, :protocol, :protocol_port merge_attributes(service.create_lb_vip(self.subnet_id, self.pool_id, self.protocol, self.protocol_port, self.attributes).body['vip']) self end def update requires :id, :subnet_id, :pool_id, :protocol, :protocol_port merge_attributes(service.update_lb_vip(self.id, self.attributes).body['vip']) self end def destroy requires :id service.delete_lb_vip(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/lb_pool.rb0000644000004100000410000000352712600047642022651 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Network class OpenStack class LbPool < Fog::OpenStack::Model identity :id attribute :subnet_id attribute :protocol attribute :lb_method attribute :name attribute :description attribute :health_monitors attribute :members attribute :status attribute :admin_state_up attribute :vip_id attribute :tenant_id attribute :active_connections attribute :bytes_in attribute :bytes_out attribute :total_connections def create requires :subnet_id, :protocol, :lb_method merge_attributes(service.create_lb_pool(self.subnet_id, self.protocol, self.lb_method, self.attributes).body['pool']) self end def update requires :id, :subnet_id, :protocol, :lb_method merge_attributes(service.update_lb_pool(self.id, self.attributes).body['pool']) self end def destroy requires :id service.delete_lb_pool(self.id) true end def stats requires :id merge_attributes(service.get_lb_pool_stats(self.id).body['stats']) self end def associate_health_monitor(health_monitor_id) requires :id service.associate_lb_health_monitor(self.id, health_monitor_id) true end def disassociate_health_monitor(health_monitor_id) requires :id service.disassociate_lb_health_monitor(self.id, health_monitor_id) true end end end end end fog-1.34.0/lib/fog/openstack/models/network/networks.rb0000644000004100000410000000135712600047642023076 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/network/network' module Fog module Network class OpenStack class Networks < Fog::OpenStack::Collection attribute :filters model Fog::Network::OpenStack::Network def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg load_response(service.list_networks(filters), 'networks') end def get(network_id) if network = service.get_network(network_id).body['network'] new(network) end rescue Fog::Network::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/storage/0000755000004100000410000000000012600047642020642 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/storage/directory.rb0000644000004100000410000000214312600047642023173 0ustar www-datawww-datarequire 'fog/openstack/models/model' require 'fog/openstack/models/storage/files' module Fog module Storage class OpenStack class Directory < Fog::OpenStack::Model identity :key, :aliases => 'name' attribute :bytes, :aliases => 'X-Container-Bytes-Used' attribute :count, :aliases => 'X-Container-Object-Count' attr_writer :public def destroy requires :key service.delete_container(key) true rescue Excon::Errors::NotFound false end def files @files ||= begin Fog::Storage::OpenStack::Files.new( :directory => self, :service => service ) end end def public_url requires :key @public_url ||= begin service.public_url(key) rescue Fog::Storage::OpenStack::NotFound => err nil end end def save requires :key service.put_container(key, :public => @public) true end end end end end fog-1.34.0/lib/fog/openstack/models/storage/files.rb0000644000004100000410000000523012600047642022271 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/storage/file' module Fog module Storage class OpenStack class Files < Fog::OpenStack::Collection attribute :directory attribute :limit attribute :marker attribute :path attribute :prefix model Fog::Storage::OpenStack::File def all(options = {}) requires :directory options = { 'limit' => limit, 'marker' => marker, 'path' => path, 'prefix' => prefix }.merge!(options) merge_attributes(options) parent = directory.collection.get( directory.key, options ) if parent # TODO change to load_response? load(parent.files.map {|file| file.attributes}) else nil end end alias_method :each_file_this_page, :each def each if !block_given? self else subset = dup.all subset.each_file_this_page {|f| yield f} while subset.length == (subset.limit || 10000) subset = subset.all(:marker => subset.last.key) subset.each_file_this_page {|f| yield f} end self end end def get(key, &block) requires :directory data = service.get_object(directory.key, key, &block) file_data = data.headers.merge({ :body => data.body, :key => key }) new(file_data) rescue Fog::Storage::OpenStack::NotFound nil end def get_url(key) requires :directory if self.directory.public_url "#{self.directory.public_url}/#{Fog::OpenStack.escape(key, '/')}" end end def get_http_url(key, expires, options = {}) requires :directory service.get_object_http_url(directory.key, key, expires, options) end def get_https_url(key, expires, options = {}) requires :directory service.get_object_https_url(directory.key, key, expires, options) end def head(key, options = {}) requires :directory data = service.head_object(directory.key, key) file_data = data.headers.merge({ :key => key }) new(file_data) rescue Fog::Storage::OpenStack::NotFound nil end def new(attributes = {}) requires :directory super({ :directory => directory }.merge!(attributes)) end end end end end fog-1.34.0/lib/fog/openstack/models/storage/directories.rb0000644000004100000410000000203012600047642023476 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/storage/directory' module Fog module Storage class OpenStack class Directories < Fog::OpenStack::Collection model Fog::Storage::OpenStack::Directory def all(options = {}) data = service.get_containers(options) load_response(data) end def get(key, options = {}) data = service.get_container(key, options) directory = new(:key => key) for key, value in data.headers if ['X-Container-Bytes-Used', 'X-Container-Object-Count'].include?(key) directory.merge_attributes(key => value) end end directory.files.merge_attributes(options) directory.files.instance_variable_set(:@loaded, true) data.body.each do |file| directory.files << directory.files.new(file) end directory rescue Fog::Storage::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/storage/file.rb0000644000004100000410000001363512600047642022116 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Storage class OpenStack class File < Fog::OpenStack::Model identity :key, :aliases => 'name' attribute :access_control_allow_origin, :aliases => ['Access-Control-Allow-Origin'] attribute :content_length, :aliases => ['bytes', 'Content-Length'], :type => :integer attribute :content_type, :aliases => ['content_type', 'Content-Type'] attribute :content_disposition, :aliases => ['content_disposition', 'Content-Disposition'] attribute :etag, :aliases => ['hash', 'Etag'] attribute :last_modified, :aliases => ['last_modified', 'Last-Modified'], :type => :time attribute :metadata attribute :origin, :aliases => ['Origin'] # @!attribute [rw] delete_at # A Unix Epoch Timestamp, in integer form, representing the time when this object will be automatically deleted. # @return [Integer] the unix epoch timestamp of when this object will be automatically deleted # @see http://docs.openstack.org/developer/swift/overview_expiring_objects.html attribute :delete_at, :aliases => ['X-Delete-At'] # @!attribute [rw] delete_after # A number of seconds representing how long from now this object will be automatically deleted. # @return [Integer] the number of seconds until this object will be automatically deleted # @see http://docs.openstack.org/developer/swift/overview_expiring_objects.html attribute :delete_after, :aliases => ['X-Delete-After'] def body attributes[:body] ||= if last_modified collection.get(identity).body else '' end end def body=(new_body) attributes[:body] = new_body end def directory @directory end def copy(target_directory_key, target_file_key, options={}) requires :directory, :key options['Content-Type'] ||= content_type if content_type options['Access-Control-Allow-Origin'] ||= access_control_allow_origin if access_control_allow_origin options['Origin'] ||= origin if origin service.copy_object(directory.key, key, target_directory_key, target_file_key, options) target_directory = service.directories.new(:key => target_directory_key) target_directory.files.get(target_file_key) end def destroy requires :directory, :key service.delete_object(directory.key, key) true end def metadata attributes[:metadata] ||= headers_to_metadata end def owner=(new_owner) if new_owner attributes[:owner] = { :display_name => new_owner['DisplayName'], :id => new_owner['ID'] } end end def public=(new_public) new_public end # Get a url for file. # # required attributes: key # # @param expires [String] number of seconds (since 1970-01-01 00:00) before url expires # @param options [Hash] # @return [String] url # def url(expires, options = {}) requires :directory, :key self.service.create_temp_url(directory.key, key, expires, "GET", options) end def public_url requires :key self.collection.get_url(self.key) end def save(options = {}) requires :body, :directory, :key options['Content-Type'] = content_type if content_type options['Content-Disposition'] = content_disposition if content_disposition options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin options['Origin'] = origin if origin options['X-Delete-At'] = delete_at if delete_at options['X-Delete-After'] = delete_after if delete_after options.merge!(metadata_to_headers) data = service.put_object(directory.key, key, body, options) update_attributes_from(data) refresh_metadata self.content_length = Fog::Storage.get_body_size(body) self.content_type ||= Fog::Storage.get_content_type(body) true end private def directory=(new_directory) @directory = new_directory end def refresh_metadata metadata.reject! {|k, v| v.nil? } end def headers_to_metadata key_map = key_mapping Hash[metadata_attributes.map {|k, v| [key_map[k], v] }] end def key_mapping key_map = metadata_attributes key_map.each_pair {|k, v| key_map[k] = header_to_key(k)} end def header_to_key(opt) opt.gsub(metadata_prefix, '').split('-').map {|k| k[0, 1].downcase + k[1..-1]}.join('_').to_sym end def metadata_to_headers header_map = header_mapping Hash[metadata.map {|k, v| [header_map[k], v] }] end def header_mapping header_map = metadata.dup header_map.each_pair {|k, v| header_map[k] = key_to_header(k)} end def key_to_header(key) metadata_prefix + key.to_s.split(/[-_]/).map(&:capitalize).join('-') end def metadata_attributes if last_modified headers = service.head_object(directory.key, self.key).headers headers.reject! {|k, v| !metadata_attribute?(k)} else {} end end def metadata_attribute?(key) key.to_s =~ /^#{metadata_prefix}/ end def metadata_prefix "X-Object-Meta-" end def update_attributes_from(data) merge_attributes(data.headers.reject {|key, value| ['Content-Length', 'Content-Type'].include?(key)}) end end end end end fog-1.34.0/lib/fog/openstack/models/model.rb0000644000004100000410000000311012600047642020616 0ustar www-datawww-datarequire 'fog/core/model' module Fog module OpenStack class Model < Fog::Model # In some cases it's handy to be able to store the project for the record, e.g. swift doesn't contain project info # in the result, so we can track it in this attribute based on what project was used in the request attr_accessor :project ################################################################################################################## # Abstract base class methods, please keep the consistent naming in all subclasses of the Model class # Initialize a record def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end # Saves a record, call create or update based on identity, which marks if object was already created def save identity ? update : create end # Updates a record def update # uncomment when exception is defined in another PR # raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :get is not implemented') end # Creates a record def create # uncomment when exception is defined in another PR # raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :get is not implemented') end # Destroys a record def destroy # uncomment when exception is defined in another PR # raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :get is not implemented') end end end end fog-1.34.0/lib/fog/openstack/models/volume/0000755000004100000410000000000012600047642020505 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/volume/volume.rb0000644000004100000410000000256112600047642022345 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Volume class OpenStack class Volume < Fog::OpenStack::Model identity :id attribute :display_name, :aliases => 'displayName' attribute :display_description, :aliases => 'displayDescription' attribute :metadata attribute :status attribute :size attribute :volume_type, :aliases => ['volumeType', 'type'] attribute :snapshot_id, :aliases => 'snapshotId' attribute :imageRef, :aliases => 'image_id' attribute :availability_zone, :aliases => 'availabilityZone' attribute :created_at, :aliases => 'createdAt' attribute :attachments attribute :source_volid attribute :tenant_id, :aliases => 'os-vol-tenant-attr:tenant_id' def save requires :display_name, :size data = service.create_volume(display_name, display_description, size, attributes) merge_attributes(data.body['volume']) true end def destroy requires :id service.delete_volume(id) true end def extend(size) requires :id service.extend_volume(id, size) true end def ready? status == 'available' end end end end end fog-1.34.0/lib/fog/openstack/models/volume/transfer.rb0000644000004100000410000000154012600047642022656 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Volume class OpenStack class Transfer < Fog::OpenStack::Model identity :id attribute :auth_key, :aliases => 'authKey' attribute :created_at, :aliases => 'createdAt' attribute :name attribute :volume_id, :aliases => 'volumeId' def save requires :name, :volume_id data = service.create_transfer(volume_id, :name => name) merge_attributes(data.body['transfer']) true end def destroy requires :id service.delete_transfer(id) true end def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end end end end end fog-1.34.0/lib/fog/openstack/models/volume/availability_zones.rb0000644000004100000410000000065612600047642024731 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/volume/availability_zone' module Fog module Volume class OpenStack class AvailabilityZones < Fog::OpenStack::Collection model Fog::Volume::OpenStack::AvailabilityZone def all(options = {}) data = service.list_zones(options) load_response(data, 'availabilityZoneInfo') end end end end end fog-1.34.0/lib/fog/openstack/models/volume/availability_zone.rb0000644000004100000410000000033712600047642024542 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Volume class OpenStack class AvailabilityZone < Fog::OpenStack::Model identity :zoneName attribute :zoneState end end end end fog-1.34.0/lib/fog/openstack/models/volume/volume_types.rb0000644000004100000410000000123012600047642023561 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/volume/volume_type' module Fog module Volume class OpenStack class VolumeTypes < Fog::OpenStack::Collection model Fog::Volume::OpenStack::VolumeType def all(options = {}) response = service.list_volume_types(options) load_response(response, 'volume_types') end def get(volume_type_id) if volume_type = service.get_volume_type_details(volume_type_id).body['volume_type'] new(volume_type) end rescue Fog::Volume::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/volume/volumes.rb0000644000004100000410000000247012600047642022527 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/volume/volume' module Fog module Volume class OpenStack class Volumes < Fog::OpenStack::Collection model Fog::Volume::OpenStack::Volume def all(options = {}) # the parameter has been "detailed = true" before. Make sure we are # backwards compatible detailed = options.is_a?(Hash) ? options.delete(:detailed) : options if detailed.nil? || detailed # This method gives details by default, unless false or {:detailed => false} is passed load_response(service.list_volumes_detailed(options), 'volumes') else Fog::Logger.deprecation('Calling OpenStack[:volume].volumes.all(false) or volumes.all(:detailed => false) '\ ' is deprecated, call .volumes.summary instead') load_response(service.list_volumes(options), 'volumes') end end def summary(options = {}) load_response(service.list_volumes(options), 'volumes') end def get(volume_id) if volume = service.get_volume_details(volume_id).body['volume'] new(volume) end rescue Fog::Volume::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/volume/transfers.rb0000644000004100000410000000213512600047642023042 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/volume/transfer' module Fog module Volume class OpenStack class Transfers < Fog::OpenStack::Collection model Fog::Volume::OpenStack::Transfer def all(options = {}) load_response(service.list_transfers_detailed(options), 'transfers') end def summary(options = {}) load_response(service.list_transfers(options), 'transfers') end def get(transfer_id) if transfer = service.get_transfer_details(transfer_id).body['transfer'] new(transfer) end rescue Fog::Volume::OpenStack::NotFound nil end def accept(transfer_id, auth_key) # NOTE: This is NOT a method on the Transfer object, since the # receiver cannot see the transfer object in the get_transfer_details # or list_transfers(_detailed) requests. if transfer = service.accept_transfer(transfer_id, auth_key).body['transfer'] new(transfer) end end end end end end fog-1.34.0/lib/fog/openstack/models/volume/volume_type.rb0000644000004100000410000000036512600047642023406 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Volume class OpenStack class VolumeType < Fog::OpenStack::Model identity :id attribute :name attribute :volume_backend_name end end end end fog-1.34.0/lib/fog/openstack/models/metering/0000755000004100000410000000000012600047642021010 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/metering/meter.rb0000644000004100000410000000000012600047642022437 0ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/metering/meters.rb0000644000004100000410000000000012600047642022622 0ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/metering/resources.rb0000644000004100000410000000105612600047642023351 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/metering/resource' module Fog module Metering class OpenStack class Resources < Fog::OpenStack::Collection model Fog::Metering::OpenStack::Resource def all(detailed=true) load_response(service.list_resources) end def find_by_id(resource_id) resource = service.get_resource(resource_id).body new(resource) rescue Fog::Metering::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/metering/resource.rb0000644000004100000410000000042412600047642023164 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Metering class OpenStack class Resource < Fog::OpenStack::Model identity :resource_id attribute :project_id attribute :user_id attribute :metadata end end end end fog-1.34.0/lib/fog/openstack/models/identity_v2/0000755000004100000410000000000012600047642021436 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/identity_v2/ec2_credential.rb0000644000004100000410000000163512600047642024633 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V2 class Ec2Credential < Fog::OpenStack::Model identity :access, :aliases => 'access_key' attribute :secret, :aliases => 'secret_key' attribute :tenant_id attribute :user_id def destroy requires :access requires :user_id service.delete_ec2_credential user_id, access true end def save raise Fog::Errors::Error, 'Existing credentials cannot be altered' if access self.user_id ||= user.id self.tenant_id ||= user.tenant_id requires :user_id, :tenant_id data = service.create_ec2_credential user_id, tenant_id merge_attributes(data.body['credential']) true end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v2/roles.rb0000644000004100000410000000103012600047642023101 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v2/role' module Fog module Identity class OpenStack class V2 class Roles < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V2::Role def all(options = {}) load_response(service.list_roles(options), 'roles') end def get(id) service.get_role(id) end end end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/models/identity_v2/role.rb0000644000004100000410000000244712600047642022733 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V2 class Role < Fog::OpenStack::Model identity :id attribute :name def save requires :name data = service.create_role(name) merge_attributes(data.body['role']) true end def destroy requires :id service.delete_role(id) true end def add_to_user(user, tenant) add_remove_to_user(user, tenant, :add) end def remove_to_user(user, tenant) add_remove_to_user(user, tenant, :remove) end private def add_remove_to_user(user, tenant, ops) requires :id user_id = get_id(user) tenant_id = get_id(tenant) case ops when :add service.create_user_role(tenant_id, user_id, id).status == 200 when :remove service.delete_user_role(tenant_id, user_id, id).status == 204 end end def get_id(_) _.is_a?(String) ? _ : _.id end end # class Role end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/models/identity_v2/user.rb0000644000004100000410000000363012600047642022743 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V2 class User < Fog::OpenStack::Model identity :id attribute :email attribute :enabled attribute :name attribute :tenant_id, :aliases => 'tenantId' attribute :password attr_accessor :email, :name, :tenant_id, :enabled, :password def ec2_credentials requires :id service.ec2_credentials(:user => self) end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :tenant_id, :password enabled = true if enabled.nil? data = service.create_user(name, password, email, tenant_id, enabled) merge_attributes(data.body['user']) true end def update(options = {}) requires :id options.merge('id' => id) response = service.update_user(id, options) true end def update_password(password) update({'password' => password, 'url' => "/users/#{id}/OS-KSADM/password"}) end def update_tenant(tenant) tenant = tenant.id if tenant.class != String update({:tenantId => tenant, 'url' => "/users/#{id}/OS-KSADM/tenant"}) end def update_enabled(enabled) update({:enabled => enabled, 'url' => "/users/#{id}/OS-KSADM/enabled"}) end def destroy requires :id service.delete_user(id) true end def roles(tenant_id = self.tenant_id) service.list_roles_for_user_on_tenant(tenant_id, self.id).body['roles'] end end # class User end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/models/identity_v2/ec2_credentials.rb0000644000004100000410000000301112600047642025004 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v2/ec2_credential' module Fog module Identity class OpenStack class V2 class Ec2Credentials < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V2::Ec2Credential attribute :user def all(options = {}) user_id = user ? user.id : nil options[:user_id] = user_id ec2_credentials = service.list_ec2_credentials(options) load_response(ec2_credentials, 'credentials') end def create(attributes = {}) if user then attributes[:user_id] ||= user.id attributes[:tenant_id] ||= user.tenant_id end super attributes end def destroy(access_key) ec2_credential = self.find_by_access_key(access_key) ec2_credential.destroy end def find_by_access_key(access_key) user_id = user ? user.id : nil ec2_credential = self.find { |ec2_credential| ec2_credential.access == access_key } unless ec2_credential then response = service.get_ec2_credential(user_id, access_key) body = response.body['credential'] body = body.merge 'service' => service ec2_credential = Fog::Identity::OpenStack::V2::EC2Credential.new(body) end ec2_credential end end end end end end fog-1.34.0/lib/fog/openstack/models/identity_v2/users.rb0000644000004100000410000000237612600047642023134 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v2/user' module Fog module Identity class OpenStack class V2 class Users < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V2::User attribute :tenant_id def all(options = {}) options[:tenant_id] = tenant_id load_response(service.list_users(options), 'users') end def find_by_id(id) self.find { |user| user.id == id } || Fog::Identity::OpenStack::V2::User.new( service.get_user_by_id(id).body['user'].merge( 'service' => service ) ) end def find_by_name(name) self.find { |user| user.name == name } || Fog::Identity::OpenStack::V2::User.new( service.get_user_by_name(name).body['user'].merge( 'service' => service ) ) end def destroy(id) user = self.find_by_id(id) user.destroy end end # class Users end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/models/identity_v2/tenant.rb0000644000004100000410000000264712600047642023265 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Identity class OpenStack class V2 class Tenant < Fog::OpenStack::Model identity :id attribute :description attribute :enabled attribute :name def to_s self.name end def roles_for(user) service.roles( :tenant => self, :user => user) end def users requires :id service.users(:tenant_id => self.id) end def destroy requires :id service.delete_tenant(self.id) true end def update(attr = nil) requires :id, :name merge_attributes( service.update_tenant(self.id, attr || attributes).body['tenant']) self end def create requires :name merge_attributes( service.create_tenant(attributes).body['tenant']) self end def grant_user_role(user_id, role_id) service.add_user_to_tenant(self.id, user_id, role_id) end def revoke_user_role(user_id, role_id) service.remove_user_from_tenant(self.id, user_id, role_id) end end # class Tenant end # class V2 end # class OpenStack end # module Identity end # module Fog fog-1.34.0/lib/fog/openstack/models/identity_v2/tenants.rb0000644000004100000410000000164712600047642023447 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/identity_v2/tenant' module Fog module Identity class OpenStack class V2 class Tenants < Fog::OpenStack::Collection model Fog::Identity::OpenStack::V2::Tenant def all(options = {}) load_response(service.list_tenants(options), 'tenants') end def find_by_id(id) cached_tenant = self.find { |tenant| tenant.id == id } return cached_tenant if cached_tenant tenant_hash = service.get_tenant(id).body['tenant'] Fog::Identity::OpenStack::V2::Tenant.new( tenant_hash.merge(:service => service)) end def destroy(id) tenant = self.find_by_id(id) tenant.destroy end end # class Tenants end # class V2 end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/models/compute/0000755000004100000410000000000012600047642020652 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/compute/address.rb0000644000004100000410000000317112600047642022626 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Address < Fog::OpenStack::Model identity :id attribute :ip attribute :pool attribute :fixed_ip attribute :instance_id def initialize(attributes = {}) # assign server first to prevent race condition with persisted? self.server = attributes.delete(:server) super end def destroy requires :id service.release_address(id) true end def server=(new_server) if new_server associate(new_server) else disassociate end end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? data = service.allocate_address(pool).body['floating_ip'] new_attributes = data.reject {|key,value| !['id', 'instance_id', 'ip', 'fixed_ip'].include?(key)} merge_attributes(new_attributes) if @server self.server = @server end true end private def associate(new_server) unless persisted? @server = new_server else @server = nil self.instance_id = new_server.id service.associate_address(instance_id, ip) end end def disassociate @server = nil if persisted? service.disassociate_address(instance_id, ip) end self.instance_id = nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/addresses.rb0000644000004100000410000000130412600047642023152 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/address' module Fog module Compute class OpenStack class Addresses < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Address def all(options = {}) load_response(service.list_all_addresses(options), 'floating_ips') end def get(address_id) if address = service.get_address(address_id).body['floating_ip'] new(address) end rescue Fog::Compute::OpenStack::NotFound nil end def get_address_pools service.list_address_pools.body['floating_ip_pools'] end end end end end fog-1.34.0/lib/fog/openstack/models/compute/security_group_rules.rb0000644000004100000410000000111212600047642025467 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/security_group_rule' module Fog module Compute class OpenStack class SecurityGroupRules < Fog::OpenStack::Collection model Fog::Compute::OpenStack::SecurityGroupRule def get(security_group_rule_id) if security_group_rule_id body = service.get_security_group_rule(security_group_rule_id).body new(body['security_group_rule']) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/volume.rb0000644000004100000410000000272512600047642022514 0ustar www-datawww-datarequire 'fog/openstack/models/model' require 'fog/openstack/models/compute/metadata' module Fog module Compute class OpenStack class Volume < Fog::OpenStack::Model identity :id attribute :name, :aliases => 'displayName' attribute :description, :aliases => 'displayDescription' attribute :status attribute :size attribute :type, :aliases => 'volumeType' attribute :snapshot_id, :aliases => 'snapshotId' attribute :availability_zone, :aliases => 'availabilityZone' attribute :created_at, :aliases => 'createdAt' attribute :attachments def save requires :name, :description, :size data = service.create_volume(name, description, size, attributes) merge_attributes(data.body['volume']) true end def destroy requires :id service.delete_volume(id) true end def attach(server_id, name) requires :id data = service.attach_volume(id, server_id, name) merge_attributes(:attachments => attachments << data.body['volumeAttachment']) true end def detach(server_id, attachment_id) requires :id service.detach_volume(server_id, attachment_id) true end def ready? self.status == "available" end end end end end fog-1.34.0/lib/fog/openstack/models/compute/images.rb0000644000004100000410000000161512600047642022447 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/image' module Fog module Compute class OpenStack class Images < Fog::OpenStack::Collection attribute :filters model Fog::Compute::OpenStack::Image attribute :server def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg data = service.list_images_detail(filters) images = load_response(data, 'images') if server self.replace(self.select {|image| image.server_id == server.id}) end images end def get(image_id) data = service.get_image_details(image_id).body['image'] new(data) rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/security_group.rb0000644000004100000410000000402112600047642024257 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class SecurityGroup < Fog::OpenStack::Model identity :id attribute :name attribute :description attribute :security_group_rules, :aliases => "rules" attribute :tenant_id def security_group_rules Fog::Compute::OpenStack::SecurityGroupRules.new(:service => service).load(attributes[:security_group_rules]) end def rules Fog::Logger.deprecation('#rules is deprecated. Use #security_group_rules instead') attributes[:security_group_rules] end # no one should be calling this because it doesn't do anything # useful but we deprecated the rules attribute and need to maintain the API def rules=(new_rules) Fog::Logger.deprecation('#rules= is deprecated. Use the Fog::Compute::Openstack::SecurityGroupRules collection to create new rules.') attributes[:security_group_rules] = new_rules end def save requires :name, :description data = service.create_security_group(name, description) merge_attributes(data.body['security_group']) true end def destroy requires :id service.delete_security_group(id) true end def create_security_group_rule(min, max, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id = nil) Fog::Logger.deprecation('#create_security_group_rule is deprecated. Use the Fog::Compute::Openstack::SecurityGroupRules collection to create new rules.') requires :id service.create_security_group_rule(id, ip_protocol, min, max, cidr, group_id) end def delete_security_group_rule(rule_id) Fog::Logger.deprecation('#create_security_group_rule is deprecated. Use the Fog::Compute::Openstack::SecurityGroupRule objects to destroy rules.') service.delete_security_group_rule(rule_id) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/metadatum.rb0000644000004100000410000000112512600047642023157 0ustar www-datawww-datarequire 'fog/openstack/models/model' require 'fog/openstack/models/meta_parent' module Fog module Compute class OpenStack class Metadatum < Fog::OpenStack::Model include Fog::Compute::OpenStack::MetaParent identity :key attribute :value def destroy requires :identity service.delete_meta(collection_name, @parent.id, key) true end def save requires :identity, :value service.update_meta(collection_name, @parent.id, key, value) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/servers.rb0000644000004100000410000000365212600047642022676 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/server' module Fog module Compute class OpenStack class Servers < Fog::OpenStack::Collection attribute :filters model Fog::Compute::OpenStack::Server def initialize(attributes) self.filters ||= {} super end def all(filters_arg = filters) filters = filters_arg data = service.list_servers_detail(filters) load_response(data, 'servers') end def summary(filters_arg = filters) filters = filters_arg data = service.list_servers(filters) load_response(data, 'servers') end # Creates a new server and populates ssh keys # @return [Fog::Compute::OpenStack::Server] # @raise [Fog::Compute::OpenStack::NotFound] - HTTP 404 # @raise [Fog::Compute::OpenStack::BadRequest] - HTTP 400 # @raise [Fog::Compute::OpenStack::InternalServerError] - HTTP 500 # @raise [Fog::Compute::OpenStack::ServiceError] # @example # service.servers.bootstrap :name => 'bootstrap-server', # :flavor_ref => service.flavors.first.id, # :image_ref => service.images.find {|img| img.name =~ /Ubuntu/}.id, # :public_key_path => '~/.ssh/fog_rsa.pub', # :private_key_path => '~/.ssh/fog_rsa' # def bootstrap(new_attributes = {}) server = create(new_attributes) server.wait_for { ready? } server.setup(:password => server.password) server end def get(server_id) if server = service.get_server_details(server_id).body['server'] new(server) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/key_pairs.rb0000644000004100000410000000134212600047642023165 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/key_pair' module Fog module Compute class OpenStack class KeyPairs < Fog::OpenStack::Collection model Fog::Compute::OpenStack::KeyPair def all(options = {}) items = Array.new service.list_key_pairs(options).body['keypairs'].each do |kp| items = items + kp.values end # TODO convert to load_response? load(items) end def get(key_pair_name) if key_pair_name self.all.select {|kp| kp.name == key_pair_name}.first end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/security_groups.rb0000644000004100000410000000121112600047642024440 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/security_group' module Fog module Compute class OpenStack class SecurityGroups < Fog::OpenStack::Collection model Fog::Compute::OpenStack::SecurityGroup def all(options = {}) load_response(service.list_security_groups(options), 'security_groups') end def get(security_group_id) if security_group_id new(service.get_security_group(security_group_id).body['security_group']) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/metadata.rb0000644000004100000410000000355112600047642022763 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/meta_parent' require 'fog/openstack/models/compute/metadatum' require 'fog/openstack/models/compute/image' require 'fog/openstack/models/compute/server' module Fog module Compute class OpenStack class Metadata < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Metadatum include Fog::Compute::OpenStack::MetaParent def all requires :parent metadata = service.list_metadata(collection_name, @parent.id).body['metadata'] metas = [] metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} } unless metadata.nil? # TODO convert to load_response? load(metas) end def get(key) requires :parent data = service.get_metadata(collection_name, @parent.id, key).body["meta"] metas = [] data.each_pair {|k,v| metas << {"key" => k, "value" => v} } new(metas[0]) rescue Fog::Compute::OpenStack::NotFound nil end def update(data=nil) requires :parent service.update_metadata(collection_name, @parent.id, to_hash(data)) end def set(data=nil) requires :parent service.set_metadata(collection_name, @parent.id, to_hash(data)) end def new(attributes = {}) requires :parent super({ :parent => @parent }.merge!(attributes)) end def to_hash(data=nil) if data.nil? data={} self.each do |meta| if meta.is_a?(Fog::Compute::OpenStack::Metadatum) then data.store(meta.key, meta.value) else data.store(meta["key"], meta["value"]) end end end data end end end end end fog-1.34.0/lib/fog/openstack/models/compute/network.rb0000644000004100000410000000045112600047642022670 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Network < Fog::OpenStack::Model identity :id attribute :name attribute :addresses end # class Network end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/models/compute/snapshot.rb0000644000004100000410000000160212600047642023035 0ustar www-datawww-datarequire 'fog/openstack/models/model' require 'fog/openstack/models/compute/metadata' module Fog module Compute class OpenStack class Snapshot < Fog::OpenStack::Model identity :id attribute :name, :aliases => 'displayName' attribute :description, :aliases => 'displayDescription' attribute :volume_id, :aliases => 'volumeId' attribute :status attribute :size attribute :created_at, :aliases => 'createdAt' def save(force=false) requires :volume_id, :name, :description data = service.create_volume_snapshot(volume_id, name, description, force) merge_attributes(data.body['snapshot']) true end def destroy requires :id service.delete_snapshot(id) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/hosts.rb0000644000004100000410000000124012600047642022334 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/host' module Fog module Compute class OpenStack class Hosts < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Host def all(options = {}) data = service.list_hosts(options) load_response(data, 'hosts') end def get(host_name) if host = service.get_host_details(host_name).body['host'] new({ 'host_name' => host_name, 'details' => host} ) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/availability_zones.rb0000644000004100000410000000111412600047642025064 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/availability_zone' module Fog module Compute class OpenStack class AvailabilityZones < Fog::OpenStack::Collection model Fog::Compute::OpenStack::AvailabilityZone def all(options = {}) data = service.list_zones_detailed(options) load_response(data, 'availabilityZoneInfo') end def summary(options = {}) data = service.list_zones(options) load_response(data, 'availabilityZoneInfo') end end end end end fog-1.34.0/lib/fog/openstack/models/compute/services.rb0000644000004100000410000000112412600047642023020 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/service' module Fog module Compute class OpenStack class Services < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Service def all(options = {}) load_response(service.list_services(options), 'services') end alias_method :summary, :all def details(options = {}) Fog::Logger.deprecation('Calling OpenStack[:compute].services.details is deprecated, use .services.all') all(options) end end end end end fog-1.34.0/lib/fog/openstack/models/compute/availability_zone.rb0000644000004100000410000000037112600047642024705 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class AvailabilityZone < Fog::OpenStack::Model identity :zoneName attribute :hosts attribute :zoneState end end end end fog-1.34.0/lib/fog/openstack/models/compute/flavors.rb0000644000004100000410000000132612600047642022655 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/flavor' module Fog module Compute class OpenStack class Flavors < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Flavor def all(options = {}) data = service.list_flavors_detail(options) load_response(data, 'flavors') end def summary(options = {}) data = service.list_flavors(options) load_response(data, 'flavors') end def get(flavor_id) data = service.get_flavor_details(flavor_id).body['flavor'] new(data) rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/key_pair.rb0000644000004100000410000000257712600047642023015 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class KeyPair < Fog::OpenStack::Model identity :name attribute :fingerprint attribute :public_key attribute :private_key attribute :user_id attribute :id attr_accessor :public_key def destroy requires :name service.delete_key_pair(name) true end def save requires :name data = if public_key service.create_key_pair(name, public_key).body['keypair'] else service.create_key_pair(name).body['keypair'] end new_attributes = data.reject {|key,value| !['fingerprint', 'public_key', 'name', 'private_key', 'user_id'].include?(key)} merge_attributes(new_attributes) true end def write(path="#{ENV['HOME']}/.ssh/fog_#{Fog.credential.to_s}_#{name}.pem") if writable? split_private_key = private_key.split(/\n/) File.open(path, "w") do |f| split_private_key.each {|line| f.puts line} f.chmod 0600 end "Key file built: #{path}" else "Invalid private key" end end def writable? !!(private_key && ENV.key?('HOME')) end end end end end fog-1.34.0/lib/fog/openstack/models/compute/host.rb0000644000004100000410000000132712600047642022157 0ustar www-datawww-datarequire 'fog/compute/models/server' require 'fog/openstack/models/compute/metadata' module Fog module Compute class OpenStack class Host < Fog::OpenStack::Model attribute :host_name attribute :service_name attribute :details attribute :zone def initialize(attributes) attributes["service_name"] = attributes.delete "service" # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end def details service.get_host_details(self.host_name).body['host'] rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/aggregates.rb0000644000004100000410000000116512600047642023313 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/aggregate' module Fog module Compute class OpenStack class Aggregates < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Aggregate def all(options = {}) load_response(service.list_aggregates(options), 'aggregates') end def find_by_id(id) new(service.get_aggregate(id).body['aggregate']) end alias_method :get, :find_by_id def destroy(id) aggregate = self.find_by_id(id) aggregate.destroy end end end end end fog-1.34.0/lib/fog/openstack/models/compute/aggregate.rb0000644000004100000410000000245712600047642023135 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Aggregate < Fog::OpenStack::Model identity :id attribute :availability_zone attribute :name attribute :metadata attribute :deleted attribute :deleted_at attribute :updated_at attribute :created_at # Detailed attribute :hosts def save requires :name identity ? update : create end def create requires :name merge_attributes(service.create_aggregate(self.name, self.attributes).body['aggregate']) self end def update merge_attributes(service.update_aggregate(self.id, self.attributes).body['aggregate']) self end def add_host(host_uuid) requires :id, service.add_aggregate_host(self.id, host_uuid) end def remove_host(host_uuid) requires :id, service.remove_aggregate_host(self.id, host_uuid) end def update_metadata(metadata) service.update_aggregate_metadata(self.id, metadata) end def destroy requires :id service.delete_aggregate(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/volumes.rb0000644000004100000410000000216312600047642022673 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/volume' module Fog module Compute class OpenStack class Volumes < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Volume def all(options = true) if !options.is_a?(Hash) if options Fog::Logger.deprecation('Calling OpenStack[:compute].volumes.all(true) is deprecated, use .volumes.all') else Fog::Logger.deprecation('Calling OpenStack[:compute].volumes.all(false) is deprecated, use .volumes.summary') end load_response(service.list_volumes(options), 'volumes') else load_response(service.list_volumes_detail(options), 'volumes') end end def summary(options = {}) load_response(service.list_volumes(options), 'volumes') end def get(volume_id) if volume = service.get_volume_details(volume_id).body['volume'] new(volume) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/security_group_rule.rb0000644000004100000410000000150312600047642025310 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class SecurityGroupRule < Fog::OpenStack::Model identity :id attribute :from_port attribute :group attribute :ip_protocol attribute :to_port attribute :parent_group_id attribute :ip_range def save requires :ip_protocol, :from_port, :to_port, :parent_group_id cidr = ip_range && ip_range["cidr"] if rule = service.create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group).data[:body] merge_attributes(rule["security_group_rule"]) end end def destroy requires :id service.delete_security_group_rule(id) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/flavor.rb0000644000004100000410000000272412600047642022475 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Flavor < Fog::OpenStack::Model identity :id attribute :name attribute :ram attribute :disk attribute :vcpus attribute :links attribute :swap attribute :rxtx_factor attribute :metadata attribute :ephemeral, :aliases => 'OS-FLV-EXT-DATA:ephemeral' attribute :is_public, :aliases => 'os-flavor-access:is_public' attribute :disabled, :aliases => 'OS-FLV-DISABLED:disabled' def save requires :name, :ram, :vcpus, :disk attributes[:ephemeral] = self.ephemeral || 0 attributes[:is_public] = self.is_public || false attributes[:disabled] = self.disabled || false attributes[:swap] = self.swap || 0 attributes[:rxtx_factor] = self.rxtx_factor || 1.0 merge_attributes(service.create_flavor(self.attributes).body['flavor']) self end def destroy requires :id service.delete_flavor(self.id) true end def metadata service.get_flavor_metadata(self.id).body['extra_specs'] rescue Fog::Compute::OpenStack::NotFound nil end def create_metadata(metadata) service.create_flavor_metadata(self.id, metadata) rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/tenant.rb0000644000004100000410000000102212600047642022463 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Tenant < Fog::OpenStack::Model identity :id attribute :description attribute :enabled attribute :name def to_s self.name end def usage(start_date, end_date) requires :id service.get_usage(self.id, start_date, end_date).body['tenant_usage'] end end # class Tenant end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/models/compute/tenants.rb0000644000004100000410000000122112600047642022647 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/tenant' module Fog module Compute class OpenStack class Tenants < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Tenant def all load_response(service.list_tenants, 'tenants') end def usages(start_date = nil, end_date = nil, details = false) service.list_usages(start_date, end_date, details).body['tenant_usages'] end def get(id) self.find {|tenant| tenant.id == id} end end # class Tenants end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/models/compute/snapshots.rb0000644000004100000410000000222712600047642023224 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/snapshot' module Fog module Compute class OpenStack class Snapshots < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Snapshot def all(options = {}) if !options.is_a?(Hash) if options Fog::Logger.deprecation('Calling OpenStack[:compute].snapshots.all(true) is deprecated, use .snapshots.all') else Fog::Logger.deprecation('Calling OpenStack[:compute].snapshots.all(false) is deprecated, use .snapshots.summary') end load_response(service.list_snapshots(options), 'snapshots') else load_response(service.list_snapshots_detail(options), 'snapshots') end end def summary(options = {}) load_response(service.list_snapshots(options), 'snapshots') end def get(snapshot_id) if snapshot = service.get_snapshot_details(snapshot_id).body['snapshot'] new(snapshot) end rescue Fog::Compute::OpenStack::NotFound nil end end end end end fog-1.34.0/lib/fog/openstack/models/compute/server.rb0000644000004100000410000002741412600047642022515 0ustar www-datawww-datarequire 'fog/compute/models/server' require 'fog/openstack/models/compute/metadata' module Fog module Compute class OpenStack class Server < Fog::Compute::Server identity :id attribute :instance_name, :aliases => 'OS-EXT-SRV-ATTR:instance_name' attribute :addresses attribute :flavor attribute :host_id, :aliases => 'hostId' attribute :image attribute :metadata attribute :links attribute :name # @!attribute [rw] personality # @note This attribute is only used for server creation. This field will be nil on subsequent retrievals. # @return [Hash] Hash containing data to inject into the file system of the cloud server instance during server creation. # @example To inject fog.txt into file system # :personality => [{ :path => '/root/fog.txt', # :contents => Base64.encode64('Fog was here!') # }] # @see #create # @see http://docs.openstack.org/api/openstack-compute/2/content/Server_Personality-d1e2543.html attribute :personality attribute :progress attribute :accessIPv4 attribute :accessIPv6 attribute :availability_zone, :aliases => 'OS-EXT-AZ:availability_zone' attribute :user_data_encoded attribute :state, :aliases => 'status' attribute :created, :type => :time attribute :updated, :type => :time attribute :tenant_id attribute :user_id attribute :key_name attribute :fault attribute :config_drive attribute :os_dcf_disk_config, :aliases => 'OS-DCF:diskConfig' attribute :os_ext_srv_attr_host, :aliases => 'OS-EXT-SRV-ATTR:host' attribute :os_ext_srv_attr_hypervisor_hostname, :aliases => 'OS-EXT-SRV-ATTR:hypervisor_hostname' attribute :os_ext_srv_attr_instance_name, :aliases => 'OS-EXT-SRV-ATTR:instance_name' attribute :os_ext_sts_power_state, :aliases => 'OS-EXT-STS:power_state' attribute :os_ext_sts_task_state, :aliases => 'OS-EXT-STS:task_state' attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state' attr_reader :password attr_writer :image_ref, :flavor_ref, :nics, :os_scheduler_hints attr_accessor :block_device_mapping, :block_device_mapping_v2 # In some cases it's handy to be able to store the project for the record, e.g. swift doesn't contain project info # in the result, so we can track it in this attribute based on what project was used in the request attr_accessor :project def initialize(attributes={}) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) self.security_groups = attributes.delete(:security_groups) self.min_count = attributes.delete(:min_count) self.max_count = attributes.delete(:max_count) self.nics = attributes.delete(:nics) self.os_scheduler_hints = attributes.delete(:os_scheduler_hints) self.block_device_mapping = attributes.delete(:block_device_mapping) self.block_device_mapping_v2 = attributes.delete(:block_device_mapping_v2) super end def metadata @metadata ||= begin Fog::Compute::OpenStack::Metadata.new({ :service => service, :parent => self }) end end def metadata=(new_metadata={}) return unless new_metadata metas = [] new_metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} } @metadata = metadata.load(metas) end def user_data=(ascii_userdata) self.user_data_encoded = [ascii_userdata].pack('m') if ascii_userdata end def destroy requires :id service.delete_server(id) true end def images requires :id service.images(:server => self) end def all_addresses # currently openstack API does not tell us what is a floating ip vs a fixed ip for the vm listing, # we fall back to get all addresses and filter sadly. # Only includes manually-assigned addresses, not auto-assigned @all_addresses ||= service.list_all_addresses.body["floating_ips"].select{|data| data['instance_id'] == id} end def reload @all_addresses = nil super end # returns all ip_addresses for a given instance # this includes both the fixed ip(s) and the floating ip(s) def ip_addresses addresses.values.flatten.map{|x| x['addr']} end def floating_ip_addresses all_floating=addresses.values.flatten.select{ |data| data["OS-EXT-IPS:type"]=="floating" }.map{|addr| addr["addr"] } # Return them all, leading with manually assigned addresses manual = all_addresses.map{|addr| addr["ip"]} all_floating.sort{ |a,b| a_manual = manual.include? a b_manual = manual.include? b if a_manual and !b_manual -1 elsif !a_manual and b_manual 1 else 0 end } all_floating.empty? ? manual : all_floating end alias_method :public_ip_addresses, :floating_ip_addresses def floating_ip_address floating_ip_addresses.first end alias_method :public_ip_address, :floating_ip_address def private_ip_addresses ip_addresses - floating_ip_addresses end def private_ip_address private_ip_addresses.first end def image_ref @image_ref end def image_ref=(new_image_ref) @image_ref = new_image_ref end def flavor_ref @flavor_ref end def flavor_ref=(new_flavor_ref) @flavor_ref = new_flavor_ref end def ready? self.state == 'ACTIVE' end def failed? self.state == 'ERROR' end def change_password(admin_password) requires :id service.change_server_password(id, admin_password) true end def rebuild(image_ref, name, admin_pass=nil, metadata=nil, personality=nil) requires :id service.rebuild_server(id, image_ref, name, admin_pass, metadata, personality) true end def resize(flavor_ref) requires :id service.resize_server(id, flavor_ref) true end def revert_resize requires :id service.revert_resize_server(id) true end def confirm_resize requires :id service.confirm_resize_server(id) true end def security_groups requires :id groups = service.list_security_groups(:server_id => id).body['security_groups'] groups.map do |group| Fog::Compute::OpenStack::SecurityGroup.new group.merge({:service => service}) end end def security_groups=(new_security_groups) @security_groups = new_security_groups end def reboot(type = 'SOFT') requires :id service.reboot_server(id, type) true end def stop requires :id service.stop_server(id) end def pause requires :id service.pause_server(id) end def suspend requires :id service.suspend_server(id) end def start requires :id case state.downcase when 'paused' service.unpause_server(id) when 'suspended' service.resume_server(id) else service.start_server(id) end end def shelve requires :id service.shelve_server(id) end def unshelve requires :id service.unshelve_server(id) end def shelve_offload requires :id service.shelve_offload_server(id) end def create_image(name, metadata={}) requires :id service.create_image(id, name, metadata) end def console(log_length = nil) requires :id service.get_console_output(id, log_length) end def migrate requires :id service.migrate_server(id) end def live_migrate(host, block_migration, disk_over_commit) requires :id service.live_migrate_server(id, host, block_migration, disk_over_commit) end def associate_address(floating_ip) requires :id service.associate_address id, floating_ip end def disassociate_address(floating_ip) requires :id service.disassociate_address id, floating_ip end def reset_vm_state(vm_state) requires :id service.reset_server_state id, vm_state end def min_count=(new_min_count) @min_count = new_min_count end def max_count=(new_max_count) @max_count = new_max_count end def networks service.networks(:server => self) end def volumes requires :id service.volumes.select do |vol| vol.attachments.find { |attachment| attachment["serverId"] == id } end end def volume_attachments requires :id service.get_server_volumes(id).body['volumeAttachments'] end def attach_volume(volume_id, device_name) requires :id service.attach_volume(volume_id, id, device_name) true end def detach_volume(volume_id) requires :id service.detach_volume(id, volume_id) true end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :flavor_ref, :name requires_one :image_ref, :block_device_mapping, :block_device_mapping_v2 options = { 'personality' => personality, 'accessIPv4' => accessIPv4, 'accessIPv6' => accessIPv6, 'availability_zone' => availability_zone, 'user_data' => user_data_encoded, 'key_name' => key_name, 'config_drive' => config_drive, 'security_groups' => @security_groups, 'min_count' => @min_count, 'max_count' => @max_count, 'nics' => @nics, 'os:scheduler_hints' => @os_scheduler_hints, 'block_device_mapping' => @block_device_mapping, 'block_device_mapping_v2' => @block_device_mapping_v2, } options['metadata'] = metadata.to_hash unless @metadata.nil? options = options.reject {|key, value| value.nil?} data = service.create_server(name, image_ref, flavor_ref, options) merge_attributes(data.body['server']) true end def setup(credentials = {}) requires :ssh_ip_address, :identity, :public_key, :username Fog::SSH.new(ssh_ip_address, username, credentials).run([ %{mkdir .ssh}, %{echo "#{public_key}" >> ~/.ssh/authorized_keys}, %{passwd -l #{username}}, %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json}, %{echo "#{Fog::JSON.encode(metadata)}" >> ~/metadata.json} ]) rescue Errno::ECONNREFUSED sleep(1) retry end private def adminPass=(new_admin_pass) @password = new_admin_pass end end end end end fog-1.34.0/lib/fog/openstack/models/compute/image.rb0000644000004100000410000000214712600047642022265 0ustar www-datawww-datarequire 'fog/openstack/models/model' require 'fog/openstack/models/compute/metadata' module Fog module Compute class OpenStack class Image < Fog::OpenStack::Model identity :id attribute :name attribute :created_at, :aliases => 'created' attribute :updated_at, :aliases => 'updated' attribute :progress attribute :status attribute :minDisk attribute :minRam attribute :server, :aliases => 'server' attribute :metadata attribute :links def metadata @metadata ||= begin Fog::Compute::OpenStack::Metadata.new({ :service => service, :parent => self }) end end def metadata=(new_metadata={}) metas = [] new_metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} } metadata.load(metas) end def destroy requires :id service.delete_image(id) true end def ready? status == 'ACTIVE' end end end end end fog-1.34.0/lib/fog/openstack/models/compute/service.rb0000644000004100000410000000165512600047642022646 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Compute class OpenStack class Service < Fog::OpenStack::Model identity :id attribute :binary attribute :host attribute :state attribute :status attribute :updated_at attribute :zone #detailed attribute :disabled_reason def enable requires :binary, :host service.enable_service(self.host, self.binary) end def disable requires :binary, :host service.disable_service(self.host, self.binary) end def disable_and_log_reason requires :binary, :host, :disabled_reason service.disable_service_log_reason(self.host, self.binary, self.disabled_reason) end def destroy requires :id service.delete_service(self.id) true end end end end end fog-1.34.0/lib/fog/openstack/models/compute/networks.rb0000644000004100000410000000136612600047642023061 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/compute/network' module Fog module Compute class OpenStack class Networks < Fog::OpenStack::Collection model Fog::Compute::OpenStack::Network attribute :server def all requires :server networks = Array.new server.addresses.each_with_index do |address, index| networks << { :id => index + 1, :name => address[0], :addresses => address[1].map {|a| a['addr'] } } end # TODO convert to load_response? load(networks) end end # class Networks end # class OpenStack end # module Compute end # module Fog fog-1.34.0/lib/fog/openstack/models/collection.rb0000644000004100000410000000327212600047642021662 0ustar www-datawww-datarequire 'fog/core/collection' module Fog module OpenStack class Collection < Fog::Collection # It's important to store the whole response, it contains e.g. important info about whether there is another # page of data. attr_accessor :response def load_response(response, index = nil) # Delete it index if it's there, so we don't store response with data twice, but we store only metadata objects = index ? response.body.delete(index) : response.body clear && objects.each { |object| self << new(object) } self.response = response self end ################################################################################################################## # Abstract base class methods, please keep the consistent naming in all subclasses of the Collection class # Returns detailed list of records def all(options = {}) raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :all is not implemented') end # Returns non detailed list of records, usually just subset of attributes, which makes this call more effective. # Not all openstack services support non detailed list, so it delegates to :all by default. def summary(options = {}) all(options) end # Gets record given record's UUID def get(uuid) raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :get is not implemented') end alias_method :find_by_id, :get # Destroys record given record's UUID def destroy(uuid) raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :destroy is not implemented') end end end end fog-1.34.0/lib/fog/openstack/models/image/0000755000004100000410000000000012600047642020260 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/image/images.rb0000644000004100000410000000375112600047642022060 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/image/image' module Fog module Image class OpenStack class Images < Fog::OpenStack::Collection model Fog::Image::OpenStack::Image def all(options = {}) load_response(service.list_public_images_detailed(options), 'images') end def summary(options = {}) load_response(service.list_public_images(options), 'images') end def details(options = {}, deprecated_query = nil) Fog::Logger.deprecation("Calling OpenStack[:glance].images.details will be removed, "\ " call .images.all for detailed list.") load_response(service.list_public_images_detailed(options, deprecated_query), 'images') end def find_by_id(id) all.find {|image| image.id == id} end alias_method :get, :find_by_id def public images = load(service.list_public_images_detailed.body['images']) images.delete_if{|image| image.is_public == false} end def private images = load(service.list_public_images_detailed.body['images']) images.delete_if{|image| image.is_public} end def destroy(id) image = self.find_by_id(id) image.destroy end def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^find_by_(.*)$/ load(service.list_public_images_detailed($1 ,arguments.first).body['images']) else super end end def find_by_size_min(size) find_attribute(__method__, size) end def find_by_size_max(size) find_attribute(__method__, size) end def find_attribute(attribute,value) attribute = attribute.to_s.gsub("find_by_", "") load(service.list_public_images_detailed(attribute , value).body['images']) end end end end end fog-1.34.0/lib/fog/openstack/models/image/image.rb0000644000004100000410000000333312600047642021671 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Image class OpenStack class Image < Fog::OpenStack::Model identity :id attribute :name attribute :size attribute :disk_format attribute :container_format attribute :id attribute :checksum #detailed attribute :min_disk attribute :created_at attribute :deleted_at attribute :updated_at attribute :deleted attribute :protected attribute :is_public attribute :status attribute :min_ram attribute :owner attribute :properties attribute :location attribute :copy_from def create requires :name merge_attributes(service.create_image(self.attributes).body['image']) self end def update requires :name merge_attributes(service.update_image(self.attributes).body['image']) self end def destroy requires :id service.delete_image(self.id) true end def add_member(member_id) requires :id service.add_member_to_image(self.id, member_id) end def remove_member(member_id) requires :id service.remove_member_from_image(self.id, member_id) end def update_members(members) requires :id service.update_image_members(self.id, members) end def members requires :id service.get_image_members(self.id).body['members'] end def metadata requires :id service.get_image(self.id).headers end end end end end fog-1.34.0/lib/fog/openstack/models/planning/0000755000004100000410000000000012600047642021004 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/planning/roles.rb0000644000004100000410000000054112600047642022455 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/planning/role' module Fog module Openstack class Planning class Roles < Fog::OpenStack::Collection model Fog::Openstack::Planning::Role def all(options = {}) load_response(service.list_roles(options)) end end end end end fog-1.34.0/lib/fog/openstack/models/planning/role.rb0000644000004100000410000000072512600047642022276 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Openstack class Planning class Role < Fog::OpenStack::Model identity :uuid attribute :description attribute :name attribute :uuid def add_to_plan(plan_uuid) service.add_role_to_plan(plan_uuid, uuid) end def remove_from_plan(plan_uuid) service.remove_role_from_plan(plan_uuid, uuid) end end end end end fog-1.34.0/lib/fog/openstack/models/planning/plans.rb0000644000004100000410000000136612600047642022454 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/planning/plan' module Fog module Openstack class Planning class Plans < Fog::OpenStack::Collection model Fog::Openstack::Planning::Plan def all(options = {}) load_response(service.list_plans(options)) end def find_by_uuid(plan_uuid) new(service.get_plan(plan_uuid).body) end alias_method :get, :find_by_uuid def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^find_by_(.*)$/ self.all.find do |plan| plan.send($1) == arguments.first end else super end end end end end end fog-1.34.0/lib/fog/openstack/models/planning/plan.rb0000644000004100000410000000305512600047642022266 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Openstack class Planning class Plan < Fog::OpenStack::Model MASTER_TEMPLATE_NAME = 'plan.yaml' ENVIRONMENT_NAME = 'environment.yaml' identity :uuid attribute :description attribute :name attribute :uuid attribute :created_at attribute :updated_at attribute :parameters def templates service.get_plan_templates(uuid).body end def master_template templates[MASTER_TEMPLATE_NAME] end def environment templates[ENVIRONMENT_NAME] end def provider_resource_templates templates.select do |key, template| ![MASTER_TEMPLATE_NAME, ENVIRONMENT_NAME].include?(key) end end def patch(parameters) service.patch_plan(uuid, parameters[:parameters]).body end def add_role(role_uuid) service.add_role_to_plan(uuid, role_uuid) end def remove_role(role_uuid) service.remove_role_from_plan(uuid, role_uuid) end def destroy requires :uuid service.delete_plan(uuid) true end def create requires :name merge_attributes(service.create_plan(self.attributes).body) self end def update(parameters=nil) requires :uuid merge_attributes(service.patch_plan(uuid, parameters).body) self end end end end end fog-1.34.0/lib/fog/openstack/models/meta_parent.rb0000644000004100000410000000126312600047642022024 0ustar www-datawww-datamodule Fog module Compute class OpenStack module MetaParent def parent @parent end def parent=(new_parent) @parent = new_parent end def collection_name if @parent.class == Fog::Compute::OpenStack::Image return "images" elsif @parent.class == Fog::Compute::OpenStack::Server return "servers" else raise "Metadata is not supported for this model type." end end def metas_to_hash(metas) hash = {} metas.each { |meta| hash.store(meta.key, meta.value) } hash end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/0000755000004100000410000000000012600047642021132 5ustar www-datawww-datafog-1.34.0/lib/fog/openstack/models/baremetal/drivers.rb0000644000004100000410000000077112600047642023142 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/baremetal/driver' module Fog module Baremetal class OpenStack class Drivers < Fog::OpenStack::Collection model Fog::Baremetal::OpenStack::Driver def all(options = {}) load_response(service.list_drivers(options), 'drivers') end def find_by_name(name) new(service.get_driver(name).body) end alias_method :get, :find_by_name end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/driver.rb0000644000004100000410000000071012600047642022750 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Baremetal class OpenStack class Driver < Fog::OpenStack::Model identity :name attribute :name attribute :hosts def properties requires :name service.get_driver_properties(self.name).body end def metadata requires :name service.get_driver(self.name).headers end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/chassis_collection.rb0000644000004100000410000000237012600047642025331 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/baremetal/chassis' module Fog module Baremetal class OpenStack class ChassisCollection < Fog::OpenStack::Collection model Fog::Baremetal::OpenStack::Chassis def all(options = {}) load_response(service.list_chassis_detailed(options), 'chassis') end def summary(options = {}) load_response(service.list_chassis(options), 'chassis') end def details(options = {}) Fog::Logger.deprecation("Calling OpenStack[:baremetal].chassis_collection.details will be removed, "\ " call .chassis_collection.all for detailed list.") all(options) end def find_by_uuid(uuid) new(service.get_chassis(uuid).body) end alias_method :get, :find_by_uuid def destroy(uuid) chassis = self.find_by_id(uuid) chassis.destroy end def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^find_by_(.*)$/ load(service.list_chassis_detailed({$1 => arguments.first}).body['chassis']) else super end end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/port.rb0000644000004100000410000000236112600047642022445 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Baremetal class OpenStack class Port < Fog::OpenStack::Model identity :uuid attribute :address attribute :uuid #detailed attribute :created_at attribute :updated_at attribute :extra attribute :node_uuid def create requires :address, :node_uuid merge_attributes(service.create_port(self.attributes).body) self end def update(patch=nil) requires :uuid, :address, :node_uuid if patch merge_attributes(service.patch_port(uuid, patch).body) else # TODO implement update_node method using PUT method and self.attributes # once it is supported by Ironic raise ArgumentError, ('You need to provide patch attribute. Ironic does ' 'not support update by hash yet, only by jsonpatch.') end self end def destroy requires :uuid service.delete_port(self.uuid) true end def metadata requires :uuid service.get_port(self.uuid).headers end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/ports.rb0000644000004100000410000000234312600047642022630 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/baremetal/port' module Fog module Baremetal class OpenStack class Ports < Fog::OpenStack::Collection model Fog::Baremetal::OpenStack::Port def all(options = {}) load_response(service.list_ports_detailed(options), 'ports') end def summary(options = {}) load_response(service.list_ports(options), 'ports') end def details(options = {}) Fog::Logger.deprecation("Calling OpenStack[:baremetal].ports.details will be removed, "\ " call .ports.all for detailed list.") load(service.list_ports_detailed(options).body['ports']) end def find_by_uuid(uuid) new(service.get_port(uuid).body) end alias_method :get, :find_by_uuid def destroy(uuid) port = self.find_by_id(uuid) port.destroy end def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^find_by_(.*)$/ load(service.list_ports_detailed({$1 => arguments.first}).body['ports']) else super end end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/node.rb0000644000004100000410000000503412600047642022406 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Baremetal class OpenStack class Node < Fog::OpenStack::Model identity :uuid attribute :instance_uuid attribute :maintenance attribute :power_state attribute :provision_state attribute :uuid #detailed attribute :created_at attribute :updated_at attribute :chassis_uuid attribute :console_enabled attribute :driver attribute :driver_info attribute :extra attribute :instance_info attribute :last_error attribute :maintenance_reason attribute :properties attribute :provision_updated_at attribute :reservation attribute :target_power_state attribute :target_provision_state def create requires :driver merge_attributes(service.create_node(self.attributes).body) self end def update(patch=nil) requires :uuid, :driver if patch merge_attributes(service.patch_node(uuid, patch).body) else # TODO implement update_node method using PUT method and self.attributes # once it is supported by Ironic raise ArgumentError, ('You need to provide patch attribute. Ironic does ' 'not support update by hash yet, only by jsonpatch.') end self end def destroy requires :uuid service.delete_node(self.uuid) true end def chassis requires :uuid service.get_chassis(self.chassis_uuid).body end def ports requires :uuid service.list_ports_detailed({:node_uuid => self.uuid}).body['ports'] end def set_node_maintenance(parameters=nil) requires :uuid service.set_node_maintenance(uuid, parameters) true end def unset_node_maintenance(parameters=nil) requires :uuid service.unset_node_maintenance(uuid, parameters) true end def metadata requires :uuid service.get_node(self.uuid).headers end def set_power_state(power_state) requires :uuid service.set_node_power_state(self.uuid, power_state) end def set_provision_state(provision_state) requires :uuid service.set_node_provision_state(self.uuid, provision_state) end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/chassis.rb0000644000004100000410000000232712600047642023120 0ustar www-datawww-datarequire 'fog/openstack/models/model' module Fog module Baremetal class OpenStack class Chassis < Fog::OpenStack::Model identity :uuid attribute :description attribute :uuid #detailed attribute :created_at attribute :updated_at attribute :extra def create requires :description merge_attributes(service.create_chassis(self.attributes).body) self end def update(patch=nil) requires :uuid, :description if patch merge_attributes(service.patch_chassis(uuid, patch).body) else # TODO implement update_node method using PUT method and self.attributes # once it is supported by Ironic raise ArgumentError, ('You need to provide patch attribute. Ironic does ' 'not support update by hash yet, only by jsonpatch.') end self end def destroy requires :uuid service.delete_chassis(self.uuid) true end def metadata requires :uuid service.get_chassis(self.uuid).headers end end end end end fog-1.34.0/lib/fog/openstack/models/baremetal/nodes.rb0000644000004100000410000000234312600047642022571 0ustar www-datawww-datarequire 'fog/openstack/models/collection' require 'fog/openstack/models/baremetal/node' module Fog module Baremetal class OpenStack class Nodes < Fog::OpenStack::Collection model Fog::Baremetal::OpenStack::Node def all(options = {}) load_response(service.list_nodes_detailed(options), 'nodes') end def summary(options = {}) load_response(service.list_nodes(options), 'nodes') end def details(options = {}) Fog::Logger.deprecation("Calling OpenStack[:baremetal].nodes.details will be removed, "\ " call .nodes.all for detailed list.") load(service.list_nodes_detailed(options).body['nodes']) end def find_by_uuid(uuid) new(service.get_node(uuid).body) end alias_method :get, :find_by_uuid def destroy(uuid) node = self.find_by_id(uuid) node.destroy end def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^find_by_(.*)$/ load(service.list_nodes_detailed({$1 => arguments.first}).body['nodes']) else super end end end end end end fog-1.34.0/lib/fog/openstack/CHANGELOG.md0000644000004100000410000000251312600047642017525 0ustar www-datawww-data# 1.10.1 2013/04/04 ## Storage * Added storage (Swift) example to set account quotas: https://github.com/fog/fog/blob/master/lib/fog/openstack/examples/storage/set-account-quota.rb * Added account impersonation to the storage service Now it's possible to use an admin account with a reseller role to impersonate other accounts and set account metadata headers. See the account quotas example included in this release ## Network * create_network request updated Implements provider extensions when creating networks. See http://docs.openstack.org/trunk/openstack-network/admin/content/provider_attributes.html * Network Router support (Quantum) Added router model/collection and related requests. * New network service example See https://github.com/fog/fog/blob/master/lib/fog/openstack/examples/network/network_subnets_routers.rb * :openstack_endpoint_type parameter was added to the network service ## Image * Added basic image service example (Glance) Download CirrOS 0.3.0 image from launchpad (~6.5MB) to /tmp and upload it to Glance. See https://github.com/fog/fog/blob/master/lib/fog/openstack/examples/image/upload-test-image.rb * Check for glance version (fog only supports v1) ## Compute * create_server and the Server model where updated to allow booting a VM with NICs (net_id, port_id, fixed_ip). fog-1.34.0/lib/fog/openstack/planning.rb0000644000004100000410000001313212600047642020046 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Openstack class Planning < Fog::Service SUPPORTED_VERSIONS = /v2/ requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id ## MODELS # model_path 'fog/openstack/models/planning' model :role collection :roles model :plan collection :plans ## REQUESTS # request_path 'fog/openstack/requests/planning' # Role requests request :list_roles # Plan requests request :list_plans request :get_plan_templates request :get_plan request :patch_plan request :create_plan request :delete_plan request :add_role_to_plan request :remove_role_from_plan class Mock def self.data @data ||= Hash.new end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 9292 management_url.path = '/v1' @openstack_management_url = management_url.to_s @data ||= { :users => {} } unless @data[:users].find {|u| u['name'] == options[:openstack_username]} id = Fog::Mock.random_numbers(6).to_s @data[:users][id] = { 'id' => id, 'name' => options[:openstack_username], 'email' => "#{options[:openstack_username]}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_region => @openstack_region, :openstack_management_url => @openstack_management_url } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['management'] # currently Tuskar is configured as 'management' service in Keystone @openstack_service_name = options[:openstack_service_name] @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @connection_options = options[:connection_options] || {} authenticate unless @path.match(SUPPORTED_VERSIONS) @path = "/v2" end @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}"#, })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end private end end def self.[](service) new(:service => service) end def self.new(attributes) attributes = attributes.dup # Prevent delete from having side effects service = attributes.delete(:service).to_s.downcase.to_sym if services.include?(service) require "fog/openstack/#{service}" return Fog::Openstack.const_get(service.to_s.capitalize).new(attributes) end raise ArgumentError, "Openstack has no #{service} service" end def self.services # Ruby 1.8.7 compatibility for select returning Array of Arrays (pairs) Hash[Fog.services.select{|service, providers| providers.include?(:openstack)}].keys end end end fog-1.34.0/lib/fog/openstack/image.rb0000644000004100000410000001242312600047642017324 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Image class OpenStack < Fog::Service SUPPORTED_VERSIONS = /v1(\.(0|1))*/ requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/image' model :image collection :images request_path 'fog/openstack/requests/image' request :list_public_images request :list_public_images_detailed request :get_image request :create_image request :update_image request :get_image_members request :update_image_members request :get_shared_images request :add_member_to_image request :remove_member_from_image request :delete_image request :get_image_by_id request :set_tenant class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :images => {} } end end def self.reset @data = nil end def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 9292 management_url.path = '/v1' @openstack_management_url = management_url.to_s @data ||= { :users => {} } unless @data[:users].find {|u| u['name'] == options[:openstack_username]} id = Fog::Mock.random_numbers(6).to_s @data[:users][id] = { 'id' => id, 'name' => options[:openstack_username], 'email' => "#{options[:openstack_username]}@mock.com", 'tenantId' => Fog::Mock.random_numbers(6).to_s, 'enabled' => true } end end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_region => @openstack_region, :openstack_management_url => @openstack_management_url } end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['image'] @openstack_service_name = options[:openstack_service_name] @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @connection_options = options[:connection_options] || {} authenticate unless @path.match(SUPPORTED_VERSIONS) @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS, @openstack_management_uri, @auth_token, @connection_options) end @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}"#, })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/compute.rb0000644000004100000410000002747712600047642017735 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Compute class OpenStack < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id ## MODELS # model_path 'fog/openstack/models/compute' model :aggregate collection :aggregates model :availability_zone collection :availability_zones model :server collection :servers model :service collection :services model :image collection :images model :flavor collection :flavors model :metadatum collection :metadata model :address collection :addresses model :security_group collection :security_groups model :security_group_rule collection :security_group_rules model :key_pair collection :key_pairs model :tenant collection :tenants model :volume collection :volumes model :network collection :networks model :snapshot collection :snapshots model :host collection :hosts ## REQUESTS # request_path 'fog/openstack/requests/compute' # Aggregate CRUD request :list_aggregates request :create_aggregate request :update_aggregate request :get_aggregate request :update_aggregate request :update_aggregate_metadata request :add_aggregate_host request :remove_aggregate_host request :delete_aggregate # Server CRUD request :list_servers request :list_servers_detail request :create_server request :get_server_details request :update_server request :delete_server # Server Actions request :server_actions request :server_action request :reboot_server request :rebuild_server request :resize_server request :confirm_resize_server request :revert_resize_server request :pause_server request :unpause_server request :suspend_server request :resume_server request :start_server request :stop_server request :rescue_server request :change_server_password request :add_fixed_ip request :remove_fixed_ip request :server_diagnostics request :boot_from_snapshot request :reset_server_state request :add_security_group request :remove_security_group request :shelve_server request :unshelve_server request :shelve_offload_server # Server Extenstions request :get_console_output request :get_vnc_console request :live_migrate_server request :migrate_server # Service CRUD request :list_services request :enable_service request :disable_service request :disable_service_log_reason request :delete_service # Image CRUD request :list_images request :list_images_detail request :create_image request :get_image_details request :delete_image # Flavor CRUD request :list_flavors request :list_flavors_detail request :get_flavor_details request :create_flavor request :delete_flavor # Flavor Actions request :get_flavor_metadata request :create_flavor_metadata # Flavor Access request :add_flavor_access request :remove_flavor_access request :list_tenants_with_flavor_access # Hypervisor request :get_hypervisor_statistics # Metadata request :list_metadata request :get_metadata request :set_metadata request :update_metadata request :delete_metadata # Metadatam request :delete_meta request :update_meta # Address request :list_addresses request :list_address_pools request :list_all_addresses request :list_private_addresses request :list_public_addresses request :get_address request :allocate_address request :associate_address request :release_address request :disassociate_address # Security Group request :list_security_groups request :get_security_group request :create_security_group request :create_security_group_rule request :delete_security_group request :delete_security_group_rule request :get_security_group_rule # Key Pair request :list_key_pairs request :create_key_pair request :delete_key_pair # Tenant request :list_tenants request :set_tenant request :get_limits # Volume request :list_volumes request :list_volumes_detail request :create_volume request :get_volume_details request :delete_volume request :attach_volume request :detach_volume request :get_server_volumes # Snapshot request :create_volume_snapshot request :list_snapshots request :list_snapshots_detail request :get_snapshot_details request :delete_snapshot # Usage request :list_usages request :get_usage # Quota request :get_quota request :get_quota_defaults request :update_quota # Hosts request :list_hosts request :get_host_details # Zones request :list_zones request :list_zones_detailed class Mock attr_reader :auth_token attr_reader :auth_token_expiration attr_reader :current_user attr_reader :current_tenant def self.data @data ||= Hash.new do |hash, key| hash[key] = { :last_modified => { :images => {}, :servers => {}, :key_pairs => {}, :security_groups => {}, :addresses => {} }, :aggregates => [{ "availability_zone" => "nova", "created_at" => "2012-11-16T06:22:23.032493", "deleted" => false, "deleted_at" => nil, "id" => 1, "name" => "name", "updated_at" => nil }], :images => { "0e09fbd6-43c5-448a-83e9-0d3d05f9747e" => { "id"=>"0e09fbd6-43c5-448a-83e9-0d3d05f9747e", "name"=>"cirros-0.3.0-x86_64-blank", 'progress' => 100, 'status' => "ACTIVE", 'updated' => "", 'minRam' => 0, 'minDisk' => 0, 'metadata' => {}, 'links' => [{"href"=>"http://nova1:8774/v1.1/admin/images/1", "rel"=>"self"}, {"href"=>"http://nova1:8774/admin/images/2", "rel"=>"bookmark"}] } }, :servers => {}, :key_pairs => {}, :security_groups => { '0' => { "id" => 0, "tenant_id" => Fog::Mock.random_hex(8), "name" => "default", "description" => "default", "rules" => [ { "id" => 0, "parent_group_id" => 0, "from_port" => 68, "to_port" => 68, "ip_protocol" => "udp", "ip_range" => { "cidr" => "0.0.0.0/0" }, "group" => {}, }, ], }, }, :server_security_group_map => {}, :addresses => {}, :quota => { 'security_group_rules' => 20, 'security_groups' => 10, 'injected_file_content_bytes' => 10240, 'injected_file_path_bytes' => 256, 'injected_files' => 5, 'metadata_items' => 128, 'floating_ips' => 10, 'instances' => 10, 'key_pairs' => 10, 'gigabytes' => 5000, 'volumes' => 10, 'cores' => 20, 'ram' => 51200 }, :volumes => {} } end end def self.reset @data = nil end include Fog::OpenStack::Core def initialize(options={}) @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 initialize_identity options management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 8774 management_url.path = '/v1.1/1' @openstack_management_url = management_url.to_s identity_public_endpoint = URI.parse(options[:openstack_auth_url]) identity_public_endpoint.port = 5000 @openstack_identity_public_endpoint = identity_public_endpoint.to_s end def data self.class.data["#{@openstack_username}-#{@current_tenant}"] end def reset_data self.class.data.delete("#{@openstack_username}-#{@current_tenant}") end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_identity_service_type = options[:openstack_identity_service_type] || 'identity' @openstack_service_type = options[:openstack_service_type] || ['nova', 'compute'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate unless @path.match(/1\.1|v2/) raise Fog::OpenStack::Errors::ServiceUnavailable.new( "OpenStack compute binding only supports version 2 (a.k.a. 1.1)") end @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}", :query => params[:query] })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # Bad Credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::OpenStack::NotFound.slurp(error) else error end end if !response.body.empty? and response.get_header('Content-Type') == 'application/json' response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/openstack/storage.rb0000644000004100000410000001360612600047642017712 0ustar www-datawww-datarequire 'fog/openstack/core' module Fog module Storage class OpenStack < Fog::Service requires :openstack_auth_url, :openstack_username, :openstack_api_key recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_tenant_id, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, :current_user, :current_tenant, :openstack_region, :openstack_endpoint_type, :openstack_project_name, :openstack_project_id, :openstack_project_domain, :openstack_user_domain, :openstack_domain_name, :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id model_path 'fog/openstack/models/storage' model :directory collection :directories model :file collection :files request_path 'fog/openstack/requests/storage' request :copy_object request :delete_container request :delete_object request :delete_multiple_objects request :delete_static_large_object request :get_container request :get_containers request :get_object request :get_object_http_url request :get_object_https_url request :head_container request :head_containers request :head_object request :put_container request :put_object request :put_object_manifest request :put_dynamic_obj_manifest request :put_static_obj_manifest request :post_set_meta_temp_url_key request :public_url class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end def self.reset @data = nil end def initialize(options={}) @openstack_api_key = options[:openstack_api_key] @openstack_username = options[:openstack_username] @path = '/v1/AUTH_1234' end def data self.class.data[@openstack_username] end def reset_data self.class.data.delete(@openstack_username) end def change_account(account) @original_path ||= @path version_string = @original_path.split('/')[1] @path = "/#{version_string}/#{account}" end def reset_account_name @path = @original_path end end class Real include Fog::OpenStack::Core def initialize(options={}) initialize_identity options @openstack_service_type = options[:openstack_service_type] || ['object-store'] @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} authenticate @persistent = options[:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end # Change the current account while re-using the auth token. # # This is usefull when you have an admin role and you're able # to HEAD other user accounts, set quotas, list files, etc. # # For example: # # # List current user account details # service = Fog::Storage[:openstack] # service.request :method => 'HEAD' # # Would return something like: # # Account: AUTH_1234 # Date: Tue, 05 Mar 2013 16:50:52 GMT # X-Account-Bytes-Used: 0 (0.00 Bytes) # X-Account-Container-Count: 0 # X-Account-Object-Count: 0 # # Now let's change the account # # service.change_account('AUTH_3333') # service.request :method => 'HEAD' # # Would return something like: # # Account: AUTH_3333 # Date: Tue, 05 Mar 2013 16:51:53 GMT # X-Account-Bytes-Used: 23423433 # X-Account-Container-Count: 2 # X-Account-Object-Count: 10 # # If we wan't to go back to our original admin account: # # service.reset_account_name # def change_account(account) @original_path ||= @path version_string = @path.split('/')[1] @path = "/#{version_string}/#{account}" end def reset_account_name @path = @original_path end def request(params, parse_json = true) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}", })) rescue Excon::Errors::Unauthorized => error if error.response.body != 'Bad username or password' # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Storage::OpenStack::NotFound.slurp(error) else error end end if !response.body.empty? && parse_json && response.get_header('Content-Type') =~ %r{application/json} response.body = Fog::JSON.decode(response.body) end response end private end end end end fog-1.34.0/lib/fog/core/0000755000004100000410000000000012600047641014653 5ustar www-datawww-datafog-1.34.0/lib/fog/core/parser.rb0000644000004100000410000000020012600047641016464 0ustar www-datawww-dataFog::Logger.deprecation("fog/core/parser is deprecated use fog/xml instead [light_black](#{caller.first})[/]") require 'fog/xml'fog-1.34.0/lib/fog/core/deprecated/0000755000004100000410000000000012600047641016753 5ustar www-datawww-datafog-1.34.0/lib/fog/core/deprecated/connection.rb0000644000004100000410000000155012600047641021440 0ustar www-datawww-datarequire "fog/xml" module Fog # @deprecated Use {Fog::Core::Connection} or {XML::SAXParserConnection} if you # require the response body to be parsed. # # The Connection class is a wrapper around an instance of Excon::Connection # supporting {#request} and {#reset} only. # # {#request} includes an option to perform SAX parsing for XML APIs. # # @see https://github.com/geemus/excon/blob/master/lib/excon/connection.rb # class Connection < Fog::XML::Connection def request(params, &block) if params.key?(:parser) Fog::Logger.deprecation("Fog::Connection is deprecated use Fog::XML::Connection instead [light_black](#{caller.first})[/]") else Fog::Logger.deprecation("Fog::Connection is deprecated use Fog::Core::Connection instead [light_black](#{caller.first})[/]") end super(params) end end end fog-1.34.0/lib/fog/vcloud.rb0000644000004100000410000000003512600047642015543 0ustar www-datawww-datarequire 'fog/vcloud/compute' fog-1.34.0/lib/fog/vcloud/0000755000004100000410000000000012600047642015220 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/examples/0000755000004100000410000000000012600047642017036 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/examples/more_on_vapps.md0000644000004100000410000000131412600047642022226 0ustar www-datawww-data# More on vApps ## Checking running or stopped selected_vapp = connection.servers.service.vapps.detect { |n| n.name == 'vapp-name' } selected_vapp.on? selected_vapp.off? ## Wait for app to come up or stop selected_vapp.wait_for { selected_vapp.on? } selected_vapp.wait_for { selected_vapp.off? } ## Delete vApp selected_vapp = connection.servers.service.vapps.detect { |n| n.name == 'vapp-name' } vapp = connection.servers.service.get_vapp(selected_vapp.href) if vapp.on? vapp.service.undeploy selected_vapp.href #undeploy to stop vApp vapp.wait_for { vapp.off? } end vapp.wait_for { vapp.off? } #double check vapp.service.delete_vapp selected_vapp.href fog-1.34.0/lib/fog/vcloud/examples/get_vapp_information.md0000644000004100000410000000044312600047642023573 0ustar www-datawww-data# Get network information - To see all vApps list connection.servers.service.vapps - To see details of a particular vApp selected_vapp = connection.servers.service.vapps.detect { |n| n.name == 'vapp-name' } connection.servers.service.get_vapp(selected_vapp.href) fog-1.34.0/lib/fog/vcloud/examples/creating_a_connection.md0000644000004100000410000000142512600047642023675 0ustar www-datawww-data# Creating a connection connection = Fog::Compute.new( :provider => :vcloud, :vcloud_username => "username@org-name", :vcloud_password => password, :vcloud_host => vendor-api-endpoint-host, :vcloud_default_vdc => default_vdc_uri, :connection_options => { :ssl_verify_peer => false, :omit_default_port => true } ) - Refer to links in [vcloud/examples/README.md](/lib/fog/vcloud/examples/REAME.md) for find various different uris - connection_options are passed down to `excon`, which is used by fog to make http requests. - We using `omit_default_port`, as currently excon adds port to host entry in headers, which might not be compatible with various vendors. fog-1.34.0/lib/fog/vcloud/examples/get_network_information.md0000644000004100000410000000045412600047642024320 0ustar www-datawww-data# Get network information - To see all networks list connection.servers.service.networks - To see details of a particular network selected_nw = connection.servers.service.networks.detect { |n| n.name == 'Default' } connection.servers.service.get_network(selected_nw.href) fog-1.34.0/lib/fog/vcloud/examples/creating_a_vapp.md0000644000004100000410000000105612600047642022504 0ustar www-datawww-data# Creating a vApp connection.servers.create( :vdc_uri => vdc-uuid, :catalog_item_uri => catalog-uuid, :name => vApp-name, :network_uri => network-uri, :network_name => network-name, :connection_options => { :ssl_verify_peer => false, :omit_default_port => true } ) - Not most of the uris can be found by understanding the vcloud api eg various network information can be retrieved by `connection.servers.service.networks` fog-1.34.0/lib/fog/vcloud/examples/README.md0000644000004100000410000000517312600047642020323 0ustar www-datawww-data# Using vCloud API via fog _contributor @singhgarima_ For more information about fog [README](/README.md), or visit their website [fog.io](http://fog.io). ## Vcloud API Some useful links to get started on the vCloud API: - [http://www.vmware.com/pdf/vcd_15_api_guide.pdf](http://www.vmware.com/pdf/vcd_15_api_guide.pdf) - [vCloud API Programming Guide](http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.doc_51%2FGUID-86CA32C2-3753-49B2-A471-1CE460109ADB.html) ## Terminology - Organization: An Organization is the fundamental vCloud Director grouping that contains users, the vApps that they create, and the resources the vApps use. It is a top-level container in a cloud that contains one or more Organization Virtual Data Centers (Org vDCs) and Catalog entities. It owns all the virtual resources for a cloud instance and can have many Org vDCs.[1] - vApp: VMware vApp is a format for packaging and managing applications. A vApp can contain multiple virtual machines.[2] - VM: A virtualized personal computer environment in which a guest operating system and associated application software can run. Multiple virtual machines can operate on the same managed host machine concurrently.[3] - Catalogs & Catalog-Items: Catalog is used in organizations for storing content. Example: base images. Each item stored in catalog is referred as catalog item. - vDC: Virtual Data Center. These are of two kinds provider vDCs (accessible to multiple organizations), and organization vDCs (accessible only by a given organization). In fog we refer to organization vDCs. - Networks: You can setup various internal networks and assign various internal ip ranges to them ## What is the difference between a virtual appliance and a virtual machine? A virtual machine is a tightly isolated software container created to run on virtualized platforms. It has four key virtualized resources (CPU, RAM, Storage, and Networking); but requires the installation of an Operating System and runs on one or more applications. A virtual appliance functions very much like a virtual machine, possessing the four key characteristics of compatibility, isolation, encapsulation, and hardware independence. However, a virtual appliance contains a pre-installed, pre-configured Operating System and an application stack optimized to provide a specific set of services.[3] **References** - [1] http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026316 - [2] http://www.vmware.com/pdf/vsphere4/r40/vsp_40_admin_guide.pdf - [3] http://www.vmware.com/technical-resources/virtualization-topics/virtual-appliances/faqs fog-1.34.0/lib/fog/vcloud/requests/0000755000004100000410000000000012600047642017073 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/requests/compute/0000755000004100000410000000000012600047642020547 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/requests/compute/get_organization.rb0000644000004100000410000000020212600047642024431 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_organization end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_customization_options.rb0000644000004100000410000000021312600047642026412 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_customization_options end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_task_list.rb0000644000004100000410000000017712600047642023735 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_task_list end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_task.rb0000644000004100000410000000017212600047642022675 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_task end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_vm_memory.rb0000644000004100000410000000045112600047642023745 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def get_vm_memory(href, parse = true) request( :expects => 200, :uri => href, :parse => parse ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_memory.rb0000644000004100000410000000361112600047642025150 0ustar www-datawww-data# -*- coding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_memory(vm_data) edit_uri = vm_data.select {|k,v| k == :Link && v[:rel] == 'edit'} edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[1][:href] : edit_uri[:Link][:href] body = < byte * 2^20 Memory Size #{vm_data[:'rasd:VirtualQuantity']} MB of memory 5 0 4 #{vm_data[:'rasd:VirtualQuantity']} 0 EOF request( :body => body, :expects => 202, :headers => { 'Content-Type' => vm_data[:"vcloud_type"] || 'application/vnd.vmware.vcloud.rasdItem+xml' }, :method => 'PUT', :uri => edit_uri, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/delete_metadata.rb0000644000004100000410000000022012600047642024170 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :delete_metadata, 202, "DELETE" end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_vm_disks.rb0000644000004100000410000000044412600047642023554 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def get_vm_disks(href) request( :expects => 200, :uri => href, :parse => true#false#true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_server.rb0000644000004100000410000000017412600047642023243 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_server end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_vapp_template.rb0000644000004100000410000000020312600047642024567 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_vapp_template end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_node.rb0000644000004100000410000000201212600047642024055 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Shared private def generate_configure_node_request(node_data) builder = Builder::XmlMarkup.new builder.NodeService(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance", :xmlns => "urn:tmrk:eCloudExtensions-2.0") { builder.Name(node_data[:name]) builder.Enabled(node_data[:enabled].to_s) builder.Description(node_data[:description]) } end end class Real include Shared def configure_node(node_uri, node_data) validate_node_data(node_data, true) request( :body => generate_configure_node_request(node_data), :expects => 200, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.nodeService+xml'}, :method => 'PUT', :uri => node_uri, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/power_off.rb0000644000004100000410000000021012600047642023053 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :power_off, 202, 'POST' end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/undeploy.rb0000644000004100000410000000221412600047642022732 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def undeploy(vapp_uri, save_state = false) # builder = Builder::XmlMarkup.new # builder.UndeployVAppParams(:xmlns => 'http://www.vmware.com/vcloud/v1', # :saveState => save_state) {} builder = if version =='1.0' "" else < shutdown EOF end request( :body => builder, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml' }, :method => 'POST', :uri => vapp_uri + '/action/undeploy', :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_network.rb0000644000004100000410000000017512600047642023427 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_network end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/power_shutdown.rb0000644000004100000410000000021512600047642024161 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :power_shutdown, 204, 'POST' end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/clone_vapp.rb0000644000004100000410000000250012600047642023217 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def validate_clone_vapp_options(options) valid_opts = [:name, :poweron] unless valid_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}") end end def generate_clone_vapp_request(uri, options) xml = Builder::XmlMarkup.new xml.CloneVAppParams(xmlns.merge!(:name => options[:name], :deploy => "true", :powerOn => options[:poweron])) { xml.VApp( :href => uri, :type => "application/vnd.vmware.vcloud.vApp+xml", :xmlns => "http://www.vmware.com/vcloud/v0.8") } end def clone_vapp(vdc_uri, vapp_uri, options = {}) unless options.key?(:poweron) options[:poweron] = "false" end validate_clone_vapp_options(options) request( :body => generate_clone_vapp_request(vapp_uri, options), :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppParams+xml'}, :method => 'POST', :uri => vdc_uri + '/action/clonevapp', :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_network_extensions.rb0000644000004100000410000000021012600047642025674 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_network_extensions end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/login.rb0000644000004100000410000000101712600047642022203 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def login headers = { 'Authorization' => authorization_header } uri = if version == '1.0' "#{base_url}/login" else "#{base_path_url}/sessions" end unauthenticated_request({ :expects => 200, :headers => headers, :method => 'POST', :parse => true, :uri => uri }) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_network_ip.rb0000644000004100000410000000256712600047642025330 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Shared private def validate_network_ip_data(network_ip_data) valid_opts = [:id, :href, :name, :status, :server] unless valid_opts.all? { |opt| network_ip_data.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}") end end end class Real include Shared def configure_network_ip(network_ip_uri, network_ip_data) validate_network_ip_data(network_ip_data) request( :body => generate_configure_network_ip_request(network_ip_data), :expects => 200, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.ip+xml' }, :method => 'PUT', :uri => network_ip_uri, :parse => true ) end private def generate_configure_network_ip_request(network_ip_data) builder = Builder::XmlMarkup.new builder.IpAddress(xmlns) { builder.Id(network_ip_data[:id]) builder.Href(network_ip_data[:href]) builder.Name(network_ip_data[:name]) builder.Status(network_ip_data[:status]) builder.Server(network_ip_data[:server]) } end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vapp.rb0000644000004100000410000001321612600047642024106 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Shared private def validate_vapp_data(vapp_data) valid_opts = [:name, :cpus, :memory, :disks] unless valid_opts.all? { |opt| vapp_data.key?(opt) } raise ArgumentError.new("Required Vapp data missing: #{(valid_opts - vapp_data.keys).map(&:inspect).join(", ")}") end end end class Real include Shared def generate_configure_vapp_request(vapp_uri, vapp_data) rasd_xmlns = { "xmlns" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" } xml = Nokogiri::XML(request( :uri => vapp_uri).body) xml.root['name'] = vapp_data[:name] #cpu xml.at("//xmlns:ResourceType[.='3']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:cpus] #memory xml.at("//xmlns:ResourceType[.='4']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:memory] #disks real_disks = xml.xpath("//xmlns:ResourceType[ .='17']/..", rasd_xmlns) real_disk_numbers = real_disks.map { |disk| disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content } disk_numbers = vapp_data[:disks].map { |vdisk| vdisk[:number].to_s } if vapp_data[:disks].length < real_disks.length #Assume we're removing a disk remove_disk_numbers = real_disk_numbers - disk_numbers remove_disk_numbers.each do |number| if result = xml.at("//xmlns:ResourceType[ .='17']/../xmlns:AddressOnParent[.='#{number}']/..", rasd_xmlns) result.remove end end elsif vapp_data[:disks].length > real_disks.length add_disk_numbers = disk_numbers - real_disk_numbers add_disk_numbers.each do |number| new_disk = real_disks.first.dup new_disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content = -1 new_disk.at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:disks].find { |disk| disk[:number].to_s == number.to_s }[:size] real_disks.first.parent << new_disk end end #puts xml.root.to_s xml.root.to_s #builder = Builder::XmlMarkup.new #builder.Vapp(:href => vapp_uri.to_s, # :type => 'application/vnd.vmware.vcloud.vApp+xml', # :name => vapp_data[:name], # :status => 2, # :size => 0, # :xmlns => 'http://www.vmware.com/vcloud/v0.8', # :"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance', # :"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema') { # #builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # builder.Section(:"xsi:type" => "q2:VirtualHardwareSection_Type", :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"xmlns:q2" => "http://www.vmware.com/vcloud/v0.8") { # builder.Info('Virtual Hardware') # builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # #builder.Item { # builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(vapp_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # #builder.Item { # builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(vapp_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # vapp_data[:disks].each do |disk_data| # #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # builder.Item { # builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # end # # } #} end def configure_vapp(vapp_uri, vapp_data) validate_vapp_data(vapp_data) request( :body => generate_configure_vapp_request(vapp_uri, vapp_data), :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml' }, :method => 'PUT', :uri => vapp_uri, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_vdc.rb0000644000004100000410000000017112600047642022506 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_vdc end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm.rb0000644000004100000410000001400412600047642023556 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Shared private def validate_vm_data(vm_data) valid_opts = [:name, :cpus, :memory, :disks] unless valid_opts.all? { |opt| vm_data.key?(opt) } raise ArgumentError.new("Required vm data missing: #{(valid_opts - vm_data.keys).map(&:inspect).join(", ")}") end end end class Real include Shared def generate_configure_vm_request(vm_data) xmlns = 'http://schemas.dmtf.org/ovf/envelope/1' xmlns_vcloud = 'http://www.vmware.com/vcloud/v1' xmlns_rasd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData' xmlns_vssd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData' builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) # TODO - remove params builder.VirtualHardwareSection( :"vcloud:href" => vm_data[:"vcloud_href"], :"vcloud:type" => vm_data[:"vcloud_type"], :name => vm_data[:name], :status => 2, :size => 0, :xmlns => xmlns, :"xmlns:vcloud" => xmlns_vcloud, :"xmlns:rasd" => xmlns_rasd, :"xmlns:vssd" => xmlns_vssd) { #builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { builder.Info(vm_data[:"ovf:Info"]) if system = vm_data[:"ovf:System"] builder.System { builder.ElementName(system[:"vssd:ElementName"], :xmlns => xmlns_vssd) if system[:"vssd:ElementName"] builder.InstanceID(system[:"vssd:InstanceID"], :xmlns => xmlns_vssd) if system[:"vssd:InstanceID"] builder.VirtualSystemIdentifier(system[:"vssd:VirtualSystemIdentifier"], :xmlns => xmlns_vssd) if system[:"vssd:VirtualSystemIdentifier"] builder.VirtualSystemType(system[:"vssd:VirtualSystemType"], :xmlns => xmlns_vssd) if system[:"vssd:VirtualSystemType"] } end vm_data[:'ovf:Item'].each do |oi| builder.Item { builder.Address(oi[:'rasd:Address'], :xmlns => xmlns_rasd) if oi[:'rasd:Address'] builder.AddressOnParent(oi[:'rasd:AddressOnParent'], :xmlns => xmlns_rasd) if oi[:'rasd:AddressOnParent'] builder.AutomaticAllocation(oi[:'rasd:AutomaticAllocation'], :xmlns => xmlns_rasd) if oi[:'rasd:AutomaticAllocation'] builder.Connection(oi[:'rasd:Connection'], :xmlns => xmlns_rasd) if oi[:'rasd:Connection'] builder.Description(oi[:'rasd:Description'], :xmlns => xmlns_rasd) if oi[:'rasd:Description'] builder.ElementName(oi[:'rasd:ElementName'], :xmlns => xmlns_rasd) if oi[:'rasd:ElementName'] builder.InstanceID(oi[:'rasd:InstanceID'], :xmlns => xmlns_rasd) if oi[:'rasd:InstanceID'] builder.ResourceSubType(oi[:'rasd:ResourceSubType'], :xmlns => xmlns_rasd) if oi[:'rasd:ResourceSubType'] builder.ResourceType(oi[:'rasd:ResourceType'], :xmlns => xmlns_rasd) if oi[:'rasd:ResourceType'] if hr = oi[:'rasd:HostResource'] attrs = {} attrs[] end } end # builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # #builder.Item { # builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(vm_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # #builder.Item { # builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(vm_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # vm_data[:disks].each do |disk_data| # #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') { # builder.Item { # builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData') # } # end } end def configure_vm(vm_uri, vm_data) validate_vm_data(vm_data) request( :body => generate_configure_vm_request(vm_uri, vm_data), :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vm+xml' }, :method => 'PUT', :uri => vm_uri, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/delete_node.rb0000644000004100000410000000022412600047642023341 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :delete_node, 200, 'DELETE', {}, "" end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_network.rb0000644000004100000410000000255112600047642024631 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def validate_network_data(network_data, configure=false) valid_opts = [:id, :href, :name, :address, :broadcast, :gateway] unless valid_opts.all? { |opt| network_data.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - network_data.keys).map(&:inspect).join(", ")}") end end def configure_network(network_uri, network_data) validate_network_data(network_data) request( :body => generate_configure_network_request(network_data), :expects => 200, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkService+xml'}, :method => 'PUT', :uri => network_uri, :parse => true ) end private def generate_configure_network_request(network_data) builder = Builder::XmlMarkup.new builder.Network(xmlns) { builder.Id(network_data[:id]) builder.Href(network_data[:href]) builder.Name(network_data[:name]) builder.Address(network_data[:address]) builder.BroadcastAddress(network_data[:broadcast]) builder.GatewayAddress(network_data[:gateway]) } end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_password.rb0000644000004100000410000000330712600047642025504 0ustar www-datawww-data# -*- encoding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_password(vmdata) edit_uri = vmdata[:href] body = < Specifies Guest OS Customization Settings true false #{vmdata[:VirtualMachineId]} false false true false #{vmdata[:AdminPassword]} false #{vmdata[:ComputerName]} EOF request( :body => body, :expects => 202, :headers => {'Content-Type' => vmdata[:type] }, :method => 'PUT', :uri => "#{edit_uri}", :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/power_reset.rb0000644000004100000410000000021212600047642023425 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :power_reset, 202, 'POST' end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_catalog.rb0000644000004100000410000000017512600047642023350 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_catalog end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_metadata.rb0000644000004100000410000000200112600047642024706 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real def configure_metadata(opts= {}) valid_opts = [:key, :value, :href] unless valid_opts.all? { |opt| opts.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - opts.keys).map(&:inspect).join(", ")}") end body = < #{opts[:key]} #{opts[:value]} EOF request( :body => body, :expects => 202, # it returns a task object :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml' }, :method => 'POST', :uri => opts[:href], :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_name_description.rb0000644000004100000410000000130012600047642027154 0ustar www-datawww-data# -*- coding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_name_description(edit_href, name, description) body = < #{description} EOF request( :body => body, :expects => 202, :headers => {'Content-Type' => "application/vnd.vmware.vcloud.vApp+xml"}, :method => 'PUT', :uri => edit_href, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_vapp.rb0000644000004100000410000000017212600047642022701 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_vapp end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/instantiate_vapp_template.rb0000644000004100000410000000734412600047642026350 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Shared private def validate_instantiate_vapp_template_options options # :network_uri removed, if not specified will use template network config. valid_opts = [:catalog_item_uri, :name, :vdc_uri] unless valid_opts.all? { |opt| options.key?(opt) } raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}") end catalog_item_uri = options[:catalog_item_uri] # Figure out the template_uri catalog_item = get_catalog_item( catalog_item_uri ).body catalog_item[:Entity] = [ catalog_item[:Entity] ] if catalog_item[:Entity].is_a?(Hash) catalog_item[:Link] = [ catalog_item[:Link] ] if catalog_item[:Link].is_a?(Hash) options[:template_uri] = begin catalog_item[:Entity].find { |entity| entity[:type] == "application/vnd.vmware.vcloud.vAppTemplate+xml" }[:href] rescue raise RuntimeError.new("Unable to locate template uri for #{catalog_item_uri}") end customization_options = begin get_vapp_template(options[:template_uri]).body[:Children][:Vm][:GuestCustomizationSection] rescue raise RuntimeError.new("Unable to get customization options for #{catalog_item_uri}") end # Check to see if we can set the password if options[:password] and customization_options[:AdminPasswordEnabled] == "false" raise ArgumentError.new("This catalog item (#{catalog_item_uri}) does not allow setting a password.") end # According to the docs if CustomizePassword is "true" then we NEED to set a password if customization_options[:AdminPasswordEnabled] == "true" and customization_options[:AdminPasswordAuto] == "false" and ( options[:password].nil? or options[:password].empty? ) raise ArgumentError.new("This catalog item (#{catalog_item_uri}) requires a :password to instantiate.") end end def generate_instantiate_vapp_template_request(options) xml = Builder::XmlMarkup.new xml.InstantiateVAppTemplateParams(xmlns.merge!(:name => options[:name], :"xml:lang" => "en")) { xml.Description(options[:description]) xml.InstantiationParams { if options[:network_uri] # TODO - implement properly xml.NetworkConfigSection { xml.tag!("ovf:Info"){ "Configuration parameters for logical networks" } xml.NetworkConfig("networkName" => options[:network_name]) { # xml.NetworkAssociation( :href => options[:network_uri] ) xml.Configuration { xml.ParentNetwork("name" => options[:network_name], "href" => options[:network_uri]) xml.FenceMode("bridged") } } } end } # The template xml.Source(:href => options[:template_uri]) xml.AllEULAsAccepted("true") } end end class Real include Shared def instantiate_vapp_template options = {} validate_instantiate_vapp_template_options options request( :body => generate_instantiate_vapp_template_request(options), :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'}, :method => 'POST', :uri => options[:vdc_uri] + '/action/instantiateVAppTemplate', :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_metadata.rb0000644000004100000410000000017612600047642023517 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_metadata end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_org_network.rb0000644000004100000410000001347512600047642025507 0ustar www-datawww-data# -*- coding: utf-8 -*- module Fog module Vcloud class Compute class Real def generate_outbound_rule() outbound_rule = < true OUTGOING allow true -1 Any -1 Any out false EOF outbound_rule end def generate_tcp_rules(tcp_ports) firewall_rules = "" tcp_ports.each do |port| firewall_rules << < true #{port} allow true #{port} Any -1 Any in false EOF end firewall_rules end def generate_udp_rules(udp_ports) firewall_rules = "" udp_ports.each do |port| firewall_rules << < true #{port} allow true #{port} Any -1 Any in false EOF end firewall_rules end def generate_configure_org_network_request(vapp_id, vapp_network, vapp_network_uri, org_network, org_network_uri, enable_firewall=false, portmap=nil) firewall_body = "" if not enable_firewall firewall_body = "false" else firewall_rules = generate_outbound_rule + generate_tcp_rules(portmap["TCP"]) + generate_udp_rules(portmap["UDP"]) firewall_body = <true drop false #{firewall_rules} EOF end body = < The configuration parameters for logical networks natRouted true #{firewall_body} true ipTranslation allowTraffic false bridged true EOF end def configure_org_network(vapp_id, vapp_network, vapp_network_uri, org_network, org_network_uri, enable_firewall=false, port_map=nil) body = generate_configure_org_network_request(vapp_id, vapp_network, vapp_network_uri, org_network, org_network_uri, enable_firewall, port_map) #puts ("Body: #{body}") request( :body => body, :expects => 202, :headers => {'Content-Type' => 'Application/vnd.vmware.vcloud.networkConfigSection+xml' }, :method => 'PUT', :uri => "#{vapp_id}/networkConfigSection", :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_network_ips.rb0000644000004100000410000000031012600047642024271 0ustar www-datawww-data# # AFAICT - This is basically undocumented - 6/18/2010 - freeformz # module Fog module Vcloud class Compute class Real basic_request :get_network_ips end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_disks.rb0000644000004100000410000001112212600047642024751 0ustar www-datawww-data# -*- coding: utf-8 -*- # # # # 0 # SCSI Controller # SCSI Controller 0 # 2 # lsilogic # 6 # # # 0 # Hard disk # Hard disk 1 # # 2000 # 2 # 17 # # # 0 # IDE Controller # IDE Controller 0 # 3 # 5 # # module Fog module Vcloud class Compute class Real def generate_configure_vm_disks_request(href, disk_data) xmlns = { "xmlns:rasd" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData", "xmlns" => "http://www.vmware.com/vcloud/v1" } # Get the XML from the API, parse it. xml = Nokogiri::XML(request( :uri => href).body) #xml.root['name'] = vapp_data[:name] #disks real_disks = xml.xpath("//rasd:ResourceType[ .='17']/..", xmlns) real_disk_numbers = real_disks.map { |disk| disk.at('.//rasd:AddressOnParent', xmlns).content } disk_numbers = disk_data.map { |vdisk| vdisk[:"rasd:AddressOnParent"].to_s } if disk_data.length < real_disks.length #Assume we're removing a disk remove_disk_numbers = real_disk_numbers - disk_numbers remove_disk_numbers.each do |number| if result = xml.at("//rasd:ResourceType[ .='17']/../rasd:AddressOnParent[.='#{number}']/..", xmlns) result.remove end end elsif disk_data.length > real_disks.length add_disk_numbers = disk_numbers - real_disk_numbers add_disk_numbers.each do |number| new_disk = real_disks.first.dup new_disk.at('.//rasd:AddressOnParent', xmlns).content = number.to_i #-1 new_disk.at('.//rasd:HostResource', xmlns)["vcloud:capacity"] = disk_data.find { |disk| disk[:'rasd:AddressOnParent'].to_s == number.to_s }[:'rasd:HostResource'][:vcloud_capacity].to_s # nokogiri bug? shouldn't need to add this explicitly. new_disk.at('.//rasd:HostResource', xmlns)["xmlns:vcloud"] = xmlns['xmlns'] new_disk.at('.//rasd:InstanceID', xmlns).content = (2000 + number.to_i).to_s new_disk.at('.//rasd:ElementName', xmlns).content = "Hard disk #{number.to_i + 1}" real_disks.first.parent << new_disk end end xml.to_s end def configure_vm_disks(vm_href, disk_data) disk_href = vm_href + '/virtualHardwareSection/disks' body = generate_configure_vm_disks_request(disk_href, disk_data) request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml' }, :method => 'PUT', :uri => disk_href, :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_network.rb0000644000004100000410000000266412600047642025340 0ustar www-datawww-data# -*- encoding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_network(network_info) edit_uri = network_info.select {|k,v| k == :Link && v[:rel] == 'edit'} edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[1][:href] : edit_uri[:Link][:href] body = < Specifies the available VM network connections 0 0 true #{network_info[:NetworkConnection][:IpAddressAllocationMode]} EOF request( :body => body, :expects => 202, :headers => {'Content-Type' => network_info[:"type"] }, :method => 'PUT', :uri => "#{edit_uri}", :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_cpus.rb0000644000004100000410000000363312600047642024616 0ustar www-datawww-data# -*- encoding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_cpus(vm_data) edit_uri = vm_data.select {|k,v| k == :Link && v[:rel] == 'edit'} edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[1][:href] : edit_uri[:Link][:href] body = < hertz * 10^6 Number of Virtual CPUs #{vm_data[:'rasd:VirtualQuantity']} virtual CPU(s) 4 0 3 #{vm_data[:'rasd:VirtualQuantity']} 0 EOF request( :body => body, :expects => 202, :headers => { 'Content-Type' => vm_data[:"vcloud_type"] || 'application/vnd.vmware.vcloud.rasdItem+xml' }, :method => 'PUT', :uri => "#{edit_uri}", :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/power_on.rb0000644000004100000410000000020712600047642022723 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :power_on, 202, 'POST' end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/delete_vapp.rb0000644000004100000410000000021412600047642023361 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :delete_vapp, 202, "DELETE" end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_network_ip.rb0000644000004100000410000000031112600047642024107 0ustar www-datawww-data# # AFAICT this is basically undocumented ATM - 6/18/2010 - freeformz # module Fog module Vcloud class Compute class Real basic_request :get_network_ip end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/configure_vm_customization_script.rb0000644000004100000410000000265712600047642030145 0ustar www-datawww-data# -*- encoding: utf-8 -*- module Fog module Vcloud class Compute class Real def configure_vm_customization_script(vmdata) edit_uri = vmdata[:href] body = < Specifies Guest OS Customization Settings true #{CGI.escapeHTML(vmdata[:CustomizationScript])} #{vmdata[:ComputerName]} EOF request( :body => body, :expects => 202, :headers => {'Content-Type' => vmdata[:type] }, :method => 'PUT', :uri => "#{edit_uri}", :parse => true ) end end end end end fog-1.34.0/lib/fog/vcloud/requests/compute/get_catalog_item.rb0000644000004100000410000000020212600047642024355 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Real basic_request :get_catalog_item end end end end fog-1.34.0/lib/fog/vcloud/core.rb0000644000004100000410000000020612600047642016473 0ustar www-datawww-datarequire 'fog/core' require 'fog/xml' module Fog module Vcloud extend Fog::Provider service(:compute, 'Compute') end end fog-1.34.0/lib/fog/vcloud/models/0000755000004100000410000000000012600047642016503 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/models/compute/0000755000004100000410000000000012600047642020157 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/models/compute/task.rb0000644000004100000410000000113512600047642021446 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Task < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :status attribute :type attribute :result, :aliases => :Result attribute :owner, :aliases => :Owner attribute :start_time, :aliases => :startTime, :type => :time attribute :end_time, :aliases => :endTime, :type => :time attribute :error, :aliases => :Error end end end end fog-1.34.0/lib/fog/vcloud/models/compute/ips.rb0000644000004100000410000000130012600047642021271 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/ip' module Fog module Vcloud class Compute class Ips < Fog::Vcloud::Collection model Fog::Vcloud::Compute::Ip undef_method :create attribute :href def all self.href = service.default_vdc_href unless self.href check_href!( :messages => "Ips href of a Network you want to enumerate" ) if data = service.get_network_ips(href).body[:IpAddress] load(data) end end def get(uri) if data = service.get_network_ip(uri).body new(data) end rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/organization.rb0000644000004100000410000000223612600047642023213 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Organization < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :name attribute :description, :aliases => :Description attribute :type attribute :full_name, :aliases => :FullName def networks @networks ||= Fog::Vcloud::Compute::Networks. new( :service => service, :href => href ) end def tasks load_unless_loaded! @tasks ||= Fog::Vcloud::Compute::Tasks. new( :service => service, :href => other_links.find{|l| l[:type] == 'application/vnd.vmware.vcloud.tasksList+xml'}[:href] ) end def vdcs @vdcs ||= Fog::Vcloud::Compute::Vdcs. new( :service => service, :href => href ) end def catalogs @catalogs ||= Fog::Vcloud::Compute::Catalogs. new( :service => service, :href => href ) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/servers.rb0000644000004100000410000000205312600047642022175 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/server' module Fog module Vcloud class Compute class Servers < Fog::Vcloud::Collection undef_method :create model Fog::Vcloud::Compute::Server attribute :href, :aliases => :Href def all check_href!("Vapp") vapp.load_unless_loaded! load(vapp.children||[]) end def get(uri) service.get_vapp(uri) rescue Fog::Errors::NotFound nil end def create options check_href! options[:vdc_uri] = href data = service.instantiate_vapp_template(options).body object = new(data) object end private def vapp @vapp ||= (attributes[:vapp] || init_vapp) end def init_vapp Fog::Vcloud::Compute::Vapp.new( :service => service, :href => self.href, :collection => Fog::Vcloud::Compute::Vapps.new(:service => service) ) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/vdc.rb0000644000004100000410000000251112600047642021257 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Vdc < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :name attribute :type attribute :description, :aliases => :Description attribute :network_quota, :aliases => :NetworkQuota, :type => :integer attribute :nic_quota, :aliases => :NicQuota, :type => :integer attribute :vm_quota, :aliases => :VmQuota, :type => :integer attribute :is_enabled, :aliases => :IsEnabled, :type => :boolean attribute :compute_capacity, :aliases => :ComputeCapacity attribute :storage_capacity, :aliases => :StorageCapacity attribute :available_networks, :aliases => :AvailableNetworks, :squash => :Network attribute :resource_entities, :aliases => :ResourceEntities, :squash => :ResourceEntity has_up :organization def networks @networks ||= Fog::Vcloud::Compute::Networks. new( :service => service, :href => href ) end def vapps @vapps ||= Fog::Vcloud::Compute::Vapps. new( :service => service, :href => href ) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/catalogs.rb0000644000004100000410000000157612600047642022312 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/catalog' module Fog module Vcloud class Compute class Catalogs < Fog::Vcloud::Collection model Fog::Vcloud::Compute::Catalog attribute :organization_uri def all org_uri = self.organization_uri || service.default_organization_uri data = service.get_organization(org_uri).links.select { |link| link[:type] == "application/vnd.vmware.vcloud.catalog+xml" } load(data) end def get(uri) service.get_catalog(uri) rescue Fog::Errors::NotFound nil end def item_by_name(name) res = nil items = all.map { |catalog| catalog.catalog_items } items.each do |i| i.map do |ii| res = ii if ii.name == name end end res end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/network.rb0000644000004100000410000000126612600047642022202 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Network < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :name, :aliases => :Name attribute :description, :aliases => :Description attribute :configuration, :aliases => :Configuration attribute :provider_info, :aliases => :ProviderInfo def parent_network return nil if configuration[:ParentNetwork].nil? @parent_network ||= service.get_network(configuration[:ParentNetwork][:href]) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/catalog.rb0000644000004100000410000000077412600047642022126 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Catalog < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :type attribute :name def catalog_items @catalog_items ||= Fog::Vcloud::Compute::CatalogItems. new( :service => service, :href => href ) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/ip.rb0000644000004100000410000000166512600047642021124 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Ip < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :name, :aliases => :Name attribute :status, :aliases => :Status attribute :server, :aliases => :Server attribute :id, :aliases => :Id, :type => :integer def save if @changed service.configure_network_ip( href, _compose_network_ip_data ) end true end def reload super @changed = false self end private def _compose_network_ip_data { :id => id, :href => href, :name => name, :status => status, :server => server } end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/tag.rb0000644000004100000410000000067012600047642021262 0ustar www-datawww-datamodule Fog module Vcloud class Compute class Tag < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :key, :aliases => :Key attribute :value, :aliases => :Value def destroy service.delete_metadata(href) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/tags.rb0000644000004100000410000000121412600047642021440 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/tag' module Fog module Vcloud class Compute class Tags < Fog::Vcloud::Collection undef_method :create model Fog::Vcloud::Compute::Tag attribute :href, :aliases => :Href def all metadata = service.get_metadata(self.href) load(metadata.body[:MetadataEntry]) if metadata.body[:MetadataEntry] end def get(uri) service.get_metadata(uri) rescue Fog::Errors::NotFound nil end def create(opts) service.configure_metadata(opts.merge(href: href)) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/catalog_items.rb0000644000004100000410000000144212600047642023320 0ustar www-datawww-datamodule Fog module Vcloud class Compute class CatalogItems < Fog::Vcloud::Collection undef_method :create model Fog::Vcloud::Compute::CatalogItem attribute :href, :aliases => :Href def all catalog_item_info = service.get_catalog_item(self.href) items = service.get_catalog_item(self.href).body[:CatalogItems] if items.size > 0 data = items[:CatalogItem] load(data) end end def get(uri) if data = service.get_catalog_item(uri) new(data.body) end rescue Fog::Errors::NotFound nil end def organization_uri @organization_uri ||= service.default_organization_uri end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/vapp.rb0000644000004100000410000000262012600047642021452 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/helpers/status' module Fog module Vcloud class Compute class Vapp < Fog::Vcloud::Model include Fog::Vcloud::Compute::Helpers::Status identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :name attribute :type attribute :status attribute :description, :aliases => :Description attribute :deployed, :type => :boolean attribute :children, :aliases => :Children, :squash => :Vm attribute :lease_settings, :aliases => :LeaseSettingsSection attribute :network_configs, :aliases => :NetworkConfigSection has_up :vdc def servers @servers ||= Fog::Vcloud::Compute::Servers. new( :service => service, :href => href, :vapp => self ) end def networks @networks ||= Fog::Vcloud::Compute::Networks. new( :service => service, :href => href ) end def ready? reload_status # always ensure we have the correct status status != '0' end private def reload_status vapp = service.get_vapp(href) self.status = vapp.status end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/catalog_item.rb0000644000004100000410000000237612600047642023144 0ustar www-datawww-datamodule Fog module Vcloud class Compute class CatalogItem < Fog::Vcloud::Model identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :type attribute :name attribute :entity, :aliases => :Entity attribute :link, :aliases => :Link attribute :property, :aliases => :Property def customization_options load_unless_loaded! if data = service.get_customization_options( link[:href] ).body data.delete_if { |key, value| [:xmlns_i, :xmlns].include?(key) } data else nil end end def password_enabled? load_unless_loaded! customization_options = service.get_vapp_template(self.entity[:href]).body[:Children][:Vm][:GuestCustomizationSection] return false if customization_options[:AdminPasswordEnabled] == "false" return true if customization_options[:AdminPasswordEnabled] == "true" \ and customization_options[:AdminPasswordAuto] == "false" \ and ( options[:password].nil? or options[:password].empty? ) end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/vdcs.rb0000644000004100000410000000132612600047642021445 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vdc' module Fog module Vcloud class Compute class Vdcs < Collection model Fog::Vcloud::Compute::Vdc undef_method :create attribute :href def all data = service.get_organization(org_uri).links.select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" } data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } } load(data) end def get(uri) service.get_vdc(uri) rescue Fog::Errors::NotFound nil end private def org_uri self.href ||= service.default_organization_uri end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/vapps.rb0000644000004100000410000000104012600047642021630 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/vapp' module Fog module Vcloud class Compute class Vapps < Collection model Fog::Vcloud::Compute::Vapp undef_method :create attribute :href def all load([service.get_vdc(service.default_vdc_href).resource_entities].flatten.select { |re| re[:type] == "application/vnd.vmware.vcloud.vApp+xml" }) end def get(uri) service.get_vapp(uri) rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/helpers/0000755000004100000410000000000012600047642021621 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud/models/compute/helpers/status.rb0000644000004100000410000000125612600047642023475 0ustar www-datawww-datamodule Fog module Vcloud class Compute module Helpers module Status def friendly_status load_unless_loaded! case status when '0' 'creating' when '8' 'off' when '4' 'on' else 'unknown' end end def on? reload_status status == '4' end def off? reload_status status == '8' end def reload_status reload # always ensure we have the correct status end end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/server.rb0000644000004100000410000002417512600047642022023 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/helpers/status' module Fog module Vcloud class Compute class Server < Fog::Vcloud::Model include Fog::Vcloud::Compute::Helpers::Status identity :href, :aliases => :Href attribute :links, :aliases => :Link, :type => :array ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd attribute :type attribute :name attribute :status attribute :deployed, :type => :boolean attribute :description, :aliases => :Description attribute :vapp_scoped_local_id, :aliases => :VAppScopedLocalId attribute :network_connections, :aliases => :NetworkConnectionSection#, :squash => :NetworkConnection attribute :virtual_hardware, :aliases => :'ovf:VirtualHardwareSection', :squash => :'ovf:Item' attribute :guest_customization, :aliases => :GuestCustomizationSection attribute :operating_system, :aliases => :'ovf:OperatingSystemSection' attribute :tasks, :aliases => :Tasks, :type => :array has_up :vapp def tags Fog::Vcloud::Compute::Tags.new(:service => service, :href => href + '/metadata') end def customization_script load_unless_loaded! self.guest_customization[:CustomizationScript] end def customization_script=(custom_script) @changed = true @update_custom_script = custom_script end def computer_name load_unless_loaded! self.guest_customization[:ComputerName] end def os_desc load_unless_loaded! self.operating_system[:'ovf:Description'] end def os_type load_unless_loaded! self.operating_system[:vmw_osType] end def ip_addresses load_unless_loaded! [self.network_connections].flatten.map{|n| n[:IpAddress] } end def ready? reload_status # always ensure we have the correct status running_tasks = self.tasks && self.tasks.flatten.any? {|ti| ti.kind_of?(Hash) && ti[:status] == 'running' } status != '0' && !running_tasks # 0 is provisioning, and no running tasks end def power_on power_operation( :power_on => :powerOn ) end def power_off power_operation( :power_off => :powerOff ) end def shutdown power_operation( :power_shutdown => :shutdown ) end def power_reset power_operation( :power_reset => :reset ) end # This is the real power-off operation def undeploy service.undeploy href end def graceful_restart requires :href shutdown wait_for { off? } power_on end def name=(new_name) attributes[:name] = new_name @changed = true end def password guest_customization[:AdminPassword] end def password=(password) return if password.nil? or password.size == 0 @changed = true @update_password = password end def cpus if cpu_mess { :count => cpu_mess[:"rasd:VirtualQuantity"].to_i, :units => cpu_mess[:"rasd:AllocationUnits"] } end end def cpus=(qty) return if qty.nil? or qty.size == 0 @changed = true @update_cpu_value = qty qty end def memory if memory_mess { :amount => memory_mess[:"rasd:VirtualQuantity"].to_i, :units => memory_mess[:"rasd:AllocationUnits"] } end end def memory=(amount) return if amount.nil? or amount.size == 0 @changed = true @update_memory_value = amount amount end def network network_connections[:NetworkConnection] if network_connections end def network=(network_info) @changed = true @update_network = network_info network_info end def disks disk_mess.map do |dm| { :number => dm[:"rasd:AddressOnParent"].to_i, :size => dm[:"rasd:HostResource"][:vcloud_capacity].to_i, :resource => dm[:"rasd:HostResource"], :disk_data => dm } end end def add_disk(size) if @disk_change == :deleted raise RuntimeError, "Can't add a disk w/o saving changes or reloading" else load_unless_loaded! @disk_change = :added @add_disk = { :'rasd:HostResource' => {:vcloud_capacity => size}, :'rasd:AddressOnParent' => (disk_mess.map { |dm| dm[:'rasd:AddressOnParent'] }.sort.last.to_i + 1).to_s, :'rasd:ResourceType' => '17' } end true end def delete_disk(number) if @disk_change == :added raise RuntimeError, "Can't delete a disk w/o saving changes or reloading" else load_unless_loaded! unless number == 0 @disk_change = :deleted @remove_disk = number end end true end def description=(description) @description_changed = true unless attributes[:description] == description || attributes[:description] == nil attributes[:description] = description end def name=(name) @name_changed = true unless attributes[:name] == name || attributes[:name] == nil attributes[:name] = name end def reload reset_tracking super end def save unless persisted? #Lame ... raise RuntimeError, "Should not be here" else if on? if @changed raise RuntimeError, "Can't save cpu, name or memory changes while the VM is on." end end if @update_custom_script guest_customization[:CustomizationScript] = @update_custom_script.to_s service.configure_vm_customization_script(guest_customization) wait_for { ready? } end if @update_password guest_customization[:AdminPassword] = @update_password.to_s service.configure_vm_password(guest_customization) wait_for { ready? } end if @update_cpu_value cpu_mess[:"rasd:VirtualQuantity"] = @update_cpu_value.to_s service.configure_vm_cpus(cpu_mess) wait_for { ready? } end if @update_memory_value memory_mess[:"rasd:VirtualQuantity"] = @update_memory_value.to_s service.configure_vm_memory(memory_mess) wait_for { ready? } end if @update_network network_connections[:NetworkConnection][:network] = @update_network[:network_name] network_connections[:NetworkConnection][:IpAddressAllocationMode] = @update_network[:network_mode] service.configure_vm_network(network_connections) wait_for { ready? } end if @disk_change == :deleted data = disk_mess.delete_if do |vh| vh[:'rasd:ResourceType'] == '17' && vh[:'rasd:AddressOnParent'].to_s == @remove_disk.to_s end service.configure_vm_disks(self.href, data) wait_for { ready? } end if @disk_change == :added data = disk_mess data << @add_disk service.configure_vm_disks(self.href, data) wait_for { ready? } end if @name_changed || @description_changed edit_uri = links.select {|i| i[:rel] == 'edit'} edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[0][:href] : edit_uri[:href] service.configure_vm_name_description(edit_uri, self.name, self.description) wait_for { ready? } end end reset_tracking true end def destroy if on? undeploy wait_for { off? } end wait_for { off? } # be sure.. wait_for { ready? } # be doubly sure.. sleep 2 # API lies. need to give it some time to be happy. service.delete_vapp(href).body[:status] == "running" end alias_method :delete, :destroy private def reset_tracking @disk_change = false @changed = false @update_password = nil @update_cpu_value = nil @update_memory_value = nil @update_network = nil @name_changed = false @description_changed = nil end def _compose_vapp_data { :name => name, :cpus => cpus[:count], :memory => memory[:amount], :disks => disks } end def memory_mess load_unless_loaded! if virtual_hardware virtual_hardware.find { |item| item[:"rasd:ResourceType"] == "4" } end end def cpu_mess load_unless_loaded! if virtual_hardware virtual_hardware.find { |item| item[:"rasd:ResourceType"] == "3" } end end def disk_mess load_unless_loaded! if virtual_hardware virtual_hardware.select { |item| item[:"rasd:ResourceType"] == "17" } else [] end end def power_operation(op) requires :href begin service.send(op.keys.first, href + "/power/action/#{op.values.first}" ) rescue Excon::Errors::InternalServerError => e #Frankly we shouldn't get here ... raise e unless e.to_s =~ /because it is already powered o(n|ff)/ end true end def reload_status server = service.get_server(href) self.status = server.status self.tasks = server.tasks end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/organizations.rb0000644000004100000410000000121012600047642023365 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/organization' module Fog module Vcloud class Compute class Organizations < Collection model Fog::Vcloud::Compute::Organization undef_method :create def all raw_orgs = if service.version == '1.0' service.login else service.request(service.basic_request_params("#{service.base_path_url}/org/")) end data = raw_orgs.body[:Org] load(data) end def get(uri) service.get_organization(uri) rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/tasks.rb0000644000004100000410000000107512600047642021634 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/task' module Fog module Vcloud class Compute class Tasks < Fog::Vcloud::Collection model Fog::Vcloud::Compute::Task attribute :href, :aliases => :Href def all self.href = service.default_vdc_href unless self.href check_href! if data = service.get_task_list(href).body[:Task] load(data) end end def get(uri) service.get_task(uri) rescue Fog::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/vcloud/models/compute/networks.rb0000644000004100000410000000256012600047642022363 0ustar www-datawww-datarequire 'fog/vcloud/models/compute/network' module Fog module Vcloud class Compute class Networks < Fog::Vcloud::Collection undef_method :create model Fog::Vcloud::Compute::Network attribute :href def all self.href = service.default_vdc_href unless self.href data = nil if self.href =~ /\/vdc\// check_href!("Vdc") data = [service.get_vdc(self.href).available_networks].flatten.compact.reject{|n| n == '' } elsif self.href =~ /\/org\// check_href!("Org") data = service.get_organization(self.href).links.select{|l| l[:type] == network_type_id } elsif self.href =~ /\/vApp\// check_href!("Vapp") data = [(service.get_vapp(self.href).network_configs||{})[:NetworkConfig]].flatten.compact.map{|n| n[:Configuration][:ParentNetwork] unless n[:Configuration].nil? }.compact end load([*data]) unless data.nil? end def get(uri) service.get_network(uri) rescue Fog::Errors::NotFound nil end private def network_type_id if service.version == '1.0' 'application/vnd.vmware.vcloud.network+xml' else 'application/vnd.vmware.vcloud.orgNetwork+xml' end end end end end end fog-1.34.0/lib/fog/vcloud/compute.rb0000644000004100000410000002552312600047642017230 0ustar www-datawww-datarequire 'fog/vcloud/core' module Fog module Vcloud class Collection < Fog::Collection def load(objects) objects = [ objects ] if objects.is_a?(Hash) super end def check_href!(opts = {}) self.href = service.default_vdc_href unless href unless href if opts.is_a?(String) t = Hash.new t[:parent] = opts opts = t end msg = ":href missing, call with a :href pointing to #{if opts[:message] opts[:message] elsif opts[:parent] "the #{opts[:parent]} whos #{self.class.to_s.split('::').last.downcase} you want to enumerate" else "the resource" end}" raise Fog::Errors::Error.new(msg) end end end end end module Fog module Vcloud class Model < Fog::Model attr_accessor :loaded alias_method :loaded?, :loaded def reload instance = super @loaded = true instance end def load_unless_loaded! unless @loaded reload end end def link_up load_unless_loaded! self.links.find{|l| l[:rel] == 'up' } end def self.has_up(item) class_eval <<-EOS, __FILE__,__LINE__ def #{item} load_unless_loaded! service.get_#{item}(link_up[:href]) end EOS end end end end module Fog module Vcloud class Compute < Fog::Service BASE_PATH = '/api' DEFAULT_VERSION = '1.5' SUPPORTED_VERSIONS = [ '1.5', '1.0' ] PORT = 443 SCHEME = 'https' attr_writer :default_organization_uri requires :vcloud_username, :vcloud_password, :vcloud_host recognizes :vcloud_port, :vcloud_scheme, :vcloud_path, :vcloud_default_vdc, :vcloud_version, :vcloud_base_path recognizes :provider # remove post deprecation model_path 'fog/vcloud/models/compute' model :catalog collection :catalogs model :catalog_item model :catalog_items model :ip collection :ips model :network collection :networks model :server collection :servers model :task collection :tasks model :vapp collection :vapps model :vdc collection :vdcs model :organization collection :organizations model :tag collection :tags request_path 'fog/vcloud/requests/compute' request :clone_vapp request :configure_network request :configure_network_ip request :configure_vapp request :configure_vm_memory request :configure_vm_cpus request :configure_org_network request :configure_vm_name_description request :configure_vm_disks request :configure_vm_password request :configure_vm_network request :delete_vapp request :get_catalog_item request :get_customization_options request :get_network_ip request :get_network_ips request :get_network_extensions request :get_task_list request :get_vapp_template request :get_vm_disks request :get_vm_memory request :instantiate_vapp_template request :login request :power_off request :power_on request :power_reset request :power_shutdown request :undeploy request :get_metadata request :delete_metadata request :configure_metadata request :configure_vm_customization_script class Mock def initialize(options={}) Fog::Mock.not_implemented end end class Real class << self def basic_request(*args) self.class_eval <<-EOS, __FILE__,__LINE__ def #{args[0]}(uri) request( { :expects => #{args[1] || 200}, :method => '#{args[2] || 'GET'}', :headers => #{args[3] ? args[3].inspect : '{}'}, :body => '#{args[4] ? args[4] : ''}', :parse => true, :uri => uri } ) end EOS end def unauthenticated_basic_request(*args) self.class_eval <<-EOS, __FILE__,__LINE__ def #{args[0]}(uri) unauthenticated_request({ :expects => #{args[1] || 200}, :method => '#{args[2] || 'GET'}', :headers => #{args[3] ? args[3].inspect : '{}'}, :parse => true, :uri => uri }) end EOS end end attr_reader :version def initialize(options = {}) require 'builder' @connections = {} @connection_options = options[:connection_options] || {} @persistent = options[:persistent] @username = options[:vcloud_username] @password = options[:vcloud_password] @host = options[:vcloud_host] @base_path = options[:vcloud_base_path] || Fog::Vcloud::Compute::BASE_PATH @version = options[:vcloud_version] || Fog::Vcloud::Compute::DEFAULT_VERSION @path = options[:vcloud_path] || "#{@base_path}/v#{@version}" @port = options[:vcloud_port] || Fog::Vcloud::Compute::PORT @scheme = options[:vcloud_scheme] || Fog::Vcloud::Compute::SCHEME @vdc_href = options[:vcloud_default_vdc] end def reload @connections.each_value { |k,v| v.reset if v } end def default_organization_uri @default_organization_uri ||= organizations.first.href @default_organization_uri end def default_vdc_href if @vdc_href.nil? unless @login_results do_login end org = organizations.first vdc = get_organization(org.href).links.find { |item| item[:type] == 'application/vnd.vmware.vcloud.vdc+xml'} @vdc_href = vdc[:href] end @vdc_href end # login handles the auth, but we just need the Set-Cookie # header from that call. def do_login @login_results = login @cookie = @login_results.headers['Set-Cookie'] || @login_results.headers['set-cookie'] end def ensure_unparsed(uri) if uri.is_a?(String) uri else uri.to_s end end def xmlns if version == '1.0' { "xmlns" => "http://www.vmware.com/vcloud/v1", "xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" } else { 'xmlns' => "http://www.vmware.com/vcloud/v1.5", "xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" } end end # If the cookie isn't set, do a get_organizations call to set it # and try the request. # If we get an Unauthorized error, we assume the token expired, re-auth and try again def request(params) unless @cookie do_login end begin do_request(params) rescue Excon::Errors::Unauthorized do_login do_request(params) end end def basic_request_params(uri,*args) { :expects => args[0] || 200, :method => args[1] || 'GET', :headers => args[2] ? args[2].inspect : {}, :body => args[3] ? args[3] : '', :parse => true, :uri => uri } end def base_path_url "#{@scheme}://#{@host}:#{@port}#{@base_path}" end private def ensure_parsed(uri) if uri.is_a?(String) URI.parse(uri) else uri end end # Don't need to set the cookie for these or retry them if the cookie timed out def unauthenticated_request(params) do_request(params) end def base_url "#{@scheme}://#{@host}:#{@port}#{@path}" end # Use this to set the Authorization header for login def authorization_header "Basic #{Base64.encode64("#{@username}:#{@password}").delete("\r\n")}" end # Actually do the request def do_request(params) # Convert the uri to a URI if it's a string. if params[:uri].is_a?(String) params[:uri] = URI.parse(params[:uri]) end host_url = "#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? ":#{params[:uri].port}" : ''}" # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to # different hosts. @connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options) # Set headers to an empty hash if none are set. headers = params[:headers] || {} headers['Accept'] = 'application/*+xml;version=1.5' if version == '1.5' # Add our auth cookie to the headers if @cookie headers.merge!('Cookie' => @cookie) end # Make the request response = @connections[host_url].request({ :body => params[:body] || '', :expects => params[:expects] || 200, :headers => headers, :method => params[:method] || 'GET', :path => params[:uri].path }) # Parse the response body into a hash unless response.body.empty? if params[:parse] document = Fog::ToHashDocument.new parser = Nokogiri::XML::SAX::PushParser.new(document) parser << response.body parser.finish response.body = document.body end end response end end def self.item_requests(*types) types.each{|t| item_request(t) } end def self.item_request(type) Fog::Vcloud::Compute::Real.class_eval <<-EOS, __FILE__,__LINE__ def get_#{type}(uri) Fog::Vcloud::Compute::#{type.to_s.capitalize}.new( self.request(basic_request_params(uri)).body.merge( :service => self, :collection => Fog::Vcloud::Compute::#{type.to_s.capitalize}s.new( :service => self ) ) ) end EOS end item_requests :organization, :vdc, :network, :vapp, :server, :catalog, :task end end end fog-1.34.0/lib/fog/go_grid/0000755000004100000410000000000012600047641015335 5ustar www-datawww-datafog-1.34.0/lib/fog/go_grid/requests/0000755000004100000410000000000012600047641017210 5ustar www-datawww-datafog-1.34.0/lib/fog/go_grid/requests/compute/0000755000004100000410000000000012600047642020665 5ustar www-datawww-datafog-1.34.0/lib/fog/go_grid/requests/compute/support_password_get.rb0000644000004100000410000000113512600047642025507 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # Get one or more passwords by id # # ==== Parameters # * options<~Hash>: # * 'id'<~String> - id of the password to retrieve # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def support_password_get(id, options={}) request( :path => 'support/password/get', :query => { 'id' => id }.merge!(options) ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_server_get.rb0000644000004100000410000000102212600047642024357 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # Get one or more servers by name # # ==== Parameters # * 'server'<~String> - id or name of server(s) to lookup # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_server_get(servers) request( :path => 'grid/server/get', :query => {'server' => [*servers]} ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_server_power.rb0000644000004100000410000000116712600047642024746 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # Start, Stop or Restart a server # # ==== Parameters # * 'server'<~String> - id or name of server to power # * 'power'<~String> - power operation, in ['restart', 'start', 'stop'] # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_server_power(server, power) request( :path => 'grid/server/power', :query => {'server' => server, 'power' => power} ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_ip_list.rb0000644000004100000410000000145112600047641023662 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List ips # # ==== Parameters # * options<~Hash>: # * 'datacenter'<~String> - datacenter to limit results to # * 'ip.state'<~String> - state to limit results to in ip.state # * 'ip.type'<~String> - type to limit results to in ip.type # * 'num_items'<~Integer> - Number of items to return # * 'page'<~Integer> - Page index for paginated results # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_ip_list(options={}) request( :path => 'grid/ip/list', :query => options ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/common_lookup_list.rb0000644000004100000410000000132612600047641025127 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List options and lookups # # ==== Parameters # * 'lookup'<~String> - the lookup to be listed # * options<~Hash>: # * 'sort'<~String> - column to sort result by in ['description', 'id', 'name'] # * 'asc'<~String> - order to sort in ['true','false'] # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def common_lookup_list(lookup, options={}) request( :path => 'common/lookup/list', :query => {'lookup' => lookup}.merge!(options) ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_image_get.rb0000644000004100000410000000165312600047641024144 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List images # # ==== Parameters # * options<~Hash>: # * 'id'<~String> - ID of the image # * 'name'<~String> - Name of the image # * 'image'<~String> - ID(s) or Name(s) of the images to retrive. Can be speicifed multiple times # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_image_get(options={}) request( :path => 'grid/image/get', :query => options ) end end class Mock def grid_image_get(options={}) #response = Excon::Response.new #images = self.data[:list].values #for image in images # case image['state'] # when 'Available' end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_server_add.rb0000644000004100000410000000215012600047642024333 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # Create a new server # # ==== Parameters # * 'name'<~String> - name of the server, 20 or fewer characters # * 'image'<~String> - image to use, in grid_image_list # * 'ip'<~String> - initial public ip for this server # * 'options'<~Hash>: # * 'server.ram'<~String> - flavor to use, in common_lookup_list('server.ram') # * 'description'<~String> - description of this server # * 'isSandbox'<~String> - treat this server as image sandbox? in ['true', 'false'] # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_server_add(image, ip, name, server_ram, options={}) request( :path => 'grid/server/add', :query => { 'image' => image, 'ip' => ip, 'name' => name, 'server.ram' => server_ram }.merge!(options) ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_image_list.rb0000644000004100000410000000223312600047641024333 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List images # # ==== Parameters # * options<~Hash>: # * 'datacenter'<~String> - datacenter to limit results to # * 'isPublic'<~String> - If true only returns public images, in ['false', 'true'] # * 'num_items'<~Integer> - Number of items to return # * 'page'<~Integer> - Page index for paginated results # * 'state'<~String> - state to limit results to, in ['Saving', 'Available'] # * 'type'<~String> - image type to limit results to # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_image_list(options={}) request( :path => 'grid/image/list', :query => options ) end end class Mock def grid_image_list(options={}) #response = Excon::Response.new #images = self.data[:list].values #for image in images # case image['state'] # when 'Available' end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_server_delete.rb0000644000004100000410000000100012600047642025036 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # Delete a server # # ==== Parameters # * 'server'<~String> - id or name of server to delete # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_server_delete(server) request( :path => 'grid/server/delete', :query => {'server' => server} ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_loadbalancer_list.rb0000644000004100000410000000124712600047641025664 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List load balancers # # ==== Parameters # * options<~Hash>: # * 'datacenter'<~String> - datacenter to limit results to # * 'num_items'<~Integer> - Number of items to return # * 'page'<~Integer> - Page index for paginated results # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_loadbalancer_list(options={}) request( :path => 'grid/loadbalancer/list', :query => options ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/grid_server_list.rb0000644000004100000410000000150212600047642024556 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List servers # # ==== Parameters # * options<~Hash>: # * 'datacenter'<~String> - datacenter to limit results to # * 'isSandbox'<~String> - If true only returns Image Sandbox servers, in ['false', 'true'] # * 'num_items'<~Integer> - Number of items to return # * 'page'<~Integer> - Page index for paginated results # * 'server.type'<~String> - server type to limit results to # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def grid_server_list(options={}) request( :path => 'grid/server/list', :query => options ) end end end end end fog-1.34.0/lib/fog/go_grid/requests/compute/support_password_list.rb0000644000004100000410000000151612600047642025706 0ustar www-datawww-datamodule Fog module Compute class GoGrid class Real # List passwords # # ==== Parameters # * options<~Hash>: # * 'datacenter'<~String> - datacenter to limit results to # * 'isSandbox'<~String> - If true only returns Image Sandbox servers, in ['false', 'true'] # * 'num_items'<~Integer> - Number of items to return # * 'page'<~Integer> - Page index for paginated results # * 'server.type'<~String> - server type to limit results to # # ==== Returns # * response<~Excon::Response>: # * body<~Array>: # TODO: docs def support_password_list(options={}) request( :path => 'support/password/list', :query => options ) end end end end end fog-1.34.0/lib/fog/go_grid/core.rb0000644000004100000410000000020712600047641016611 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module GoGrid extend Fog::Provider service(:compute, 'Compute') end end fog-1.34.0/lib/fog/go_grid/models/0000755000004100000410000000000012600047641016620 5ustar www-datawww-datafog-1.34.0/lib/fog/go_grid/models/compute/0000755000004100000410000000000012600047641020274 5ustar www-datawww-datafog-1.34.0/lib/fog/go_grid/models/compute/images.rb0000644000004100000410000000121612600047641022066 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/go_grid/models/compute/image' module Fog module Compute class GoGrid class Images < Fog::Collection model Fog::Compute::GoGrid::Image attribute :server def all data = service.grid_image_list.body['list'] load(data) if server self.replace(self.select {|image| image.server_id == server.id}) end end def get(image_id) response = service.grid_image_get.body['list'][image_id] new(data) rescue Fog::Compute::GoGrid::NotFound nil end end end end end fog-1.34.0/lib/fog/go_grid/models/compute/servers.rb0000644000004100000410000000134012600047641022310 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/go_grid/models/compute/server' module Fog module Compute class GoGrid class Servers < Fog::Collection model Fog::Compute::GoGrid::Server def all data = service.grid_server_list.body['list'] load(data) end def bootstrap(new_attributes = {}) server = create(new_attributes) server.wait_for { ready? } server.setup server end def get(server_id) if server_id && server = service.grid_server_get(server_id).body['list'].first new(server) end rescue Fog::Compute::GoGrid::NotFound nil end end end end end fog-1.34.0/lib/fog/go_grid/models/compute/password.rb0000644000004100000410000000170112600047641022462 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class GoGrid class Password < Fog::Model identity :id attribute :server_id attribute :applicationtype attribute :username attribute :password_id, :aliases => 'id' attribute :password attribute :server def initialize(attributes={}) super end def destroy requires :id service.grid_server_destroy(id) true end def image requires :image_id service.grid_image_get(image_id) end def ready? @state == 'On' end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :password_id data = service.support_password_list() merge_attributes(data.body) true end end end end end fog-1.34.0/lib/fog/go_grid/models/compute/passwords.rb0000644000004100000410000000143012600047641022644 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/go_grid/models/compute/password' module Fog module Compute class GoGrid class Passwords < Fog::Collection model Fog::Compute::GoGrid::Password def all data = service.support_password_list.body['list'] load(data) end def bootstrap(new_attributes = {}) password = create(new_attributes) password.wait_for { ready? } password end def get(id) #if server_id && server = service.grid_server_get(server_id).body['list'] if id && server = service.support_password_get(id).body['list'] new(server) end rescue Fog::Compute::GoGrid::NotFound nil end end end end end fog-1.34.0/lib/fog/go_grid/models/compute/server.rb0000644000004100000410000000505112600047641022130 0ustar www-datawww-datarequire 'fog/compute/models/server' module Fog module Compute class GoGrid class BlockInstantiationError < StandardError; end class Server < Fog::Compute::Server extend Fog::Deprecation deprecate(:ip, :public_ip_address) identity :id attribute :name attribute :image_id # id or name attribute :public_ip_address, :aliases => 'ip', :squash => 'ip' attribute :memory # server.ram attribute :state attribute :description # Optional attribute :sandbox # Optional. Default: False def initialize(attributes={}) image_id ||= 'ubuntu_10_04_LTS_64_base' # Ubuntu 10.04 LTS 64bit super end def destroy requires :id service.grid_server_delete(id) true end def image requires :image_id service.grid_image_get(:image => image_id) end def private_ip_address nil end def ready? @state && @state["name"] == 'On' end def reload requires :name begin if data = collection.get(name) new_attributes = data.attributes merge_attributes(new_attributes) self end rescue Excon::Errors::BadRequest false end end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :image_id, :memory, :public_ip_address options = { 'isSandbox' => sandbox, 'image' => image_id } options = options.reject {|key, value| value.nil?} data = service.grid_server_add(image, public_ip_address, name, memory, options) merge_attributes(data.body) true end def setup(credentials = {}) requires :identity, :ssh_ip_address, :public_key, :username Fog::SSH.new(ssh_ip_address, username, credentials).run([ %{mkdir .ssh}, %{echo "#{public_key}" >> ~/.ssh/authorized_keys}, %{passwd -l root}, %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json}, %{echo "#{Fog::JSON.encode(metadata)}" >> ~/metadata.json} ]) rescue Errno::ECONNREFUSED sleep(1) retry end private def adminPass=(new_admin_pass) @password = new_admin_pass end end end end end fog-1.34.0/lib/fog/go_grid/models/compute/image.rb0000644000004100000410000000257312600047641021712 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class GoGrid class Image < Fog::Model identity :id attribute :name attribute :description attribute :friendly_name, :aliases => 'friendlyName' attribute :created_at, :aliases => 'createdTime' attribute :updated_at, :aliases => 'updatedTime' attribute :server_id, :aliases => 'id' attribute :state attribute :price attribute :location attribute :billingtokens attribute :os attribute :architecture attribute :type attribute :active, :aliases => 'isActive' attribute :public, :aliases => 'isPublic' attribute :object_type, :aliases => 'object' attribute :owner def server=(new_server) requires :id @server_id = new_server.id end def destroy requires :id service.grid_server_delete(id) true end def ready? status == 'Available' end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :server_id data = service.grid_server_add(server_id, 'name' => name) merge_attributes(data.body['image']) true end end end end end fog-1.34.0/lib/fog/go_grid/compute.rb0000644000004100000410000000612512600047641017342 0ustar www-datawww-datarequire 'fog/go_grid/core' module Fog module Compute class GoGrid < Fog::Service requires :go_grid_api_key, :go_grid_shared_secret recognizes :host, :path, :port, :scheme, :persistent model_path 'fog/go_grid/models/compute' model :image collection :images model :server collection :servers model :password collection :passwords request_path 'fog/go_grid/requests/compute' request :common_lookup_list request :grid_image_get request :grid_image_list request :grid_ip_list request :grid_loadbalancer_list request :grid_server_add request :grid_server_delete request :grid_server_get request :grid_server_list request :grid_server_power request :support_password_get request :support_password_list class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = {} end end def self.reset @data = nil end def initialize(options={}) @go_grid_api_key = options[:go_grid_api_key] @go_grid_shared_secret = options[:go_grid_shared_secret] end def data self.class.data[@go_grid_api_key] end def reset_data self.class.data.delete(@go_grid_api_key) end end class Real def initialize(options={}) require 'digest/md5' @go_grid_api_key = options[:go_grid_api_key] @go_grid_shared_secret = options[:go_grid_shared_secret] @connection_options = options[:connection_options] || {} @host = options[:host] || "api.gogrid.com" @path = options[:path] || "/api" @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload @connection.reset end def request(params) params = { :expects => 200, :method => 'GET' }.merge!(params) params[:query] ||= {} params[:query].merge!({ 'api_key' => @go_grid_api_key, 'format' => 'json', 'sig' => Digest::MD5.hexdigest("#{@go_grid_api_key}#{@go_grid_shared_secret}#{Time.now.to_i}"), 'v' => '1.5' }) begin response = @connection.request( params.merge!(:path => "#{@path}/#{params[:path]}") ) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::GoGrid::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end end end end end fog-1.34.0/lib/fog/cloudsigma.rb0000644000004100000410000000004112600047641016372 0ustar www-datawww-datarequire 'fog/cloudsigma/compute' fog-1.34.0/lib/fog/dnsimple/0000755000004100000410000000000012600047641015536 5ustar www-datawww-datafog-1.34.0/lib/fog/dnsimple/requests/0000755000004100000410000000000012600047641017411 5ustar www-datawww-datafog-1.34.0/lib/fog/dnsimple/requests/dns/0000755000004100000410000000000012600047641020175 5ustar www-datawww-datafog-1.34.0/lib/fog/dnsimple/requests/dns/list_records.rb0000644000004100000410000000152212600047641023216 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Get the list of records for the specific domain. # # ==== Parameters # * domain<~String> - domain name or numeric ID # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * <~Array>: # * 'record'<~Hash> The representation of the record. def list_records(domain) request( :expects => 200, :method => "GET", :path => "/domains/#{domain}/records" ) end end class Mock def list_records(domain) response = Excon::Response.new response.status = 200 response.body = self.data[:records][domain] || [] response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/get_domain.rb0000644000004100000410000000177412600047641022641 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Get the details for a specific domain in your account. You # may pass either the domain numeric ID or the domain name # itself. # # ==== Parameters # * domain<~String> - domain name or numeric ID # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'domain'<~Hash> The representation of the domain. def get_domain(domain) request( :expects => 200, :method => "GET", :path => "/domains/#{domain}" ) end end class Mock def get_domain(id) domain = self.data[:domains].find do |domain| domain["domain"]["id"] == id || domain["domain"]["name"] == id end response = Excon::Response.new response.status = 200 response.body = domain response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/create_record.rb0000644000004100000410000000351412600047641023326 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Create a new host in the specified zone # # ==== Parameters # * domain<~String> - domain name or numeric ID # * name<~String> # * type<~String> # * content<~String> # * options<~Hash> - optional # * priority<~Integer> # * ttl<~Integer> # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'record'<~Hash> The representation of the record. def create_record(domain, name, type, content, options = {}) body = { "record" => { "name" => name, "record_type" => type, "content" => content } } body["record"].merge!(options) request( :body => Fog::JSON.encode(body), :expects => 201, :method => 'POST', :path => "/domains/#{domain}/records" ) end end class Mock def create_record(domain, name, type, content, options = {}) body = { "record" => { "id" => Fog::Mock.random_numbers(1).to_i, "domain_id" => domain, "name" => name, "content" => content, "ttl" => 3600, "prio" => nil, "record_type" => type, "system_record" => nil, "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, }.merge(options) } self.data[:records][domain] ||= [] self.data[:records][domain] << body response = Excon::Response.new response.status = 201 response.body = body response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/create_domain.rb0000644000004100000410000000346412600047641023323 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Create a single domain in DNSimple in your account. # # ==== Parameters # * name<~String> - domain name to host (ie example.com) # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'domain'<~Hash> The representation of the domain. def create_domain(name) body = { "domain" => { "name" => name } } request( :body => Fog::JSON.encode(body), :expects => 201, :method => 'POST', :path => "/domains" ) end end class Mock def create_domain(name) body = { "domain" => { "id" => Fog::Mock.random_numbers(1).to_i, "user_id" => 1, "registrant_id" => nil, "name" => name, "unicode_name" => name, "token" => "4fIFYWYiJayvL2tkf_mkBkqC4L+4RtYqDA", "state" => "registered", "language" => nil, "lockable" => true, "auto_renew" => nil, "whois_protected" => false, "record_count" => 0, "service_count" => 0, "expires_on" => Date.today + 365, "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, } } self.data[:domains] << body response = Excon::Response.new response.status = 201 response.body = body response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/delete_record.rb0000644000004100000410000000140412600047641023321 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Delete the record with the given ID for the given domain. # # ==== Parameters # * domain<~String> - domain name or numeric ID # * record_id<~String> def delete_record(domain, record_id) request( :expects => 200, :method => "DELETE", :path => "/domains/#{domain}/records/#{record_id}" ) end end class Mock def delete_record(domain, record_id) self.data[:records][domain].reject! { |record| record["record"]["id"] == record_id } response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/update_record.rb0000644000004100000410000000265312600047641023350 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Update the given record for the given domain. # # ==== Parameters # * domain<~String> - domain name or numeric ID # * record_id<~String> # * options<~Hash> - optional # * type<~String> # * content<~String> # * priority<~Integer> # * ttl<~Integer> # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'record'<~Hash> The representation of the record. def update_record(domain, record_id, options) body = { "record" => options } request( :body => Fog::JSON.encode(body), :expects => 200, :method => "PUT", :path => "/domains/#{domain}/records/#{record_id}" ) end end class Mock def update_record(domain, record_id, options) record = self.data[:records][domain].find { |record| record["record"]["id"] == record_id } response = Excon::Response.new if record.nil? response.status = 400 else response.status = 200 record["record"].merge!(options) record["record"]["updated_at"] = Time.now.iso8601 response.body = record end response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/get_record.rb0000644000004100000410000000250612600047641022642 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Gets record from given domain. # # ==== Parameters # * domain<~String> - domain name or numeric ID # * record_id<~String> # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'record'<~Hash> The representation of the record. def get_record(domain, record_id) request( :expects => 200, :method => "GET", :path => "/domains/#{domain}/records/#{record_id}" ) end end class Mock def get_record(domain, record_id) response = Excon::Response.new if self.data[:records].key?(domain) response.status = 200 response.body = self.data[:records][domain].find { |record| record["record"]["id"] == record_id } if response.body.nil? response.status = 404 response.body = { "error" => "Couldn't find Record with id = #{record_id}" } end else response.status = 404 response.body = { "error" => "Couldn't find Domain with name = #{domain}" } end response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/list_domains.rb0000644000004100000410000000147712600047641023220 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Get the details for a specific domain in your account. You # may pass either the domain numeric ID or the domain name itself. # # ==== Parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * <~Array>: # * 'domain'<~Hash> The representation of the domain. def list_domains request( :expects => 200, :method => 'GET', :path => '/domains' ) end end class Mock def list_domains response = Excon::Response.new response.status = 200 response.body = self.data[:domains] response end end end end end fog-1.34.0/lib/fog/dnsimple/requests/dns/delete_domain.rb0000644000004100000410000000164212600047641023316 0ustar www-datawww-datamodule Fog module DNS class DNSimple class Real # Delete the given domain from your account. You may use # either the domain ID or the domain name. # # Please note that for domains which are registered with # DNSimple this will not delete the domain from the registry. # # ==== Parameters # * domain<~String> - domain name or numeric ID # def delete_domain(domain) request( :expects => 200, :method => 'DELETE', :path => "/domains/#{domain}" ) end end class Mock def delete_domain(name) self.data[:records].delete name self.data[:domains].reject! { |domain| domain["domain"]["name"] == name } response = Excon::Response.new response.status = 200 response end end end end end fog-1.34.0/lib/fog/dnsimple/dns.rb0000644000004100000410000000667612600047641016666 0ustar www-datawww-datarequire 'fog/dnsimple/core' module Fog module DNS class DNSimple < Fog::Service recognizes :dnsimple_email, :dnsimple_password, :dnsimple_token, :dnsimple_domain, :dnsimple_url, :host, :path, :port, :scheme, :persistent model_path 'fog/dnsimple/models/dns' model :record collection :records model :zone collection :zones request_path 'fog/dnsimple/requests/dns' request :list_domains request :create_domain request :get_domain request :delete_domain request :create_record request :list_records request :update_record request :delete_record request :get_record class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :domains => [], :records => {} } end end def self.reset @data = nil end def initialize(options={}) @dnsimple_email = options[:dnsimple_email] @dnsimple_password = options[:dnsimple_password] @dnsimple_token = options[:dnsimple_token] @dnsimple_domain = options[:dnsimple_domain] end def data self.class.data[@dnsimple_email] end def reset_data self.class.data.delete(@dnsimple_email) end end class Real def initialize(options={}) @dnsimple_email = options[:dnsimple_email] @dnsimple_password = options[:dnsimple_password] @dnsimple_token = options[:dnsimple_token] @dnsimple_domain = options[:dnsimple_domain] @connection_options = options[:connection_options] || {} if options[:dnsimple_url] uri = URI.parse(options[:dnsimple_url]) options[:host] = uri.host options[:port] = uri.port options[:scheme] = uri.scheme end @host = options[:host] || "api.dnsimple.com" @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload @connection.reset end def request(params) params[:headers] ||= {} if(@dnsimple_password) key = "#{@dnsimple_email}:#{@dnsimple_password}" params[:headers].merge!("Authorization" => "Basic " + Base64.encode64(key).gsub("\n",'')) elsif(@dnsimple_token) if(@dnsimple_domain) params[:headers].merge!("X-DNSimple-Domain-Token" => @dnsimple_token) else params[:headers].merge!("X-DNSimple-Token" => "#{@dnsimple_email}:#{@dnsimple_token}") end else raise ArgumentError.new("Insufficient credentials to properly authenticate!") end params[:headers].merge!( "Accept" => "application/json", "Content-Type" => "application/json" ) version = params.delete(:version) || 'v1' params[:path] = File.join('/', version, params[:path]) response = @connection.request(params) unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end end end end end fog-1.34.0/lib/fog/dnsimple/core.rb0000644000004100000410000000020112600047641017004 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module DNSimple extend Fog::Provider service(:dns, 'DNS') end end fog-1.34.0/lib/fog/dnsimple/models/0000755000004100000410000000000012600047641017021 5ustar www-datawww-datafog-1.34.0/lib/fog/dnsimple/models/dns/0000755000004100000410000000000012600047641017605 5ustar www-datawww-datafog-1.34.0/lib/fog/dnsimple/models/dns/zones.rb0000644000004100000410000000101412600047641021264 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/dnsimple/models/dns/zone' module Fog module DNS class DNSimple class Zones < Fog::Collection model Fog::DNS::DNSimple::Zone def all clear data = service.list_domains.body.map {|zone| zone['domain']} load(data) end def get(zone_id) data = service.get_domain(zone_id).body['domain'] new(data) rescue Excon::Errors::NotFound nil end end end end end fog-1.34.0/lib/fog/dnsimple/models/dns/record.rb0000644000004100000410000000274012600047641021413 0ustar www-datawww-datarequire 'fog/core/model' module Fog module DNS class DNSimple class Record < Fog::Model extend Fog::Deprecation deprecate :ip, :value deprecate :ip=, :value= identity :id attribute :zone_id, :aliases => "domain_id" attribute :name attribute :value, :aliases => "content" attribute :ttl attribute :priority, :aliases => "prio" attribute :type, :aliases => "record_type" attribute :created_at attribute :updated_at def initialize(attributes={}) super end def destroy service.delete_record(zone.id, identity) true end def zone @zone end def save requires :name, :type, :value options = {} options[:prio] = priority if priority options[:ttl] = ttl if ttl # decide whether its a new record or update of an existing if id.nil? data = service.create_record(zone.id, name, type, value, options) else options[:name] = name if name options[:content] = value if value options[:type] = type if type data = service.update_record(zone.id, id, options) end merge_attributes(data.body["record"]) true end private def zone=(new_zone) @zone = new_zone end end end end end fog-1.34.0/lib/fog/dnsimple/models/dns/zone.rb0000644000004100000410000000166312600047641021113 0ustar www-datawww-datarequire 'fog/core/model' require 'fog/dnsimple/models/dns/records' module Fog module DNS class DNSimple class Zone < Fog::Model identity :id attribute :domain, :aliases => 'name' attribute :created_at attribute :updated_at def destroy service.delete_domain(identity) true end def records @records ||= begin Fog::DNS::DNSimple::Records.new( :zone => self, :service => service ) end end def nameservers [ "ns1.dnsimple.com", "ns2.dnsimple.com", "ns3.dnsimple.com", "ns4.dnsimple.com", ] end def save requires :domain data = service.create_domain(domain).body["domain"] merge_attributes(data) true end end end end end fog-1.34.0/lib/fog/dnsimple/models/dns/records.rb0000644000004100000410000000136412600047641021577 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/dnsimple/models/dns/record' module Fog module DNS class DNSimple class Records < Fog::Collection attribute :zone model Fog::DNS::DNSimple::Record def all requires :zone clear data = service.list_records(zone.id).body.map {|record| record['record']} load(data) end def get(record_id) requires :zone data = service.get_record(zone.id, record_id).body["record"] new(data) rescue Excon::Errors::NotFound nil end def new(attributes = {}) requires :zone super({ :zone => zone }.merge!(attributes)) end end end end end fog-1.34.0/lib/fog/internet_archive.rb0000644000004100000410000000004712600047642017603 0ustar www-datawww-datarequire 'fog/internet_archive/storage' fog-1.34.0/lib/fog/vcloud_director/0000755000004100000410000000000012600047642017113 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/requests/0000755000004100000410000000000012600047642020766 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/requests/compute/0000755000004100000410000000000012600047642022442 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/requests/compute/post_clone_media.rb0000644000004100000410000000701312600047642026274 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a copy of a media object. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp template. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] source_id Object identifier of the source media # object. # @param [Hash] options # @option options [String] :Description Optional description. # @option options [Boolean] :IsSourceDelete A value of true deletes the # Source object after successful completion of the copy operation. # Defaults to false if empty or missing. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneMedia.html # @since vCloud API version 0.9 def post_clone_media(vdc_id, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } CloneMediaParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}media/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml response = request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneMediaParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneMedia" ) ensure_list! response.body, :Files, :File response end end class Mock def post_clone_media(vdc_id, source_id, options={}) # TODO: check this happens. unless source_media = data[:medias][source_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.media:#{source_id})\"." ) end unless data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"." ) end media_id = uuid media_name = "#{source_media[:name]}-copy-#{uuid}" owner = { :href => make_href("media/#{media_id}"), :type => 'application/vnd.vmware.vcloud.media+xml' } task_id = enqueue_task( "Copy Media File #{media_name}(#{media_id})", 'vdcCopyMedia', owner, :on_success => lambda do data[:medias][media_id][:status] = 1 end ) media = source_media.dup.merge( :name => media_name, :status => 0, :tasks => [task_id] ) data[:medias][media_id] = media body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(media_body(media_id)) Excon::Response.new( :status => 201, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_organization.rb0000644000004100000410000000704112600047642026334 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve an organization. # # @param [String] id The object identifier of the organization. # @return [Excon:Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organization.html # @since vCloud API version 0.9 def get_organization(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}" ) ensure_list! response.body, :Tasks, :Task response end end class Mock def get_organization(id) unless id == data[:org][:uuid] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"com.vmware.vcloud.entity.org:#{id}\"" ) end org = data[:org] body = {:href=>make_href("org/#{id}"), :type=>"application/vnd.vmware.vcloud.org+xml", :id=>"urn:vcloud:org:#{id}", :name=>org[:name], :Link=> [{:href=>make_href("tasksList/#{id}"), :type=>"application/vnd.vmware.vcloud.tasksList+xml", :rel=>"down"}, {:href=>make_href("admin/org/#{id}/catalogs"), :type=>"application/vnd.vmware.admin.catalog+xml", :rel=>"add"}, {:href=>make_href("org/#{id}/metadata"), :type=>"application/vnd.vmware.vcloud.metadata+xml", :rel=>"down"}], :Description=>org[:description]||'', :Tasks=>{:Task=>[]}, :FullName=>org[:full_name]} body[:Link] += data[:catalogs].map do |catalog_id, catalog| [{:href=>make_href("catalog/#{catalog_id}"), :name=>catalog[:name], :type=>"application/vnd.vmware.vcloud.catalog+xml", :rel=>"down"}, {:href=>make_href("org/#{id}/catalog/#{catalog_id}/controlAccess/"), :type=>"application/vnd.vmware.vcloud.controlAccess+xml", :rel=>"down"}, {:href=> make_href("org/#{id}/catalog/#{catalog_id}/action/controlAccess"), :type=>"application/vnd.vmware.vcloud.controlAccess+xml", :rel=>"controlAccess"}] end.flatten body[:Link] += data[:networks].map do |network_id, network| {:href=>make_href("network/#{network_id}"), :name=>network[:name], :type=>"application/vnd.vmware.vcloud.orgNetwork+xml", :rel=>"down"} end body[:Link] += data[:vdcs].map do |vdc_id, vdc| {:href=>make_href("vdc/#{vdc_id}"), :name=>vdc[:name], :type=>"application/vnd.vmware.vcloud.vdc+xml", :rel=>"down"} end if api_version.to_f >= 5.1 body[:Link] << {:href=>make_href('supportedSystemsInfo/'), :type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml", :rel=>"down"} end Excon::Response.new( :body => body, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_disk_metadata_item_metadata.rb0000644000004100000410000000333112600047642031327 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the disk. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-DiskMetadataItem-metadata.html # @since vCloud API version 5.1 def put_disk_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_media_metadata.rb0000644000004100000410000000136312600047642026550 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with a media object. # # @param [String] id Object identifier of the media object # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaMetadata.html # @since vCloud API version 1.5 def get_media_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_owner.rb0000644000004100000410000000305212600047642026006 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the owner of a vApp. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppOwner.html # @since vCloud API version 1.5 def get_vapp_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/owner" ) end end class Mock def get_vapp_owner(id) type = 'application/vnd.vmware.vcloud.owner+xml' unless vapp = data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_owner_section_body(id) ) end def get_owner_section_body(id) { :type => 'application/vnd.vmware.vcloud.owner+xml', :User => { :type => "application/vnd.vmware.admin.user+xml", :name => "mockuser", :href => make_href("user/12345678-1234-1234-1234-12345678df2b"), } } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_href.rb0000644000004100000410000000075612600047642024562 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # This is used for manual testing. # # @api private def get_href(href) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :override_path => true, :path => URI.parse(href).path ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_org_vdc_gateways.rb0000644000004100000410000000575312600047642027167 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_edge_gateways, :get_org_vdc_gateways # List all gateways for this Org vDC. # # @param [String] id Object identifier of the vDC. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrgVdcGateways.html # @since vCloud API version 5.1 def get_org_vdc_gateways(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{id}/edgeGateways" ) ensure_list! response.body, :EdgeGatewayRecord response end end class Mock def get_org_vdc_gateways(vdc_id) unless data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"." ) end body = {:xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :total => "1", :pageSize => "25", :page => "1", :name => "edgeGateways", :type => "application/vnd.vmware.vcloud.query.records+xml", :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=records"), :xsi_schemaLocation => xsi_schema_location, :Link => [{:rel => "alternate", :type => "application/vnd.vmware.vcloud.query.references+xml", :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=references")}, {:rel => "alternate", :type => "application/vnd.vmware.vcloud.query.idrecords+xml", :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=records")}], :EdgeGatewayRecord => []} vdc_edge_gateways = data[:edge_gateways].select do |id, edge_gateway| edge_gateway[:vdc] == vdc_id end body[:EdgeGatewayRecord] += vdc_edge_gateways.map do |id, edge_gateway| {:vdc => make_href("vdc/#{vdc_id}"), :numberOfOrgNetworks => "1", :numberOfExtNetworks => "1", :name => edge_gateway[:name], :isBusy => "false", :haStatus => "DISABLED", :gatewayStatus => "READY", :href => make_href("admin/edgeGateway/#{id}"), :isSyslogServerSettingInSync => "true"} end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_answer_vm_pending_question.rb0000644000004100000410000000233212600047642031470 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Answer a question being asked by a VM. # # @param [String] id Object identifier of the VM. # @param [Integer] choice_id Choice ID of this answer. # @param [String] question_id Question ID of the question. # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AnswerVmPendingQuestion.html # @since vCloud API version 0.9 def post_answer_pending_vm_question(id, choice_id, question_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } VmAnswerQuestion(attrs) { ChoiceId choice_id QuestionId question_id } end.to_xml request( :body => body, :expects => 204, # this might be wrong :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vmPendingAnswer+xml'}, :method => 'POST', :path => "vApp/#{id}/quesiton/action/answer" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_media_owner.rb0000644000004100000410000000444112600047642026122 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the owner of a media object. # # @param [String] id Object identifier of the media object. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the media object. # * :type<~String> - The MIME type of the media object. # * :Link<~Hash>: # * :href<~String> - # * :type<~String> - # * :rel<~String> - # * :User<~Hash> - Reference to the user who is the owner of this # media object. # * :href<~String> - The URI of the user. # * :name<~String> - The name of the user. # * :type<~String> - The MIME type of the user. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaOwner.html # @since vCloud API version 1.5 def get_media_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/owner" ) end end class Mock def get_media_owner(id) unless data[:medias][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "com.vmware.vcloud.entity.media:%s".' % id ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, :Link => { :href => make_href("media/#{id}"), :type => 'application/vnd.vmware.vcloud.media+xml', :rel => 'up' }, :User => { :href => make_href("admin/user/#{user_uuid}"), :name => user_name, :type => 'application/vnd.vmware.admin.user+xml', } } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_update_media_metadata.rb0000644000004100000410000000356012600047642030321 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Merge the metadata provided in the request with existing metadata. # # @param [String] id Object identifier of the media object. # @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateMediaMetadata.html # @since vCloud API version 1.5 def post_update_media_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_task_list.rb0000644000004100000410000001432012600047642025623 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_tasks_list, :get_task_list # Retrieve a list of this organization's queued, running, or recently # completed tasks. # # @param [String] id Object identifier of the organization. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN format. # The value of this attribute uniquely identifies the entity, # persists for the life of the entity, and is never reused. # * :name<~String> - The name of the entity. # * :Task<~Array>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN # format. The value of this attribute uniquely identifies the # entity, persists for the life of the entity, and is never # reused. # * :operationKey<~String> - Optional unique identifier to # support idempotent semantics for create and delete # operations. # * :name<~String> - The name of the entity. # * :cancelRequested<~String> - Whether user has requested this # processing to be canceled. # * :endTime<~String> - The date and time that processing of the # task was completed. May not be present if the task is still # being executed. # * :expiryTime<~String> - The date and time at which the task # resource will be destroyed and no longer available for # retrieval. May not be present if the task has not been # executed or is still being executed. # * :operation<~String> - A message describing the operation that # is tracked by this task. # * :operationName<~String> - The short name of the operation # that is tracked by this task. # * :serviceNamespace<~String> - Identifier of the service that # created the task. # * :startTime<~String> - The date and time the system started # executing the task. May not be present if the task has not # been executed yet. # * :status<~String> - The execution status of the task. # * :Link<~Array>: # * :Description<~String> - Optional description. # * :Owner<~Hash> - Reference to the owner of the task. This is # typically the object that the task is creating or updating. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Error<~Hash> - Represents error information from a failed # task. # * :majorErrorCode<~String> - The class of the error. Matches # the HTTP status code. # * :message<~String> - An one line, human-readable message # describing the error that occurred. # * :minorErrorCode<~String> - Resource-specific error code. # * :stackTrace<~String> - The stack trace of the exception. # * :vendorSpecificErrorCode<~String> - A vendor- or # implementation-specific error code that can reference # specific modules or source lines for diagnostic purposes. # * :User<~Hash> - The user who started the task. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Organization<~Hash> - The organization to which the :User # belongs. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Progress<~String> - Read-only indicator of task progress as # an approximate percentage between 0 and 100. Not available # for all tasks. # * :Params # * :Details<~String> - Detailed message about the task. Also # contained by the :Owner entity when task status is # preRunning. # # @raise [Fog::Compute::VcloudDirector::BadRequest] # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-TaskList.html # @since vCloud API version 0.9 def get_task_list(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "tasksList/#{id}" ) ensure_list! response.body, :Task response end end class Mock def get_task_list(id) unless id == data[:org][:uuid] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"com.vmware.vcloud.entity.org:#{id}\"." ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, :href => make_href("tasksList/#{id}"), :type => "application/vnd.vmware.vcloud.tasksList+xml", :name => "Tasks Lists", :Task => data[:tasks].keys.map {|task_id| task_body(task_id)} } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_task.rb0000644000004100000410000001644712600047642024604 0ustar www-datawww-datarequire 'date' module Fog module Compute class VcloudDirector class Real # Retrieve a task. # # @param [String] id The object identifier of the task. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN format. # The value of this attribute uniquely identifies the entity, # persists for the life of the entity, and is never reused. # * :operationKey<~String> - Optional unique identifier to support # idempotent semantics for create and delete operations. # * :name<~String> - The name of the entity. # * :cancelRequested<~String> - Whether user has requested this # processing to be canceled. # * :endTime<~String> - The date and time that processing of the # task was completed. May not be present if the task is still # being executed. # * :expiryTime<~String> - The date and time at which the task # resource will be destroyed and no longer available for # retrieval. May not be present if the task has not been executed # or is still being executed. # * :operation<~String> - A message describing the operation that # is tracked by this task. # * :operationName<~String> - The short name of the operation that # is tracked by this task. # * :serviceNamespace<~String> - Identifier of the service that # created the task. # * :startTime<~String> - The date and time the system started # executing the task. May not be present if the task has not been # executed yet. # * :status<~String> - The execution status of the task. # * :Link<~Array>: # * :Description<~String> - Optional description. # * :Owner<~Hash> - Reference to the owner of the task. This is # typically the object that the task is creating or updating. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Error<~Hash> - Represents error information from a failed # task. # * :majorErrorCode<~String> - The class of the error. Matches # the HTTP status code. # * :message<~String> - An one line, human-readable message # describing the error that occurred. # * :minorErrorCode<~String> - Resource-specific error code. # * :stackTrace<~String> - The stack trace of the exception. # * :vendorSpecificErrorCode<~String> - A vendor- or # implementation-specific error code that can reference # specific modules or source lines for diagnostic purposes. # * :User<~Hash> - The user who started the task. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Organization<~Hash> - The organization to which the :User # belongs. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Progress<~String> - Read-only indicator of task progress as an # approximate percentage between 0 and 100. Not available for all # tasks. # * :Params # * :Details<~String> - Detailed message about the task. Also # contained by the :Owner entity when task status is preRunning. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Task.html # @since vCloud API version 0.9 def get_task(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "task/#{id}" ) # vCloud Director bug: Owner may be absent for some tasks, fix # targeted for 5.1.3 (due out at the beginning Q1 2014). # # We'd prefer that Owner is always present; if nothing else, this # let's the tests pass. response.body[:Owner] ||= {:href => '', :name => nil, :type => nil} response end end class Mock def get_task(id) unless data[:tasks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(task_body(id)) Excon::Response.new( :status => 200, :headers => {'Type' => "application/#{body[:type]};version=#{api_version}"}, :body => body ) end private # @param [String] id Object identifier of the task. # @return [Hash] def task_body(id) task = data[:tasks][id] body = { :href => make_href("tasks/#{id}"), :type => 'application/vnd.vmware.vcloud.task+xml', :id => "urn:vcloud:tasl:#{id}", :name => task[:name], :cancelRequested => task[:cancel_requested].to_s, :expiryTime => task[:expiry_time].strftime('%Y-%m-%dT%H:%M:%S%z'), :operation => task[:operation], :operationName => task[:operation_name], :serviceNamespace => task[:service_namespace], :status => task[:status], :Link => [], :Owner => task[:owner], :User => { # for now, always the current user :href => make_href("admin/user/#{user_uuid}"), :name => user_name, :type => 'application/vnd.vmware.admin.user+xml', }, :Organization => { # for now, always the current org :href => make_href("org/#{data[:org][:uuid]}"), :name => data[:org][:name], :type => 'application/vnd.vmware.vcloud.org+xml', }, :Progress => task[:progress].to_s, :Details => task[:details] || '', } body[:endTime] = task[:end_time].strftime('%Y-%m-%dT%H:%M:%S%z') if task[:end_time] body[:startTime] = task[:start_time].strftime('%Y-%m-%dT%H:%M:%S%z') if task[:start_time] body[:Description] = task[:description] if task[:description] if task[:status] == 'running' body[:Link] << { :href => make_href("task/#{id}/action/cancel"), :type => 'application/vnd.vmware.vcloud.task+xml', :rel => 'cancel', } end body end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_memory.rb0000644000004100000410000000666212600047642025201 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :put_vm_memory, :put_memory # Update the RASD item that specifies memory properties of a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [Integer] memory Memory size in Megabytes. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Memory.html # @since vCloud API version 0.9 def put_memory(id, memory) data = < byte * 2^20 Memory Size #{memory} MB of memory 5 0 4 #{memory} 0 EOF request( :body => data, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/memory" ) end end class Mock def put_memory(id, memory) unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end owner = { :href => make_href("vApp/#{id}"), :type => 'application/vnd.vmware.vcloud.vm+xml' } task_id = enqueue_task( "Updating Virtual Machine #{data[:vms][id][:name]}(#{id})", 'vappUpdateVm', owner, :on_success => lambda do data[:vms][id][:memory_in_mb] = memory end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm.rb0000644000004100000410000000130012600047642024242 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/vm' # Retrieve a vApp or VM. # # @note This should probably be deprecated. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see #get_vapp def get_vm(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Vm.new, :path => "vApp/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_vapp_template_metadata_item_metadata.rb0000644000004100000410000000157212600047642033675 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete the specified key and its value from vApp template or VM # metadata. # # @param [String] id Object identifier of the vApp template or VM. # @param [String] key Key of the metadata item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppTemplateMetadataItem-metadata.html # @since vCloud API version 1.5 def delete_vapp_template_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_remove_all_snapshots.rb0000644000004100000410000000161312600047642030264 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Removes all user created snapshots for a vApp or virtual machine. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or virtual machine. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RemoveAllSnapshots.html # @since vCloud API version 5.1 def post_remove_all_snapshots(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/removeAllSnapshots" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_reboot_vapp.rb0000644000004100000410000000207712600047642026362 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Reboot a vApp or VM. # # If used on a vApp, reboots all VMs in the vApp. If used on a VM, # reboots the VM. This operation is available only for a vApp or VM # that is powered on. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RebootVApp.html # @since vCloud API version 0.9 def post_reboot_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/reboot" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disks_rasd_items_list.rb0000644000004100000410000000527312600047642030217 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all RASD items that specify hard disk and hard disk # controller properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksRasdItemsList.html # @since vCloud API version 0.9 def get_disks_rasd_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end end class Mock def get_disks_rasd_items_list(id) type = 'application/vnd.vmware.vcloud.rasdItemsList+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :type => type, :href => make_href("vApp/#{id}/virtualHardwareSection/disks"), :Link => { :rel=>"edit", :type=>"application/vnd.vmware.vcloud.rasdItemsList+xml", :href=>make_href("vApp/#{id}/virtualHardwareSection/disks"), }, :Item => [ get_disks_rasd_items_list_body(id, vm), get_media_rasd_item_ide_controller_body(id, vm), ].flatten } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => body ) end def get_disks_rasd_items_list_body(id, vm) [ { :"rasd:Address"=>"0", :"rasd:Description"=>"SCSI Controller", :"rasd:ElementName"=>"SCSI Controller 0", :"rasd:InstanceID"=>"2", :"rasd:ResourceSubType"=>"lsilogic", :"rasd:ResourceType"=>"6" }, # TODO: Add support for adding disks { :"rasd:AddressOnParent"=>"0", :"rasd:Description"=>"Hard disk", :"rasd:ElementName"=>"Hard disk 1", :"rasd:HostResource"=>{ :ns12_capacity=>"51200", :ns12_busSubType=>"lsilogic", :ns12_busType=>"6" }, :"rasd:InstanceID"=>"2000", :"rasd:Parent"=>"2", :"rasd:ResourceType"=>"17" }, ] end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_vapp_metadata_item_metadata.rb0000644000004100000410000000175612600047642032006 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :delete_metadata, :delete_vapp_metadata_item_metadata require 'fog/vcloud_director/parsers/compute/metadata' # Delete the specified key and its value from vApp or VM metadata. # # @param [String] id Object identifier of the vApp or VM. # @param [String] key Key of the metadata item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppMetadataItem-metadata.html # @since vCloud API version 1.5 def delete_vapp_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata.rb0000644000004100000410000000141312600047642030115 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all metadata associated with a catalog item. # # @param [String] id Object identifier of the catalog item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItemMetadata.html # @since vCloud API version 1.5 def get_catalog_item_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_allocated_ip_addresses.rb0000644000004100000410000000142212600047642030302 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a list of IP addresses allocated to the network. # # @param [String] id Object identifier of the network. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-AllocatedIpAddresses.html # @since vCloud API version 5.1 def get_allocated_ip_addresses(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "network/#{id}/allocatedAddresses" ) end end end end end ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_guest_customization_system_section_vapp_template.rbfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_guest_customization_system_section_vapp_temp0000644000004100000410000000150412600047642034546 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves the guest customization section of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vAppTemplate.html # @since vCloud API version 1.0 def get_guest_customization_system_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/guestCustomizationSection" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_control_access_params_vapp.rb0000644000004100000410000000137512600047642031226 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve access control information for a vApp. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ControlAccessParams-vApp.html # @since vCloud API 0.9 def get_control_access_params_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/controlAccess" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_serial_ports_items_list.rb0000644000004100000410000000144612600047642030575 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all RASD items that specify serial port properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SerialPortsItemsList.html # @since vCloud API version 1.5 def get_serial_ports_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/serialPorts" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_vapp_metadata_item_metadata.rb0000644000004100000410000000556412600047642031355 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the vApp or VM. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VAppMetadataItem-metadata.html # @since vCloud API version 1.5 def put_vapp_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)}" ) end end class Mock def put_vapp_metadata_item_metadata(id, key, value) unless vm_or_vapp = data[:vapps][id] || vm_or_vapp = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end owner = { :href => make_href("vApp/#{id}"), :type => 'application/vnd.vmware.vcloud.vm+xml' } task_id = enqueue_task( "Updating Virtual Machine #{vm_or_vapp[:name]}(#{id})", 'vappUpdateVm', owner, :on_success => lambda do vm_or_vapp[:metadata][key] = value end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb0000644000004100000410000000164112600047642031122 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from virtual datacenter # metadata. # # @param [String] id Object identifier of the network. # @param [String] domain # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcMetadataItem-metadata.html # @since vCloud API version 1.5 def get_vdc_metadata_item_metadata(id, domain, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_lease_settings_section_vapp_template.rb0000644000004100000410000000147112600047642033307 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves the lease settings section of a vApp template. # # @param [String] id Object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-LeaseSettingsSection-vAppTemplate.html # @since vCloud API version 0.9 def get_lease_settings_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/leaseSettingsSection" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_virtual_hardware_section.rb0000644000004100000410000000175312600047642030723 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the virtual hardware section of a VM. # # This operation retrieves the entire VirtualHardwareSection of a VM. # You can also retrieve many RASD item elements of a # VirtualHardwareSection individually, or as groups of related items. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VirtualHardwareSection.html # @since vCloud API version 0.9 def get_virtual_hardware_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_product_sections_vapp_template.rb0000644000004100000410000000150712600047642032141 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a list of ProductSection elements from a vApp template or # VM. # # @param [String] id Object identifier of the vApp template or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ProductSections-vAppTemplate.html # @since vCloud API version 1.5 def get_product_sections_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/productSections" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_config_section_vapp.rb0000644000004100000410000000364112600047642031422 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network config section of a vApp. # # @param [String] id The object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConfigSection-vApp.html # @since vCloud API version 0.9 def get_network_config_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConfigSection/" ) end end class Mock def get_network_config_section_vapp(id) type = 'application/vnd.vmware.vcloud.networkConfigSection+xml' unless vapp = data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vapp_network_config_section_body(id, vapp) ) end def get_vapp_network_config_section_body(id, vapp) # TODO: This is effectively hardcoding a vAppNetwork configuration # into here, but this is sufficient for initial testing. # This network configuration has no networks. { :type => "application/vnd.vmware.vcloud.networkConfigSection+xml", :href => make_href("vApp/#{id}/networkConfigSection/"), :ovf_required => "false", :"ovf:Info" => "The configuration parameters for logical networks", :NetworkConfig => [], } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_disks.rb0000644000004100000410000000173412600047642025452 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/disks' # Retrieve all RASD items that specify hard disk and hard disk # controller properties of a VM. # # @deprecated Use {#get_disks_rasd_items_list} instead. # @todo Log deprecation warning. # # @param [String] id # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksRasdItemsList.html # @since vCloud API version 0.9 def get_vm_disks(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Disks.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_reset_vapp.rb0000644000004100000410000000207112600047642026204 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Reset a vApp or VM. # # If used on a vApp, resets all VMs in the vApp. If used on a VM, # resets the VM. This operation is available only for a vApp or VM that # is powered on. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ResetVApp.html # @since vCloud API version 0.9 def post_reset_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/reset" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_cpu_rasd_item.rb0000644000004100000410000000370012600047642026444 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_vm_cpu, :get_cpu_rasd_item # Retrieve the RASD item that specifies CPU properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CpuRasdItem.html # @since vCloud API version 0.9 def get_cpu_rasd_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/cpu" ) end end class Mock def get_cpu_rasd_item(id) type = 'application/vnd.vmware.vcloud.rasdItem+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_cpu_rasd_item_body(id, vm) ) end def get_cpu_rasd_item_body(id, vm) { :ns12_href => make_href("vApp/#{id}/virtualHardwareSection/cpu"), :ns12_type => "application/vnd.vmware.vcloud.rasdItem+xml", :"rasd:AllocationUnits"=>"hertz * 10^6", :"rasd:Description"=>"Number of Virtual CPUs", :"rasd:ElementName"=>"#{vm[:cpu_count]} virtual CPU(s)", :"rasd:InstanceID"=>"4", :"rasd:Reservation"=>"0", :"rasd:ResourceType"=>"3", :"rasd:VirtualQuantity"=>"#{vm[:cpu_count]}", :"rasd:Weight"=>"0", } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_upload_media.rb0000644000004100000410000001027212600047642026461 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Upload a media image. # # The response includes an upload link for the media image. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] name The name of the media image. # @param [String] image_type Media image type. One of: iso, floppy. # @param [Integer] size Size of the media file, in bytes. # @param [Hash] options # @option options [String] :operationKey Optional unique identifier to # support idempotent semantics for create and delete operations. # @option options [String] :Description Optional description. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UploadMedia.html # @since vCloud API version 0.9 # @todo Support vDC Storage Profiles. def post_upload_media(vdc_id, name, image_type, size, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name, :imageType => image_type, :size => size } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) Media(attrs) { if options.key?(:Description) Description options[:Description] end } end.to_xml response = request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.media+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/media" ) ensure_list! response.body, :Files, :File response end end class Mock def post_upload_media(vdc_id, name, image_type, size, options={}) unless ['iso','floppy'].include?(image_type) raise Fog::Compute::VcloudDirector::BadRequest.new( 'The value of parameter imageType is incorrect.' ) end unless size.to_s =~ /^\d+$/ raise Fog::Compute::VcloudDirector::BadRequest.new( 'validation error on field \'size\': must be greater than or equal to 0' ) end unless data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"." ) end media_id = uuid file_id = uuid owner = { :href => make_href("media/#{media_id}"), :type => 'application/vnd.vmware.vcloud.media+xml' } task_id = enqueue_task( "Importing Media File #{name}(#{file_id})", 'vdcUploadMedia', owner, :on_success => lambda do media = data[:medias][media_id] media[:file][:bytes_transferred] = media[:size] media[:status] = 1 end ) media = { :description => options[:Description], :file => { :bytes_transferred => 0, :uuid => file_id }, :image_type => image_type, :name => name, :size => size.to_i, :status => 0, :tasks => [task_id], :vdc_id => vdc_id, :vdc_storage_class => data[:vdc_storage_classes].find {|k,v| v[:default]}.first } data[:medias][media_id] = media body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(media_body(media_id)) Excon::Response.new( :status => 201, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb0000644000004100000410000001513512600047642030560 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/generators/compute/org_vdc_network' # Create an Org vDC network. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # Produce media type(s): # application/vnd.vmware.vcloud.orgVdcNetwork+xml # Output type: # OrgVdcNetworkType # # @param [String] vdc_id Object identifier of the vDC # @param [String] name The name of the entity. # @param [Hash] options # @option options [String] :Description Optional description. # @option options [Hash] :Configuration Network configuration. # @option options [Hash] :EdgeGateway EdgeGateway that connects this # Org vDC network. Applicable only for routed networks. # @option options [Hash] :ServiceConfig Specifies the service # configuration for an isolated Org vDC networks. # @option options [Boolean] :IsShared True if this network is shared # to multiple Org vDCs. # * :Configuration<~Hash>: NetworkConfigurationType # * :IpScopes<~Hash>: # * :IpScope<~Hash>: # * :IsInherited<~Boolean>: ? # * :Gateway<~String>: IP address of gw # * :Netmask<~String>: Subnet mask of network # * :Dns1<~String>: Primary DNS server. # * :Dns2<~String>: Secondary DNS server. # * :DnsSuffix<~String>: DNS suffix. # * :IsEnabled<~String>: Indicates if subnet is enabled or not. # Default value is True. # * :IpRanges<~Array>: IP ranges used for static pool allocation # in the network. Array of Hashes of: # * :StartAddress - start IP in range # * :EndAddress - end IP in range # * :EdgeGateway<~Hash>: EdgeGateway that connects this Org vDC # network. Applicable only for routed networks. # * :ServiceConfig<~Hash>: Specifies the service configuration for an # isolated network # # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateOrgVdcNetwork.html # @since vCloud API version 5.1 def post_create_org_vdc_network(vdc_id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::OrgVdcNetwork.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.orgVdcNetwork+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{vdc_id}/networks" ) end end class Mock def post_create_org_vdc_network(vdc_id, name, options={}) unless data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"." ) end type = 'network' id = uuid # Description # Configuration # IpScopes # IpScope # IsInherited # Gateway # Netmask # Dns1 # Dns2 # DnsSuffix # IsEnabled # IpRanges # IpRange # StartAddress # EndAddress # FenceMode # EdgeGateway # IsShared network_body = { :name => name, :vdc => vdc_id, } [:Description, :IsShared].each do |key| network_body[key] = options[key] if options.key?(key) end if options.key?(:EdgeGateway) network_body[:EdgeGateway] = options[:EdgeGateway][:href].split('/').last end if configuration = options[:Configuration] if ip_scopes = configuration[:IpScopes] if ip_scope = ip_scopes[:IpScope] [:IsInherited, :Gateway, :Netmask, :Dns1, :Dns2, :DnsSuffix, :IsEnabled].each do |key| network_body[key] = ip_scope[key] if ip_scope.key?(key) end if ip_ranges = ip_scope[:IpRanges] network_body[:IpRanges] = [] ip_ranges.each do |ipr| network_body[:IpRanges] << { :StartAddress => ipr[:IpRange][:StartAddress], :EndAddress => ipr[:IpRange][:EndAddress] } end end end end network_body[:FenceMode] = configuration[:FenceMode] if ip_scope.key?(:FenceMode) end owner = { :href => make_href("#{type}/#{id}"), :type => "application/vnd.vmware.vcloud.#{type}+xml" } task_id = enqueue_task( "Adding #{type} #{name} (#{id})", 'CreateOrgVdcNetwork', owner, :on_success => lambda do data[:networks][id] = network_body end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, :href => make_href("admin/network/#{id}"), :name => name, :id => "urn:vcloud:network:#{id}", :type => "application/vnd.vmware.vcloud.orgVdcNetwork+xml", :Link => [ {:rel=>"up", :type=>"application/vnd.vmware.vcloud.vdc+xml", :href=>make_href("vdc/#{vdc_id}")}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("admin/network/#{id}/metadata")}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.allocatedNetworkAddress+xml", :href=>make_href("admin/network/#{id}/allocatedAddresses/")}, ], }.merge(options) body[:Tasks] = { :Task => task_body(task_id) } Excon::Response.new( :status => 201, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vms_in_lease_from_query.rb0000644000004100000410000001476712600047642030561 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of VMs in lease by using REST API general # QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :VMRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VMsInLeaseFromQuery.html # @since vCloud API version 1.5 def get_vms_in_lease_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vms/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VMReference : :VMRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end class Mock def get_vms_in_lease_from_query(options={}) if options.key?(:filter) && options[:filter] =~ /^href==([^;,]+)$/ href = $1 id = href.split('/').last else Fog::Mock.not_implemented("Filter by href is currently the only option implemented in get_vms_in_lease_from_query Mock") end vm = data[:vms][id] parent_vapp_id = vm[:parent_vapp] vdc_id = data[:vapps][parent_vapp_id][:vdc_id] body = { :xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :href=>make_href('query'), :name=>"vm", :type=>"application/vnd.vmware.vcloud.query.records+xml", :xsi_schemaLocation=>xsi_schema_location, :total=>"1", :pageSize=>"25", :page=>"1", :Link=> [{:rel=>"alternate", :type=>"application/vnd.vmware.vcloud.query.references+xml", :href=>make_href('query')}, {:rel=>"alternate", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :href=>make_href('query')}], :VMRecord=> [{:vdc=>make_href(vdc_id), :numberOfCpus=>vm[:cpu_count], :name=>vm[:name], :containerName=>data[:vapps][parent_vapp_id][:name], :memoryMB=>vm[:memory_in_mb], :isVAppTemplate=>"false", :href=>make_href(id), :taskStatus=>"success", :task=>make_href("task/#{uuid}"), :taskDetails=>" ", :taskStatusName=>"vappUpdateVm"}] } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_exit_maintenance_mode.rb0000644000004100000410000000121112600047642030346 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Take the vApp out of maintenance mode. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ExitMaintenanceMode.html # @since vCloud API version 1.5 def post_exit_maintenance_mode(id) request( :expects => 204, :method => 'POST', :path => "vApp/#{id}/action/exitMaintenanceMode" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template.rb0000644000004100000410000000133112600047642026465 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a vApp template. # # @param [String] id Object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplate.html # @since vCloud API version 0.9 def get_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_consolidate_vm_vapp_template.rb0000644000004100000410000000153712600047642031771 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Consolidate VM snapshots. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ConsolidateVm-vAppTemplate.html # @since vCloud API version 1.5 def post_consolidate_vm_vapp_template(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/consolidate" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_execute_query.rb0000644000004100000410000010413312600047642026517 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # REST API General queries handler. # # @param [String] type The type of the query. Type names are # case-sensitive. You can retrieve a summary list of all typed # queries types accessible to the currently authenticated user by # making a request with type=nil. # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] if type is specified. # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :Record<~Array> - The name and content of this item # varies according to the type and format of the query. # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # @return [Excon::Response] if type is nil. # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # # @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-ExecuteQuery.html # @since vCloud API version 1.5 def get_execute_query(type=nil, options={}) if type.nil? response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'query' ) else query = ["type=#{type}"] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link # TODO: figure out the right key (this isn't it) #ensure_list! response.body, # response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? # "#{response.body[:name]}Reference".to_sym : # "#{response.body[:name]}Record".to_sym %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end class Mock def get_execute_query(type=nil, options={}) unless options[:fields].nil? Fog::Mock.not_implemented("Fields are not yet implemented in get_execute_query Mock for #{type}") end unless options[:format].nil? || options[:format] == 'records' Fog::Mock.not_implemented("Formats #{options[:format]} is not yet implemented in get_execute_query Mock for #{type}") end # NB: default is to sort by 'Database ID' (uuid?). Does this matter? unless options[:sortAsc].nil? && options[:sortDesc].nil? Fog::Mock.not_implemented("Sorting by field is not yet implemented in get_execute_query Mock for #{type}") end # NB: default offset is 0 unless options[:offset].nil? Fog::Mock.not_implemented("Offset results are not yet implemented in get_execute_query Mock for #{type}") end # NB: default page is 1 if options.key?(:page) && options[:page].to_i != 1 Fog::Mock.not_implemented("Paginated results are not yet implemented in get_execute_query Mock for #{type}") end # NB: default pageSize is 25 unless options[:pageSize].nil? Fog::Mock.not_implemented("Paginated results are not yet implemented in get_execute_query Mock for #{type}") end if type.nil? body = all_types else body = fetch_items(type, options) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end private def fetch_items(type, opts) if opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+)$/ name = $1 elsif type == 'vAppTemplate' && opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+);catalogName==([^;,]+)$/ #TODO also match in other order name = $1 catalog_name = $2 elsif opts.key?(:filter) Fog::Mock.not_implemented("Complex filters are not yet implemented in get_execute_query Mock for #{type}: #{opts[:filter]}") end body = { :xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :href=>make_href('query'), :name=>type, :type=>"application/vnd.vmware.vcloud.query.records+xml", :xsi_schemaLocation=>xsi_schema_location, } records = [] record_type = nil if type == 'orgVdc' record_type = :OrgVdcRecord vdc_id = data[:vdcs].keys[0] vdc_name = data[:vdcs][vdc_id][:name] records = [{ :storageUsedMB=>"123967", :storageLimitMB=>"8388608", :storageAllocationMB=>"0", :status=>"READY", :orgName=>"orgName", :name=>vdc_name, :memoryUsedMB=>"0", :memoryLimitMB=>"0", :memoryAllocationMB=>"0", :isSystemVdc=>"false", :isEnabled=>"true", :isBusy=>"false", :href=>make_href("vdc/#{vdc_id}"), }] body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records elsif type == 'orgVdcNetwork' record_type = :OrgVdcNetworkRecords data_type = :networks data[data_type].each do |id, dr| r = {} if name.nil? || dr[:name] == name vdc_id = dr[:vdc] if data[:vdcs][vdc_id] && data[:vdcs][vdc_id].key?(:name) r[:vdcName] = data[:vdcs][vdc_id][:name] end r[:name] = dr[:name] r[:vdc] = make_href("vdc/#{vdc_id}") if vdc_id r[:href] = make_href("admin/network/#{id}") mapping = { :description => :Description, :netmask => :Netmask, :linkType => :LinkType, :dns1 => :Dns1, :dns2 => :Dns2, :dnsSuffix => :DnsSuffix, :defaultGateway => :Gateway, :isShared => :IsShared, :isBusy => :IsBusy, :isIpScopeInherited => :IsIpScopeInherited, } mapping.each do |k,v| r[k] = dr[v] if dr.key?(v) end records << r end end body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records elsif type == 'edgeGateway' record_type = :EdgeGatewayRecord edge_gateway_id = data[:edge_gateways].keys[0] vdc_id = data[:edge_gateways][edge_gateway_id][:vdc] records = [{ :vdc=>make_href("vdc/#{vdc_id}"), :numberOfOrgNetworks=>"1", :numberOfExtNetworks=>"1", :name=>"Test EdgeGateway Name", :isBusy=>"false", :haStatus=>"DISABLED", :gatewayStatus=>"READY", :href=>make_href("edgeGateway/#{edge_gateway_id}"), :taskStatus=>"success", :taskOperation=>"networkConfigureEdgeGatewayServices", :task=>make_href("task/#{uuid}"), :taskDetails=>" " }] body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records elsif type == 'vAppTemplate' record_type = :VAappTemplateRecord records = [{ :vdcName=>"Bogus vDC", :vdc=>make_href("vdc/#{uuid}"), :storageProfileName=>"*", :status=>"RESOLVED", :ownerName=>"system", :org=> make_href("org/#{data[:org][:uuid]}"), :name=> name, :isPublished=>"true", :isGoldMaster=>"false", :isExpired=>"false", :isEnabled=>"true", :isDeployed=>"false", :isBusy=>"false", :creationDate=>"2013-09-19T22:55:30.257+01:00", :catalogName=> catalog_name, :href=> make_href("vAppTemplate/vappTemplate-#{uuid}"), :honorBootOrder=>"false", :isVdcEnabled=>"true", :isInCatalog=>"true", :cpuAllocationMhz=>"8", :cpuAllocationInMhz=>"16000", :storageKB=>"52428800", :numberOfShadowVMs=>"0", :numberOfVMs=>"1", :isAutoDeleteNotified=>"false", :numberOfCpus=>"8", :isAutoUndeployNotified=>"false", :memoryAllocationMB=>"32768" }] body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records elsif type == 'vApp' record_type = :VAppRecord all_records = data[:vapps].map do |vapp_id, vapp| { :vdcName => data.fetch(:vdcs).fetch(vapp[:vdc_id]).fetch(:name), :vdc => make_href("vdc/#{vapp[:vdc_id]}"), :storageProfileName => "*", :ownerName => "system", :name => vapp.fetch(:name), :status => 'POWERED_OFF', :isInMaintenanceMode=> 'false', :isPublic => 'false', :isExpired =>"false", :isEnabled =>"true", :isDeployed =>"false", :isBusy => "false", :pvdcHighestSupportedHardwareVersion => '8', :lowestHardwareVersionInVApp => '8', :creationDate => "2013-09-19T22:55:30.257+01:00", :href => make_href("vApp/#{vapp_id}"), :honorBootOrder => "false", :isVdcEnabled => "true", :cpuAllocationMhz => "8", :cpuAllocationInMhz => "16000", :storageKB => "52428800", :numberOfVMs => "1", :isAutoDeleteNotified => "false", :numberOfCpus => "8", :isAutoUndeployNotified => "false", :memoryAllocationMB => "32768", :task => make_href("task/#{uuid}"), :taskStatusName => 'vdcInstantiateVapp', :taskStatus => 'success', :taskDetails => " ", } end records = all_records.select do |record| record[:name] == name end body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records elsif type == 'task' record_type = :TaskRecord data_type = :tasks data[data_type].each do |id, dr| r = {} if name.nil? || dr.fetch(:operation_name) == name r[:name] = dr.fetch(:operation_name) r[:href] = make_href("task/#{id}") if dr.key?(:end_time) r[:endDate] = dr.fetch(:end_time).strftime('%Y-%m-%dT%H:%M:%S%z') else r[:endDate] = nil end if dr.key?(:start_time) r[:startDate] = dr.fetch(:start_time).strftime('%Y-%m-%dT%H:%M:%S%z') else r[:startDate] = nil end r[:status] = dr.fetch(:status) r[:serviceNamespace] = 'com.vmware.vcloud' r[:ownerName] = '000.0.000000' r[:orgName] = data.fetch(:org).fetch(:name) r[:org] = make_href("org/#{data[:org][:uuid]}") r[:objectType] = dr.fetch(:owner).fetch(:type).split(/\./).last.split(/\+/).first r[:objectName] = dr.fetch(:owner).fetch(:name, '') # objectName is optional r[:object] = dr.fetch(:owner).fetch(:href) r[:details] = '! []' records << r end end else Fog::Mock.not_implemented("No 'get by name' get_execute_query Mock for #{type} (#{name})") end body[:page] = 1.to_s # TODO: Support pagination body[:pageSize] = records.size.to_s # TODO: Support pagination body[:total] = records.size.to_s body[record_type] = records body end def all_types {:xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :type=>"application/vnd.vmware.vcloud.query.queryList+xml", :href=>make_href('query'), :xsi_schemaLocation=>xsi_schema_location, :Link=> [{:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"organization", :href=>make_href('query?type=organization&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"organization", :href=>make_href('query?type=organization&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"organization", :href=>make_href('query?type=organization&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"orgVdc", :href=>make_href('query?type=orgVdc&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"orgVdc", :href=>make_href('query?type=orgVdc&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"orgVdc", :href=>make_href('query?type=orgVdc&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"media", :href=>make_href('query?type=media&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"media", :href=>make_href('query?type=media&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"media", :href=>make_href('query?type=media&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vAppTemplate", :href=>make_href('query?type=vAppTemplate&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vAppTemplate", :href=>make_href('query?type=vAppTemplate&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vAppTemplate", :href=>make_href('query?type=vAppTemplate&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vApp", :href=>make_href('query?type=vApp&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vApp", :href=>make_href('query?type=vApp&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vApp", :href=>make_href('query?type=vApp&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vm", :href=>make_href('query?type=vm&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vm", :href=>make_href('query?type=vm&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vm", :href=>make_href('query?type=vm&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"orgNetwork", :href=>make_href('query?type=orgNetwork&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"orgNetwork", :href=>make_href('query?type=orgNetwork&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"orgNetwork", :href=>make_href('query?type=orgNetwork&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vAppNetwork", :href=>make_href('query?type=vAppNetwork&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vAppNetwork", :href=>make_href('query?type=vAppNetwork&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vAppNetwork", :href=>make_href('query?type=vAppNetwork&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"catalog", :href=>make_href('query?type=catalog&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"catalog", :href=>make_href('query?type=catalog&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"catalog", :href=>make_href('query?type=catalog&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"group", :href=>make_href('query?type=group&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"group", :href=>make_href('query?type=group&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"group", :href=>make_href('query?type=group&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"user", :href=>make_href('query?type=user&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"user", :href=>make_href('query?type=user&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"user", :href=>make_href('query?type=user&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"strandedUser", :href=>make_href('query?type=strandedUser&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"strandedUser", :href=>make_href('query?type=strandedUser&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"strandedUser", :href=>make_href('query?type=strandedUser&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"role", :href=>make_href('query?type=role&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"role", :href=>make_href('query?type=role&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"role", :href=>make_href('query?type=role&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"allocatedExternalAddress", :href=>make_href('query?type=allocatedExternalAddress&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"allocatedExternalAddress", :href=>make_href('query?type=allocatedExternalAddress&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"event", :href=>make_href('query?type=event&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"event", :href=>make_href('query?type=event&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"right", :href=>make_href('query?type=right&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"right", :href=>make_href('query?type=right&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"right", :href=>make_href('query?type=right&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vAppOrgNetworkRelation", :href=>make_href('query?type=vAppOrgNetworkRelation&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vAppOrgNetworkRelation", :href=>make_href('query?type=vAppOrgNetworkRelation&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vAppOrgNetworkRelation", :href=>make_href('query?type=vAppOrgNetworkRelation&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"catalogItem", :href=>make_href('query?type=catalogItem&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"catalogItem", :href=>make_href('query?type=catalogItem&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"catalogItem", :href=>make_href('query?type=catalogItem&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"task", :href=>make_href('query?type=task&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"task", :href=>make_href('query?type=task&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"task", :href=>make_href('query?type=task&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"disk", :href=>make_href('query?type=disk&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"disk", :href=>make_href('query?type=disk&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"disk", :href=>make_href('query?type=disk&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vmDiskRelation", :href=>make_href('query?type=vmDiskRelation&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vmDiskRelation", :href=>make_href('query?type=vmDiskRelation&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"service", :href=>make_href('query?type=service&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"service", :href=>make_href('query?type=service&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"service", :href=>make_href('query?type=service&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"orgVdcStorageProfile", :href=>make_href('query?type=orgVdcStorageProfile&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"orgVdcStorageProfile", :href=>make_href('query?type=orgVdcStorageProfile&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"orgVdcStorageProfile", :href=>make_href('query?type=orgVdcStorageProfile&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"apiDefinition", :href=>make_href('query?type=apiDefinition&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"apiDefinition", :href=>make_href('query?type=apiDefinition&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"apiDefinition", :href=>make_href('query?type=apiDefinition&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"fileDescriptor", :href=>make_href('query?type=fileDescriptor&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"fileDescriptor", :href=>make_href('query?type=fileDescriptor&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"edgeGateway", :href=>make_href('query?type=edgeGateway&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"edgeGateway", :href=>make_href('query?type=edgeGateway&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"edgeGateway", :href=>make_href('query?type=edgeGateway&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"orgVdcNetwork", :href=>make_href('query?type=orgVdcNetwork&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"orgVdcNetwork", :href=>make_href('query?type=orgVdcNetwork&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"orgVdcNetwork", :href=>make_href('query?type=orgVdcNetwork&format=idrecords')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.references+xml", :name=>"vAppOrgVdcNetworkRelation", :href=>make_href('query?type=vAppOrgVdcNetworkRelation&format=references')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.records+xml", :name=>"vAppOrgVdcNetworkRelation", :href=>make_href('query?type=vAppOrgVdcNetworkRelation&format=records')}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.query.idrecords+xml", :name=>"vAppOrgVdcNetworkRelation", :href=>make_href('query?type=vAppOrgVdcNetworkRelation&format=idrecords')} ] } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_section_vapp.rb0000644000004100000410000000137012600047642030072 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network section of a vApp. # # @param [String] id The object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkSection-vApp.html # @since vCloud API version 0.9 def get_network_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_media_metadata_item_metadata.rb0000644000004100000410000000353312600047642031460 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the media object. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-MediaMetadataItem-metadata.html # @since vCloud API version 1.5 def put_media_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapps_in_lease_from_query.rb0000644000004100000410000001116112600047642031066 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of vApps by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :VAppRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppsInLeaseFromQuery.html # @since vCloud API version 1.5 def get_vapps_in_lease_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vApps/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VAppReference : :VAppRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_request.rb0000644000004100000410000000057012600047642025320 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # This is used for manual testing. # # @api private def get_request(uri) request( :expects => 200, :idempotent => true, :method => 'GET', :path => uri ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_vm_capabilities.rb0000644000004100000410000000306712600047642027020 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Update VM's capabilities. # # @param [String] id Object identifier of the VM. # @param [Hash] options # @option options [Boolean] :MemoryHotAddEnabled True if the virtual # machine supports addition of memory while powered on. # @option options [Boolean] :CpuHotAddEnabled True if the virtual # machine supports addition of virtual CPUs while powered on. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VmCapabilities.html def put_vm_capabilities(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } VmCapabilities(attrs) { if options.key?(:MemoryHotAddEnabled) MemoryHotAddEnabled options[:MemoryHotAddEnabled] end if options.key?(:CpuHotAddEnabled) MemoryHotAddEnabled options[:CpuHotAddEnabled] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vmCapabilitiesSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/vmCapabilities" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_snapshot_section.rb0000644000004100000410000000311612600047642027212 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve SnapshotSection element for a vApp or VM. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SnapshotSection.html # @since vCloud API version 5.1 def get_snapshot_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/snapshotSection" ) end end class Mock def get_snapshot_section(id) type = 'application/vnd.vmware.vcloud.snapshotSection+xml' unless data[:vms][id] || data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_snapshot_section_body(id) ) end def get_snapshot_section_body(id) { :type => "application/vnd.vmware.vcloud.snapshotSection+xml", :href => make_href("vApp/#{id}/snapshotSection"), :ovf_required => "false", :"ovf:Info" => "Snapshot information section" } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_current_session.rb0000644000004100000410000000631512600047642027060 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a representation of the current session. # # A Session object contains one or more URLs from which you can begin # browsing, as well as links to the query service and entity resolver. # The list of URLs in the Session object is based on the role and # privileges of the authenticated user. # # A Session object expires after a configurable interval of client # inactivity. # # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :org<~String> - The name of the user's organization. # * :user<~String> - The name of the user that owns the session # * :Link<~Array]: # * :href<~String> - Contains the URI to the linked entity. # * :name<~String> - Contains the name of the linked entity. # * :type<~String> - Contains the type of the linked entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CurrentSession.html # @since vCloud API version 1.5 def get_current_session request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'session' ) end end class Mock def get_current_session body = {:href => make_href('session/'), :type => 'application/vnd.vmware.vcloud.session+xml', :org => data[:org][:name], :user => user_name, :Link => [{:href => make_href('org/'), :type => 'application/vnd.vmware.vcloud.orgList+xml', :rel => 'down'}, {:href => make_href('admin/'), :type => 'application/vnd.vmware.admin.vcloud+xml', :rel => 'down'}, {:href => make_href("org/#{data[:org][:uuid]}"), :name => data[:org][:name], :type => 'application/vnd.vmware.vcloud.org+xml', :rel => 'down'}, {:href => make_href('query'), :type => 'application/vnd.vmware.vcloud.query.queryList+xml', :rel => 'down'}, {:href => make_href('entity/'), :type => 'application/vnd.vmware.vcloud.entity+xml', :rel => 'entityResolver'}]} if @api_version.to_f >= 5.1 body[:Link] << { :href => make_href('extensibility'), :type => 'application/vnd.vmware.vcloud.apiextensibility+xml', :rel => 'down:extensibility' } end Excon::Response.new( :body => body, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb0000644000004100000410000000154512600047642034036 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the vDC storage profile. # # @param [String] id Object identifier of the vDC storage profile. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClassMetadataItem-metadata.html def get_vdc_storage_class_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_update_disk_metadata.rb0000644000004100000410000000354512600047642030177 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Merge the metadata provided in the request with existing metadata. # # @param [String] id Object identifier of the disk. # @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateDiskMetadata.html # @since vCloud API version 5.1 def post_update_disk_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_entity.rb0000644000004100000410000000271512600047642025147 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Redirects to the URL of an entity with the given VCD ID. # # @param [String] id # @return [Excon:Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN format. # The value of this attribute uniquely identifies the entity, # persists for the life of the entity, and is never reused. # * :name<~String> - The name of the entity. # * :Link<~Array]: # * :href<~String> - Contains the URI to the linked entity. # * :type<~String> - Contains the type of the linked entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Entity.html # @since vCloud API version 1.5 def get_entity(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "entity/#{id}" ) ensure_list! response.body, :Link response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_metadata_value.rb0000644000004100000410000000163312600047642026636 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # deprecated Use {#put_vapp_metadata_item_metadata} instead. def put_metadata_value(vm_id, metadata_key, metadata_value) Fog::Logger.deprecation("#{self} => ##{put_metadata_value} is deprecated, use ##{put_vapp_metadata_item_metadata} instead [light_black](#{caller.first})[/]") body=" #{metadata_value} " request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{vm_id}/metadata/#{URI.escape(metadata_key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_vapp_template.rb0000644000004100000410000000147612600047642027162 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete a vApp template. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppTemplate.html # @since vCloud API version 0.9 def delete_vapp_template(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vms_by_metadata.rb0000644000004100000410000000107712600047642026772 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/vms_by_metadata' # @see #get_vms_in_lease_by_query def get_vms_by_metadata(key,value) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmsByMetadata.new, :path => "vms/query?format=records&filter=metadata:#{key}==STRING:#{value}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_customization.rb0000644000004100000410000000202012600047642027232 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/vm_customization' # Retrieves the guest customization section of a VM. # # @deprecated Use {#get_guest_customization_system_section_vapp} # instead. # @todo Log deprecation warning. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vApp.html # @since vCloud API version 1.0 def get_vm_customization(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmCustomization.new, :path => "vApp/#{id}/guestCustomizationSection" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network.rb0000644000004100000410000000442412600047642025323 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/network' # Retrieve an organization network. # # @deprecated Use {#get_network_complete} instead # # @param [String] id Object identifier of the network. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Network.html # @since vCloud API version 0.9 def get_network(id) Fog::Logger.deprecation("#{self} => #get_network is deprecated, use #get_network_complete instead [light_black](#{caller.first})[/]") request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Network.new, :path => "network/#{id}" ) end end class Mock def get_network(id) Fog::Logger.deprecation("#{self} => #get_network is deprecated, use #get_network_complete instead [light_black](#{caller.first})[/]") unless network = data[:networks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = {:name=>network[:name], :href=>make_href("network/#{id}"), :type=>"application/vnd.vmware.vcloud.orgNetwork+xml", :id=>id, :description=>nil, :is_inherited=>network[:IsInherited], :gateway=>network[:Gateway], :netmask=>network[:Netmask], :dns1=>network[:Dns1], :dns2=>network[:Dns2], :dns_suffix=>network[:DnsSuffix]} body[:ip_ranges] = network[:IpRanges].map do |ip_range| {:start_address=>ip_range[:StartAddress], :end_address=>ip_range[:EndAddress]} end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_capture_vapp.rb0000644000004100000410000000560112600047642026527 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a vApp template from a vApp. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp template. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] name Name of the vApp template. # @param [String] source_id Object identifier of the vApp to capture. # @param [Hash] options # @option options [String] :Description Optional description. # @option options [Hash] :LeaseSettingsSection # * :StorageLeaseInSeconds<~Integer> - Storage lease in seconds. # @option options [Hash] :CustomizationSection # * :goldMaster<~Boolean> - True if this template is a gold master. # * :CustomizeOnInstantiate<~Boolean> - True if instantiating this # template applies customization settings. Otherwise, instantiation # creates an identical copy. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CaptureVApp.html # @since vCloud API version 0.9 def post_capture_vapp(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1', :name => name } CaptureVAppParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}vApp/#{source_id}") if section = options[:LeaseSettingsSection] LeaseSettingsSection { self['ovf'].Info 'Lease settings section' if section.key?(:StorageLeaseInSeconds) StorageLeaseInSeconds section[:StorageLeaseInSeconds] end } end if section = options[:CustomizationSection] attrs = {} attrs[:goldMaster] = section[:goldMaster] if section.key?(:goldMaster) CustomizationSection(attrs) { self['ovf'].Info 'VApp template customization section' CustomizeOnInstantiate section[:CustomizeOnInstantiate] } end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.captureVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/captureVApp" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_deploy_vapp.rb0000644000004100000410000000411712600047642026361 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Deploy a vApp or VM. # # Deployment allocates all resources for the vApp and the virtual # machines it contains. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp. # @param [Hash] options # @option options [Integer] :deploymentLeaseSeconds Lease in seconds # for deployment. A value of 0 is replaced by the organization # default deploymentLeaseSeconds value. # @option options [Boolean] :forceCustomization Used to specify whether # to force customization on deployment, if not set default value is # false. # @option options [Boolean] :powerOn Used to specify whether to power # on vApp on deployment, if not set default value is true. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DeployVApp.html # @since vCloud API version 0.9 def post_deploy_vapp(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } attrs[:deploymentLeaseSeconds] = options[:deploymentLeaseSeconds] if options.key?(:deploymentLeaseSeconds) attrs[:forceCustomization] = options[:forceCustomization] if options.key?(:forceCustomization) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) DeployVAppParams(attrs) end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.deployVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/deploy" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_power_off_vapp.rb0000644000004100000410000000225212600047642027051 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :post_vm_poweroff, :post_power_off_vapp # Power off a vApp or VM. # # If used on a vApp, powers off all VMs in the vApp. If used on a VM, # powers off the VM. This operation is available only for a vApp or VM # that is powered on. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOffVApp.html # @since vCloud API version 0.9 def post_power_off_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/powerOff" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_templates_from_query.rb0000644000004100000410000001124112600047642031121 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of vAppTemplates using REST API general # QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :VAppTemplateRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplatesFromQuery.html # @since vCloud API version 1.5 def get_vapp_templates_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vAppTemplates/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VAppTemplateReference : :VAppTemplateRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_network.rb0000644000004100000410000001401012600047642025344 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/generators/compute/org_vdc_network' # Update an Org vDC network. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # Produce media type(s): # application/vnd.vmware.vcloud.orgVdcNetwork+xml # Output type: # TaskType # # @param [String] id Object identifier of the network # @param [String] name The name of the entity. # @param [Hash] options # @option options [String] :Description Optional description. # @option options [Hash] :Configuration Network configuration. # @option options [Hash] :EdgeGateway EdgeGateway that connects this # Org vDC network. Applicable only for routed networks. # @option options [Hash] :ServiceConfig Specifies the service # configuration for an isolated Org vDC networks. # @option options [Boolean] :IsShared True if this network is shared # to multiple Org vDCs. # * :Configuration<~Hash>: NetworkConfigurationType # * :IpScopes<~Hash>: # * :IpScope<~Hash>: # * :IsInherited<~Boolean>: ? # * :Gateway<~String>: IP address of gw # * :Netmask<~String>: Subnet mask of network # * :Dns1<~String>: Primary DNS server. # * :Dns2<~String>: Secondary DNS server. # * :DnsSuffix<~String>: DNS suffix. # * :IsEnabled<~String>: Indicates if subnet is enabled or not. # Default value is True. # * :IpRanges<~Array>: IP ranges used for static pool allocation # in the network. Array of Hashes of: # * :StartAddress - start IP in range # * :EndAddress - end IP in range # * :EdgeGateway<~Hash>: EdgeGateway that connects this Org vDC # network. Applicable only for routed networks. # * :ServiceConfig<~Hash>: Specifies the service configuration for an # isolated network # # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateOrgVdcNetwork.html # @since vCloud API version 5.1 def put_network(id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::OrgVdcNetwork.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.orgVdcNetwork+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) end end class Mock def put_network(id, name, options={}) original_network = data[:networks][id] unless original_network raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\"." ) end type = 'network' # Description # Configuration # IpScopes # IpScope # IsInherited # Gateway # Netmask # Dns1 # Dns2 # DnsSuffix # IsEnabled # IpRanges # IpRange # StartAddress # EndAddress # FenceMode # EdgeGateway # IsShared # vdc_id = original_network[:vdc], network_body = { :name => name, :vdc => vdc_id, } [:Description, :IsShared].each do |key| network_body[key] = options[key] if options.key?(key) end if options.key?(:EdgeGateway) network_body[:EdgeGateway] = options[:EdgeGateway][:href].split('/').last end if configuration = options[:Configuration] if ip_scopes = configuration[:IpScopes] if ip_scope = ip_scopes[:IpScope] [:IsInherited, :Gateway, :Netmask, :Dns1, :Dns2, :DnsSuffix, :IsEnabled].each do |key| network_body[key] = ip_scope[key] if ip_scope.key?(key) end if ip_ranges = ip_scope[:IpRanges] network_body[:IpRanges] = [] ip_ranges.each do |ipr| network_body[:IpRanges] << { :StartAddress => ipr[:IpRange][:StartAddress], :EndAddress => ipr[:IpRange][:EndAddress] } end end end end network_body[:FenceMode] = configuration[:FenceMode] if ip_scope.key?(:FenceMode) end owner = { :href => make_href("#{type}/#{id}"), :type => "application/vnd.vmware.vcloud.#{type}+xml" } task_id = enqueue_task( "Updating #{type} #{name} (#{id})", 'networkUpdateNetwork', owner, :on_success => lambda do data[:networks][id] = network_body end ) task = task_body(task_id) task.delete(:Owner) #known-bug: admin-api does not return owner. body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_customization_system_section.rbfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_customization_system_section.r0000644000004100000410000000150312600047642034444 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves the customization section of a vApp template. # # @param [String] id Object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateCustomizationSystemSection.html # @since vCloud API version 1.0 def get_vapp_template_customization_system_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/customizationSection" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_users_from_query.rb0000644000004100000410000001124112600047642027236 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of users for organization the org admin belongs to # by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :UserRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-UsersFromQuery-query.html # @since vCloud API version 1.5 def get_users_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/users/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :UserReference : :UserRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_upgrade_hw_version.rb0000644000004100000410000000167212600047642027734 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Upgrade the virtual hardware version of a VM to the highest supported # virtual hardware version of the vDC that contains it. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpgradeHwVersion.html # @since vCloud API version 5.1 def post_upgrade_hw_version(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/upgradeHardwareVersion" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vcloud.rb0000644000004100000410000000606212600047642025126 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve an administrative view of a cloud. # # The VCloud element provides access to cloud-wide namespace of objects # that an administrator can view and, in most cases, modify. # # @return [Excon:Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - The name of the entity. # * :Description<~String> - Optional description. # * :OrganizationReferences: # * :OrganizationReference<~Array>: # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :ProviderVdcReferences<~Hash>: # * :ProviderVdcReferences<~Array>: # * :RightReferences<~Hash>: # * :RightReferences<~Array>: # * :RoleReferences<~Hash>: # * :RoleReferences<~Array>: # * :Networks<~Hash>: # * :Network<~Array>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Vcloud.html # @since vCloud API version 0.9 def get_vcloud response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/' ) ensure_list! response.body, :OrganizationReferences, :OrganizationReference ensure_list! response.body, :ProviderVdcReferences, :ProviderVdcReference ensure_list! response.body, :RightReferences, :RightReference ensure_list! response.body, :RoleReferences, :RoleReference ensure_list! response.body, :Networks, :Network response end end class Mock def get_vcloud body = {:href=>make_href('admin/'), :type=>"application/vnd.vmware.admin.vcloud+xml", :name=>'VMware vCloud Director', :Description=>'5.1.2.1377223 Tue Oct 15 20:56:05 GMT 2013', :Tasks=>{:Task=>[]}, :OrganizationReferences=> {:OrganizationReference=> [{:type=>"application/vnd.vmware.admin.organization+xml", :name=>data[:org][:name], :href=>make_href("api/admin/org/#{data[:org][:uuid]}")}]}, :ProviderVdcReferences=>{:ProviderVdcReference=>[]}, :RightReferences=>{:RightReference=>[]}, :RoleReferences=>{:RoleReference=>[]}, :Networks=>{:Network=>[]}} Excon::Response.new( :body => body, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_update_vapp_metadata.rb0000644000004100000410000000355312600047642030212 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Merge the metadata provided in the request with existing metadata. # # @param [String] id Object identifier of the vApp or VM. # @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateVAppMetadata.html # @since vCloud API version 1.5 def post_update_vapp_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb0000644000004100000410000000361512600047642026317 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Attach a disk to a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [String] disk_id Object identifier of the disk. # @param [Hash] options # @option options [Integer] :BusNumber Bus number on which to place the # disk controller. If empty or missing, the system assigns a bus # number and a unit number on that bus. # @option options [Integer] :BusNumber Unit number (slot) on the bus # specified by :BusNumber. Ignored if :BusNumber is empty or missing. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AttachDisk.html # @since vCloud API version 5.1 def post_attach_disk(id, disk_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } DiskAttachOrDetachParams(attrs) { Disk(:href => "#{end_point}disk/#{disk_id}") if options.key?(:BusNumber) BusNumber options[:BusNumber] end if options.key?(:UnitNumber) BusNumber options[:UnitNumber] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/disk/action/attach" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_startup_section.rb0000644000004100000410000000355412600047642027063 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the startup section of a vApp. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-StartupSection.html # @since vCloud API version 0.9 def get_startup_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/startupSection" ) end end class Mock def get_startup_section(id) type = 'application/vnd.vmware.vcloud.startupSection+xml' unless vapp = data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vapp_ovf_startup_section_body(id, vapp) ) end def get_vapp_ovf_startup_section_body(id, vapp) { :xmlns_ns12 => "http://www.vmware.com/vcloud/v1.5", :ns12_href => make_href("vApp/#{id}"), :ns12_type => "application/vnd.vmware.vcloud.startupSection+xml", :"ovf:Info" => "VApp startup section", :"ovf:Item" => { :ovf_stopDelay => "0", :ovf_stopAction => "powerOff", :ovf_startDelay => "0", :ovf_startAction => "powerOn", :ovf_order => "0", :ovf_id => vapp[:name], }, } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb0000644000004100000410000000155712600047642032045 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from network metadata. # # @param [String] id Object identifier of the network. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkMetadataItem-metadata.html # @since vCloud API version 1.5 def get_network_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_config_section_vapp_template.rb0000644000004100000410000000147512600047642033320 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network config section of a vApp template. # # @param [String] id The object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConfigSection-vAppTemplate.html # @since vCloud API version 0.9 def get_network_config_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkConfigSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disk_metadata.rb0000644000004100000410000000134312600047642026421 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the disk. # # @param [String] id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskMetadata.html # @since vCloud API version 5.1 def get_disk_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb0000644000004100000410000000154612600047642031320 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from vApp or VM metadata. # # @param [String] id Object identifier of the vApp or VM. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadataItem-metadata.html # @since vCloud API version 1.5 def get_vapp_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_cards_items_list.rb0000644000004100000410000000437412600047642030737 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all RASD items that specify network card properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkCardsItemsList.html # @since vCloud API version 0.9 def get_network_cards_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/networkCards" ) end end class Mock def get_network_cards_items_list(id) type = 'application/vnd.vmware.vcloud.rasdItemsList+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :type => type, :href => make_href("vApp/#{id}/virtualHardwareSection/networkCards"), :Link => { :rel=>"edit", :type=>"application/vnd.vmware.vcloud.rasdItemsList+xml", :href=>make_href("vApp/#{id}/virtualHardwareSection/networkCards"), }, :Item => get_network_cards_rasd_items_list_body(id, vm) } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => body ) end def get_network_cards_rasd_items_list_body(id, vm) [{ :"rasd:Address" => vm[:nics][0][:mac_address], :"rasd:AddressOnParent" => "0", :"rasd:AutomaticAllocation" => "true", :"rasd:Connection" => vm[:nics][0][:network_name], :"rasd:Description" => "E1000 ethernet adapter", :"rasd:ElementName" => "Network adapter 0", :"rasd:InstanceID" => "1", :"rasd:ResourceSubType" => "E1000", :"rasd:ResourceType" => "10" }] end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_pending_question.rb0000644000004100000410000000226412600047642027707 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a question being asked by a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :Question<~String> - Question text. # * :QuestionId<~String> - Question ID of this question. # * Choices<~Array>: # * Id<~String> - Choice ID of the answer. # * Text<~String> - Answer text. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmPendingQuestion.html # @since vCloud API version 0.9 def get_vm_pending_question(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/question" ) ensure_list! response.body, :Choices response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdcs_from_query.rb0000644000004100000410000001113612600047642027037 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of vdcs in the organization. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :OrgVdcRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-RightsFromQuery-query.html # @since vCloud API version 1.5 def get_vdcs_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/vdcs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :OrgVdcReference : :OrgVdcRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_disk.rb0000644000004100000410000000333712600047642025251 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete a disk. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Disk.html # @since vCloud API version 5.1 def delete_disk(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}" ) end end class Mock def delete_disk(id) unless data[:disks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.disk:#{id})\"" ) end owner = { :href => make_href("disk/#{id}"), :type => 'application/vnd.vmware.vcloud.disk+xml' } task_id = enqueue_task( "Deleting Disk(#{id})", 'vdcDeleteDisk', owner, :on_success => lambda do data[:disks].delete(id) end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_enable_nested_hv.rb0000644000004100000410000000155112600047642027323 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Expose hardware-assisted CPU virtualization to guest OS. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnableNestedHv.html # @since vCloud API version 5.1 def post_enable_nested_hv(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/enableNestedHypervisor" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_capabilities.rb0000644000004100000410000000364612600047642026772 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Gets capabilities for the VM identified by id. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :MemoryHotAddEnabled<~String> - True if the virtual machine # supports addition of memory while powered on. # * :CpuHotAddEnabled<~String> - True if the virtual machine # supports addition of virtual CPUs while powered on. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmCapabilities.html def get_vm_capabilities(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/vmCapabilities" ) end end class Mock def get_vm_capabilities(id) type = 'application/vnd.vmware.vcloud.vmCapabilitiesSection+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vm_capabilities_section_body(id, vm) ) end def get_vm_capabilities_section_body(id, vm) { :type => "application/vnd.vmware.vcloud.vmCapabilitiesSection+xml", :href => make_href("vApp/#{id}/vmCapabilities/"), :MemoryHotAddEnabled => "false", :CpuHotAddEnabled => "false", } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalogs_from_query.rb0000644000004100000410000001116612600047642027700 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of Catalogs by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :CatalogRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogsFromQuery.html # @since vCloud API version 1.5 def get_catalogs_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'catalogs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :CatalogReference : :CatalogRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_login_session.rb0000644000004100000410000000302112600047642026703 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Log in and create a Session object. # # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :org<~String> - The name of the user's organization. # * :user<~String> - The name of the user that owns the session # * :Link<~Array]: # * :href<~String> - Contains the URI to the linked entity. # * :name<~String> - Contains the name of the linked entity. # * :type<~String> - Contains the type of the linked entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-Login-sessions.html # @since vCloud API version 1.5 def post_login_session headers = { 'Accept' => "application/*+xml;version=#{@api_version}", 'Authorization' => "Basic #{Base64.encode64("#{@vcloud_director_username}:#{@vcloud_director_password}").delete("\r\n")}" } @connection.request( :expects => 200, :headers => headers, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "#{@path}/sessions" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_supported_versions.rb0000644000004100000410000021240412600047642027606 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # List all supported versions. # # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-SupportedVersions.html # @since vCloud API version 0.9 def get_supported_versions @connection.request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "#{@path}/versions" ) end end class Mock def get_supported_versions body = {:xmlns=>"http://www.vmware.com/vcloud/versions", :xmlns_xsi=>xmlns_xsi, :xsi_schemaLocation=>xsi_schema_location, :VersionInfo=> [{:Version=>"1.5", :LoginUrl=>make_href("sessions"), :MediaTypeMapping=> [{:MediaType=> "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", :ComplexTypeName=>"InstantiateVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwProviderVdcReferences+xml", :ComplexTypeName=>"VMWProviderVdcReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.customizationSection+xml", :ComplexTypeName=>"CustomizationSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.prepareHostParams+xml", :ComplexTypeName=>"PrepareHostParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.relocateVmParams+xml", :ComplexTypeName=>"RelocateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.org+xml", :ComplexTypeName=>"OrgType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vmwExternalNetworkReferences+xml", :ComplexTypeName=>"VMWExternalNetworkReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.networkConnectionSection+xml", :ComplexTypeName=>"NetworkConnectionSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.host+xml", :ComplexTypeName=>"HostType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.catalogItem+xml", :ComplexTypeName=>"CatalogItemType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.owner+xml", :ComplexTypeName=>"OwnerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vdc+xml", :ComplexTypeName=>"VdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vdc+xml", :ComplexTypeName=>"AdminVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.catalog+xml", :ComplexTypeName=>"AdminCatalogType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.recomposeVAppParams+xml", :ComplexTypeName=>"RecomposeVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml", :ComplexTypeName=>"ImportVmIntoExistingVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.taskExtensionRequestUpdateProgressOperationParams+xml", :ComplexTypeName=>"TaskExtensionRequestUpdateProgressParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.catalog+xml", :ComplexTypeName=>"CatalogType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", :ComplexTypeName=>"CloneVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.providervdc+xml", :ComplexTypeName=>"ProviderVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmsObjectRefsList+xml", :ComplexTypeName=>"VmObjectRefsListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.undeployVAppParams+xml", :ComplexTypeName=>"UndeployVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vdcReferences+xml", :ComplexTypeName=>"VdcReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.systemPasswordPolicySettings+xml", :ComplexTypeName=>"SystemPasswordPolicySettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vApp+xml", :ComplexTypeName=>"VAppType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.taskExtensionRequest+xml", :ComplexTypeName=>"TaskExtensionRequestType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vimServerNetworks+xml", :ComplexTypeName=>"VimObjectRefListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml", :ComplexTypeName=>"VMWProviderVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.orgSettings+xml", :ComplexTypeName=>"OrgSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.captureVAppParams+xml", :ComplexTypeName=>"CaptureVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.screenTicket+xml", :ComplexTypeName=>"ScreenTicketType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.runtimeInfoSection+xml", :ComplexTypeName=>"RuntimeInfoSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.tasksList+xml", :ComplexTypeName=>"TasksListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.amqpSettingsTest+xml", :ComplexTypeName=>"AmqpSettingsTestType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.extensionSettings+xml", :ComplexTypeName=>"TaskExtensionSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml", :ComplexTypeName=>"ImportVmAsVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationGeneralSettings+xml", :ComplexTypeName=>"OrgGeneralSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.registerVimServerParams+xml", :ComplexTypeName=>"RegisterVimServerParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.network+xml", :ComplexTypeName=>"OrgNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml", :ComplexTypeName=>"UploadVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.datastore+xml", :ComplexTypeName=>"DatastoreType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.metadata+xml", :ComplexTypeName=>"MetadataType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.licensingReportList+xml", :ComplexTypeName=>"LicensingReportListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPool+xml", :ComplexTypeName=>"VMWNetworkPoolType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.systemSettings+xml", :ComplexTypeName=>"SystemSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwHostReferences+xml", :ComplexTypeName=>"VMWHostReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.taskExtensionRequestOperationParams+xml", :ComplexTypeName=>"TaskExtensionRequestOperationParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.metadata.value+xml", :ComplexTypeName=>"MetadataValueType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.taskOperationList+xml", :ComplexTypeName=>"TaskOperationListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.media+xml", :ComplexTypeName=>"MediaType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.productSections+xml", :ComplexTypeName=>"ProductSectionListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.amqpSettings+xml", :ComplexTypeName=>"AmqpSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vAppTemplate+xml", :ComplexTypeName=>"VAppTemplateType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.deployVAppParams+xml", :ComplexTypeName=>"DeployVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.importVmIntoExistingVAppTemplateParams+xml", :ComplexTypeName=>"ImportVmIntoExistingVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.resourcePoolList+xml", :ComplexTypeName=>"ResourcePoolListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.networkConfigSection+xml", :ComplexTypeName=>"NetworkConfigSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml", :ComplexTypeName=>"OrganizationResourcePoolSetType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationPasswordPolicySettings+xml", :ComplexTypeName=>"OrgPasswordPolicySettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.publishCatalogParams+xml", :ComplexTypeName=>"PublishCatalogParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwExtension+xml", :ComplexTypeName=>"VMWExtensionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml", :ComplexTypeName=>"MediaInsertOrEjectParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vmPendingQuestion+xml", :ComplexTypeName=>"VmPendingQuestionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.notificationsSettings+xml", :ComplexTypeName=>"NotificationsSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.ldapUserSettings+xml", :ComplexTypeName=>"LdapUserAttributesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.right+xml", :ComplexTypeName=>"RightType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.ldapSettings+xml", :ComplexTypeName=>"LdapSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.organization+xml", :ComplexTypeName=>"AdminOrgType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.orgList+xml", :ComplexTypeName=>"OrgListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml", :ComplexTypeName=>"OrgVAppTemplateLeaseSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwVimServerReferences+xml", :ComplexTypeName=>"VMWVimServerReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml", :ComplexTypeName=>"VMWExternalNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.entity+xml", :ComplexTypeName=>"EntityType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneMediaParams+xml", :ComplexTypeName=>"CloneMediaParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.licensingReport+xml", :ComplexTypeName=>"LicensingReportType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.importMediaParams+xml", :ComplexTypeName=>"ImportMediaParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml", :ComplexTypeName=>"UpdateResourcePoolSetParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.taskExtensionRequestList+xml", :ComplexTypeName=>"ReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vmPendingAnswer+xml", :ComplexTypeName=>"VmQuestionAnswerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.rasdItemsList+xml", :ComplexTypeName=>"RasdItemsListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.generalSettings+xml", :ComplexTypeName=>"GeneralSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPoolReferences+xml", :ComplexTypeName=>"VMWNetworkPoolReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.group+xml", :ComplexTypeName=>"GroupType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.controlAccess+xml", :ComplexTypeName=>"ControlAccessParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.ldapGroupSettings+xml", :ComplexTypeName=>"LdapGroupAttributesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.user+xml", :ComplexTypeName=>"UserType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vcloud+xml", :ComplexTypeName=>"VCloudType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.uberAdminSettings+xml", :ComplexTypeName=>"UberAdminSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwvirtualcenter+xml", :ComplexTypeName=>"VimServerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.leaseSettingsSection+xml", :ComplexTypeName=>"LeaseSettingsSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.composeVAppParams+xml", :ComplexTypeName=>"ComposeVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationEmailSettings+xml", :ComplexTypeName=>"OrgEmailSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vm+xml", :ComplexTypeName=>"VmType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vmwProviderVdcResourcePoolSet+xml", :ComplexTypeName=>"VMWProviderVdcResourcePoolSetType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppParams+xml", :ComplexTypeName=>"CloneVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.guestCustomizationSection+xml", :ComplexTypeName=>"GuestCustomizationSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.task+xml", :ComplexTypeName=>"TaskType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.session+xml", :ComplexTypeName=>"SessionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vAppLeaseSettings+xml", :ComplexTypeName=>"OrgLeaseSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.importVmAsVAppParams+xml", :ComplexTypeName=>"ImportVmAsVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.role+xml", :ComplexTypeName=>"RoleType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.rasdItem+xml", :ComplexTypeName=>"RASD_Type", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.startupSection+xml", :ComplexTypeName=>"StartupSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml", :ComplexTypeName=>"VirtualHardwareSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.operatingSystemSection+xml", :ComplexTypeName=>"OperatingSystemSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.networkSection+xml", :ComplexTypeName=>"NetworkSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vAppNetwork+xml", :ComplexTypeName=>"VAppNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.network+xml", :ComplexTypeName=>"NetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.orgNetwork+xml", :ComplexTypeName=>"OrgNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml", :ComplexTypeName=>"VMWExternalNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}]}, {:Version=>"5.1", :LoginUrl=>make_href("sessions"), :MediaTypeMapping=> [{:MediaType=> "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", :ComplexTypeName=>"InstantiateVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml", :ComplexTypeName=>"MergeParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationFederationSettings+xml", :ComplexTypeName=>"OrgFederationSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.emailSettings+xml", :ComplexTypeName=>"EmailSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.prepareHostParams+xml", :ComplexTypeName=>"PrepareHostParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.org+xml", :ComplexTypeName=>"OrgType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.aclRule+xml", :ComplexTypeName=>"AclRuleType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.organizationLdapSettings+xml", :ComplexTypeName=>"OrgLdapSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.networkConnectionSection+xml", :ComplexTypeName=>"NetworkConnectionSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.owner+xml", :ComplexTypeName=>"OwnerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vdc+xml", :ComplexTypeName=>"AdminVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml", :ComplexTypeName=>"ImportVmIntoExistingVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.catalog+xml", :ComplexTypeName=>"CatalogType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", :ComplexTypeName=>"CloneVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.createVdcParams+xml", :ComplexTypeName=>"CreateVdcParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmsObjectRefsList+xml", :ComplexTypeName=>"VmObjectRefsListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.undeployVAppParams+xml", :ComplexTypeName=>"UndeployVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.createSnapshotParams+xml", :ComplexTypeName=>"CreateSnapshotParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.blockingTask+xml", :ComplexTypeName=>"BlockingTaskType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwPvdcStorageProfile+xml", :ComplexTypeName=>"VMWProviderVdcStorageProfileType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.allocatedNetworkAddress+xml", :ComplexTypeName=>"AllocatedIpAddressesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vimServerNetworks+xml", :ComplexTypeName=>"VimObjectRefListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.blockingTaskOperationParams+xml", :ComplexTypeName=>"BlockingTaskOperationParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.updateProviderVdcStorageProfiles+xml", :ComplexTypeName=>"UpdateProviderVdcStorageProfilesParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.bundleUploadSocket+xml", :ComplexTypeName=>"BundleUploadSocketType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.gateway+xml", :ComplexTypeName=>"GatewayType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.screenTicket+xml", :ComplexTypeName=>"ScreenTicketType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.resourceClassAction+xml", :ComplexTypeName=>"ResourceClassActionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.event+xml", :ComplexTypeName=>"EventType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.tasksList+xml", :ComplexTypeName=>"TasksListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.migrateVmParams+xml", :ComplexTypeName=>"MigrateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.diskCreateParams+xml", :ComplexTypeName=>"DiskCreateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.registerVAppParams+xml", :ComplexTypeName=>"RegisterVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationGeneralSettings+xml", :ComplexTypeName=>"OrgGeneralSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.registerVimServerParams+xml", :ComplexTypeName=>"RegisterVimServerParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.datastore+xml", :ComplexTypeName=>"DatastoreType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml", :ComplexTypeName=>"DiskAttachOrDetachParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.updateRightsParams+xml", :ComplexTypeName=>"UpdateRightsParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.metadata+xml", :ComplexTypeName=>"MetadataType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vdcStorageProfile+xml", :ComplexTypeName=>"AdminVdcStorageProfileType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.systemSettings+xml", :ComplexTypeName=>"SystemSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwHostReferences+xml", :ComplexTypeName=>"VMWHostReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.userEntityRights+xml", :ComplexTypeName=>"UserEntityRightsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.metadata.value+xml", :ComplexTypeName=>"MetadataValueType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.media+xml", :ComplexTypeName=>"MediaType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.brandingSettings+xml", :ComplexTypeName=>"BrandingSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.updateVdcStorageProfiles+xml", :ComplexTypeName=>"UpdateVdcStorageProfilesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.amqpSettings+xml", :ComplexTypeName=>"AmqpSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.resourceClass+xml", :ComplexTypeName=>"ResourceClassType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.deployVAppParams+xml", :ComplexTypeName=>"DeployVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.resourcePoolList+xml", :ComplexTypeName=>"ResourcePoolListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vdcStorageProfile+xml", :ComplexTypeName=>"VdcStorageProfileType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.networkConfigSection+xml", :ComplexTypeName=>"NetworkConfigSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml", :ComplexTypeName=>"OrganizationResourcePoolSetType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.createProviderVdcParams+xml", :ComplexTypeName=>"VMWProviderVdcParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.publishCatalogParams+xml", :ComplexTypeName=>"PublishCatalogParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwExtension+xml", :ComplexTypeName=>"VMWExtensionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.notificationsSettings+xml", :ComplexTypeName=>"NotificationsSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.right+xml", :ComplexTypeName=>"RightType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml", :ComplexTypeName=>"SupportedOperatingSystemsInfoType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vm.complianceResult+xml", :ComplexTypeName=>"ComplianceResultType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.orgList+xml", :ComplexTypeName=>"OrgListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwVimServerReferences+xml", :ComplexTypeName=>"VMWVimServerReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml", :ComplexTypeName=>"VMWExternalNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.entity+xml", :ComplexTypeName=>"EntityType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneMediaParams+xml", :ComplexTypeName=>"CloneMediaParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.licensingReport+xml", :ComplexTypeName=>"LicensingReportType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.apiDefinition+xml", :ComplexTypeName=>"ApiDefinitionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vshieldmanager+xml", :ComplexTypeName=>"ShieldManagerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.blockingTaskList+xml", :ComplexTypeName=>"ReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vmPendingAnswer+xml", :ComplexTypeName=>"VmQuestionAnswerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.rasdItemsList+xml", :ComplexTypeName=>"RasdItemsListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.generalSettings+xml", :ComplexTypeName=>"GeneralSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.group+xml", :ComplexTypeName=>"GroupType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.controlAccess+xml", :ComplexTypeName=>"ControlAccessParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.user+xml", :ComplexTypeName=>"UserType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwvirtualcenter+xml", :ComplexTypeName=>"VimServerType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.strandedItem+xml", :ComplexTypeName=>"StrandedItemType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.leaseSettingsSection+xml", :ComplexTypeName=>"LeaseSettingsSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationEmailSettings+xml", :ComplexTypeName=>"OrgEmailSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppParams+xml", :ComplexTypeName=>"CloneVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.task+xml", :ComplexTypeName=>"TaskType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vAppLeaseSettings+xml", :ComplexTypeName=>"OrgLeaseSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.role+xml", :ComplexTypeName=>"RoleType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwProviderVdcReferences+xml", :ComplexTypeName=>"VMWProviderVdcReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.customizationSection+xml", :ComplexTypeName=>"CustomizationSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.service+xml", :ComplexTypeName=>"ServiceType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.relocateVmParams+xml", :ComplexTypeName=>"RelocateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.rights+xml", :ComplexTypeName=>"RightRefsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vmwExternalNetworkReferences+xml", :ComplexTypeName=>"VMWExternalNetworkReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.disk+xml", :ComplexTypeName=>"DiskType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.kerberosSettings+xml", :ComplexTypeName=>"KerberosSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.operationLimitsSettings+xml", :ComplexTypeName=>"OrgOperationLimitsSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.host+xml", :ComplexTypeName=>"HostType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.catalogItem+xml", :ComplexTypeName=>"CatalogItemType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.entityReferences+xml", :ComplexTypeName=>"EntityReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vdc+xml", :ComplexTypeName=>"VdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.catalog+xml", :ComplexTypeName=>"AdminCatalogType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.recomposeVAppParams+xml", :ComplexTypeName=>"RecomposeVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.orgVdcNetwork+xml", :ComplexTypeName=>"OrgVdcNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.providervdc+xml", :ComplexTypeName=>"ProviderVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.blockingTaskUpdateProgressOperationParams+xml", :ComplexTypeName=>"BlockingTaskUpdateProgressParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vdcReferences+xml", :ComplexTypeName=>"VdcReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.systemPasswordPolicySettings+xml", :ComplexTypeName=>"SystemPasswordPolicySettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vApp+xml", :ComplexTypeName=>"VAppType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml", :ComplexTypeName=>"VMWProviderVdcType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vms+xml", :ComplexTypeName=>"VmsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.orgSettings+xml", :ComplexTypeName=>"OrgSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.apiFilter+xml", :ComplexTypeName=>"ApiFilterType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.captureVAppParams+xml", :ComplexTypeName=>"CaptureVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vmCapabilitiesSection+xml", :ComplexTypeName=>"VmCapabilitiesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.runtimeInfoSection+xml", :ComplexTypeName=>"RuntimeInfoSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.amqpSettingsTest+xml", :ComplexTypeName=>"AmqpSettingsTestType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml", :ComplexTypeName=>"ImportVmAsVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.guestPersonalizationSettings+xml", :ComplexTypeName=>"OrgGuestPersonalizationSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.orgNetwork+xml", :ComplexTypeName=>"OrgNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.fileDescriptor+xml", :ComplexTypeName=>"FileDescriptorType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml", :ComplexTypeName=>"UploadVAppTemplateParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.licensingReportList+xml", :ComplexTypeName=>"LicensingReportListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPool+xml", :ComplexTypeName=>"VMWNetworkPoolType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.taskOperationList+xml", :ComplexTypeName=>"TaskOperationListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vSphereWebClientUrl+xml", :ComplexTypeName=>"VSphereWebClientUrlType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.productSections+xml", :ComplexTypeName=>"ProductSectionListType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.blockingTaskSettings+xml", :ComplexTypeName=>"BlockingTaskSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vAppTemplate+xml", :ComplexTypeName=>"VAppTemplateType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.organizationPasswordPolicySettings+xml", :ComplexTypeName=>"OrgPasswordPolicySettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml", :ComplexTypeName=>"MediaInsertOrEjectParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vmPendingQuestion+xml", :ComplexTypeName=>"VmPendingQuestionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.organization+xml", :ComplexTypeName=>"AdminOrgType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.ldapSettings+xml", :ComplexTypeName=>"LdapSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.snapshotSection+xml", :ComplexTypeName=>"SnapshotSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml", :ComplexTypeName=>"OrgVAppTemplateLeaseSettingsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.importMediaParams+xml", :ComplexTypeName=>"ImportMediaParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=> "application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml", :ComplexTypeName=>"UpdateResourcePoolSetParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.licenseSettings+xml", :ComplexTypeName=>"LicenseType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.bundleUploadParams+xml", :ComplexTypeName=>"BundleUploadParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPoolReferences+xml", :ComplexTypeName=>"VMWNetworkPoolReferencesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vcloud+xml", :ComplexTypeName=>"VCloudType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.serviceResource+xml", :ComplexTypeName=>"ServiceResourceType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.composeVAppParams+xml", :ComplexTypeName=>"ComposeVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.admin.vmwProviderVdcResourcePool+xml", :ComplexTypeName=>"VMWProviderVdcResourcePoolSetType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vm+xml", :ComplexTypeName=>"VmType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=> "application/vnd.vmware.vcloud.guestCustomizationSection+xml", :ComplexTypeName=>"GuestCustomizationSectionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.session+xml", :ComplexTypeName=>"SessionType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.pvdcStorageProfile+xml", :ComplexTypeName=>"ProviderVdcStorageProfileType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwStorageProfiles+xml", :ComplexTypeName=>"VMWStorageProfilesType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.importVmAsVAppParams+xml", :ComplexTypeName=>"ImportVmAsVAppParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.admin.serviceLink+xml", :ComplexTypeName=>"ServiceLinkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.enableDownloadParams+xml", :ComplexTypeName=>"EnableDownloadParamsType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.rasdItem+xml", :ComplexTypeName=>"RASD_Type", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.startupSection+xml", :ComplexTypeName=>"StartupSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml", :ComplexTypeName=>"VirtualHardwareSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.operatingSystemSection+xml", :ComplexTypeName=>"OperatingSystemSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.networkSection+xml", :ComplexTypeName=>"NetworkSection_Type", :SchemaLocation=> "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.vAppNetwork+xml", :ComplexTypeName=>"VAppNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.network+xml", :ComplexTypeName=>"NetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.vcloud.orgNetwork+xml", :ComplexTypeName=>"OrgNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/master.xsd"}, {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml", :ComplexTypeName=>"VMWExternalNetworkType", :SchemaLocation=> "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}]}]} Excon::Response.new( :body => body, :headers => {'Content-Type' => 'text/xml'}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_cancel_task.rb0000644000004100000410000000231212600047642026301 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :post_task_cancel, :post_cancel_task # Cancel a task. # # @param [String] id Object identifier of the task. # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CancelTask.html # @since vCloud API version 1.5 def post_cancel_task(id) request( :expects => 204, :method => 'POST', :path => "task/#{id}/action/cancel" ) end end class Mock def post_cancel_task(id) unless task = data[:tasks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "com.vmware.vcloud.entity.task:%s"' % id ) end # @note Tasks don't actually get cancelled (confirmed VCloud Director # bug) so we'll emulate that. Set the flag and we're done! task[:cancel_requested] = true Excon::Response.new( :status => 204 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_disks.rb0000644000004100000410000000247212600047642025001 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :put_vm_disks, :put_disks require 'fog/vcloud_director/generators/compute/disks' # Update all RASD items that specify hard disk and hard disk controller # properties of a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [Array] disks # * disks is the body of #get_vm_disks # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Disks.html # @since vCloud API version 0.9 def put_disks(id, disks=[]) data = Fog::Generators::Compute::VcloudDirector::Disks.new(disks) request( :body => data.generate_xml, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItemsList+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc.rb0000644000004100000410000001537212600047642024412 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a vDC. # # @param [String] id Object identifier of the vDC. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Vdc.html # @since vCloud API version 0.9 def get_vdc(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}" ) ensure_list! response.body, :ResourceEntities, :ResourceEntity ensure_list! response.body, :AvailableNetworks, :Network ensure_list! response.body, :VdcStorageProfiles, :VdcStorageProfile response end end class Mock def get_vdc(vdc_id) response = Excon::Response.new unless vdc = data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"com.vmware.vcloud.entity.vdc:#{vdc_id}\"." ) end body = {:xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :status=>"1", :name=>vdc[:name], :id=>"urn:vcloud:vdc:#{vdc_id}", :type=>"application/vnd.vmware.vcloud.vdc+xml", :href=>make_href("vdc/#{vdc_id}"), :xsi_schemaLocation=>xsi_schema_location, :Link=> [{:rel=>"up", :type=>"application/vnd.vmware.vcloud.org+xml", :href=>make_href("org/#{data[:org][:uuid]}")}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("vdc/#{vdc_id}/metadata")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml", :href=> make_href("vdc/#{vdc_id}/action/uploadVAppTemplate")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.media+xml", :href=>make_href("vdc/#{vdc_id}/media")}, {:rel=>"add", :type=> "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", :href=> make_href("vdc/#{vdc_id}/action/instantiateVAppTemplate")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.cloneVAppParams+xml", :href=>make_href("vdc/#{vdc_id}/action/cloneVApp")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", :href=> make_href("vdc/#{vdc_id}/action/cloneVAppTemplate")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.cloneMediaParams+xml", :href=>make_href("vdc/#{vdc_id}/action/cloneMedia")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.captureVAppParams+xml", :href=>make_href("vdc/#{vdc_id}/action/captureVApp")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.composeVAppParams+xml", :href=>make_href("vdc/#{vdc_id}/action/composeVApp")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.diskCreateParams+xml", :href=>make_href("vdc/#{vdc_id}/disk")}, {:rel=>"edgeGateways", :type=>"application/vnd.vmware.vcloud.query.records+xml", :href=>make_href("admin/vdc/#{vdc_id}/edgeGateways")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.orgVdcNetwork+xml", :href=>make_href("admin/vdc/#{vdc_id}/networks")}, {:rel=>"orgVdcNetworks", :type=>"application/vnd.vmware.vcloud.query.records+xml", :href=>make_href("admin/vdc/#{vdc_id}/networks")}], :Description=>vdc[:description]||'', :AllocationModel=>"AllocationVApp", :ComputeCapacity=> {:Cpu=> {:Units=>"MHz", :Allocated=>"0", :Limit=>"0", :Reserved=>"0", :Used=>"0", :Overhead=>"0"}, :Memory=> {:Units=>"MB", :Allocated=>"0", :Limit=>"0", :Reserved=>"0", :Used=>"0", :Overhead=>"0"}}, :ResourceEntities => { :ResourceEntity => [] }, :AvailableNetworks => {}, :Capabilities=> {:SupportedHardwareVersions=> {:SupportedHardwareVersion=>"vmx-08"}}, :NicQuota=>"0", :NetworkQuota=>"20", :UsedNetworkCount=>"0", :VmQuota=>"100", :IsEnabled=>"true"} body[:ResourceEntities][:ResourceEntity] = data[:catalog_items].map do |id, item| {:type=>"application/vnd.vmware.vcloud.#{item[:type]}+xml", :name=>item[:name], :href=>make_href("#{item[:type]}/#{item[:type]}-#{id}")} end body[:ResourceEntities][:ResourceEntity] += get_vapps_in_this_vdc(vdc_id).map do |vapp_id, vapp| {:type => "application/vnd.vmware.vcloud.vApp+xml", :name => vapp[:name], :href => make_href("vApp/#{vapp_id}")} end body[:AvailableNetworks][:Network] = data[:networks].map do |id, network| {:type=>"application/vnd.vmware.vcloud.network+xml", :name=>network[:name], :href=>make_href("network/#{id}")} end if api_version.to_f >= 5.1 body[:VdcStorageProfiles] = {} body[:VdcStorageProfiles][:VdcStorageProfile] = data[:vdc_storage_classes].select do |id, storage_class| storage_class[:vdc] == vdc_id end.map do |id, storage_class| {:type => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', :name => storage_class[:name], :href => make_href("vdcStorageProfile/#{id}")} end end response.status = 200 response.headers = {'Content-Type' => "#{body[:type]};version=#{api_version}"} response.body = body response end def get_vapps_in_this_vdc(vdc_id) data[:vapps].select do |vapp_id, vapp| vapp[:vdc_id] == vdc_id end end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_thumbnail.rb0000644000004100000410000000156012600047642025613 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a thumbnail image of a VM console. # # The content type of the response can be any of `image/png`, # `image/gif`. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~String> - the thumbnail image. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Thumbnail.html # @since vCloud API version 0.9 def get_thumbnail(id) request( :expects => 200, :headers => {'Accept' => "image/*;version=#{@api_version}"}, :idempotent => true, :method => 'GET', :path => "vApp/#{id}/screen" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_instantiate_vapp_template.rb0000644000004100000410000001762712600047642031315 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a vApp from a vApp template. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp. # # @note This may not work at all or may work only under certain # circumstances. # # @param [String] id Object identifier of the vDC. # @param [String] vapp_template_id Object identifier of the vApp # template. # @param [String] name # @param [Hash] options # @option options [Boolean] :deploy True if the vApp should be deployed # at instantiation. Defaults to true. # @option options [Boolean] :powerOn True if the vApp should be # powered-on at instantiation. Defaults to true. # @option options [String] :Description Optional description. # @option options [Hash] :InstantiationParams Instantiation parameters # for the composed vApp. # * :LeaseSettingsSection<~Hasn>: # * :DeploymentLeaseTimeInSeconds<~Integer> - Deployment lease in # seconds. # * :StorageLeaseTimeInSeconds<~Integer> - Storage lease in # seconds. # * :DeploymentLeaseExpiration<~Integer> - Expiration date/time of # deployment lease. # * :StorageLeaseExpiration<~Integer> - Expiration date/time of # storage lease. # * :NetworkConfigSection<~Hash>: # * :NetworkConfig<~Hash>: # * :networkName<~String> - The name of the vApp network. # * :Configuration<~Hash>: # * :ParentNetwork<~Hash>: # * :href<~String> - # * :FenceMode<~String> - Isolation type of the network. # @option options [Boolean] :IsSourceDelete Set to true to delete the # source object after the operation completes. # @option options [Boolean] :AllEULAsAccepted True confirms acceptance # of all EULAs in a vApp template. # @return [Excon::Response] # * body<~Hash>: # # @raise Fog::Compute::VcloudDirector::DuplicateName # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstantiateVAppTemplate.html # @since vCloud API version 0.9 def post_instantiate_vapp_template(id, vapp_template_id, name, options={}) body = Nokogiri::XML::Builder.new do attrs = { 'xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1', :name => name } attrs[:deploy] = options[:deploy] if options.key?(:deploy) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) InstantiateVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end if instantiation_params = options[:InstantiationParams] InstantiationParams { if section = instantiation_params[:LeaseSettingsSection] LeaseSettingsSection { self['ovf'].Info 'Lease settings section' if section.key?(:DeploymentLeaseInSeconds) DeploymentLeaseInSeconds section[:DeploymentLeaseInSeconds] end if section.key?(:StorageLeaseInSeconds) StorageLeaseInSeconds section[:StorageLeaseInSeconds] end if section.key?(:DeploymentLeaseExpiration) DeploymentLeaseExpiration section[:DeploymentLeaseExpiration].strftime('%Y-%m-%dT%H:%M:%S%z') end if section.key?(:StorageLeaseExpiration) StorageLeaseExpiration section[:StorageLeaseExpiration].strftime('%Y-%m-%dT%H:%M:%S%z') end } end if section = instantiation_params[:NetworkConfigSection] NetworkConfigSection { self['ovf'].Info 'Configuration parameters for logical networks' if network_configs = section[:NetworkConfig] network_configs = [network_configs] if network_configs.is_a?(Hash) network_configs.each do |network_config| NetworkConfig(:networkName => network_config[:networkName]) { if configuration = network_config[:Configuration] Configuration { ParentNetwork(configuration[:ParentNetwork]) FenceMode configuration[:FenceMode] } end } end end } end } end Source(:href => "#{end_point}vAppTemplate/#{vapp_template_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end if options.key?(:AllEULAsAccepted) AllEULAsAccepted options[:AllEULAsAccepted] end } end.to_xml begin request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/action/instantiateVAppTemplate" ) rescue Fog::Compute::VcloudDirector::BadRequest => e if e.minor_error_code == 'DUPLICATE_NAME' raise Fog::Compute::VcloudDirector::DuplicateName.new(e.message) end raise end end end class Mock def post_instantiate_vapp_template(vdc_id, vapp_template_id, name, options={}) unless data[:vdcs][vdc_id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"." ) end type = 'vApp' vapp_id = "vapp-#{uuid}" vm_id = "vm-#{uuid}" data[:vapps][vapp_id] = { :name => name, :vdc_id => vdc_id, :description => options.fetch(:description, "vApp created from #{vapp_template_id}"), :networks => [], :metadata => {:'vapp_key' => 'vapp_value'}, :status => "0", } data[:vms][vm_id] = { :name => 'vm-template-name', :parent_vapp => vapp_id, :memory_in_mb => "1024", :cpu_count => "2", :metadata => {:'vm_key' => 'vm_value'}, :nics => [ { :network_name => 'Default Network', :mac_address => "00:50:56:00:00:00", :ip_address => "192.168.0.1", } ], } owner = { :href => make_href("#{type}/#{vapp_id}"), :type => "application/vnd.vmware.vcloud.#{type}+xml" } task_id = enqueue_task( "Creating Virtual Application #{name}(#{vapp_id})", 'vdcInstantiateVapp', owner, :on_success => lambda do data[:vapps][vapp_id][:status] = "8" end ) body = get_vapp(vapp_id).body body[:Tasks] = { :Task => task_body(task_id) } Excon::Response.new( :status => 201, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_shadow_vm.rb0000644000004100000410000000124112600047642025613 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a shadow VM. # # @param [String] id The object identifier of the shadow VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ShadowVm.html def get_shadow_vm(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "shadowVm/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb0000644000004100000410000000155112600047642031760 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from catalog metadata. # # @param [String] id Object identifier of the catalog. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogMetadataItem-metadata.html # @since vCloud API version 1.5 def get_catalog_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disks_from_query.rb0000644000004100000410000001113512600047642027214 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a disk list by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :DiskRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksFromQuery.html # @since vCloud API version 1.5 def get_disks_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'disks/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :DiskReference : :DiskRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_check_vm_compliance.rb0000644000004100000410000000163512600047642030012 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Perform storage profile compliance check on a VM. # # This operation is asynchronous and return a task. When the task # completes, the compliance check on the VM has been completed and the # results can be retrieved. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CheckVmCompliance.html # @since vCloud API version 5.1 def post_check_vm_compliance(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/checkCompliance" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_owner.rb0000644000004100000410000000136712600047642027710 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the owner of a vApp template. # # @param [String] id Object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateOwner.html # @since vCloud API version 1.5 def get_vapp_template_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/owner" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_install_vmware_tools.rb0000644000004100000410000000153212600047642030304 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Install VMware Tools on a running VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstallVMwareTools.html # @since vCloud API version 1.5 def post_install_vmware_tools(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/installVMwareTools" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_media.rb0000644000004100000410000000671112600047642024712 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a media object. # # @param [String] id Object identifier of the media object. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Media.html # @since vCloud API version 0.9 def get_media(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}" ) ensure_list! response.body, :Files, :File response end end class Mock def get_media(id) unless data[:medias][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.media:#{id})\"." ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(media_body(id)) Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=>#{@api_version}"}, :body => body ) end private def media_body(id) media = data[:medias][id] body = { :size => media[:size].to_s, :imageType => media[:image_type], :status => media[:status].to_s, :name => media[:name], :id => "urn:vcloud:media:#{id}", :type => 'application/vnd.vmware.vcloud.media+xml', :href => make_href("media/#{id}"), :Link => { :href => make_href("vdc/#{media[:vdc_id]}"), :type => 'application/vnd.vmware.vcloud.vdc+xml', :rel => 'up' }, :Description => media[:description] || '', :Tasks => { # FIXME: there's only one for now :Task => media[:tasks].map {|task_id| task_body(task_id)}.first }, :Files => { :File => [] }, :Owner => { :type => 'application/vnd.vmware.vcloud.owner+xml', :User => { :href => make_href("admin/user/#{user_uuid}"), :name => user_uuid, :type => 'application/vnd.vmware.admin.user+xml', } } } if media[:status] == 0 body[:Files][:File] << { :size => media[:size].to_s, :bytesTransferred => media[:file][:bytes_transferred].to_s, :name => 'file', :Link=> { :href => make_href("transfer/#{media[:file][:uuid]}/file"), :rel => 'upload:default' } } end if api_version.to_f >= 5.1 storage_class_id = media[:vdc_storage_class] body[:VdcStorageProfile] = { :href => make_href("vdcStorageProfile/#{storage_class_id}"), :name => data[:vdc_storage_classes][storage_class_id][:name], :type => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', } end body end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_medias_from_query.rb0000644000004100000410000001114712600047642027344 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a media list by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :MediaRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediasFromQuery.html # @since vCloud API version 1.5 def get_medias_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'mediaList/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :MediaReference : :MediaRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb0000644000004100000410000000355612600047642033036 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the metadata value for the specified key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the catalog item. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-CatalogItemMetadataItem-metadata.html # @since vCloud API version 1.5 def put_catalog_item_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_upload_vapp_template.rb0000644000004100000410000000332412600047642030243 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Upload an OVF package to create a vApp template # # The response includes an upload link for the OVF descriptor. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] name The name of the vApp template. # @param [Hash] options # @option options [Boolean] :manifestRequired True if an OVF manifest # is included in the upload. Default value is false. # @option options [String] :Description Optional description. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UploadVAppTemplate.html # @since vCloud API version 0.9 def post_upload_vapp_template(vdc_id, name, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } attrs[:manifestRequired] = options[:manifestRequired] if options.key?(:manifestRequired) UploadVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/uploadVAppTemplate" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_shutdown_vapp.rb0000644000004100000410000000211612600047642026735 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Shut down a vApp or VM. # # If used on a vApp, shuts down all VMs in the vApp. If used on a VM, # shuts down the VM. This operation is available only for a vApp or VM # that is powered on. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ShutdownVApp.html # @since vCloud API version 0.9 def post_shutdown_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/shutdown" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_cpu.rb0000644000004100000410000000662212600047642024454 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :put_vm_cpu, :put_cpu # Update the RASD item that specifies CPU properties of a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [Integer] num_cpus # @return [Excon:Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Cpu.html # @since vCloud API version 0.9 def put_cpu(id, num_cpus) data = < hertz * 10^6 Number of Virtual CPUs #{num_cpus} virtual CPU(s) 4 0 3 #{num_cpus} 0 EOF request( :body => data, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/cpu" ) end end class Mock def put_cpu(id, num_cpus) unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end owner = { :href => make_href("vApp/#{id}"), :type => 'application/vnd.vmware.vcloud.vm+xml' } task_id = enqueue_task( "Updating Virtual Machine #{data[:vms][id][:name]}(#{id})", 'vappUpdateVm', owner, :on_success => lambda do data[:vms][id][:cpu_count] = num_cpus end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb0000644000004100000410000000246212600047642026455 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Eject virtual media. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [String] media_id Object identifier of the media object. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EjectCdRom.html # @since vCloud API version 0.9 def post_eject_cd_rom(id, media_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } MediaInsertOrEjectParams(attrs) { Media(:href => "#{end_point}media/#{media_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/media/action/ejectMedia" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb0000644000004100000410000001401012600047642032544 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :put_vm_customization, :put_guest_customization_section_vapp # Updates the guest customization section of a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [Hash] options # @option options [Boolean] :Enabled True if guest customization is # enabled. # @option options [Boolean] :ChangeSid True if customization can change # the Windows SID of this virtual machine. # @option options [Boolean] :JoinDomainEnabled True if this virtual # machine can join a Windows Domain. # @option options [Boolean] :UseOrgSettings True if customization # should use organization settings (OrgGuestPersonalizationSettings) # when joining a Windows Domain. # @option options [String] :DomainName The name of the Windows Domain # to join. # @option options [String] :DomainUserName User name to specify when # joining a Windows Domain. # @option options [String] :DomainUserPassword Password to use with # :DomainUserName. # @option options [String] :MachineObjectOU The name of the Windows # Domain Organizational Unit (OU) in which the computer account for # this virtual machine will be created. # @option options [Boolean] :AdminPassword_enabled True if guest # customization can modify administrator password settings for this # virtual machine. # @option options [Boolean] :AdminPassword_auto True if the # administrator password for this virtual machine should be # automatically generated. # @option options [String] :AdminPassword True if the administrator # password for this virtual machine should be set to this string. # (:AdminPasswordAuto must be false.) # @option options [Boolean] :ResetPasswordRequired True if the # administrator password for this virtual machine must be reset after # first use. # @option customization [String] :CustomizationScript Script to run on # guest customization. The entire script must appear in this element. # @option customization [String] :ComputerName Computer name to assign # to this virtual machine. # @return [Excon::Response] # * body<~Hash>: # * :Tasks<~Hash>: # * :Task<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-GuestCustomizationSection-vApp.html # @since vCloud API version 1.0 def put_guest_customization_section_vapp(id, options={}) options = options.dup # Mutate options to new format. deprecated = { :enabled => :Enabled, :change_sid => :ChangeSid, :join_domain_enabled => :JoinDomainEnabled, :use_org_settings => :UseOrgSettings, :admin_password => :AdminPassword, :admin_password_enabled => :AdminPasswordEnabled, :admin_password_auto => :AdminPasswordAuto, :reset_password_required => :ResetPasswordRequired, :customization_script => :CustomizationScript, :computer_name => :ComputerName } deprecated.each do |from, to| options[to] = options.delete(from) if options.key?(from) end body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1' } GuestCustomizationSection(attrs) { self['ovf'].Info 'Specifies Guest OS Customization Settings' if options.key?(:Enabled) Enabled options[:Enabled] end if options.key?(:ChangeSid) ChangeSid options[:ChangeSid] end if options.key?(:JoinDomainEnabled) JoinDomainEnabled options[:JoinDomainEnabled] end if options.key?(:UseOrgSettings) UseOrgSettings options[:UseOrgSettings] end if options.key?(:DomainName) DomainName options[:DomainName] end if options.key?(:DomainUser) DomainUser options[:DomainUser] end if options.key?(:DomainUserPassword) DomainUserPassword options[:DomainUserPassword] end if options.key?(:MachineObjectOU) MachineObjectOU options[:MachineObjectOU] end if options.key?(:AdminPasswordEnabled) AdminPasswordEnabled options[:AdminPasswordEnabled] end if options.key?(:AdminPasswordAuto) AdminPasswordAuto options[:AdminPasswordAuto] end if options.key?(:AdminPassword) AdminPassword options[:AdminPassword] end if options.key?(:ResetPasswordRequired) ResetPasswordRequired options[:ResetPasswordRequired] end if options.key?(:CustomizationScript) CustomizationScript options[:CustomizationScript] end if options.key?(:ComputerName) ComputerName options[:ComputerName] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.guestCustomizationSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/guestCustomizationSection" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog.rb0000644000004100000410000000235212600047642025242 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a catalog. # # @param [String] id Object identifier of the catalog. # @return [Excon::Response] # * hash<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Catalog.html # @since vCloud API version 0.9 def get_catalog(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}" ) ensure_list! response.body, :CatalogItems, :CatalogItem response end end class Mock def get_catalog(id) unless catalog = data[:catalogs][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.catalog:#{id})\"." ) end Fog::Mock.not_implemented catalog.is_used_here # avoid warning from syntax checker end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vms_disk_attached_to.rb0000644000004100000410000000220712600047642030005 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a list of all VMs attached to a disk. # # @param [String] id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmsDisksAttachedTo.html # @since vCloud API version 5.1 def get_vms_disk_attached_to(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/attachedVms" ) ensure_list! response.body, :VmReference response end end class Mock def get_vms_disk_attached_to(id) unless data[:disks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id ) end Fog::Mock.not_implemented end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata.rb0000644000004100000410000000143312600047642030330 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the vApp template or VM. # # @param [String] id Object identifier of the vApp template or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateMetadata.html # @since vCloud API version 1.5 def get_vapp_template_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_logout.rb0000644000004100000410000000066212600047642025626 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Logout.html def delete_logout request( :expects => 204, :method => 'DELETE', :path => 'session' ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_suspend_vapp.rb0000644000004100000410000000210512600047642026541 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Suspend a vApp or VM. # # If used on a vApp, suspends all VMs in the vApp. If used on a VM, # suspends the VM. This operation is available only for a vApp or VM # that is powered on. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-SuspendVApp.html # @since vCloud API version 0.9 def post_suspend_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/suspend" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_ovf_descriptor.rb0000644000004100000410000000132012600047642027700 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the OVF descriptor of a vApp directly. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~String> - the OVF descriptor. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppOvfDescriptor.html # @since vCloud API version 5.1 def get_vapp_ovf_descriptor(id) request( :expects => 200, :idempotent => true, :method => 'GET', :path => "vApp/#{id}/ovf" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_product_sections_vapp.rb0000644000004100000410000000142212600047642030242 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a list of ProductSection elements from a vApp or VM. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ProductSections-vApp.html # @since vCloud API version 1.5 def get_product_sections_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/productSections" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_undeploy_vapp.rb0000644000004100000410000000523612600047642026727 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Undeploy a vApp/VM. # # Undeployment deallocates all resources used by the vApp and the VMs # it contains. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp. # @param [Hash] options # @option options [String] :UndeployPowerAction The specified action is # applied to all virtual machines in the vApp. All values other than # default ignore actions, order, and delay specified in the # StartupSection. One of: # - powerOff (Power off the virtual machines. This is the default # action if this attribute is missing or empty) # - suspend (Suspend the virtual machines) # - shutdown (Shut down the virtual machines) # - force (Attempt to power off the virtual machines. Failures in # undeploying the virtual machine or associated networks are # ignored. All references to the vApp and its virtual machines are # removed from the database) # - default (Use the actions, order, and delay specified in the # StartupSection). # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UndeployVApp.html # @since vCloud API version 0.9 def post_undeploy_vapp(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } UndeployVAppParams(attrs) { if options[:UndeployPowerAction] UndeployPowerAction options[:UndeployPowerAction] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/undeploy" ) end # @deprecated Use {#post_undeploy_vapp} instead. def undeploy(id) Fog::Logger.deprecation("#{self} => ##{undeploy} is deprecated, use ##{post_undeploy_vapp} instead [light_black](#{caller.first})[/]") post_undeploy_vapp(id, :UndeployPowerAction => 'shutdown') end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disk.rb0000644000004100000410000001041112600047642024555 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a disk. # # @param [String] id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the disk. # * :type<~String> - The MIME type of the disk. # * :id<~String> - The disk identifier, expressed in URN format. # * :name<~String> - The name of the disk. # * :status<~String> - Creation status of the disk. # * :busSubType<~String> - Disk bus sub type. # * :busType<~String> - Disk bus type. # * :size<~String> - Size of the disk. # * :Description<~String> - Optional description. # * :Tasks<~Hash> - A list of queued, running, or recently # completed tasks associated with this disk. # * :StorageProfile<~Hash> - Storage profile of the disk. # * :Owner<~Hash> - Disk owner. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Disk.html # @since vCloud API version 5.1 def get_disk(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}" ) ensure_list! response.body, :Link ensure_list! response.body, :Tasks, :Task ensure_list! response.body, :Files, :File response end end class Mock def get_disk(id) unless data[:disks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(disk_body(id)) Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"}, :body => body ) end private def disk_body(id) disk = data[:disks][id] storage_class_id = disk[:vdc_storage_class] body = { :href => make_href("disk/#{id}"), :type => 'application/vnd.vmware.vcloud.disk+xml', :id => "urn:vcloud:disk:#{id}", :name => disk[:name], :status => disk[:status].to_s, :busSubType => disk[:bus_sub_type], :busType => disk[:bus_type], :size => disk[:size].to_s, :Link => [ { :href => make_href("vdc/#{disk[:vdc_id]}"), :rel => 'up', :type => 'application/vnd.vmware.vcloud.vdc+xml' } ], :Description => disk[:description], :Tasks => { # FIXME: there's only one for now :Task => disk[:tasks].map {|task_id| task_body(task_id)}.first }, :Files => { :File => [] }, :StorageProfile => { :href => make_href("vdcStorageProfile/#{storage_class_id}"), :name => data[:vdc_storage_classes][storage_class_id][:name], :type => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', }, :Owner => { :type => 'application/vnd.vmware.vcloud.owner+xml', :User => { :href => make_href("admin/user/#{user_uuid}"), :name => user_name, :type => 'application/vnd.vmware.admin.user+xml', } } } if api_version.to_f >= 5.1 storage_class_id = disk[:vdc_storage_class] body[:VdcStorageProfile] = { :href => make_href("vdcStorageProfile/#{storage_class_id}"), :name => data[:vdc_storage_classes][storage_class_id][:name], :type => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', } end body end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_catalog_item.rb0000644000004100000410000000114212600047642026737 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete a catalog item. # # @param [String] id Object identifier of the catalog item. # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-CatalogItem.html # @since vCloud API version 0.9 def delete_catalog_item(id) request( :expects => 204, :method => 'DELETE', :path => "catalogItem/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vms.rb0000644000004100000410000000130312600047642024430 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/vms' # Retrieve a vApp or VM. # # @note This should probably be deprecated. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see #get_vapp def get_vms(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Vms.new, :path => "vApp/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_enable_vapp_template_download.rb0000644000004100000410000000134312600047642032073 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Enable a vApp template for download. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnableVAppTemplateDownload.html # @since vCloud API version 0.9 def post_enable_vapp_template_download(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/enableDownload" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_create_catalog_item.rb0000644000004100000410000000410712600047642030011 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Add an item to a catalog. # # @param [String] id Object identifier of the catalog. # @param [String] name The name of the entity. # @param [Hash] entity A reference to a VAppTemplate or Media object. # * href<~String> - Contains the URI to the entity. # @param [Hash] options # @option options [String] :operationKey Optional unique identifier to # support idempotent semantics for create and delete operations. # @option options [String] :Description Optional description. # @return [Excon::Response] # * body<~Hash>: # # @raise Fog::Compute::VcloudDirector::DuplicateName # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateCatalogItem.html # @since vCloud API version 0.9 def post_create_catalog_item(id, name, entity, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name, } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) CatalogItem(attrs) { if options.key?(:Description) Description options[:Description] end Entity(entity) } end.to_xml begin request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.catalogItem+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/catalogItems" ) rescue Fog::Compute::VcloudDirector::BadRequest => e if e.minor_error_code == 'DUPLICATE_NAME' raise Fog::Compute::VcloudDirector::DuplicateName.new(e.message) end raise end end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_network_connection_system_section_vapp.rb0000644000004100000410000001242212600047642033746 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :put_vm_network, :put_network_connection_system_section_vapp # Update the network connection section of a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [Hash] options Container for the network connections of this # virtual machine. # @option options [Integer] :PrimaryNetworkConnectionIndex (0) # Virtual slot number associated with the NIC that should be # considered this virtual machine's primary network connection. # Defaults to slot 0. # @option options [Array] :NetworkConnection # * :needsCustomization<~Boolean> - True if this NIC needs # customization. # * :network<~String> - Name of the network to which this NIC is # connected. # * :NetworkConnectionIndex<~Integer> - Virtual slot number # associated with this NIC. First slot number is 0. # * :IpAddress<~String> - IP address assigned to this NIC. # * :IsConnected<~Boolean> - If the virtual machine is undeployed, # this value specifies whether the NIC should be connected upon # deployment. If the virtual machine is deployed, this value # reports the current status of this NIC's connection, and can be # updated to change that connection status. # * :MACAddress<~String> - MAC address associated with the NIC. # * :IpAddressAllocationMode<~String> - IP address allocation mode # for this connection. One of: # - POOL (A static IP address is allocated automatically from a # pool of addresses.) # - DHCP (The IP address is obtained from a DHCP service.) # - MANUAL (The IP address is assigned manually in the :IpAddress # element.) # - NONE (No IP addressing mode specified.) # @return [Excon::Response] # * body<~Hash>: # * :Tasks<~Hash>: # * :Task<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-NetworkConnectionSystemSection-vApp.html # @since vCloud API version 0.9 def put_network_connection_system_section_vapp(id, options={}) options = options.dup # Mutate options to new format. deprecated = { :needs_customization => :needsCustomization, :network => :network, :network_connection_index => :NetworkConnectionIndex, :ip_address => :IpAddress, :is_connected => :IsConnected, :mac_address => :MACAddress, :ip_address_allocation_mode => :IpAddressAllocationMode } option = options.delete(:primary_network_connection_index) options[:PrimaryNetworkConnectionIndex] ||= option unless option.nil? unless options.key?(:NetworkConnection) deprecated.each do |from, to| if options.key?(from) options[:NetworkConnection] ||= [{}] options[:NetworkConnection].first[to] = options.delete(from) end end end options[:NetworkConnection] = [options[:NetworkConnection]] if options[:NetworkConnection].is_a?(Hash) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1' } NetworkConnectionSection(attrs) { self[:ovf].Info 'Specifies the available VM network connections' if options.key?(:PrimaryNetworkConnectionIndex) PrimaryNetworkConnectionIndex options[:PrimaryNetworkConnectionIndex] end if network_connection = options[:NetworkConnection] network_connection.each do |nic| attrs = { :network => nic[:network] } if nic.key?(:needsCustomization) attrs[:needsCustomization] = nic[:needsCustomization] end NetworkConnection(attrs) { NetworkConnectionIndex nic[:NetworkConnectionIndex] if nic.key?(:IpAddress) IpAddress nic[:IpAddress] end IsConnected nic[:IsConnected] if nic.key?(:MACAddress) MACAddress nic[:MACAddress] end IpAddressAllocationMode nic[:IpAddressAllocationMode] } end end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkConnectionSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConnectionSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_section_vapp_template.rb0000644000004100000410000000144312600047642031766 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network section of a vApp template. # # @param [String] id The object identifier of the vApp template. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkSection-vAppTemplate.html # @since vCloud API version 0.9 def get_network_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_supported_systems_info.rb0000644000004100000410000002446312600047642030466 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # List operating systems available for use on virtual machines owned by # this organization. # # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SupportedSystemsInfo.html # @since vCloud API version 5.1 def get_supported_systems_info request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'supportedSystemsInfo' ) end end class Mock def get_supported_systems_info body = # this is a subset of the full list {:xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml", :href=>make_href('supportedSystemsInfo/'), :xsi_schemaLocation=>xsi_schema_location, :OperatingSystemFamilyInfo=> [{:Name=>"Microsoft Windows", :OperatingSystemFamilyId=>"1", :OperatingSystem=> [{:OperatingSystemId=>"85", :DefaultHardDiskAdapterType=>"4", :MinimumHardDiskSizeGigabytes=>"40", :MinimumMemoryMegabytes=>"512", :Name=>"Microsoft Windows Server 2012 (64-bit)", :InternalName=>"windows8Server64Guest", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"8", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"true", :SupportsMemHotAdd=>"true", :cimOsId=>"74", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"3", :DefaultHardDiskAdapterType=>"4", :MinimumHardDiskSizeGigabytes=>"40", :MinimumMemoryMegabytes=>"512", :Name=>"Microsoft Windows Server 2008 R2 (64-bit)", :InternalName=>"windows7Server64Guest", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"true", :SupportsMemHotAdd=>"true", :cimOsId=>"102", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"4", :DefaultHardDiskAdapterType=>"4", :MinimumHardDiskSizeGigabytes=>"40", :MinimumMemoryMegabytes=>"512", :Name=>"Microsoft Windows Server 2008 (32-bit)", :InternalName=>"winLonghornGuest", :Supported=>"true", :x64=>"false", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"true", :SupportsMemHotAdd=>"true", :cimOsId=>"73", :CimVersion=>"0", :SupportedForCreate=>"true"}]}, {:Name=>"Linux", :OperatingSystemFamilyId=>"2", :OperatingSystem=> [{:OperatingSystemId=>"48", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"64", :Name=>"Ubuntu Linux (64-bit)", :InternalName=>"ubuntu64Guest", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"94", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"47", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"64", :Name=>"Ubuntu Linux (32-bit)", :InternalName=>"ubuntuGuest", :Supported=>"true", :x64=>"false", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"93", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"50", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other 2.6.x Linux (64-bit)", :InternalName=>"other26xLinux64Guest", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"7", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"100", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"49", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other 2.6.x Linux (32-bit)", :InternalName=>"other26xLinuxGuest", :Supported=>"true", :x64=>"false", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"7", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"99", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"54", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other Linux (64-bit)", :InternalName=>"otherLinux64Guest", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"false", :cimOsId=>"101", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"53", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other Linux (32-bit)", :InternalName=>"otherLinuxGuest", :Supported=>"true", :x64=>"false", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"true", :PersonalizationAuto=>"true", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"false", :cimOsId=>"36", :CimVersion=>"0", :SupportedForCreate=>"true"}]}, {:Name=>"Other", :OperatingSystemFamilyId=>"3", :OperatingSystem=> [{:OperatingSystemId=>"68", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other (64-bit)", :InternalName=>"otherGuest64", :Supported=>"true", :x64=>"true", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"false", :PersonalizationAuto=>"false", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"102", :CimVersion=>"0", :SupportedForCreate=>"true"}, {:OperatingSystemId=>"67", :DefaultHardDiskAdapterType=>"3", :MinimumHardDiskSizeGigabytes=>"8", :MinimumMemoryMegabytes=>"32", :Name=>"Other (32-bit)", :InternalName=>"otherGuest", :Supported=>"true", :x64=>"false", :MaximumCpuCount=>"64", :MinimumHardwareVersion=>"4", :PersonalizationEnabled=>"false", :PersonalizationAuto=>"false", :SysprepPackagingSupported=>"false", :SupportsMemHotAdd=>"true", :cimOsId=>"1", :CimVersion=>"0", :SupportedForCreate=>"true"}]}]} Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb0000644000004100000410000000155512600047642031431 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from media object metadata. # # @param [String] id Object identifier of the media object. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaMetadataItem-metadata.html # @since vCloud API version 1.5 def get_media_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp.rb0000644000004100000410000001407412600047642024602 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a vApp or VM. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VApp.html # @since vCloud API version 0.9 def get_vapp(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) ensure_list! response.body, :Children, :Vm response end end class Mock def get_vapp(id) # Retrieve a vApp or VM. # case id when /^vapp-/ body = get_mock_vapp_body(id) when /^vm-/ body = get_mock_vm_body(id) else raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end def get_mock_vm_body(id) unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :name => vm[:name], :href => make_href("vApp/#{id}"), :type => "application/application/vnd.vmware.vcloud.vm+xml", :status => vm[:status], :deployed => vm[:deployed], :needsCustomization => vm[:needs_customization], :"ovf:VirtualHardwareSection" => get_vm_virtual_hardware_section_body(id, vm), :"ovf:OperatingSystemSection" => get_vm_operating_system_section_body(id, vm), :NetworkConnectionSection => get_vm_network_connection_section_body(id, vm), :GuestCustomizationSection => get_vm_guest_customization_section_body(id, vm), :RuntimeInfoSection => get_vm_runtime_info_section_body(id, vm), :SnapshotSection => get_snapshot_section_body(id), :DateCreated => vm[:date_created], # eg "2014-03-16T10:52:31.874Z" :VAppScopedLocalId => vm[:parent_vapp].split('-').last, # strip the vapp- prefix :"ovfenv:Environment" => get_vm_ovfenv_environment_section_body(id, vm), :VmCapabilities => get_vm_capabilities_section_body(id, vm), :StorageProfile => get_vm_storage_profile_section_body(id, vm), } body end def get_mock_vapp_body(id) unless vapp = data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :deployed => "true", :status => vapp[:status], :name => vapp[:name], :type => "application/vnd.vmware.vcloud.vApp+xml", :href => make_href("vApp/#{id}"), :LeaseSettingsSection => get_vapp_lease_settings_section_body(id), :"ovf:StartupSection" => get_vapp_ovf_startup_section_body(id, vapp), :"ovf:NetworkSection" => get_vapp_ovf_network_section_body(id, vapp), :NetworkConfigSection => get_vapp_network_config_section_body(id, vapp), :SnapshotSection => get_snapshot_section_body(id), :DateCreated => vapp[:date_created], # eg "2014-03-16T10:52:31.874Z" :Owner => get_owner_section_body(id), :InMaintenanceMode => "false", :Children => { :Vm => get_vapp_children_vms_body(id) }, } body end def get_vapp_ovf_network_section_body(id, vapp) {} end def get_vapp_children_vms_body(id) child_vms = data[:vms].select do |vm_id, vm_details| vm_details[:parent_vapp] == id end if RUBY_VERSION.to_f < 1.9 # 1.8 Hash.select returns an Array of [k,v] pairs. child_vms = Hash[child_vms] end child_vms.keys.collect do |vm_id| get_mock_vm_body(vm_id) end end def get_vm_ovfenv_environment_section_body(id, vm) # TODO: I'm pretty sure this is just repeating info in other # sections, and the OVF part of VMs is extremely verbose. It's # likely to not be needed in Mock mode {} end def get_vm_storage_profile_section_body(id, vm) { :type => "application/vnd.vmware.vcloud.vdcStorageProfile+xml", :name => "Mock Storage Profile", :href => make_href("vdcStorageProfile/12345678-1234-1234-1234-1234500e49a8"), } end def get_vm_virtual_hardware_section_body(id, vm) {:xmlns_ns12=>"http://www.vmware.com/vcloud/v1.5", :ovf_transport=>"", :ns12_href => make_href("vApp/#{id}/virtualHardwareSection/"), :ns12_type=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml", :"ovf:Info"=>"Virtual hardware requirements", :"ovf:System"=>{ :"vssd:ElementName"=>"Virtual Hardware Family", :"vssd:InstanceID"=>"0", :"vssd:VirtualSystemIdentifier" => vm[:name], :"vssd:VirtualSystemType"=>"vmx-08" }, :"ovf:Item" => get_vm_ovf_item_list(id, vm), } end def get_vm_ovf_item_list(id, vm) [ get_network_cards_rasd_items_list_body(id, vm), get_disks_rasd_items_list_body(id, vm), get_media_rasd_item_cdrom_body(id, vm), get_media_rasd_item_floppy_body(id, vm), get_cpu_rasd_item_body(id, vm), get_memory_rasd_item_body(id, vm), ].compact.flatten end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_upload_disk.rb0000644000004100000410000001236512600047642026341 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a disk. # # @param [String] id Object identifier of the vDC. # @param [String] name The name of the disk. # @param [Integer] size Size of the disk. For modify operation this is # required only for the XSD validation it could not be changed. # @param [Hash] options # @option options [String] :operationKey Optional unique identifier to # support idempotent semantics for create and delete operations. # @option options [Integer] :busSubType Disk bus sub type. # @option options [Integer] :busType Disk bus type. # @option options [String] :Description Optional description. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the disk. # * :type<~String> - The MIME type of the disk. # * :id<~String> - The disk identifier, expressed in URN format. # * :operationKey<~String> - Optional unique identifier to support # idempotent semantics for create and delete operations. # * :name<~String> - The name of the disk. # * :status<~String> - Creation status of the disk. # * :busSubType<~String> - Disk bus sub type. # * :busType<~String> - Disk bus type. # * :size<~String> - Size of the disk. # * :Link: # * :Description<~String> - Optional description. # * :Tasks<~Hash>: # * :StorageProfile<~Hash> - Storage profile of the disk. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Owner<~Hash> - Disk owner. # * :type<~String> - The MIME type of the entity. # * :User<~Hash> - Reference to the user who is the owner of this # disk. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateDisk.html # @since vCloud API version 5.1 def post_upload_disk(id, name, size, options={}) body = Nokogiri::XML::Builder.new do DiskCreateParams(:xmlns => 'http://www.vmware.com/vcloud/v1.5') { attrs = { :name => name, :size => size } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) attrs[:busSubType] = options[:busSubType] if options.key?(:busSubType) attrs[:busType] = options[:busType] if options.key?(:busType) Disk(attrs) { if options.key?(:Description) Description options[:Description] end if options.key?(:StorageProfile) attrs = { :href => options[:StorageProfile][:href] } StorageProfile(attrs) end } } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskCreateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/disk" ) end end class Mock def post_upload_disk(id, name, size, options={}) unless size.to_s =~ /^\d+$/ raise Fog::Compute::VcloudDirector::BadRequest.new( "validation error on field 'diskSpec.sizeBytes': must be greater than or equal to 0" ) end unless data[:vdcs][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "(com.vmware.vcloud.entity.vdc:%s)".' % id ) end disk_id = uuid owner = { :href => make_href("disk/#{disk_id}"), :type => 'application/vnd.vmware.vcloud.disk+xml' } task_id = enqueue_task( "Creating Disk #{name}(#{disk_id})", 'vdcCreateDisk', owner, :on_success => lambda do data[:disks][disk_id][:status] = 1 end ) disk = { :description => options[:Description], :name => name, :size => size.to_i, :status => 0, :tasks => [task_id], :vdc_id => id, :vdc_storage_class => data[:vdc_storage_classes].find {|k,v| v[:default]}.first } data[:disks][disk_id] = disk body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location }.merge(disk_body(disk_id)) Excon::Response.new( :status => 201, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb0000644000004100000410000000550612600047642026442 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the vApp or VM. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html # @since vCloud API version 1.5 def get_vapp_metadata(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/" ) ensure_list! response.body, :MetadataEntry response end end class Mock def get_vapp_metadata(id) unless vm_or_vapp = data[:vapps][id] || vm_or_vapp = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("vApp/#{id}/metadata"), :xsi_schemaLocation=>xsi_schema_location, :Link=> [{:rel=>"up", :type=>"application/vnd.vmware.vcloud.vApp+xml", :href=>make_href("/vApp/#{id}")}, {:rel=>"add", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("vApp/#{id}/metadata")}], :MetadataEntry=>get_metadata_entries(vm_or_vapp[:metadata], id) } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end private def get_metadata_entries(metadata, id) metadata_entries = [] for key, value in metadata do metadata_entries << {:type=>"application/vnd.vmware.vcloud.metadata.value+xml", :href=>make_href("vApp/#{id}/metadata/#{key}"), :Link=> [{:rel=>"up", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("vApp/#{id}/metadata")}, {:rel=>"edit", :type=>"application/vnd.vmware.vcloud.metadata.value+xml", :href=>make_href("vApp/#{id}/metadata/#{key}")}, {:rel=>"remove", :href=>make_href("vApp/#{id}/metadata/#{key}")}], :Key=>"#{key}", :TypedValue=>{:xsi_type=>"MetadataStringValue", :Value=>"#{metadata[key]}"}} end metadata_entries end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_organizations.rb0000644000004100000410000000334112600047642026516 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a list of organizations accessible to you. # # The system administrator has access to all organizations. # # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :Org<~Array]: # * :href<~String> - Contains the URI to the linked entity. # * :name<~String> - Contains the name of the linked entity. # * :type<~String> - Contains the type of the linked entity. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organizations.html # @since vCloud API version 0.9 def get_organizations response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'org' ) ensure_list! response.body, :Org response end end class Mock def get_organizations body = {:href=>make_href('org/'), :type=>"application/vnd.vmware.vcloud.orgList+xml", :Org=> [{:href=>make_href("org/#{data[:org][:uuid]}"), :name=>data[:org][:name], :type=>"application/vnd.vmware.vcloud.org+xml"}]} Excon::Response.new( :body => body, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :status => 200 ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb0000644000004100000410000001035612600047642030240 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a vApp from a vApp template. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp. # # @param [String] vapp_name # @param [String] template_id # @param [Hash] options # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstantiateVAppTemplate.html # @since vCloud API version 0.9 def instantiate_vapp_template(vapp_name, template_id, options={}) params = populate_uris(options.merge(:vapp_name => vapp_name, :template_id => template_id)) # @todo Move all the logic to a generator. data = generate_instantiate_vapp_template_request(params) request( :body => data, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{params[:vdc_id]}/action/instantiateVAppTemplate" ) end private def populate_uris(options = {}) options[:vdc_id] || raise("vdc_id option is required") options[:vdc_uri] = vdc_end_point(options[:vdc_id]) options[:network_uri] = network_end_point(options[:network_id]) if options[:network_id] options[:template_uri] = vapp_template_end_point(options[:template_id]) || raise("template_id option is required") options end def generate_instantiate_vapp_template_request(options ={}) xml = Builder::XmlMarkup.new xml.InstantiateVAppTemplateParams(xmlns.merge!(:name => options[:vapp_name], :"xml:lang" => "en")) { xml.Description(options[:description]) xml.InstantiationParams { # This options are fully ignored if options[:network_uri] xml.NetworkConfigSection { xml.tag!("ovf:Info"){ "Configuration parameters for logical networks" } xml.NetworkConfig("networkName" => options[:network_name]) { xml.Configuration { xml.ParentNetwork(:href => options[:network_uri]) xml.FenceMode("bridged") } } } end } # The template xml.Source(:href => options[:template_uri]) # Use of sourceItems for configuring VM's during instantiation. # NOTE: Name and storage profile configuration supported so far. # http://pubs.vmware.com/vca/index.jsp?topic=%2Fcom.vmware.vcloud.api.doc_56%2FGUID-BF9B790D-512E-4EA1-99E8-6826D4B8E6DC.html (options[:vms_config] || []).each do |vm_config| next unless vm_config[:href] xml.SourcedItem { xml.Source(:href => vm_config[:href]) xml.VmGeneralParams{ xml.Name(vm_config[:name]) if vm_config[:name] } if storage_href = vm_config[:storage_profile_href] xml.StorageProfile(:href => storage_href) end } end xml.AllEULAsAccepted("true") } end def xmlns { 'xmlns' => "http://www.vmware.com/vcloud/v1.5", "xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" } end def vdc_end_point(vdc_id = nil) end_point + ( vdc_id ? "vdc/#{vdc_id}" : "vdc" ) end def network_end_point(network_id = nil) end_point + ( network_id ? "network/#{network_id}" : "network" ) end def vapp_template_end_point(vapp_template_id = nil) end_point + ( vapp_template_id ? "vAppTemplate/#{vapp_template_id}" : "vAppTemplate" ) end def endpoint end_point end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb0000644000004100000410000000246612600047642026673 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Insert virtual media. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [String] media_id Object identifier of the media object. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InsertCdRom.html # @since vCloud API version 0.9 def post_insert_cd_rom(id, media_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } MediaInsertOrEjectParams(attrs) { Media(:href => "#{end_point}media/#{media_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/media/action/insertMedia" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb0000644000004100000410000000244312600047642026301 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Detach a disk from a VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [String] disk_id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DetachDisk.html # @since vCloud API version 5.1 def post_detach_disk(id, disk_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } DiskAttachOrDetachParams(attrs) { Disk(:href => "#{end_point}disk/#{disk_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/disk/action/detach" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_consolidate_vm_vapp.rb0000644000004100000410000000150612600047642030072 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Consolidate VM snapshots. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ConsolidateVm-vApp.html # @since vCloud API version 1.5 def post_consolidate_vm_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/consolidate" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb0000644000004100000410000000665012600047642027322 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_vdc_storage_profile, :get_vdc_storage_class # Returns storage class referred by the Id. All properties of the # storage classes are visible to vcloud user, except for VDC Storage # Class reference. # # @param [String] id Object identifier of the vDC storage profile. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN format. # The value of this attribute uniquely identifies the entity, # persists for the life of the entity, and is never reused. # * :name<~String> - The name of the entity. # * :Description<~String> - Optional description. # * :Enabled<~String> - True if this storage profile is enabled for # use in the vDC. # * :Units<~String> - Units used to define :Limit. # * :Limit<~String> - Maximum number of :Units allocated for this # storage profile. # * :Default<~String> - True if this is default storage profile for # this vDC. The default storage profile is used when an object # that can specify a storage profile is created with no storage # profile specified. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClass.html def get_vdc_storage_class(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}" ) end end class Mock def get_vdc_storage_class(id) unless vdc_storage_class = data[:vdc_storage_classes][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.vdcstorageProfile:#{id})\"." ) end body = {:xmlns=>xmlns, :xmlns_xsi=>xmlns_xsi, :name=>vdc_storage_class[:name], :id=>"urn:vcloud:vdcstorageProfile:#{id}", :type=>"application/vnd.vmware.vcloud.vdcStorageProfile+xml", :href=>make_href("api/vdcStorageProfile/#{id}"), :xsi_schemaLocation=>xsi_schema_location, :Link=> [{:rel=>"up", :type=>"application/vnd.vmware.vcloud.vdc+xml", :href=>make_href("vdc/#{vdc_storage_class[:vdc]}")}, {:rel=>"down", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("vdcStorageProfile/#{id}/metadata")}], :Enabled=>vdc_storage_class[:enabled].to_s, :Units=>vdc_storage_class[:units], :Limit=>vdc_storage_class[:limit].to_s, :Default=>vdc_storage_class[:default].to_s} Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_runtime_info_section_type.rb0000644000004100000410000000333412600047642031114 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the runtime info section of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-RuntimeInfoSectionType.html # @since vCloud API version 1.5 def get_runtime_info_section_type(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/runtimeInfoSection" ) end end class Mock def get_runtime_info_section_type(id) type = 'application/vnd.vmware.vcloud.virtualHardwareSection+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vm_runtime_info_section_body(id, vm) ) end def get_vm_runtime_info_section_body(id, vm) { :xmlns_ns12 => "http://www.vmware.com/vcloud/v1.5", :ns12_href => make_href("vApp/#{id}/runtimeInfoSection"), :ns12_type => "application/vnd.vmware.vcloud.virtualHardwareSection+xml", :"ovf:Info" => "Specifies Runtime info", :VMWareTools => { :version => "9282", } } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_network.rb0000644000004100000410000000354112600047642026005 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete an OrgVdcNetwork # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the OrgVdcNetwork. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Network.html # @since vCloud API version 0.9 def delete_network(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) end end class Mock def delete_network(id) unless data[:networks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\"" ) end owner = { :href => make_href("network/#{id}"), :type => 'application/vnd.vmware.vcloud.network+xml' } task_id = enqueue_task( "Deleting Network(#{id})", 'DeleteNetwork', owner, :on_success => lambda do data[:networks].delete(id) end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb0000644000004100000410000000153212600047642031277 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from disk metadata. # # @param [String] id Object identifier of the disk. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskMetadataItem-metadata.html # @since vCloud API version 5.1 def get_disk_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb0000644000004100000410000000163312600047642033210 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from vApp template or VM # metadata. # # @param [String] id Object identifier of the vApp template or VM. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateMetadataItem-metadata.html # @since vCloud API version 1.5 def get_vapp_template_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_metadata.rb0000644000004100000410000000166412600047642025415 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the vApp or VM. # # @deprecated Use {#get_vapp_metadata} instead. # @todo Log deprecation warning. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html # @since vCloud API version 1.5 def get_metadata(id) require 'fog/vcloud_director/parsers/compute/metadata' request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Metadata.new, :path => "vApp/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_metadata.rb0000644000004100000410000000136212600047642027161 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the network. # # @param [String] id Object identifier of the network. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkMetadata.html # @since vCloud API version 1.5 def get_network_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "network/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_clone_vapp_template.rb0000644000004100000410000000367312600047642030066 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a copy of a vApp template. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp template. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] name Name of the new vApp template. # @param [String] source_id Object identifier of the source vApp # template. # @param [Hash] options # @option options [String] :Description Optional description. # @option options [Boolean] :IsSourceDelete Set to true to delete the # source object after the operation completes. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneVAppTemplate.html # @since vCloud API version 0.9 def post_clone_vapp_template(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } CloneVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}vAppTemplate/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneVAppTemplate" ) end end end end end ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_connection_system_section_vapp_template.rbfog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_connection_system_section_vapp_templ0000644000004100000410000000150412600047642034513 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network connection section of a VM. # # @param [String] id The object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vAppTemplate.html # @since vCloud API version 0.9 def get_network_connection_system_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkConnectionSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_product_sections.rb0000644000004100000410000000334412600047642027252 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the vApp # @param [Array] sections List of sections hashes # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-E13A5613-8A41-46E3-889B-8E1EAF10ABBE.html # @since vCloud API version 1.5 def put_product_sections(id, sections) xml = '' xml += '' xml += 'Global vApp Custom Properties' xml += 'Global' sections.each do |section| section[:user_configurable] ||= true section[:type] ||= "string" section[:password] ||= false xml += "" end xml += '' xml += "" request( :body => xml, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.productSections+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/productSections" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_groups_from_query.rb0000644000004100000410000001124212600047642027415 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of groups for organization the org admin belongs to # by using REST API general QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :GroupRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GroupsFromQuery.html # @since vCloud API version 1.5 def get_groups_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/groups/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :GroupReference : :GroupRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_control_access_params_catalog.rb0000644000004100000410000000156312600047642031671 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve access control information for a catalog. # # @param [String] id Object identifier of the organization. # @param [String] catalog_id Object identifier of the catalog. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ControlAccessParams-vApp.html # @since vCloud API 0.9 def get_control_access_params_catalog(id, catalog_id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}/catalog/#{catalog_id}/controlAccess" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_org_settings.rb0000644000004100000410000000254612600047642026344 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve settings for this organization. # # Organization settings are divided into categories. This request # retrieves all categories of organization settings. # # @param [String] id Object identitifier of the organization. # @return [Excon:Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :OrgGeneralSettings<~Hash>: # * :VAppLeaseSettings<~Hash>: # * :VAppTemplateLeaseSettings<~Hash>: # * :OrgLdapSettings<~Hash>: # * :OrgEmailSettings<~Hash>: # * :OrgPasswordPolicySettings<~Hash>: # * :OrgOperationLimitsSettings<~Hash>: # * :OrgFederationSettings<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrgSettings.html # @since vCloud API version 0.9 def get_org_settings(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/org/#{id}/settings" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog_metadata.rb0000644000004100000410000000134212600047642027100 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all catalog metadata. # # @param [String] id Object identifier of the catalog. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogMetadata.html # @since vCloud API version 1.5 def get_catalog_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_lease_settings_section_vapp.rb0000644000004100000410000000332112600047642031410 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves the lease settings section of a vApp. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-LeaseSettingsSection-vApp.html # @since vCloud API version 1.0 def get_lease_settings_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/leaseSettingsSection" ) end end class Mock def get_lease_settings_section_vapp(id) type = 'application/vnd.vmware.vcloud.leaseSettingsSection+xml' unless vapp = data[:vapps][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vapp_lease_settings_section_body(id) ) end def get_vapp_lease_settings_section_body(id) { :type => "application/vnd.vmware.vcloud.leaseSettingsSection+xml", :href => make_href("vApp/#{id}/leaseSettingsSection/"), :ovf_required=>"false", :"ovf:Info"=>"Lease settings section", :DeploymentLeaseInSeconds=>"0", :StorageLeaseInSeconds=>"0", } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_media_drives_rasd_items_list.rb0000644000004100000410000000543412600047642031534 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve all RASD items that specify CD-ROM, DVD, and floppy disk # device and controller properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaDrivesRasdItemsList.html # @since vCloud API version 0.9 def get_media_drives_rasd_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/media" ) end end class Mock def get_media_drives_rasd_items_list(id) type = 'application/vnd.vmware.vcloud.rasdItemsList+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :type => type, :href => make_href("vApp/#{id}/virtualHardwareSection/media"), :Item => [ get_media_rasd_item_ide_controller_body(id, vm), get_media_rasd_item_cdrom_body(id, vm), get_media_rasd_item_floppy_body(id, vm), ] } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => body ) end def get_media_rasd_item_ide_controller_body(id, vm) { :"rasd:Address"=>"0", :"rasd:Description"=>"IDE Controller", :"rasd:ElementName"=>"IDE Controller 0", :"rasd:InstanceID"=>"3", :"rasd:ResourceType"=>"5" } end def get_media_rasd_item_cdrom_body(id, vm) { :"rasd:AddressOnParent"=>"1", :"rasd:AutomaticAllocation"=>"true", :"rasd:Description"=>"CD/DVD Drive", :"rasd:ElementName"=>"CD/DVD Drive 1", :"rasd:HostResource"=>"", :"rasd:InstanceID"=>"3000", :"rasd:Parent"=>"3", :"rasd:ResourceType"=>"15" } end def get_media_rasd_item_floppy_body(id, vm) { :"rasd:AddressOnParent"=>"0", :"rasd:AutomaticAllocation"=>"false", :"rasd:Description"=>"Floppy Drive", :"rasd:ElementName"=>"Floppy Drive 1", :"rasd:HostResource"=>"", :"rasd:InstanceID"=>"8000", :"rasd:ResourceType"=>"14" } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_organizations_from_query.rb0000644000004100000410000001124012600047642030763 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves a list of organizations by using REST API general # QueryHandler. # # @param [Hash] options # @option options [String] :sortAsc (Sorted by database ID) Sort # results by attribute-name in ascending order. attribute-name cannot # include metadata. # @option options [String] :sortDesc (Sorted by database ID) Sort # results by attribute-name in descending order. attribute-name # cannot include metadata. # @option options [Integer] :page (1) If the query results span # multiple pages, return this page. # @option options [Integer] :pageSize (25) Number of results per page, # to a maximum of 128. # @option options [String] :format (records) One of the following # types: # - *references* Returns a reference to each object, including its # :name, :type, and :href attributes. # - *records* Returns all database records for each object, with each # record as an attribute. # - *idrecords* Identical to the records format, except that object # references are returned in :id format rather than :href format. # @option options [Array] :fields (all static attribute names) # List of attribute names or metadata key names to return. # @option options [Integer] :offset (0) Integer value specifying the # first record to return. Record numbers < offset are not returned. # @option options [String] :filter (none) Filter expression. # @return [Excon::Response] # * hash<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :name<~String> - Query name that generated this result set. # * :page<~String> - Page of the result set that this container # holds. The first page is page number 1. # * :pageSize<~String> - Page size, as a number of records or # references. # * :total<~String> - Total number of records or references in the # container. # * :Link<~Array>: # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the type of the entity. # * :rel<~String> - Defines the relationship of the link to the # object that contains it. # * :OrganizationRecord<~Array>: # * TODO # * :firstPage<~Integer> - First page in the result set. # * :previousPage<~Integer> - Previous page in the result set. # * :nextPage<~Integer> - Next page in the result set. # * :lastPage<~Integer> - Last page in the result set. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationsFromQuery.html # @since vCloud API version 1.5 def get_organizations_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/orgs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :OrganizationReference : :OrganizationRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vapp_template_ovf_descriptor.rb0000644000004100000410000000136112600047642031600 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the OVF descriptor of a vApp template. # # @param [String] id Object identifier of the vAppTemplate. # @return [Excon::Response] # * body<~String> - the OVF descriptor. # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateOvfDescriptor.html # @since vCloud API version 0.9 def get_vapp_template_ovf_descriptor(id) request( :expects => 200, :idempotent => true, :method => 'GET', :path => "vAppTemplate/#{id}/ovf" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_update_catalog_item_metadata.rb0000644000004100000410000000362012600047642031667 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Merge the metadata provided in the request with existing catalog item metadata. # # @param [String] id Object identifier of the catalog item. # @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateCatalogItemMetadata.html # @since vCloud API version 1.5 def post_update_catalog_item_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_compliance_results.rb0000644000004100000410000000132012600047642030217 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the results of a compliance check. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmComplianceResults.html def get_vm_compliance_results(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/complianceResult" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_vm.rb0000644000004100000410000000451412600047642024305 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/generators/compute/vm' # Update the name, description and storage profile for VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @param [String] name of the VM. # @param [Hash] options # * :Description<~String>: - description to be assigned. # * :StorageProfile<~Hash>: - storage profile to be assigned. # * :name<~String> # * :href<~String> # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Vm.html # @since vCloud API version 0.9 def put_vm(id, name, options) body = Fog::Generators::Compute::VcloudDirector::Vm.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vm+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) end end class Mock def put_vm(id, name, options) unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end owner = { :href => make_href("vApp/#{id}"), :type => 'application/vnd.vmware.vcloud.vm+xml' } task_id = enqueue_task( "Updating Virtual Machine #{data[:vms][id][:name]}(#{id})", 'vappUpdateVm', owner, :on_success => lambda do data[:vms][id][:name] = name end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb0000644000004100000410000000160012600047642032771 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key from catalog item metadata. # # @param [String] id Object identifier of the catalog item. # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItemMetadataItem-metadata.html # @since vCloud API version 1.5 def get_catalog_item_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_organization_metadata.rb0000644000004100000410000000140212600047642030167 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with the organization. # # @param [String] id Object identifier of the organization. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationMetadata.html # @since vCloud API version 1.5 def get_organization_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}/metadata" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_clone_vapp.rb0000644000004100000410000000466412600047642026174 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Create a copy of a vApp. # # The response includes a Task element. You can monitor the task to to # track the creation of the vApp template. # # @param [String] vdc_id Object identifier of the vDC. # @param [String] name Name of the new vApp. # @param [String] source_id Object identifier of the source vApp. # @param [Hash] options # @option options [Boolean] :deploy True if the vApp should be deployed # at instantiation. Defaults to true. # @option options [Boolean] :powerOn True if the vApp should be # powered-on at instantiation. Defaults to true. # @option options [String] :Description Optional description. # @option options [Hash] :InstantiationParams Instantiation parameters # for the composed vApp. # @option options [Boolean] :IsSourceDelete Set to true to delete the # source object after the operation completes. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneVApp.html # @since vCloud API version 0.9 def post_clone_vapp(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } attrs[:deploy] = options[:deploy] if options.key?(:deploy) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) CloneVAppParams(attrs) { if options.key?(:Description) Description options[:Description] end InstantiationParams { # TODO } Source(:href => "#{end_point}vApp/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneVApp" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_connection_system_section_vapp.rb0000644000004100000410000000440512600047642033717 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the network connection section of a VM. # # @param [String] id The object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vApp.html # @since vCloud API version 0.9 def get_network_connection_system_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConnectionSection/" ) end end class Mock def get_network_connection_system_section_vapp(id) type = 'application/vnd.vmware.vcloud.networkConnectionSection+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vm_network_connection_section_body(id, vm) ) end def get_vm_network_connection_section_body(id, vm) # TODO: Needs work - does not handle multiple NIC case yet, or # DHCP/POOL allocations { :type => "application/vnd.vmware.vcloud.networkConnectionSection+xml", :href => make_href("vApp/#{id}/networkConnectionSection/"), :ovf_required => "false", :"ovf:Info" => "Specifies the available VM network connections", :PrimaryNetworkConnectionIndex => "0", :NetworkConnection => { :network => vm[:nics][0][:network_name], :needsCustomization => "false", :NetworkConnectionIndex => "0", :IpAddress => vm[:nics][0][:ip_address], :IsConnected => "true", :MACAddress => vm[:nics][0][:mac_address], :IpAddressAllocationMode => "MANUAL" } } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_guest_customization_system_section_vapp.rb0000644000004100000410000000460412600047642034127 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieves the guest customization section of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vApp.html # @since vCloud API version 1.0 def get_guest_customization_system_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/guestCustomizationSection" ) end end class Mock def get_guest_customization_system_section_vapp(id) type = 'application/vnd.vmware.vcloud.guestCustomizationSection+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vm_guest_customization_section_body(id, vm) ) end def get_vm_guest_customization_section_body(id, vm) { :type => "application/vnd.vmware.vcloud.guestCustomizationSection+xml", :href => make_href("vApp/#{id}/guestCustomizationSection/"), :ovf_required => "false", :"ovf:Info" => "Specifies Guest OS Customization Settings", :Enabled => "true", :ChangeSid => "false", :VirtualMachineId => id.split('-').last, # strip the 'vm-' prefix :JoinDomainEnabled => "false", :UseOrgSettings => "false", :AdminPasswordEnabled => "false", :AdminPasswordAuto => "true", :ResetPasswordRequired => "false", :CustomizationScript => vm[:customization_script] || "", :ComputerName => vm[:computer_name] || vm[:name], :Link => { :rel=>"edit", :type=>"application/vnd.vmware.vcloud.guestCustomizationSection+xml", :href=>make_href("vApp/#{id}"), }, } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb0000644000004100000410000000173312600047642033054 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the value of the specified key in the specified domain from # organization metadata. # # @param [String] id Object identifier of the network. # @param [String] domain # @param [String] key Key of the metadata. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationMetadataItem-metadata.html # @since vCloud API version 5.1 def get_organization_metadata_item_metadata(id, domain, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/org/#{id}/metadata/#{URI.escape(domain)}/#{URI.escape(key)})" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_disable_nested_hv.rb0000644000004100000410000000155412600047642027503 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Hide hardware-assisted CPU virtualization from guest OS. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DisableNestedHv.html # @since vCloud API version 5.1 def post_disable_nested_hv(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/disableNestedHypervisor" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb0000644000004100000410000000242412600047642031054 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/generators/compute/vapp' # Modify the name or description of a vApp. # # This operation is asynchronous and returns a task that you can monitor # to track the progress of the request. # # # @param [String] id Object identifier of the vApp. # @param [String] name of the vApp. # @param [Hash] options # * :Description<~String>: - description to be assigned (optional) # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/PUT-VAppNameAndDescription.html # @since vCloud API version 0.9 def put_vapp_name_and_description(id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::Vapp.new(name, options).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_shadow_vm.rb0000644000004100000410000000164012600047642026301 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Deletes shadow VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @deprecated Since vCloud API version 5.1 this operation may be # removed in a future release. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-ShadowVm.html # @since vCloud API version 1.5 def delete_shadow_vm(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "shadowVm/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_acquire_ticket.rb0000644000004100000410000000154512600047642027035 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a screen ticket that you can use with the VMRC browser # plug-in to gain access to the console of a running VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Conflict] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AcquireTicket.html # @since vCloud API version 0.9 def post_acquire_ticket(id) request( :expects => 200, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/screen/action/acquireTicket" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc_metadata.rb0000644000004100000410000000133512600047642026244 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve metadata associated with a vDC. # # @param [String] id Object identifier of the vDC. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcMetadata.html # @since vCloud API version 1.5 def get_vdc_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_network_complete.rb0000644000004100000410000000512212600047642027207 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve an organization network. # # @param [String] id Object identifier of the network. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Network.html # @since vCloud API version 0.9 def get_network_complete(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) ensure_list! response.body[:Configuration][:IpScopes][:IpScope], :IpRanges, :IpRange response end end class Mock def get_network_complete(id) unless network = data[:networks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end body = { :name => network[:name], :href => make_href("network/#{id}"), :type => "application/vnd.vmware.vcloud.orgNetwork+xml", :id => id, :Description => network[:Description], :Configuration => { :IpScopes => { :IpScope => { :IsInherited => network[:IsInherited].to_s, :Gateway => network[:Gateway], :Netmask => network[:Netmask], :Dns1 => network[:Dns1], :Dns2 => network[:Dns2], :DnsSuffix => network[:DnsSuffix], :IsEnabled => true.to_s, :IpRanges => { :IpRange => [], }, } }, :FenceMode => network[:FenceMode], :RetainNetInfoAcrossDeployments => false.to_s, }, :IsShared => network[:IsShared].to_s, } body[:Configuration][:IpScopes][:IpScope][:IpRanges][:IpRange] = network[:IpRanges].map do |ip_range| {:StartAddress => ip_range[:StartAddress], :EndAddress => ip_range[:EndAddress]} end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_power_on_vapp.rb0000644000004100000410000000224412600047642026714 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :post_vm_poweron, :post_power_on_vapp # Power on a vApp or VM. # # If used on a vApp, powers on all VMs in the vApp. If used on a VM, # powers on the VM. This operation is available only for a vApp or VM # that is powered off. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOnVApp.html # @since vCloud API version 0.9 def post_power_on_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/powerOn" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_disable_vapp_template_download.rb0000644000004100000410000000134712600047642032254 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Disable a vApp template for download. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DisableVAppTemplateDownload.html # @since vCloud API version 0.9 def post_disable_vapp_template_download(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/disableDownload" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vm_network.rb0000644000004100000410000000177212600047642026030 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/parsers/compute/vm_network' # Retrieve the network connection section of a VM. # # @deprecated Use {#get_network_connection_system_section_vapp} # instead. # @todo Log deprecation warning. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vApp.html # @since vCloud API version 0.9 def get_vm_network(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmNetwork.new, :path => "vApp/#{id}/networkConnectionSection/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_media_metadata_item_metadata.rb0000644000004100000410000000151412600047642032107 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete the specified key and its value from media object metadata. # # @param [String] id Object identifier of the media object. # @param [String] key Key of the metadata item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-MediaMetadataItem-metadata.html # @since vCloud API version 1.5 def delete_media_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_vapp.rb0000644000004100000410000000153712600047642025265 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete a vApp or VM. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::BadRequest] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VApp.html # @since vCloud API version 0.9 def delete_vapp(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_update_vapp_template_metadata.rb0000644000004100000410000000360712600047642032105 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Merge the metadata provided in the request with existing metadata. # # @param [String] id Object identifier of the vApp template. # @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateVAppTemplateMetadata.html # @since vCloud API version 1.5 def post_update_vapp_template_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb0000644000004100000410000000556312600047642032436 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real require 'fog/vcloud_director/generators/compute/edge_gateway_service_configuration' # Configure edge gateway services like firewall, nat and load balancer. # # The response includes a Task element. You can monitor the task to # track the configuration of edge gateway services. # # @param [String] id Object identifier of the edge gateway. # @param [Hash] configuration # @configuration firewall_service [Hash] - configurations for firewall service. # @configuration nat_service [Hash] - configurations for NAT network service. # @configuration load_balancer_service [Hash] - configurations for load balancer service # @return [Excon::Response] # * body<~Hash>: # @see https://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ConfigureEdgeGatewayServices.html # vCloud API Documentaion # @since vCloud API version 5.1 def post_configure_edge_gateway_services(id, configuration) body = Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(configuration).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "admin/edgeGateway/#{id}/action/configureServices" ) end end class Mock def post_configure_edge_gateway_services(id, configuration) unless data[:edge_gateways][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.edgegateway:#{id})\"." ) end owner = { :href => make_href("admin/edgeGateway/#{id}"), :type => 'application/vnd.vmware.vcloud.gateway+xml' } task_id = enqueue_task( "Configuring edgegateway(#{id})", 'networkConfigureEdgeGatewayServices', owner, :on_success => lambda do data[:edge_gateways][id][:Configuration][:EdgeGatewayServiceConfiguration] = configuration end ) task = task_body(task_id) task.delete(:Owner) # known bug - admin tasks do not return Owner body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_disk_metadata_item_metadata.rb0000644000004100000410000000147112600047642031764 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete the specified key and its value from disk metadata. # # @param [String] id Object identifier of the disk. # @param [String] key Key of the metadata item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-DiskMetadataItem-metadata.html # @since vCloud API version 5.1 def delete_disk_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_media.rb0000644000004100000410000001316212600047642025373 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete a media object. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the media object. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the entity. # * :type<~String> - The MIME type of the entity. # * :id<~String> - The entity identifier, expressed in URN format. # The value of this attribute uniquely identifies the entity, # persists for the life of the entity, and is never reused. # * :operationKey<~String> - Optional unique identifier to support # idempotent semantics for create and delete operations. # * :name<~String> - The name of the entity. # * :cancelRequested<~String> - Whether user has requested this # processing to be canceled. # * :endTime<~String> - The date and time that processing of the # task was completed. May not be present if the task is still # being executed. # * :expiryTime<~String> - The date and time at which the task # resource will be destroyed and no longer available for # retrieval. May not be present if the task has not been executed # or is still being executed. # * :operation<~String> - A message describing the operation that # is tracked by this task. # * :operationName<~String> - The short name of the operation that # is tracked by this task. # * :serviceNamespace<~String> - Identifier of the service that # created the task. # * :startTime<~String> - The date and time the system started # executing the task. May not be present if the task has not been # executed yet. # * :status<~String> - The execution status of the task. # * :Link<~Array>: # * :Description<~String> - Optional description. # * :Owner<~Hash> - Reference to the owner of the task. This is # typically the object that the task is creating or updating. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Error<~Hash> - Represents error information from a failed # task. # * :majorErrorCode<~String> - The class of the error. Matches # the HTTP status code. # * :message<~String> - An one line, human-readable message # describing the error that occurred. # * :minorErrorCode<~String> - Resource-specific error code. # * :stackTrace<~String> - The stack trace of the exception. # * :vendorSpecificErrorCode<~String> - A vendor- or # implementation-specific error code that can reference # specific modules or source lines for diagnostic purposes. # * :User<~Hash> - The user who started the task. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Organization<~Hash> - The organization to which the :User # belongs. # * :href<~String> - Contains the URI to the entity. # * :name<~String> - Contains the name of the entity. # * :type<~String> - Contains the type of the entity. # * :Progress<~String> - Read-only indicator of task progress as # an approximate percentage between 0 and 100. Not available # for all tasks. # * :Params # * :Details<~String> - Detailed message about the task. Also # contained by the :Owner entity when task status is # preRunning. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Media.html # @since vCloud API version 0.9 def delete_media(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "media/#{id}" ) end end class Mock def delete_media(id) unless media = data[:medias][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.media:#{id})\"" ) end owner = { :href => make_href("media/#{id}"), :type => 'application/vnd.vmware.vcloud.media+xml' } task_id = enqueue_task( "Deleting Media File(#{media[:file][:uuid]})", 'vdcDeleteMedia', owner, :on_success => lambda do data[:medias].delete(id) end ) body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, }.merge(task_body(task_id)) Excon::Response.new( :status => 202, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_memory_rasd_item.rb0000644000004100000410000000372312600047642027172 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_vm_memory, :get_memory_rasd_item # Retrieve the RASD item that specifies memory properties of a VM. # # @param [String] id Object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MemoryRasdItem.html # @since vCloud API version 0.9 def get_memory_rasd_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/memory" ) end end class Mock def get_memory_rasd_item(id) type = 'application/vnd.vmware.vcloud.rasdItem+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_memory_rasd_item_body(id, vm) ) end def get_memory_rasd_item_body(id, vm) { :ns12_href => make_href("vApp/#{id}/virtualHardwareSection/memory"), :ns12_type=>"application/vnd.vmware.vcloud.rasdItem+xml", :"rasd:AllocationUnits"=>"byte * 2^20", :"rasd:Description"=>"Memory Size", :"rasd:ElementName"=>"#{vm[:memory_in_mb]} MB of memory", :"rasd:InstanceID"=>"5", :"rasd:Reservation"=>"0", :"rasd:ResourceType"=>"4", :"rasd:VirtualQuantity"=>"#{vm[:memory_in_mb]}", :"rasd:Weight"=>"0", } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_operating_system_section.rb0000644000004100000410000000360712600047642030754 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the operating system section of a VM. # # @param [String] id The object identifier of the VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OperatingSystemSection.html # @since vCloud API version 0.9 def get_operating_system_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/operatingSystemSection/" ) end end class Mock def get_operating_system_section(id) type = 'application/vnd.vmware.vcloud.operatingSystemSection+xml' unless vm = data[:vms][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'This operation is denied.' ) end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{type};version=#{api_version}"}, :body => get_vm_operating_system_section_body(id, vm) ) end def get_vm_operating_system_section_body(id, vm) { :xmlns_ns12=>"http://www.vmware.com/vcloud/v1.5", :ovf_id => "94", # TODO: What is this? :ns12_href => make_href("vApp/#{id}/operatingSystemSection/"), :ns12_type => "application/vnd.vmware.vcloud.operatingSystemSection+xml", :vmw_osType => vm[:guest_os_type], # eg "ubuntu64Guest" :"ovf:Info"=>"Specifies the operating system installed", :"ovf:Description"=> vm[:guest_os_description], # eg "Ubuntu Linux (64-bit)", } end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_revert_snapshot.rb0000644000004100000410000000161012600047642027260 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Reverts a vApp or virtual machine to the current snapshot, if any. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or virtual machine. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RevertSnapshot.html # @since vCloud API version 5.1 def post_revert_snapshot(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/revertToCurrentSnapshot" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_discard_vapp_state.rb0000644000004100000410000000174012600047642027675 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Discard suspended state of a vApp or VM. # # Discarding the suspended state of a vApp discards the suspended state # of all VMs it contains. # # This operation is asynchronous and returns a task that you can # monitor to track the progress of the request. # # @param [String] id Object identifier of the vApp or VM. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DiscardVAppState.html # @since vCloud API version 0.9 def post_discard_vapp_state(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/discardSuspendedState" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_disk_owner.rb0000644000004100000410000000436112600047642025776 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve the owner of a disk. # # @param [String] id Object identifier of the disk. # @return [Excon::Response] # * body<~Hash>: # * :href<~String> - The URI of the disk. # * :type<~String> - The MIME type of the disk. # * :Link<~Hash>: # * :href<~String> - # * :type<~String> - # * :rel<~String> - # * :User<~Hash> - Reference to the user who is the owner of this # disk. # * :href<~String> - The URI of the user. # * :name<~String> - The name of the user. # * :type<~String> - The MIME type of the user. # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskOwner.html # @since vCloud API version 5.1 def get_disk_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/owner" ) end end class Mock def get_disk_owner(id) unless data[:disks][id] raise Fog::Compute::VcloudDirector::Forbidden.new( 'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id ) end body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :xsi_schemaLocation => xsi_schema_location, :Link => { :href => make_href("disk/#{id}"), :type => 'application/vnd.vmware.vcloud.disk+xml', :rel => 'up' }, :User => { :href => make_href("admin/user/#{user_uuid}"), :name => user_name, :type => 'application/vnd.vmware.admin.user+xml', } } Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb0000644000004100000410000001070512600047642026256 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve an edge gateway. # # @param [String] id Object identifier of the edge gateway. # @return [Excon::Response] # * body<~Hash>: # # @raise [Fog::Compute::VcloudDirector::Forbidden] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-EdgeGateway.html # @since vCloud API version 5.1 def get_edge_gateway(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/edgeGateway/#{id}" ) ensure_list! response.body[:Configuration], :GatewayInterfaces, :GatewayInterface edge_gateway_service_configuration = response.body[:Configuration][:EdgeGatewayServiceConfiguration] ensure_list! edge_gateway_service_configuration[:FirewallService], :FirewallRule if edge_gateway_service_configuration[:FirewallService] ensure_list! edge_gateway_service_configuration[:NatService], :NatRule if edge_gateway_service_configuration[:NatService] if edge_gateway_service_configuration[:LoadBalancerService] ensure_list! edge_gateway_service_configuration[:LoadBalancerService], :Pool edge_gateway_service_configuration[:LoadBalancerService][:Pool].each do |pool| ensure_list! pool, :ServicePort ensure_list! pool, :Member pool[:Member].each do |member| ensure_list! member, :ServicePort end end ensure_list! edge_gateway_service_configuration[:LoadBalancerService], :VirtualServer edge_gateway_service_configuration[:LoadBalancerService][:VirtualServer].each do |virtual_server| ensure_list! virtual_server, :ServiceProfile end end response end end class Mock def get_edge_gateway(id) unless edge_gateway = data[:edge_gateways][id] raise Fog::Compute::VcloudDirector::Forbidden.new( "No access to entity \"(com.vmware.vcloud.entity.gateway:#{id})\"" ) end vdc_id = edge_gateway[:vdc] body = { :xmlns => xmlns, :xmlns_xsi => xmlns_xsi, :status => "1", :name => edge_gateway[:name], :id => "urn:vcloud:gateway:#{id}", :type => "application/vnd.vmware.admin.edgeGateway+xml", :href => make_href("admin/edgeGateway/#{id}"), :xsi_schemaLocation => xsi_schema_location, :Link =>[{:rel => "up", :type => "application/vnd.vmware.vcloud.vdc+xml", :href => make_href("vdc/#{vdc_id}")}, {:rel => "edgeGateway:redeploy", :href => make_href("admin/edgeGateway/#{id}/action/redeploy")}, {:rel => "edgeGateway:configureServices", :type => "application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml", :href => make_href("admin/edgeGateway/#{id}/action/configureServices")}, {:rel => "edgeGateway:reapplyServices", :href => make_href("admin/edgeGateway/#{id}/action/reapplyServices")}, {:rel => "edgeGateway:syncSyslogSettings", :href => make_href("admin/edgeGateway/#{id}/action/syncSyslogServerSettings")}], :Description => "vCloud CI (nft00052i2)", :Configuration => edge_gateway[:Configuration].dup } body[:Configuration][:GatewayInterfaces][:GatewayInterface] += edge_gateway[:networks].map do |network| extras = { :Network => { :type => "application/vnd.vmware.admin.network+xml", :name => "anything", :href => make_href("admin/network/#{network}") }, :Name => data[:networks][network][:name], :DisplayName => data[:networks][network][:name] } data[:networks][network].merge extras end Excon::Response.new( :status => 200, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :body => body ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata.rb0000644000004100000410000000156512600047642031162 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real extend Fog::Deprecation deprecate :get_vdc_storage_profile_metadata, :get_vdc_storage_class_metadata # Retrieve metadata associated with the vDC storage profile. # # @param [String] id Object identifier of the vDC storage profile. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClassMetadata.html def get_vdc_storage_class_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}/metadata/" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/post_enter_maintenance_mode.rb0000644000004100000410000000156712600047642030530 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Place the vApp in maintenance mode. # # When a vApp is in maintenance mode, it is read-only to users. Only a # system administrator can modify it. User-initiated tasks that are # running when the vApp enters maintenance mode continue to run. # # @param [String] id Object identifier of the vApp. # @return [Excon::Response] # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnterMaintenanceMode.html # @since vCloud API version 1.5 def post_enter_maintenance_mode(id) request( :expects => 204, :method => 'POST', :path => "vApp/#{id}/action/enterMaintenanceMode" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/put_vapp_template_metadata_item_metadata.rb0000644000004100000410000000356212600047642033244 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the vApp template. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VAppTemplateMetadataItem-metadata.html # @since vCloud API version 1.5 def put_vapp_template_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vappTemplate/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/delete_catalog_item_metadata_item_metadata.rb0000644000004100000410000000153712600047642033465 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Delete the specified key and its value from catalog item metadata. # # @param [String] id Object identifier of the catalog item. # @param [String] key Key of the metadata item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-CatalogItemMetadataItem-metadata.html # @since vCloud API version 1.5 def delete_catalog_item_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/requests/compute/get_catalog_item.rb0000644000004100000410000000132412600047642026256 0ustar www-datawww-datamodule Fog module Compute class VcloudDirector class Real # Retrieve a catalog item. # # @param [String] id Object identifier of the catalog item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItem.html # @since vCloud API version 0.9 def get_catalog_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}" ) end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/0000755000004100000410000000000012600047642020572 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/parsers/compute/0000755000004100000410000000000012600047642022246 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/parsers/compute/metadata.rb0000644000004100000410000000661012600047642024356 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector # # # # # # # # # buenas si # no tanto ya # # # # # # hola # adios # # # # {:metadata=>{"buenas si"=>"no tanto ya", "hola"=>"adios"}, # :type=>"application/vnd.vmware.vcloud.metadata+xml", # :href=> # "https://example.com/api/vApp/vm-18545e82-d919-4071-ae7e-d1300d9d8112/metadata", # :id=>"vm-18545e82-d919-4071-ae7e-d1300d9d8112"} # class Metadata < VcloudDirectorParser def reset @response = { :metadata => {} } end def start_element(name, attributes) super case name when 'Metadata' metadata = extract_attributes(attributes) @response[:type] = metadata[:type] @response[:href] = metadata[:href] @response[:id] = @response[:href].split('/')[-2] end end def end_element(name) case name when 'Key' @key = value when 'Value' @val = value when 'MetadataEntry' @response[:metadata].merge!(Hash[@key, @val]) end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/network.rb0000644000004100000410000001103512600047642024264 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector # #{:xmlns=>"http://www.vmware.com/vcloud/v1.5", # :xmlns_xsi=>"http://www.w3.org/2001/XMLSchema-instance", # :name=>"DevOps - Dev Network Connection", # :id=>"urn:vcloud:network:d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", # :type=>"application/vnd.vmware.vcloud.orgNetwork+xml", # :href=> # "https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", # :xsi_schemaLocation=> # "http://www.vmware.com/vcloud/v1.5 http://10.194.1.65/api/v1.5/schema/master.xsd", # :Link=> # [{:rel=>"up", # :type=>"application/vnd.vmware.vcloud.org+xml", # :name=>"DevOps", # :href=> # "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a"}, # {:rel=>"down", # :type=>"application/vnd.vmware.vcloud.metadata+xml", # :href=> # "https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17/metadata"}], # :Description=>"", # :Configuration=> # {:IpScope=> # {:IsInherited=>"true", # :Gateway=>"10.192.0.1", # :Netmask=>"255.255.252.0", # :Dns1=>"10.192.0.11", # :Dns2=>"10.192.0.12", # :DnsSuffix=>"dev.ad.mdsol.com", # :IpRanges=> # {:IpRange=> # {:StartAddress=>"10.192.0.100", :EndAddress=>"10.192.3.254"}}}, # :FenceMode=>"bridged", # :RetainNetInfoAcrossDeployments=>"false"}} # # # # # # # # # true # 10.192.0.1 # 255.255.252.0 # 10.192.0.11 # 10.192.0.12 # dev.ad.mdsol.com # # # 10.192.0.100 # 10.192.3.254 # # # # bridged # false # # # class Network < VcloudDirectorParser def reset @response = { :ip_ranges => [] } @ip_range = {} end def start_element(name, attributes) super case name when 'OrgNetwork', 'OrgVdcNetwork' # OrgVdcNetwork belongs to 5.1 network = extract_attributes(attributes) @response.merge!(network.reject {|key,value| ![:href, :name, :type].include?(key)}) @response[:id] = @response[:href].split('/').last when 'Description', @response[:description] = value end end def end_element(name) case name when 'IsInherited' @response[:is_inherited] = (value == "true") when 'Gateway', 'Netmask', 'Dns1', 'Dns2' @response[name.downcase.to_sym] = value when 'DnsSuffix' @response[:dns_suffix] = value when 'StartAddress' @ip_range[:start_address] = value when 'EndAddress' @ip_range[:end_address] = value when 'IpRange' @response[:ip_ranges] << @ip_range @ip_range = {} end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/vms_by_metadata.rb0000644000004100000410000000275612600047642025744 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector class VmsByMetadata < VcloudDirectorParser def reset @response = { :vm_records => [] } end def start_element(name, attributes) super case name when 'QueryResultRecords' results = extract_attributes(attributes) @response[:type] = results[:type] @response[:href] = results[:href] @response[:total] = results[:total].to_i # href "https://devlab.mdsol.com/api/vms/query?page=1&pageSize=25&format=records&filter=metadata:unoo==STRING:janderr&fields=name,containerName" key = @response[:href].scan(/filter=metadata:(.*)==STRING/).flatten.first value = @response[:href].scan(/STRING:(.*)&?/).flatten.first @response[:id] = "#{key}:#{value}" when 'VMRecord' results = extract_attributes(attributes) results[:id] = results[:href].split('/').last results[:vapp_name] = results.delete(:containerName) results[:vapp_id] = results.delete(:container).split('/').last results[:cpu] = results.delete(:numberOfCpus) results[:memory] = results.delete(:memoryMB) results[:type] = "application/vnd.vmware.vcloud.vm+xml" @response[:vm_records] << results end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/vm_customization.rb0000644000004100000410000000375212600047642026214 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector class VmCustomization < VcloudDirectorParser def reset @response = { } end def start_element(name, attributes) super case name when 'GuestCustomizationSection' customizations = extract_attributes(attributes) @response[:href] = customizations[:href] @response[:type] = customizations[:type] # href looks like this: # "https://example.com/api/vApp/vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64/guestCustomizationSection/" @response[:id] = @response[:href].split('/')[-2] end end def end_element(name) case name when 'Enabled' @response[:enabled] = (value == "true") when 'ChangeSid' @response[:change_sid] = (value == "true") when 'JoinDomainEnabled' @response[:join_domain_enabled] = (value == "true") when 'UseOrgSettings' @response[:use_org_settings] = (value == "true") when 'AdminPassword' @response[:admin_password] = value when 'AdminPasswordEnabled' @response[:admin_password_enabled] = (value == "true") when 'AdminPasswordAuto' @response[:admin_password_auto] = (value == "true") when 'ResetPasswordRequired' @response[:reset_password_required] = (value == "true") when 'VirtualMachineId' @response[:virtual_machine_id] = value when 'ComputerName' @response[:computer_name] = value when 'CustomizationScript' @response[:has_customization_script] = !value.empty? @response[:customization_script] = CGI::unescapeHTML(value) if @response[:has_customization_script] end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/vm_network.rb0000644000004100000410000001145412600047642024773 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector # #{:xmlns=>"http://www.vmware.com/vcloud/v1.5", # :xmlns_xsi=>"http://www.w3.org/2001/XMLSchema-instance", # :name=>"DevOps - Dev Network Connection", # :id=>"urn:vcloud:network:d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", # :type=>"application/vnd.vmware.vcloud.orgNetwork+xml", # :href=> # "https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", # :xsi_schemaLocation=> # "http://www.vmware.com/vcloud/v1.5 http://10.194.1.65/api/v1.5/schema/master.xsd", # :Link=> # [{:rel=>"up", # :type=>"application/vnd.vmware.vcloud.org+xml", # :name=>"DevOps", # :href=> # "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a"}, # {:rel=>"down", # :type=>"application/vnd.vmware.vcloud.metadata+xml", # :href=> # "https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17/metadata"}], # :Description=>"", # :Configuration=> # {:IpScope=> # {:IsInherited=>"true", # :Gateway=>"10.192.0.1", # :Netmask=>"255.255.252.0", # :Dns1=>"10.192.0.11", # :Dns2=>"10.192.0.12", # :DnsSuffix=>"dev.ad.mdsol.com", # :IpRanges=> # {:IpRange=> # {:StartAddress=>"10.192.0.100", :EndAddress=>"10.192.3.254"}}}, # :FenceMode=>"bridged", # :RetainNetInfoAcrossDeployments=>"false"}} # # # # # # # # # true # 10.192.0.1 # 255.255.252.0 # 10.192.0.11 # 10.192.0.12 # dev.ad.mdsol.com # # # 10.192.0.100 # 10.192.3.254 # # # # bridged # false # # # class VmNetwork < VcloudDirectorParser def reset @response = { } end def start_element(name, attributes) super case name when 'NetworkConnectionSection' network_connection_section = extract_attributes(attributes) @response[:type] = network_connection_section[:type] @response[:href] = network_connection_section[:href] @response[:id] = @response[:href].split('/')[-2] when 'NetworkConnection' network_connection = extract_attributes(attributes) @response[:network] = network_connection[:network] @response[:needs_customization] = ( network_connection[:needsCustomization] == "true" ) end end def end_element(name) case name when 'Info' @response[:info] = value when 'PrimaryNetworkConnectionIndex' @response[:primary_network_connection_index] = value.to_i when 'NetworkConnectionIndex' @response[:network_connection_index] = value.to_i when 'IpAddress' @response[:ip_address] = value when 'IsConnected' @response[:is_connected] = (value == "true") when 'MACAddress' @response[:mac_address] = value when 'IpAddressAllocationMode' @response[:ip_address_allocation_mode] = value end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/vm.rb0000644000004100000410000000453012600047642023217 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector class Vm < VcloudDirectorParser def reset @in_operating_system = false @in_children = false @resource_type = nil @response = { :vm => { :ip_address => '' } } @links = [] end def start_element(name, attributes) super case name when 'OperatingSystemSection' @in_operating_system = true when 'Vm' vm_attrs = extract_attributes(attributes) @response[:vm].merge!(vm_attrs.reject {|key,value| ![:href, :name, :status, :type].include?(key)}) @response[:vm][:id] = @response[:vm][:href].split('/').last @response[:vm][:status] = human_status(@response[:vm][:status]) when 'HostResource' @current_host_resource = extract_attributes(attributes) when 'Link' @links << extract_attributes(attributes) end end def end_element(name) case name when 'IpAddress' @response[:vm][:ip_address] = value when 'Description' if @in_operating_system @response[:vm][:operating_system] = value @in_operating_system = false end when 'ResourceType' @resource_type = value when 'VirtualQuantity' case @resource_type when '3' @response[:vm][:cpu] = value when '4' @response[:vm][:memory] = value end when 'ElementName' @element_name = value when 'Item' if @resource_type == '17' # disk @response[:vm][:disks] ||= [] @response[:vm][:disks] << { @element_name => @current_host_resource[:capacity].to_i } end when 'Link' @response[:vm][:links] = @links end end def human_status(status) case status when '0', 0 'creating' when '8', 8 'off' when '4', 4 'on' else 'unknown' end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/disks.rb0000644000004100000410000000302312600047642023706 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector class Disks < VcloudDirectorParser def reset @disk = {} @response = { :disks => [] } @host_resource = nil end def start_element(name, attributes) super case name when 'HostResource' @host_resource = extract_attributes(attributes) end end def end_element(name) case name when 'Address' @disk[:address] = value.to_i when 'AddressOnParent' @disk[:address_on_parent] = value.to_i when 'Description' @disk[:description] = value when 'ElementName' @disk[:name] = value when 'InstanceID' @disk[:id] = value.to_i when 'ResourceSubType' @disk[:resource_sub_type] = value when 'Parent' @disk[:parent] = value.to_i when 'ResourceType' @disk[:resource_type] = value.to_i when 'Item' if @host_resource @disk[:capacity] = @host_resource[:capacity].to_i @disk[:bus_sub_type] = @host_resource[:busSubType] @disk[:bus_type] = @host_resource[:busType].to_i end @response[:disks] << @disk @host_resource = nil @disk = {} end end end end end end end fog-1.34.0/lib/fog/vcloud_director/parsers/compute/vms.rb0000644000004100000410000000546412600047642023411 0ustar www-datawww-datamodule Fog module Parsers module Compute module VcloudDirector class Vms < VcloudDirectorParser def reset @vm = { :ip_address => '' } @in_operating_system = false @in_children = false @resource_type = nil @response = { :vms => [] } @links = [] end def start_element(name, attributes) super case name when 'OperatingSystemSection' @in_operating_system = true when 'VApp' vapp = extract_attributes(attributes) @response.merge!(vapp.reject {|key,value| ![:href, :name, :size, :status, :type].include?(key)}) @response[:id] = @response[:href].split('/').last when 'Vm' vapp = extract_attributes(attributes) @vm.merge!(vapp.reject {|key,value| ![:href, :name, :status, :type].include?(key)}) @vm[:id] = @vm[:href].split('/').last @vm[:vapp_id] = @response[:id] @vm[:vapp_name] = @response[:name] @vm[:status] = human_status(@vm[:status]) when 'Children' @in_children = true when 'HostResource' @current_host_resource = extract_attributes(attributes) when 'Link' @links << extract_attributes(attributes) end end def end_element(name) if @in_children case name when 'IpAddress' @vm[:ip_address] = value when 'Description' if @in_operating_system @vm[:operating_system] = value @in_operating_system = false end when 'ResourceType' @resource_type = value when 'VirtualQuantity' case @resource_type when '3' @vm[:cpu] = value when '4' @vm[:memory] = value end when 'ElementName' @element_name = value when 'Item' if @resource_type == '17' # disk @vm[:disks] ||= [] @vm[:disks] << { @element_name => @current_host_resource[:capacity].to_i } end when 'Link' @vm[:links] = @links when 'Vm' @response[:vms] << @vm @vm = {} end end end def human_status(status) case status when '0', 0 'creating' when '8', 8 'off' when '4', 4 'on' else 'unknown' end end end end end end end fog-1.34.0/lib/fog/vcloud_director/query.rb0000644000004100000410000000335012600047642020606 0ustar www-datawww-datarequire 'pp' module Fog module VcloudDirector module Query def find_by_query(options={}) type = options.fetch(:type) { self.query_type } results = get_all_results(type, options) data = results.map do |query_record| model_data = {} model_data[:id] = query_record[:href].split('/').last model_data[:name] = query_record.fetch(:name) if query_record.key?(:name) if self.methods.include?(:populate_model_from_query_record) model_data.merge(self.populate_model_from_query_record(query_record)) else model_data end end load(data) end private def get_all_results(type, options) results = [] if options.key?(:page) page_range = [ Integer(options[:page]) ] else page_range = (1..get_num_pages(type, options)) end page_range.each do |page| results += get_results_page(page, type, options) || [] end results end def get_num_pages(type, options) body = service.get_execute_query(type, options) last_page = body[:lastPage] || 1 raise "Invalid lastPage (#{last_page}) in query results" unless last_page.is_a? Integer last_page.to_i end def get_results_page(page, type, options) body = service.get_execute_query(type, options.merge({:page=>page})).body record_key = key_of_first_record_or_reference(body) body[record_key] = [body[record_key]] if body[record_key].is_a?(Hash) body[record_key] end def key_of_first_record_or_reference(body) body.keys.detect { |key| key.to_s =~ /Record|Reference$/ } end end end end fog-1.34.0/lib/fog/vcloud_director/generators/0000755000004100000410000000000012600047642021264 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/generators/compute/0000755000004100000410000000000012600047642022740 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/generators/compute/metadata.rb0000644000004100000410000000643712600047642025057 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # {:metadata=> # {"buenas si"=>"no tanto ya", # "hola"=>"adios"}, # :type=>"application/vnd.vmware.vcloud.metadata+xml", # :href=> # "https://example.com/api/vApp/vm-18545e82-d919-4071-ae7e-d1300d9d8112/metadata", # :id=>"vm-18545e82-d919-4071-ae7e-d1300d9d8112"} # # This is what it generates: # # # # buenas si # no tanto ya # # # hola # adios # # # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/MetadataType.html class MetadataBase attr_reader :attrs def initialize(attrs={}) @attrs = attrs end def generate_xml output = "" output << header attrs[:metadata].each_pair do |k,v| output << metadata_entry(k,v) end output << tail output end def add_item(k,v) @attrs[:metadata].merge!(Hash[k,v]) end # 1.5 def header <<-END END end def metadata_entry raise "This is an abstract class. Use the appropriate subclass" end # 5.1 #def header # '' #end def tail <<-END END end end class MetadataV51 < MetadataBase def metadata_entry(key, value) <<-END #{key} #{value} END end end class MetadataV15 < MetadataBase def metadata_entry(key, value) <<-END #{key} #{value} END end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/vm_network.rb0000644000004100000410000001135212600047642025462 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # This is the data structure it accepts, this is the output of # #get_vm_network # # {:type=>"application/vnd.vmware.vcloud.networkConnectionSection+xml", # :href=> # "https://example.com/api/vApp/vm-8b74d95a-ee91-4f46-88d8-fc92be0dbaae/networkConnectionSection/", # :id=>"vm-8b74d95a-ee91-4f46-88d8-fc92be0dbaae", # :primary_network_connection_index=>0, # :network=>"DevOps - Dev Network Connection", # :needs_customization=>true, # :network_connection_index=>0, # :ip_address=>"10.192.0.130", # :is_connected=>true, # :mac_address=>"00:50:56:01:00:8d", # :ip_address_allocation_mode=>"POOL"} # # This is what it generates: # # # Specifies the available VM network connections # 0 # # 0 # 10.192.0.130 # true # 00:50:56:01:00:8d # POOL # # # # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/NetworkConnectionSectionType.html class VmNetwork attr_reader :attrs def initialize(attrs={}) @attrs = attrs end def generate_xml output = "" output << header output << body(@attrs) output << tail output end def network @attrs[:network] end def network=(new_network_name) @attrs[:network] = new_network_name end def ip_address @attrs[:ip_address] end def ip_address=(new_ip_address) @attrs[:ip_address] = new_ip_address end def is_connected @attrs[:is_connected] end def is_connected=(new_is_connected) @attrs[:is_connected] = new_is_connected end def ip_address_allocation_mode @attrs[:ip_address_allocation_mode] end def ip_address_allocation_mode=(new_ip_address_allocation_mode) @attrs[:ip_address_allocation_mode] = new_ip_address_allocation_mode end private def header <<-END END end def body(opts={}) <<-END #{opts[:info]} #{opts[:primary_network_connection_index]} #{opts[:network_connection_index]} #{opts[:ip_address]} #{opts[:is_connected]} #{opts[:mac_address]} #{opts[:ip_address_allocation_mode]} END end def tail <<-END END end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb0000644000004100000410000000730412600047642026465 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/OrgVdcNetworkType.html class OrgVdcNetwork attr_reader :options def initialize(options={}) @options = options end def generate_xml body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => options[:name] } OrgVdcNetwork(attrs) { Description options[:Description] if options.key?(:Description) if configuration = options[:Configuration] Configuration { if ip_scopes = configuration[:IpScopes] IpScopes { if ip_scope = ip_scopes[:IpScope] IpScope { IsInherited ip_scope[:IsInherited] if ip_scope.key?(:IsInherited) Gateway ip_scope[:Gateway] if ip_scope.key?(:Gateway) Netmask ip_scope[:Netmask] if ip_scope.key?(:Netmask) Dns1 ip_scope[:Dns1] if ip_scope.key?(:Dns1) Dns2 ip_scope[:Dns2] if ip_scope.key?(:Dns2) DnsSuffix ip_scope[:DnsSuffix] if ip_scope.key?(:DnsSuffix) IsEnabled ip_scope[:IsEnabled] if ip_scope.key?(:IsEnabled) if ip_ranges = ip_scope[:IpRanges] IpRanges { ip_ranges.each do |h| if h.key?(:IpRange) IpRange { StartAddress h[:IpRange][:StartAddress] EndAddress h[:IpRange][:EndAddress] } end end } end } end } end FenceMode configuration[:FenceMode] if router_info = configuration[:RouterInfo] RouterInfoType { ExternalIp router_info[:ExternalIp] } end } end # Configuration if edgegw = options[:EdgeGateway] and configuration[:FenceMode] != 'isolated' EdgeGateway(edgegw) elsif options[:Configuration] && options[:Configuration][:FenceMode] == 'isolated' # isolated networks can specify ServiceConfig if sc = options[:ServiceConfig] ServiceConfig { if dhcp = sc[:GatewayDhcpService] IsEnabled dhcp[:IsEnabled] if dhcp[:IsEnabled] if pool = dhcp[:Pool] IsEnabled pool[:IsEnabled] DefaultLeaseTime pool[:DefaultLeaseTime] MaxLeaseTime pool[:MaxLeaseTime] LowIpAddress pool[:LowIpAddress] HighIpAddress pool[:HighIpAddress] end end } end end IsShared options[:IsShared] if options.key?(:IsShared) } end.to_xml end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/vm.rb0000644000004100000410000000174612600047642023717 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/VmType.html class Vm attr_reader :attrs def initialize(attrs={}) @attrs = attrs end def generate_xml attrs = @attrs Nokogiri::XML::Builder.new do Vm('xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'name' => attrs[:name]) { Description attrs[:Description] if attrs.key?(:Description) if attrs.key?(:StorageProfile) StorageProfile( 'type' => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', 'name' => attrs[:StorageProfile][:name], 'href' => attrs[:StorageProfile][:href] ) end } end.to_xml end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb0000644000004100000410000002462212600047642032367 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector class EdgeGatewayServiceConfiguration def initialize(configuration={}) @configuration = configuration end def generate_xml Nokogiri::XML::Builder.new do |xml| xml.EdgeGatewayServiceConfiguration('xmlns' => "http://www.vmware.com/vcloud/v1.5"){ build_firewall_service(xml) build_nat_service(xml) build_load_balancer_service(xml) build_vpn(xml) build_dhcp(xml) build_static_routing_service(xml) } end.to_xml end private def build_dhcp(xml) dhcp_config = @configuration[:GatewayDhcpService] return unless dhcp_config xml.GatewayDhcpService { xml.IsEnabled dhcp_config[:IsEnabled] if dhcp_config.key?(:IsEnabled) dhcp_config[:pools].each do |pool| xml.Pool { xml.IsEnabled pool[:IsEnabled] xml.Network pool[:Network] xml.DefaultLeaseTime pool[:DefaultLeaseTime] xml.MaxLeaseTime pool[:MaxLeaseTime] xml.LowIpAddress pool[:LowIpAddress] xml.HighIpAddress pool[:HighIpAddress] } end } end def build_vpn(xml) vpn_config = @configuration[:GatewayIpsecVpnService] return unless vpn_config xml.GatewayIpsecVpnService { xml.IsEnabled vpn_config[:IsEnabled] if vpn_config.key?(:IsEnabled) vpn_config[:Tunnel].each do |tunnel_config| xml.Tunnel { xml.Name tunnel_config[:Name] xml.Description tunnel_config[:Description] xml.IpsecVpnLocalPeer { xml.Id tunnel_config[:IpsecVpnLocalPeerId] xml.Name tunnel_config[:IpsecVpnLocalPeerName] } xml.PeerIpAddress tunnel_config[:PeerIpAddress] xml.PeerId tunnel_config[:PeerId] xml.LocalIpAddress tunnel_config[:LocalIpAddress] xml.LocalId tunnel_config[:LocalId] tunnel_config[:LocalSubnet].each do |subnet| xml.LocalSubnet { xml.Name subnet[:Name] xml.Gateway subnet[:Gateway] xml.Netmask subnet[:Netmask] } end tunnel_config[:PeerSubnet].each do |subnet| xml.PeerSubnet { xml.Name subnet[:Name] xml.Gateway subnet[:Gateway] xml.Netmask subnet[:Netmask] } end xml.SharedSecret tunnel_config[:SharedSecret] xml.SharedSecretEncrypted tunnel_config[:SharedSecretEncrypted] if tunnel_config.key?(:SharedSecretEncrypted) xml.EncryptionProtocol tunnel_config[:EncryptionProtocol] xml.Mtu tunnel_config[:Mtu] xml.IsEnabled tunnel_config[:IsEnabled] } end } end def build_load_balancer_service(xml) lb_config = @configuration[:LoadBalancerService] return unless lb_config xml.LoadBalancerService { xml.IsEnabled lb_config[:IsEnabled] if lb_config.key?(:IsEnabled) lb_config[:Pool].each do |pool| xml.Pool { xml.Name pool[:Name] xml.Description pool[:Description] if pool.key?(:Description) pool[:ServicePort].each do |service_port| xml.ServicePort { xml.IsEnabled service_port[:IsEnabled] xml.Protocol service_port[:Protocol] xml.Algorithm service_port[:Algorithm] xml.Port service_port[:Port] xml.HealthCheckPort service_port[:HealthCheckPort] xml.HealthCheck { xml.Mode service_port[:HealthCheck][:Mode] xml.Uri service_port[:HealthCheck][:Uri] xml.HealthThreshold service_port[:HealthCheck][:HealthThreshold] xml.UnhealthThreshold service_port[:HealthCheck][:UnhealthThreshold] xml.Interval service_port[:HealthCheck][:Interval] xml.Timeout service_port[:HealthCheck][:Timeout] } } end pool[:Member].each do |member| xml.Member { xml.IpAddress member[:IpAddress] xml.Weight member[:Weight] member[:ServicePort].each do |member_service_port| xml.ServicePort { xml.Protocol member_service_port[:Protocol] xml.Port member_service_port[:Port] xml.HealthCheckPort member_service_port[:HealthCheckPort] } end } end } end lb_config[:VirtualServer].each do |virtual_server| xml.VirtualServer { xml.IsEnabled virtual_server[:IsEnabled] xml.Name virtual_server[:Name] xml.Description virtual_server[:Description] xml.Interface(:href => virtual_server[:Interface][:href], :name => virtual_server[:Interface][:name]) xml.IpAddress virtual_server[:IpAddress] virtual_server[:ServiceProfile].each do |service_profile| xml.ServiceProfile { xml.IsEnabled service_profile[:IsEnabled] xml.Protocol service_profile[:Protocol] xml.Port service_profile[:Port] xml.Persistence { xml.Method service_profile[:Persistence][:Method] if service_profile[:Persistence][:Method] == 'COOKIE' xml.CookieName service_profile[:Persistence][:CookieName] xml.CookieMode service_profile[:Persistence][:CookieMode] end } } end xml.Logging virtual_server[:Logging] xml.Pool virtual_server[:Pool] } end } end def build_nat_service(xml) nat_config = @configuration[:NatService] return unless nat_config xml.NatService { xml.IsEnabled nat_config[:IsEnabled] nat_config[:NatRule].each do |rule| xml.NatRule { xml.RuleType rule[:RuleType] xml.IsEnabled rule[:IsEnabled] xml.Id rule[:Id] gateway_nat_rule = rule[:GatewayNatRule] xml.GatewayNatRule { xml.Interface(:name => gateway_nat_rule[:Interface][:name], :href => gateway_nat_rule[:Interface][:href]) xml.OriginalIp gateway_nat_rule[:OriginalIp] xml.OriginalPort gateway_nat_rule[:OriginalPort] if gateway_nat_rule.key?(:OriginalPort) xml.TranslatedIp gateway_nat_rule[:TranslatedIp] xml.TranslatedPort gateway_nat_rule[:TranslatedPort] if gateway_nat_rule.key?(:TranslatedPort) xml.Protocol gateway_nat_rule[:Protocol] if rule[:RuleType] == "DNAT" } } end } end def build_static_routing_service(xml) routing_config = @configuration[:StaticRoutingService] return unless routing_config xml.StaticRoutingService { xml.IsEnabled routing_config[:IsEnabled] routing_config[:StaticRoute].each do |rule| xml.StaticRoute{ xml.Name rule[:Name] xml.Network rule[:Network] xml.NextHopIp rule[:NextHopIp] xml.GatewayInterface( :type => rule[:GatewayInterface][:type], :name => rule[:GatewayInterface][:name], :href => rule[:GatewayInterface][:href] ) } end } end def build_firewall_service(xml) firewall_config = @configuration[:FirewallService] return unless firewall_config xml.FirewallService { xml.IsEnabled firewall_config[:IsEnabled] xml.DefaultAction firewall_config[:DefaultAction] if firewall_config.key?(:DefaultAction) xml.LogDefaultAction firewall_config[:LogDefaultAction] if firewall_config.key?(:LogDefaultAction) firewall_config[:FirewallRule].each do |rule| xml.FirewallRule { xml.Id rule[:Id] xml.IsEnabled rule[:IsEnabled] if rule.key?(:IsEnabled) xml.MatchOnTranslate rule[:MatchOnTranslate] if rule.key?(:MatchOnTranslate) xml.Description rule[:Description] if rule.key?(:Description) xml.Policy rule[:Policy] if rule.key?(:Policy) xml.Protocols { rule[:Protocols].each do |key, value| xml.send(key.to_s.capitalize, value) end } xml.IcmpSubType rule[:IcmpSubType] if rule.key?(:IcmpSubType) xml.Port rule[:Port] if rule.key?(:Port) xml.DestinationPortRange rule[:DestinationPortRange] xml.DestinationIp rule[:DestinationIp] xml.SourcePort rule[:SourcePort] if rule.key?(:SourcePort) xml.SourcePortRange rule[:SourcePortRange] xml.SourceIp rule[:SourceIp] xml.Direction rule[:Direction] if rule.key?(:Direction) #Firewall rule direction is allowed only in backward compatibility mode. xml.EnableLogging rule[:EnableLogging] if rule.key?(:EnableLogging) } end } end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/disks.rb0000644000004100000410000001611012600047642024401 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # This is the data structure it accepts, this is the output of # #get_vm_disks: # # {:disks=> # [{:address=>0, # :description=>"SCSI Controller", # :name=>"SCSI Controller 0", # :id=>2, # :resource_sub_type=>"VirtualSCSI", # :resource_type=>6}, # {:address_on_parent=>0, # :description=>"Hard disk", # :name=>"Hard disk 1", # :id=>2000, # :parent=>2, # :resource_type=>17, # :capacity=>16384, # :bus_sub_type=>"VirtualSCSI", # :bus_type=>6}, # {:address=>0, # :description=>"IDE Controller", # :name=>"IDE Controller 0", # :id=>3, # :resource_type=>5}]} # # This is what it generates: # # # # 0 # SCSI Controller # SCSI Controller 0 # 2 # VirtualSCSI # 6 # # # 0 # Hard disk # Hard disk 1 # # 2000 # 2 # 17 # # # 0 # IDE Controller # IDE Controller 0 # 3 # 5 # # # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/RasdItemsListType.html class Disks def initialize(items=[]) @items = items[:disks] end def modify_hard_disk_size(disk_number, new_size) found = false @items.each do |item| if item[:resource_type] == 17 if item[:name] == "Hard disk #{disk_number}" found = true raise "Hard disk size can't be reduced" if item[:capacity].to_i > new_size.to_i item[:capacity] = new_size end end end raise "Hard disk #{disk_number} not found" unless found true end def add_hard_disk(size) new_hard_disk = last_hard_disk.dup new_hard_disk[:capacity] = size new_hard_disk[:name] = increase_hard_disk_name(new_hard_disk[:name]) new_hard_disk[:address_on_parent] += 1 new_hard_disk[:id] += 1 @items << new_hard_disk end def delete_hard_disk(disk_number) @items.delete_if {|item| item[:resource_type] == 17 && item[:name] =~ /#{disk_number}$/ } end def disks { :disks => @items } end def generate_xml output = "" output << header @items.each do |item| output << case item[:resource_type] when 6 scsi_controller(item) when 17 hard_disk_item(item) when 5 ide_controller_item(item) end end output << tail output end def header <<-END END end def tail <<-END END end def hard_disk_item(opts={}) <<-END #{opts[:address_on_parent]} #{opts[:description]} #{opts[:name]} #{opts[:id]} #{opts[:parent]} 17 END end def ide_controller_item(opts={}) <<-END #{opts[:address]} #{opts[:description]} #{opts[:name]} #{opts[:id]} 5 END end def scsi_controller(opts={}) <<-END #{opts[:address]} #{opts[:description]} #{opts[:name]} #{opts[:id]} #{opts[:resource_sub_type]} 6 END end # helpers def last_hard_disk hard_disks = @items.select{|item| item[:resource_type] == 17} names = hard_disks.map{|item| item[:name] } only_numbers = names.map{|b| b.scan(/\d+/).first.to_i} # extract numbers last_number = only_numbers.sort.last # get the last number hard_disks.find{|hard_disk| hard_disk[:name] =~ /#{last_number}$/ } end def increase_hard_disk_name(hard_disk_name) hard_disk_name.gsub(/(\d+)$/) { $1.to_i + 1 } end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/vapp.rb0000644000004100000410000000136412600047642024237 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/VAppType.html class Vapp attr_reader :name, :options def initialize(name, options={}) @name = name @options = options end def generate_xml attrs = @attrs Nokogiri::XML::Builder.new do VApp('xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'name' => name ) { Description options[:Description] if options.key?(:Description) } end.to_xml end end end end end end fog-1.34.0/lib/fog/vcloud_director/generators/compute/customization.rb0000644000004100000410000001102412600047642026173 0ustar www-datawww-datamodule Fog module Generators module Compute module VcloudDirector # This is the data structure it accepts, this is the output of # #get_vm_customization: # # {:type=>"application/vnd.vmware.vcloud.guestCustomizationSection+xml", # :href=> # "https://example.com/api/vApp/vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64/guestCustomizationSection/", # :id=>"vm-2bbbf556-55dc-4974-82e6-aa6e814f0b64", # :enabled=>false, # :change_sid=>false, # :virtual_machine_id=>"2bbbf556-55dc-4974-82e6-aa6e814f0b64", # :join_domain_enabled=>false, # :use_org_settings=>false, # :admin_password_enabled=>false, # :admin_password_auto=>true, # :reset_password_required=>false, # :customization_script=>"hola\nmundo", # :has_customization_script=>true, # :computer_name=>"DEVWEB-001"} # # This is what it generates: # # # Specifies Guest OS Customization Settings # true # true # 55cc91f2-7e12-48d4-ad90-6f637a51fd88 # false # false # true # true # false # DEVWEB-001 # # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/GuestCustomizationSectionType.html class Customization def initialize(attrs={}) @attrs = attrs end def generate_xml output = "" output << header output << body(@attrs) output << tail output end private def header <<-END END end # The order matters: http://communities.vmware.com/thread/448760?start=0&tstart=0 # # CustomizationScript: Script to run on guest customization. You # could use XML escape sequence to make multiple lines script. # The script could contain any UNICODE symbol by specifying its # number in format &#xxxx; where xxxx is the number. The predefined # symbols in the XML are: # * & & # * < < # * > > # * " " # * ' ' def body(opts={}) <<-END Specifies Guest OS Customization Settings #{opts[:enabled]} #{opts[:change_sid]} #{opts[:virtual_machine_id]} #{opts[:join_domain_enabled]} #{opts[:use_org_settings]} #{opts[:admin_password_enabled]} #{opts[:admin_password_auto]} #{opts[:reset_password_required]} #{CGI::escapeHTML(opts[:customization_script]).gsub(/\r/, " ")} #{opts[:computer_name]} END end def tail <<-END END end end end end end end fog-1.34.0/lib/fog/vcloud_director/core.rb0000644000004100000410000000477512600047642020405 0ustar www-datawww-datarequire 'fog/core' require 'fog/xml' module Fog module VcloudDirector extend Fog::Provider module Errors class ServiceError < Fog::Errors::Error attr_reader :minor_error_code attr_reader :major_error_code attr_reader :stack_trace attr_reader :status_code attr_reader :vendor_specific_error_code def self.slurp(error, service=nil) major_error_code = nil message = nil minor_error_code = nil stack_trace = nil status_code = nil vendor_specific_error_code = nil if error.response status_code = error.response.status unless error.response.body.empty? _, media_type = error.response.headers.find {|k,v| k.downcase == 'content-type'} if media_type =~ /vnd\.vmware\.vcloud\.error\+xml/i begin document = Fog::ToHashDocument.new Nokogiri::XML::SAX::Parser.new(document).parse_memory(error.response.body) major_error_code = document.body[:majorErrorCode] message = document.body[:message] minor_error_code = document.body[:minorErrorCode] stack_trace = document.body[:stackTrace] vendor_specific_error_code = document.body[:vendorSpecificErrorCode] rescue => e Fog::Logger.warning("Received exception '#{e}' while decoding>> #{error.response.body}") message = error.response.body end else message = CGI::unescapeHTML(error.response.body) end end end new_error = super(error, message) new_error.instance_variable_set(:@major_error_code, major_error_code) new_error.instance_variable_set(:@minor_error_code, minor_error_code) new_error.instance_variable_set(:@stack_trace, stack_trace) new_error.instance_variable_set(:@status_code, status_code) new_error.instance_variable_set(:@vendor_specific_error_code, vendor_specific_error_code) new_error end end class BadRequest < ServiceError; end class Unauthorized < ServiceError; end class Forbidden < ServiceError; end class Conflict < ServiceError; end class MalformedResponse < ServiceError; end class DuplicateName < ServiceError; end class TaskError < ServiceError; end end service(:compute, 'Compute') end end fog-1.34.0/lib/fog/vcloud_director/models/0000755000004100000410000000000012600047642020376 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/models/compute/0000755000004100000410000000000012600047642022052 5ustar www-datawww-datafog-1.34.0/lib/fog/vcloud_director/models/compute/media.rb0000644000004100000410000000113312600047642023454 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Media < Model identity :id attribute :href attribute :type attribute :name attribute :status, :type => :integer attribute :image_type, :aliases => :imageType attribute :size, :type => :integer attribute :description, :aliases => :Description # @return [Boolean] def destroy requires :id response = service.delete_media(id) service.process_task(response.body) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/task.rb0000644000004100000410000000340712600047642023345 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Task < Fog::Model identity :id attribute :href attribute :type attribute :name attribute :end_time, :aliases => :endTime, :type => :time attribute :expiry_time, :aliases => :expiryTime, :type => :time attribute :operation attribute :operation_name, :aliases => :operationName attribute :start_time, :aliases => :startTime, :type => :time attribute :status attribute :description, :aliases => :Description attribute :error, :aliases => :Error attribute :progress, :aliases => :Progress, :type => :integer # Since 5.1 attribute :operation_key, :aliases => :operationKey attribute :cancel_requested, :aliases => :cancelRequested, :type => :boolean attribute :service_namespace, :aliases => :serviceNamespace attribute :details, :aliases => :Details def ready? status == 'success' end def success? status == 'success' end def non_running? if @service.show_progress? && (@last_progress ||= 0) < 100 if status == 'running' || status == 'queued' Fog::Formatador.redisplay_progressbar(progress, 100, :label => operation_name, :started_at => start_time) @last_progress = progress elsif status == 'success' Fog::Formatador.redisplay_progressbar(100, 100, :label => operation_name, :started_at => start_time) @last_progress = 100 end end ! %w(running queued).include?(status) end def cancel service.post_cancel_task(id) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/medias.rb0000644000004100000410000000447312600047642023651 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/media' module Fog module Compute class VcloudDirector class Medias < Collection model Fog::Compute::VcloudDirector::Media attribute :vdc # @param [String] name The name of the entity. # @param [#read] io The input object to read from. # @param [String] image_type Media image type. One of: iso, floppy. # @return [Media] def create(name, io, image_type='iso') requires :vdc response = service.post_upload_media(vdc.id, name, image_type, io.size) service.add_id_from_href!(response.body) media = new(response.body) # Perhaps this would be better implemented as media#upload. file = response.body[:Files][:File].first file[:Link] = [file[:Link]] if file[:Link].is_a?(Hash) link = file[:Link].find {|l| l[:rel] == 'upload:default'} headers = { 'Content-Length' => io.size, 'Content-Type' => 'application/octet-stream', 'x-vcloud-authorization' => service.vcloud_token } chunker = lambda do # to_s will convert the nil received after everything is read to # the final empty chunk. io.read(Excon.defaults[:chunk_size]).to_s end Excon.put( link[:href], :expects => 200, :headers => headers, :request_block => chunker) service.process_task(response.body[:Tasks][:Task]) media.reload media end private # @param [String] item_id # @return [Media] def get_by_id(item_id) item = service.get_media(item_id).body %w(:Link).each {|key_to_delete| item.delete(key_to_delete)} service.add_id_from_href!(item) item end # @return [Array] def item_list data = service.get_vdc(vdc.id).body return [] if data[:ResourceEntities].empty? items = data[:ResourceEntities][:ResourceEntity].select do |resource| resource[:type] == 'application/vnd.vmware.vcloud.media+xml' end items.each {|item| service.add_id_from_href!(item)} items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/organization.rb0000644000004100000410000000136612600047642025111 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Organization < Model identity :id attribute :name attribute :type attribute :href attribute :description, :aliases => :Description attribute :full_name, :aliases => :FullName def vdcs requires :id service.vdcs(:organization => self) end def catalogs requires :id service.catalogs(:organization => self) end def networks requires :id service.networks(:organization => self) end def tasks requires :id service.tasks(:organization => self) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/custom_fields.rb0000644000004100000410000000375612600047642025252 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/custom_field' module Fog module Compute class VcloudDirector class CustomFields < Collection model Fog::Compute::VcloudDirector::CustomField attribute :vapp def get_by_id(item_id) item_list.detect{|i| i[:id] == item_id} end def [](key) get key.to_s end def set(key, value, opts={:type => 'string', :password => 'false', :user_configurable => 'true'}) new_items = item_list.each.reject{|item| item[:id] == key} new_items << { :id => key, :value => value, :type => opts[:type], :password => opts[:password], :user_configurable => opts[:user_configurable] } response = service.put_product_sections(vapp.id, new_items) service.process_task(response.body) end def []=(key,value) set(key,value) end def delete(item_id) id = item_id.to_s new_items = item_list.each.reject{|item| item[:id] == id} response = service.put_product_sections(vapp.id, new_items) service.process_task(response.body) end def item_list return @items if @items resp = service.get_product_sections_vapp(vapp.id).body collection = resp["ovf:ProductSection".to_sym]["ovf:Property".to_sym] rescue [] collection = [collection] if collection.is_a?(Hash) @items = collection.collect do |property| { :id => property[:ovf_key], :value => property[:ovf_value], :type => property[:ovf_type], :password => property[:ovf_password], :user_configurable => property[:ovf_userConfigurable] } end rescue [] end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vdc.rb0000644000004100000410000000217512600047642023160 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Vdc < Model identity :id attribute :name attribute :type attribute :href attribute :description, :aliases => :Description attribute :available_networks, :aliases => :AvailableNetworks, :squash => :Network attribute :compute_capacity, :aliases => :ComputeCapacity attribute :storage_capacity , :aliases => :StorageCapacity attribute :allocation_model, :aliases => :AllocationModel attribute :capabilities, :aliases => :Capabilities, :squash => :SupportedHardwareVersions attribute :nic_quota, :aliases => :NicQuota, :type => :integer attribute :network_quota ,:aliases => :NetworkQuota, :type => :integer attribute :vm_quota ,:aliases => :VmQuota, :type => :integer attribute :is_enabled ,:aliases => :IsEnabled, :type => :boolean def medias requires :id service.medias(:vdc => self) end def vapps requires :id service.vapps(:vdc => self) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/custom_field.rb0000644000004100000410000000042612600047642025056 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class CustomField < Model identity :id attribute :value attribute :type attribute :password attribute :user_configurable end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/catalogs.rb0000644000004100000410000000146612600047642024203 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/catalog' module Fog module Compute class VcloudDirector class Catalogs < Collection model Fog::Compute::VcloudDirector::Catalog attribute :organization private def get_by_id(item_id) item = service.get_catalog(item_id).body %w(:CatalogItems :Link).each {|key_to_delete| item.delete(key_to_delete) } service.add_id_from_href!(item) item end def item_list data = service.get_organization(organization.id).body items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.catalog+xml" } items.each{|item| service.add_id_from_href!(item) } items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/network.rb0000644000004100000410000000102212600047642024063 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Network < Model identity :id attribute :name attribute :type attribute :href attribute :description attribute :is_inherited attribute :is_shared attribute :fence_mode attribute :gateway attribute :netmask attribute :dns1 attribute :dns2 attribute :dns_suffix attribute :ip_ranges, :type => :array end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vm_customizations.rb0000644000004100000410000000147412600047642026202 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/vm_customization' module Fog module Compute class VcloudDirector class VmCustomizations < Collection model Fog::Compute::VcloudDirector::VmCustomization attribute :vm private def get_by_id(item_id) item = service.get_vm_customization(item_id).body add_id_from_href!(item) item end # The HREF returned for a VM customization object is actually the VM # HREF suffixed with '/guestCustomizationSection/' so we cannot use # service.add_id_from_href! like all other collections. def add_id_from_href!(item={}) item[:id] = item[:href].gsub('/guestCustomizationSection/', '').split('/').last end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/catalog.rb0000644000004100000410000000073412600047642024015 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Catalog < Model identity :id attribute :name attribute :type attribute :href attribute :description, :aliases => :Description attribute :is_published, :aliases => :IsPublished, :type => :boolean def catalog_items requires :id service.catalog_items(:catalog => self) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vm_customization.rb0000644000004100000410000000210012600047642026002 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class VmCustomization < Model identity :id attribute :type attribute :href attribute :enabled attribute :change_sid attribute :join_domain_enabled attribute :use_org_settings attribute :admin_password_auto attribute :admin_password attribute :admin_password_enabled attribute :reset_password_required attribute :virtual_machine_id attribute :computer_name attribute :has_customization_script # bug: for some reason if the customization_script has /r, is showed # here as /n. Looks likes is something in excon def script attributes[:customization_script] end def script=(new_script) attributes[:customization_script] = new_script end def save response = service.put_guest_customization_section_vapp(id, attributes) service.process_task(response.body) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vm_network.rb0000644000004100000410000000123312600047642024571 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class VmNetwork < Model identity :id attribute :type attribute :href attribute :info attribute :primary_network_connection_index attribute :network attribute :needs_customization attribute :network_connection_index attribute :is_connected attribute :mac_address attribute :ip_address_allocation_mode def save response = service.put_network_connection_system_section_vapp(id, attributes) service.process_task(response.body) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vm_networks.rb0000644000004100000410000000057712600047642024766 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/vm_network' module Fog module Compute class VcloudDirector class VmNetworks < Collection model Fog::Compute::VcloudDirector::VmNetwork attribute :vm def get(id) data = service.get_vm_network(id).body new(data) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vm.rb0000644000004100000410000001136712600047642023031 0ustar www-datawww-datarequire 'fog/core/model' require 'fog/vcloud_director/models/compute/vm_customization' module Fog module Compute class VcloudDirector class Vm < Model identity :id attribute :vapp_id attribute :vapp_name attribute :name attribute :type attribute :href attribute :status attribute :operating_system attribute :ip_address attribute :cpu, :type => :integer attribute :memory, :type => :integer attribute :hard_disks, :aliases => :disks def reload # when collection.vapp is nil, it means it's fatherless, # vms from different vapps are loaded in the same collection. # This situation comes from a "query" result collection.vapp.nil? ? reload_single_vm : super end def reload_single_vm return unless data = begin collection.get_single_vm(identity) rescue Excon::Errors::SocketError nil end # these two attributes don't exists in the get_single_vm response # that's why i use the old attributes data.attributes[:vapp_id] = attributes[:vapp_id] data.attributes[:vapp_name] = attributes[:vapp_name] new_attributes = data.attributes merge_attributes(new_attributes) self end # Power off the VM. def power_off requires :id begin response = service.post_power_off_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Power on the VM. def power_on requires :id begin response = service.post_power_on_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Reboot the VM. def reboot requires :id begin response = service.post_reboot_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Reset the VM. def reset requires :id begin response = service.post_reset_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Shut down the VM. def shutdown requires :id begin response = service.post_shutdown_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Suspend the VM. def suspend requires :id begin response = service.post_suspend_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end def tags requires :id service.tags(:vm => self) end def customization requires :id data = service.get_vm_customization(id).body service.vm_customizations.new(data) end def network requires :id data = service.get_vm_network(id).body service.vm_networks.new(data) end def disks requires :id service.disks(:vm => self) end def memory=(new_memory) has_changed = ( memory != new_memory.to_i ) not_first_set = !memory.nil? attributes[:memory] = new_memory.to_i if not_first_set && has_changed response = service.put_memory(id, memory) service.process_task(response.body) end end def cpu=(new_cpu) has_changed = ( cpu != new_cpu.to_i ) not_first_set = !cpu.nil? attributes[:cpu] = new_cpu.to_i if not_first_set && has_changed response = service.put_cpu(id, cpu) service.process_task(response.body) end end def ready? reload status == 'on' end def vapp # get_by_metadata returns a vm collection where every vapp parent is orpahn collection.vapp ||= service.vapps.get(vapp_id) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/tag.rb0000644000004100000410000000134412600047642023154 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Tag < Model identity :id attribute :value def value=(new_value) has_changed = ( value != new_value ) not_first_set = !value.nil? attributes[:value] = new_value if not_first_set && has_changed response = service.put_vapp_metadata_item_metadata(vm.id, id, value) service.process_task(response.body) end end def destroy response = service.delete_vapp_metadata_item_metadata(vm.id, id) service.process_task(response.body) end def vm attributes[:vm] end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/tags.rb0000644000004100000410000000163212600047642023337 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/tag' module Fog module Compute class VcloudDirector class Tags < Collection model Fog::Compute::VcloudDirector::Tag attribute :vm def get_by_name(tag_name) get(tag_name) end def get_by_id(item_id) item_list unless @items @items.find{ |i| i[:id] == item_id} end def create(key,value) response = service.post_update_vapp_metadata(vm.id, { key => value} ) service.process_task(response.body) end def hash_items @tags = service.get_metadata(vm.id).body @tags[:metadata] end private def item_list @items =[] hash_items.each_pair{ |k,v| @items << {:id => k, :value => v }.merge(:vm => vm) } @items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/catalog_items.rb0000644000004100000410000000165712600047642025223 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/catalog_item' module Fog module Compute class VcloudDirector class CatalogItems < Collection model Fog::Compute::VcloudDirector::CatalogItem attribute :catalog private def item_list data = service.get_catalog(catalog.id).body items = data[:CatalogItems][:CatalogItem].select do |link| link[:type] == 'application/vnd.vmware.vcloud.catalogItem+xml' end items.each {|item| service.add_id_from_href!(item)} items end def get_by_id(item_id) item = service.get_catalog_item(item_id).body item[:vapp_template_id] = item[:Entity][:href].split('/').last %w(:Link :Entity).each {|key_to_delete| item.delete(key_to_delete) } service.add_id_from_href!(item) item end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/disks.rb0000644000004100000410000000172112600047642023515 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/disk' module Fog module Compute class VcloudDirector class Disks < Collection model Fog::Compute::VcloudDirector::Disk attribute :vm def create(size) item_list unless @disks data = Fog::Generators::Compute::VcloudDirector::Disks.new(@disks) data.add_hard_disk(size) response = service.put_disks(vm.id, data.disks) service.process_task(response.body) end def get_by_id(item_id) item = item_list.find{ |i| i[:id] == item_id} item.merge!(:all_disks => @disks, :vm => vm) if item item end def item_list @disks = service.get_vm_disks(vm.id).body items = @disks[:disks] items.each do |disk| disk[:all_disks] = @disks disk[:vm] = vm end items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vapp.rb0000644000004100000410000001105012600047642023342 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Vapp < Model identity :id attribute :name attribute :type attribute :href attribute :description, :aliases => :Description attribute :deployed, :type => :boolean attribute :status attribute :lease_settings, :aliases => :LeaseSettingsSection attribute :network_section, :aliases => :"ovf:NetworkSection", :squash => :"ovf:Network" attribute :network_config, :aliases => :NetworkConfigSection, :squash => :NetworkConfig attribute :owner, :aliases => :Owner, :squash => :User attribute :InMaintenanceMode, :type => :boolean def vms requires :id service.vms(:vapp => self) end def tags requires :id service.tags(:vm => self) end def custom_fields requires :id service.custom_fields( :vapp => self) end # @param [String] action The specified action is applied to all virtual # machines in the vApp. All values other than **default** ignore # actions, order, and delay specified in the StartupSection. One of: # * powerOff (Power off the virtual machines. This is the default # action if this attribute is missing or empty) # * suspend (Suspend the virtual machines) # * shutdown (Shut down the virtual machines) # * force (Attempt to power off the virtual machines. Failures in # undeploying the virtual machine or associated networks are ignored. # All references to the vApp and its virtual machines are removed # from the database) # * default (Use the actions, order, and delay specified in the # StartupSection) def undeploy(action='powerOff') begin response = service.post_undeploy_vapp(id, :UndeployPowerAction => action) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Power off all VMs in the vApp. def power_off requires :id begin response = service.post_power_off_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Power on all VMs in the vApp. def power_on requires :id begin response = service.post_power_on_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Reboot all VMs in the vApp. def reboot requires :id begin response = service.post_reboot_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Reset all VMs in the vApp. def reset requires :id begin response = service.post_reset_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Shut down all VMs in the vApp. def shutdown requires :id begin response = service.post_shutdown_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end # Suspend all VMs in the vApp. def suspend requires :id begin response = service.post_suspend_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end def destroy requires :id begin response = service.delete_vapp(id) rescue Fog::Compute::VcloudDirector::BadRequest => ex Fog::Logger.debug(ex.message) return false end service.process_task(response.body) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/catalog_item.rb0000644000004100000410000000121012600047642025021 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class CatalogItem < Model identity :id attribute :name attribute :type attribute :href attribute :description, :aliases => :Description attribute :vapp_template_id def instantiate(vapp_name, options={}) response = service.instantiate_vapp_template(vapp_name, vapp_template_id, options) service.process_task(response.body[:Tasks][:Task]) response.body[:href].split('/').last # returns the vapp_id if it was instantiated successfully . end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vms.rb0000644000004100000410000000166712600047642023216 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/vm' module Fog module Compute class VcloudDirector class Vms < Collection include Fog::VcloudDirector::Query model Fog::Compute::VcloudDirector::Vm attribute :vapp def get_by_metadata(key, value) data = service.get_vms_by_metadata(key, value).body items = data[:vm_records] load(items) end def get_single_vm(vm_id) item = service.get_vm(vm_id).body return nil unless item new(item[:vm]) end def query_type "vm" end private def get_by_id(item_id) item = item_list.find{ |vm| vm[:id] == item_id } item end def item_list data = service.get_vms(vapp.id).body # vapp.id items = data[:vms] items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vdcs.rb0000644000004100000410000000162412600047642023341 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/vdc' module Fog module Compute class VcloudDirector class Vdcs < Collection include Fog::VcloudDirector::Query model Fog::Compute::VcloudDirector::Vdc attribute :organization def query_type "orgVdc" end private def get_by_id(item_id) item = service.get_vdc(item_id).body %w(:VdcItems :Link :ResourceEntities).each {|key_to_delete| item.delete(key_to_delete) } service.add_id_from_href!(item) item end def item_list data = service.get_organization(organization.id).body items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" } items.each{|item| service.add_id_from_href!(item) } items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/vapps.rb0000644000004100000410000000200712600047642023527 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/vapp' module Fog module Compute class VcloudDirector class Vapps < Collection include Fog::VcloudDirector::Query model Fog::Compute::VcloudDirector::Vapp attribute :vdc def query_type "vApp" end private def get_by_id(item_id) item = service.get_vapp(item_id).body %w(:Link).each {|key_to_delete| item.delete(key_to_delete) } service.add_id_from_href!(item) item[:Description] ||= "" item end def item_list data = service.get_vdc(vdc.id).body return [] if data[:ResourceEntities].empty? resource_entities = data[:ResourceEntities][:ResourceEntity] items = resource_entities.select { |link| link[:type] == "application/vnd.vmware.vcloud.vApp+xml" } items.each{|item| service.add_id_from_href!(item) } items end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/disk.rb0000644000004100000410000000304412600047642023332 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class VcloudDirector class Disk < Model # there is no lazy_load in disks identity :id attribute :address attribute :description attribute :name attribute :resource_sub_type attribute :resource_type attribute :address_on_parent attribute :parent attribute :capacity attribute :bus_sub_type attribute :bus_type # TODO Virtual machine disk sizes may only be increased, not decreased. def capacity=(new_capacity) has_changed = ( capacity != new_capacity.to_i ) not_first_set = !capacity.nil? attributes[:capacity] = new_capacity.to_i if not_first_set && has_changed data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks) num_disk = name.scan(/\d+/).first.to_i data.modify_hard_disk_size(num_disk, new_capacity) response = service.put_disks(attributes[:vm].id, data.disks) service.process_task(response.body) end end def all_disks attributes[:all_disks] # this is passed at instantiation time end def destroy num_disk = name.scan(/\d+/).first.to_i data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks) data.delete_hard_disk(num_disk) response = service.put_disks(attributes[:vm].id, data.disks) service.process_task(response.body) end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/organizations.rb0000644000004100000410000000121012600047642025260 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/organization' module Fog module Compute class VcloudDirector class Organizations < Collection model Fog::Compute::VcloudDirector::Organization private def get_by_id(org_id) org = service.get_organization(org_id).body org.delete(:Link) service.add_id_from_href!(org) org end def item_list data = service.get_organizations.body orgs = data[:Org] orgs.each {|org| service.add_id_from_href!(org)} orgs end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/tasks.rb0000644000004100000410000000137512600047642023532 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/task' module Fog module Compute class VcloudDirector class Tasks < Collection include Fog::VcloudDirector::Query model Fog::Compute::VcloudDirector::Task attribute :organization def query_type "task" end def get(id) data = service.get_task(id).body return nil unless data data[:id] = data[:href].split('/').last data[:progress] ||= 0 new(data) end private def item_list data = service.get_task_list(organization.id).body data[:Task].each {|task| service.add_id_from_href!(task)} end end end end end fog-1.34.0/lib/fog/vcloud_director/models/compute/networks.rb0000644000004100000410000000345012600047642024255 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/vcloud_director/models/compute/network' module Fog module Compute class VcloudDirector class Networks < Collection include Fog::VcloudDirector::Query model Fog::Compute::VcloudDirector::Network attribute :organization def query_type "orgVdcNetwork" end private def get_by_id(item_id) raw_network = service.get_network_complete(item_id).body data = {} data[:type] = raw_network[:type] data[:href] = raw_network[:href] service.add_id_from_href!(data) data[:name] = raw_network[:name] data[:description] = raw_network[:Description] data[:is_shared] = raw_network[:IsShared] net_config = raw_network[:Configuration] data[:fence_mode] = net_config[:FenceMode] ip_scope = net_config[:IpScopes][:IpScope] data[:is_inherited] = ip_scope[:IsInherited] data[:gateway] = ip_scope[:Gateway] data[:netmask] = ip_scope[:Netmask] data[:dns1] = ip_scope[:Dns1] data[:dns2] = ip_scope[:Dns2] data[:dns_suffix] = ip_scope[:DnsSuffix] data[:ip_ranges] = [] raw_ip_ranges = ip_scope[:IpRanges][:IpRange] data[:ip_ranges] = raw_ip_ranges.map do |ip_range| { :start_address => ip_range[:StartAddress], :end_address => ip_range[:EndAddress] } end data end def item_list data = service.get_organization(organization.id).body items = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.orgNetwork+xml" } items.each{|item| service.add_id_from_href!(item) } items end end end end end fog-1.34.0/lib/fog/vcloud_director/README.md0000644000004100000410000006524512600047642020406 0ustar www-datawww-data# VMware vCloud Director 5.1 API client ## Introduction Collection and Model representation in vcloud_director fog provider. ```no-highlight organizations organization vdcs -> vdc -> vapps -> vapp -> vms -> vm -> customizations -> script -> network -> disks -> disk -> tags -> tag -> power_on networks -> network catalogs -> catalog -> catalog_items -> catalog_item -> instantiate_vapp medias -> media ``` ### Actions Every collection supports the following methods: Method Name | Lazy Load ----------------- | --------- get(id) | false get_by_name(name) | false all | true all(false) | false ### Lazy Loading When listing a collection (eg: `vdc.vapps`), lazy load will be used by default to improve the performance, otherwise it will make as many requests as items are in the collection. You can disable lazy load using the explict caller and passing a *false* option: `vdc.vapps.all(false)`. Attributes showing the value **NonLoaded** will be populated when accessing the value, if there are more than one **NonLoaded** values the first time accessing on any of those values will populate the others. You can explicitly load those attributes with the `reload` method: ```ruby org = vcloud.organizations.first org.reload ``` Lazy load isn't used with `get` and `get_by_name` methods are used. ## Initialization ```ruby vcloud = Fog::Compute::VcloudDirector.new( :vcloud_director_username => "@", :vcloud_director_password => "", :vcloud_director_host => 'api.example.com', :vcloud_director_show_progress => false, # task progress bar on/off ) ``` ## Organizations ### List Organizations Note that when listing, by default only the attributes `id`, `name`, `type`, and `href` are loaded. To disable lazy loading, and load all attributes, just specify `false`. Another option is to reload a specific item: `vcloud.organizations.first.reload` ```ruby vcloud.organizations ``` ``` ] > ``` ### Retrieve an Organization by Id ```ruby org = vcloud.organizations.get("c6a4c623-c158-41cf-a87a-dbc1637ad55a") ``` ### Retrieve an Organization by Name ```ruby org = vcloud.organizations.get_by_name("DevOps") ``` ## vDCs It shows the Organization's vDCs. ### List vDCs ```ruby org = vcloud.organizations.first org.vdcs ``` ```ruby [ ] > ``` ### Retrieve a vDC ```ruby org = vcloud.organizations.first org.vdcs.get_by_name("DevOps - VDC") ``` ```ruby "application/vnd.vmware.vcloud.network+xml", :name=>"DevOps - Dev Network Connection", :href=>"https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17"}, compute_capacity_cpu=NonLoaded, compute_capacity_memory={:Units=>"MB", :Allocated=>"0", :Limit=>"0", :Used=>"3584", :Overhead=>"65"}, storage_capacity={:Units=>"MB", :Allocated=>"1048320", :Limit=>"1048320", :Used=>"903168", :Overhead=>"0"}, allocation_model="AllocationVApp", capabilities={:SupportedHardwareVersion=>"vmx-09"}, nic_quota=0, network_quota=1024, vm_quota=0, is_enabled=true > ``` ## vApps ### List vApps ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vdc.vapps ``` ```ruby [ , ] > ``` ### Retrieve a vApp ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vdc.vapps.get_by_name("segundo") ``` ```ruby "0", :ovf_stopAction=>"powerOff", :ovf_startDelay=>"0", :ovf_startAction=>"powerOn", :ovf_order=>"0", :ovf_id=>"DEVWEB"}, network_section={:ovf_name=>"DevOps - Dev Network Connection", :"ovf:Description"=>""}, network_config={:networkName=>"DevOps - Dev Network Connection", :Link=>{:rel=>"repair", :href=>"https://example.com/api/admin/network/82a07044-4dda-4a3e-a53d-8981cf0d5baa/action/reset"}, :Description=>"", :Configuration=>{:IpScope=>{:IsInherited=>"true", :Gateway=>"10.192.0.1", :Netmask=>"255.255.252.0", :Dns1=>"10.192.0.11", :Dns2=>"10.192.0.12", :DnsSuffix=>"dev.ad.mdsol.com", :IpRanges=>{:IpRange=>{:StartAddress=>"10.192.0.100", :EndAddress=>"10.192.3.254"}}}, :ParentNetwork=>{:name=>"DevOps - Dev Network Connection", :id=>"d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", :href=>"https://example.com/api/admin/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17"}, :FenceMode=>"bridged", :RetainNetInfoAcrossDeployments=>"false"}, :IsDeployed=>"false"}, owner={:type=>"application/vnd.vmware.admin.user+xml", :name=>"restebanez", :href=>"https://example.com/api/admin/user/c3ca7b97-ddea-425f-8bdb-1fdb946f7349"}, InMaintenanceMode=false > ``` ## VMs ### List VMs ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vapp.vms ``` ```ruby "0", :ovf_stopAction=>"powerOff", :ovf_startDelay=>"0", :ovf_startAction=>"powerOn", :ovf_order=>"0", :ovf_id=>"DEVWEB"}, network_section={:ovf_name=>"DevOps - Dev Network Connection", :"ovf:Description"=>""}, network_config={:networkName=>"DevOps - Dev Network Connection", :Link=>{:rel=>"repair", :href=>"https://example.com/api/admin/network/82a07044-4dda-4a3e-a53d-8981cf0d5baa/action/reset"}, :Description=>"", :Configuration=>{:IpScope=>{:IsInherited=>"true", :Gateway=>"10.192.0.1", :Netmask=>"255.255.252.0", :Dns1=>"10.192.0.11", :Dns2=>"10.192.0.12", :DnsSuffix=>"dev.ad.mdsol.com", :IpRanges=>{:IpRange=>{:StartAddress=>"10.192.0.100", :EndAddress=>"10.192.3.254"}}}, :ParentNetwork=>{:name=>"DevOps - Dev Network Connection", :id=>"d5f47bbf-de27-4cf5-aaaa-56772f2ccd17", :href=>"https://example.com/api/admin/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17"}, :FenceMode=>"bridged", :RetainNetInfoAcrossDeployments=>"false"}, :IsDeployed=>"false"}, owner={:type=>"application/vnd.vmware.admin.user+xml", :name=>"restebanez", :href=>"https://example.com/api/admin/user/c3ca7b97-ddea-425f-8bdb-1fdb946f7349"}, InMaintenanceMode=false > [ 163840}] > ] > ``` ### Retrieve a VM ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vapp.vms.get_by_name("DEVWEB") ``` ```ruby 163840}] > ``` ### Modify CPU ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.cpu = 4 ``` ```no-highlight 4 ``` ### Modify Memory ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.memory = 4096 ``` ```no-highlight 4096 ``` ### Power On a VM ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.power_on ``` ```no-highlight true ``` ## VM Customization ### Retrieve VM Customization ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.customization ``` ```ruby ``` ### Modify VM Customization Customization attributes model requires to `save` it after setting the attributes. ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") customization = vm.customization customization.compute_name = "NEWNAME" customization.enabled = false customization.script = "new userdata script" customization.save ``` ```no-highlight true ``` ## VM Network ### Show VM Networks ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.network ``` ```ruby ``` ### Modify one or more attributes Network attributes model requires to `save` it after setting the attributes. ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") network = vm.network network.is_connected = false network.ip_address_allocation_mode = "DHCP" network.save ``` ```no-highlight true ``` ## VM Disk ### List VM Disks ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.disks ``` ```ruby 163840}] > [ , , ] > ``` ### Create a New Disk ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.disks.create(1024) ``` ```no-highlight true ``` The new disk should show up. ```ruby >> vm.disks 163840}] > [ , , , ] > ``` ### Modify the Hard Disk Size ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") disk = vm.disks.get_by_name("Hard disk 2") disk.capacity = 2048 ``` ```no-highlight true ``` ### Destroy a Hard Disk ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") disk = vm.disks.get_by_name("Hard disk 2") disk.destroy ``` ```no-highlight true ``` ## VM Tags ### List VM Tags ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.tags ``` ```ruby 163840}] > [ , , , ] > ``` ### Create a Tag ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.tags.create('this_is_a_key', 'this_is_a_value') ``` ```no-highlight true ``` ### Retrieve a Tag ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.tags.get_by_name('this_is_a_key') ``` ```ruby ``` ### Modify a Tag ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.tags.get_by_name('this_is_a_key').value = 'new_value' ``` ```no-highlight "new_value" ``` ### Destroy a Tag ```ruby org = vcloud.organizations.first vdc = org.vdcs.first vapp = vdc.vapps.get_by_name("segundo") vm = vapp.vms.get_by_name("DEVWEB") vm.tags.get_by_name('this_is_a_key').destroy ``` ```no-highlight true ``` ## Networks It shows the Organization's Networks. ### List Networks ```ruby org = vcloud.organizations.first org.networks ``` ```ruby [ ] > ``` ### Retrieve a Network ```ruby org = vcloud.organizations.first org.networks.get_by_name("DevOps - Dev Network Connection") ``` ```ruby "10.192.0.100", :end_address=>"10.192.3.254"}] > ``` ## Catalogs It shows the Organization's Catalogs. ### List Catalogs ```ruby org = vcloud.organizations.first org.catalogs ``` ```ruby [ , ] > ``` ### Retrieve a Catalog ```ruby org = vcloud.organizations.first org.catalogs.get("4ee720e5-173a-41ac-824b-6f4908bac975") # or get_by_name("Public VM Templates") ``` ```ruby ``` ## Catalog Items ### List Catalog Items ```ruby org = vcloud.organizations.first catalog = org.catalogs.first catalog.catalog_items ``` ```ruby [ , , ] > ``` ### Retrieve a Catalog Item ```ruby org = vcloud.organizations.first catalog = org.catalogs.first catalog.catalog_items.get_by_name('DEVAPP') ``` ```ruby ``` ### Instantiate a vApp Template It creates a Vapp from a CatalogItem. ```ruby org = vcloud.organizations.first catalog = org.catalogs.first template = catalog.catalog_items.get_by_name('DEVAPP') template.instantiate('webserver') ``` It there were more than one vDC or/and network you'd have to specify it as a second param: ```ruby template.instantiate('webserver', { vdc_id: "9a06a16b-12c6-44dc-aee1-06aa52262ea3", network_id: "d5f47bbf-de27-4cf5-aaaa-56772f2ccd17" } ``` fog-1.34.0/lib/fog/vcloud_director/compute.rb0000644000004100000410000007545412600047642021133 0ustar www-datawww-datarequire 'fog/vcloud_director/core' require 'fog/vcloud_director/query' class VcloudDirectorParser < Fog::Parsers::Base def extract_attributes(attributes_xml) attributes = {} until attributes_xml.empty? if attributes_xml.first.is_a?(Array) until attributes_xml.first.empty? attribute = attributes_xml.first.shift attributes[attribute.localname.to_sym] = attribute.value end else attribute = attributes_xml.shift attributes[attribute.localname.to_sym] = attribute.value end end attributes end end class NonLoaded end module Fog module Compute class VcloudDirector < Fog::Service module Defaults PATH = '/api' PORT = 443 SCHEME = 'https' API_VERSION = '5.1' end class ServiceError < Fog::VcloudDirector::Errors::ServiceError; end class BadRequest < Fog::VcloudDirector::Errors::BadRequest; end class Unauthorized < Fog::VcloudDirector::Errors::Unauthorized; end class Forbidden < Fog::VcloudDirector::Errors::Forbidden; end class Conflict < Fog::VcloudDirector::Errors::Conflict; end class MalformedResponse < Fog::VcloudDirector::Errors::MalformedResponse; end class DuplicateName < Fog::VcloudDirector::Errors::DuplicateName; end class TaskError < Fog::VcloudDirector::Errors::TaskError; end requires :vcloud_director_username, :vcloud_director_password, :vcloud_director_host recognizes :vcloud_director_api_version, :vcloud_director_show_progress, :path, :vcloud_token secrets :vcloud_director_password model_path 'fog/vcloud_director/models/compute' model :catalog collection :catalogs model :organization collection :organizations model :catalog_item collection :catalog_items model :custom_field collection :custom_fields model :vdc collection :vdcs model :vapp collection :vapps model :task collection :tasks model :vm collection :vms model :vm_customization collection :vm_customizations model :network collection :networks model :disk collection :disks model :vm_network collection :vm_networks model :tag # this is called metadata in vcloud collection :tags model :media collection :medias # sic request_path 'fog/vcloud_director/requests/compute' request :delete_catalog_item request :delete_catalog_item_metadata_item_metadata request :delete_disk request :delete_disk_metadata_item_metadata request :delete_logout request :delete_media request :delete_media_metadata_item_metadata request :delete_network request :delete_shadow_vm request :delete_vapp request :delete_vapp_metadata_item_metadata request :delete_vapp_template request :delete_vapp_template_metadata_item_metadata request :get_allocated_ip_addresses request :get_catalog request :get_catalog_item request :get_catalog_item_metadata request :get_catalog_item_metadata_item_metadata request :get_catalog_metadata request :get_catalog_metadata_item_metadata request :get_catalogs_from_query request :get_control_access_params_catalog request :get_control_access_params_vapp request :get_cpu_rasd_item request :get_current_session request :get_disk request :get_disk_metadata request :get_disk_metadata_item_metadata request :get_disk_owner request :get_disks_from_query request :get_disks_rasd_items_list request :get_edge_gateway request :get_entity request :get_execute_query request :get_groups_from_query request :get_guest_customization_system_section_vapp request :get_guest_customization_system_section_vapp_template request :get_href # this is used for manual testing request :get_lease_settings_section_vapp request :get_lease_settings_section_vapp_template request :get_media request :get_media_drives_rasd_items_list request :get_media_metadata request :get_media_metadata_item_metadata request :get_media_owner request :get_medias_from_query request :get_memory_rasd_item request :get_metadata request :get_network request :get_network_cards_items_list request :get_network_complete request :get_network_config_section_vapp request :get_network_config_section_vapp_template request :get_network_connection_system_section_vapp request :get_network_connection_system_section_vapp_template request :get_network_metadata request :get_network_metadata_item_metadata request :get_network_section_vapp request :get_network_section_vapp_template request :get_operating_system_section request :get_org_settings request :get_org_vdc_gateways request :get_organization request :get_organization_metadata request :get_organization_metadata_item_metadata request :get_organizations request :get_organizations_from_query request :get_product_sections_vapp request :get_product_sections_vapp_template request :get_request # this is used for manual testing request :get_runtime_info_section_type request :get_serial_ports_items_list request :get_shadow_vm request :get_snapshot_section request :get_startup_section request :get_supported_systems_info request :get_supported_versions request :get_task request :get_task_list request :get_thumbnail request :get_users_from_query request :get_vapp request :get_vapp_metadata request :get_vapp_metadata_item_metadata request :get_vapp_ovf_descriptor request :get_vapp_owner request :get_vapp_template request :get_vapp_template_customization_system_section request :get_vapp_template_metadata request :get_vapp_template_metadata_item_metadata request :get_vapp_template_ovf_descriptor request :get_vapp_template_owner request :get_vapp_templates_from_query request :get_vapps_in_lease_from_query request :get_vcloud request :get_vdc request :get_vdc_metadata request :get_vdc_metadata_item_metadata request :get_vdc_storage_class request :get_vdc_storage_class_metadata request :get_vdc_storage_class_metadata_item_metadata request :get_vdcs_from_query request :get_virtual_hardware_section request :get_vm request :get_vm_capabilities request :get_vm_compliance_results request :get_vm_customization request :get_vm_disks request :get_vm_network request :get_vm_pending_question request :get_vms request :get_vms_by_metadata request :get_vms_disk_attached_to request :get_vms_in_lease_from_query request :instantiate_vapp_template # to be deprecated request :post_acquire_ticket request :post_answer_vm_pending_question request :post_attach_disk request :post_cancel_task request :post_capture_vapp request :post_check_vm_compliance request :post_clone_media request :post_clone_vapp request :post_clone_vapp_template request :post_configure_edge_gateway_services request :post_consolidate_vm_vapp request :post_consolidate_vm_vapp_template request :post_create_catalog_item request :post_create_org_vdc_network request :post_deploy_vapp request :post_detach_disk request :post_disable_nested_hv request :post_disable_vapp_template_download request :post_discard_vapp_state request :post_eject_cd_rom request :post_enable_nested_hv request :post_enable_vapp_template_download request :post_enter_maintenance_mode request :post_exit_maintenance_mode request :post_insert_cd_rom request :post_install_vmware_tools request :post_instantiate_vapp_template request :post_login_session request :post_power_off_vapp request :post_power_on_vapp request :post_reboot_vapp request :post_remove_all_snapshots request :post_reset_vapp request :post_revert_snapshot request :post_shutdown_vapp request :post_suspend_vapp request :post_undeploy_vapp request :post_update_catalog_item_metadata request :post_update_disk_metadata request :post_update_media_metadata request :post_update_vapp_metadata request :post_update_vapp_template_metadata request :post_upgrade_hw_version request :post_upload_disk request :post_upload_media request :post_upload_vapp_template request :put_catalog_item_metadata_item_metadata request :put_cpu request :put_disk_metadata_item_metadata request :put_disks request :put_guest_customization_section_vapp request :put_media_metadata_item_metadata request :put_memory request :put_metadata_value # deprecated request :put_network request :put_network_connection_system_section_vapp request :put_product_sections request :put_vapp_metadata_item_metadata request :put_vapp_name_and_description request :put_vapp_template_metadata_item_metadata request :put_vm request :put_vm_capabilities class Model < Fog::Model def initialize(attrs={}) super(attrs) lazy_load_attrs.each do |attr| attributes[attr]= NonLoaded if attributes[attr].nil? make_lazy_load_method(attr) end self.class.attributes.each {|attr| make_attr_loaded_method(attr)} end def lazy_load_attrs @lazy_load_attrs ||= self.class.attributes - attributes.keys end def make_lazy_load_method(attr) self.class.instance_eval do define_method(attr) do reload if attributes[attr] == NonLoaded and !@inspecting attributes[attr] end end end # it adds an attr_loaded? method to know if the value has been loaded # yet or not: ie description_loaded? def make_attr_loaded_method(attr) self.class.instance_eval do define_method("#{attr}_loaded?") do attributes[attr] != NonLoaded end end end def inspect @inspecting = true out = super @inspecting = false out end end class Collection < Fog::Collection def all(lazy_load=true) lazy_load ? index : get_everyone end def get(item_id) item = get_by_id(item_id) return nil unless item new(item) end def get_by_name(item_name) item_found = item_list.find {|item| item[:name] == item_name} return nil unless item_found get(item_found[:id]) end def index load(item_list) end def get_everyone items = item_list.map {|item| get_by_id(item[:id])} load(items) end end class Real extend Fog::Deprecation deprecate :auth_token, :vcloud_token attr_reader :end_point, :api_version, :show_progress alias_method :show_progress?, :show_progress def initialize(options={}) @vcloud_director_password = options[:vcloud_director_password] @vcloud_director_username = options[:vcloud_director_username] @connection_options = options[:connection_options] || {} @host = options[:vcloud_director_host] @path = options[:path] || Fog::Compute::VcloudDirector::Defaults::PATH @persistent = options[:persistent] || false @port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT @scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) @end_point = "#{@scheme}://#{@host}#{@path}/" @api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION @show_progress = options[:vcloud_director_show_progress] @show_progress = $stdin.tty? if @show_progress.nil? @vcloud_token = options[:vcloud_token] end def vcloud_token login if @vcloud_token.nil? @vcloud_token end def org_name login if @org_name.nil? @org_name end def user_name login if @user_name.nil? @user_name end def reload @connection.reset end def request(params) begin do_request(params) rescue EOFError # This error can occur if Vcloud receives a request from a network # it deems to be unauthorized; no HTTP response is sent, but the # connection is sent a signal to terminate early. raise( MalformedResponse, "Connection unexpectedly terminated by vcloud" ) # this is to know if Excon::Errors::Unauthorized really happens #rescue Excon::Errors::Unauthorized # login # do_request(params) end end # @api private def do_request(params) headers = { 'Accept' => "application/*+xml;version=#{@api_version}", 'x-vcloud-authorization' => vcloud_token } if params[:path] if params[:override_path] == true path = params[:path] else path = "#{@path}/#{params[:path]}" end else path = "#{@path}" end @connection.request({ :body => params[:body], :expects => params[:expects], :headers => headers.merge!(params[:headers] || {}), :idempotent => params[:idempotent], :method => params[:method], :parser => params[:parser], :path => path, :query => params[:query] }) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::BadRequest then BadRequest.slurp(error); when Excon::Errors::Unauthorized then Unauthorized.slurp(error); when Excon::Errors::Forbidden then Forbidden.slurp(error); when Excon::Errors::Conflict then Conflict.slurp(error); else ServiceError.slurp(error) end end def process_task(response_body) task = make_task_object(response_body) wait_and_raise_unless_success(task) true end def make_task_object(task_response) task_response[:id] = task_response[:href].split('/').last tasks.new(task_response) end def wait_and_raise_unless_success(task) task.wait_for { non_running? } raise TaskError.new "status: #{task.status}, error: #{task.error}" unless task.success? end def add_id_from_href!(data={}) data[:id] = data[:href].split('/').last end # Compensate for Fog::ToHashDocument shortcomings. # @api private # @param [Hash] hash # @param [String,Symbol] key1 # @param [String,Symbol] key2 # @return [Hash] def ensure_list!(hash, key1, key2=nil) if key2.nil? hash[key1] ||= [] hash[key1] = [hash[key1]] if hash[key1].is_a?(Hash) else hash[key1] ||= {key2 => []} hash[key1] = {key2 => []} if hash[key1].empty? hash[key1][key2] = [hash[key1][key2]] if hash[key1][key2].is_a?(Hash) end hash end private def login @vcloud_token ||= ENV['FOG_VCLOUD_TOKEN'] if @vcloud_token response = get_current_session session_org = response.body[:org] session_user = response.body[:user] check_session_matches_credentials(session_org, session_user) else response = post_login_session x_vcloud_authorization = response.headers.keys.find do |key| key.downcase == 'x-vcloud-authorization' end @vcloud_token = response.headers[x_vcloud_authorization] end @org_name = response.body[:org] @user_name = response.body[:user] end # @note This isn't needed. def logout delete_logout @vcloud_token = nil @org_name = nil end def check_session_matches_credentials(session_org, session_user) fog_credential_org = @vcloud_director_username.split('@').last fog_credential_user = @vcloud_director_username.split('@')[0...-1].join('@') if session_org != fog_credential_org raise Fog::Errors::Error.new "FOG_CREDENTIAL specified is for vCloud organisation '#{fog_credential_org}' but " + "your current session is for '#{session_org}'. You should generate a new FOG_VCLOUD_TOKEN." end if session_user != fog_credential_user raise Fog::Errors::Error.new "FOG_CREDENTIAL specified is for user '#{fog_credential_user}' but " + "your current session is for '#{session_user}'. You should generate a new FOG_VCLOUD_TOKEN." end end end class Mock attr_reader :end_point, :api_version def data @@data ||= Hash.new do |hash, key| vdc1_uuid = uuid vdc2_uuid = uuid default_network_uuid = uuid uplink_network_uuid = uuid isolated_vdc1_network_uuid = uuid isolated_vdc2_network_uuid = uuid vapp1_id = "vapp-#{uuid}" vapp2_id = "vapp-#{uuid}" vapp1vm1_id = "vm-#{uuid}" vapp2vm1_id = "vm-#{uuid}" vapp2vm2_id = "vm-#{uuid}" catalog_uuid = uuid hash[key] = { :catalogs => { catalog_uuid => { :name => 'Default Catalog' } }, :catalog_items => { uuid => { :type => 'vAppTemplate', :name => 'vAppTemplate 1', :catalog => catalog_uuid, } }, :disks => {}, :edge_gateways => { uuid => { :name => 'MockEdgeGateway', :networks => [uplink_network_uuid, default_network_uuid], :vdc => vdc1_uuid, :Configuration => { :GatewayBackingConfig => "compact", :GatewayInterfaces => { :GatewayInterface => []}, :EdgeGatewayServiceConfiguration => { :FirewallService => { :IsEnabled => "true", :DefaultAction => "drop", :LogDefaultAction => "false", :FirewallRule => [] }, :NatService => {:IsEnabled => "true"}}, :HaEnabled => "false", :UseDefaultRouteForDnsRelay => "false" } } }, :medias => {}, :networks => { default_network_uuid => { :IsShared => true, :vdc => vdc1_uuid, :FenceMode => 'natRouted', :ApplyRateLimit => "false", :Description => 'Org Network for mocking', :Dns1 => '8.8.8.8', :Dns2 => '8.8.4.4', :DnsSuffix => 'example.com', :Gateway => '192.168.1.1', :InterfaceType => "internal", :IpRanges => [{ :StartAddress=>'192.168.1.2', :EndAddress=>'192.168.1.254' }], :IsInherited => false, :Netmask => '255.255.255.0', :name => 'vDC1 Default Network', :SubnetParticipation => { :Gateway => "192.168.1.0", :Netmask => "255.255.0.0", :IpAddress => "192.168.1.0" }, :UseForDefaultRoute => "false" }, isolated_vdc1_network_uuid => { :IsShared => false, :vdc => vdc1_uuid, :ApplyRateLimit => "false", :FenceMode => 'isolated', :Description => 'Org Network for mocking', :Dns1 => '8.8.8.8', :Dns2 => '8.8.4.4', :DnsSuffix => 'example.com', :InterfaceType => "internal", :IpRanges => [{ :StartAddress=>'10.1.0.100', :EndAddress=>'10.1.0.200' }], :IsInherited => false, :Netmask => '255.255.255.0', :name => 'vDC1 backend network', :SubnetParticipation => { :Gateway => "192.168.1.0", :Netmask => "255.255.0.0", :IpAddress => "192.168.1.0" }, :UseForDefaultRoute => "false" }, isolated_vdc2_network_uuid => { :IsShared => false, :vdc => vdc2_uuid, :ApplyRateLimit => "false", :Description => 'Org Network for mocking', :Dns1 => '8.8.8.8', :Dns2 => '8.8.4.4', :DnsSuffix => 'example.com', :InterfaceType => "internal", :IpRanges => [{ :StartAddress=>'10.2.0.100', :EndAddress=>'10.2.0.200' }], :IsInherited => false, :Netmask => '255.255.255.0', :name => 'vDC2 backend network', :SubnetParticipation => { :Gateway => "192.168.1.0", :Netmask => "255.255.0.0", :IpAddress => "192.168.1.0" }, :UseForDefaultRoute => "false" }, uplink_network_uuid => { :IsShared => false, :vdc => vdc1_uuid, :ApplyRateLimit => "false", :FenceMode => 'bridged', :Description => 'Uplink Network for mocking', :Dns1 => '8.8.8.8', :Dns2 => '8.8.4.4', :DnsSuffix => 'example.com', :Gateway => '198.51.100.1', :InterfaceType => "uplink", :IpRanges => [{ :StartAddress=>'198.51.100.2', :EndAddress=>'198.51.100.254' }], :IsInherited => false, :Netmask => '255.255.255.0', :name => 'uplink Network', :SubnetParticipation => { :Gateway => "198.51.100.81", :Netmask => "255.255.255.248", :IpAddress => "198.51.100.83", :IpRanges => { :IpRange => { :StartAddress => "198.51.100.84", :EndAddress => "198.51.100.86" } } }, :UseForDefaultRoute => "true" } }, :org => { :description => 'Organization for mocking', :full_name => 'Mock Organization', :name => org_name, :uuid => uuid }, :tasks => {}, :vapps => { vapp1_id => { :name => 'mock-vapp-1', :vdc_id => vdc1_uuid, :description => "Mock vApp 1", :networks => [ { :parent_id => default_network_uuid, }, ], }, vapp2_id => { :name => 'mock-vapp-2', :vdc_id => vdc2_uuid, :description => "Mock vApp 2", :networks => [ { :parent_id => default_network_uuid }, ] }, }, :vdc_storage_classes => { uuid => { :default => true, :enabled => true, :limit => 2 * 1024 * 1024, :name => 'DefaultMockStorageClass', :units => 'MB', :vdc => vdc1_uuid, } }, :vdcs => { vdc1_uuid => { :description => 'vDC1 for mocking', :name => 'MockVDC 1' }, vdc2_uuid => { :description => 'vDC2 for mocking', :name => 'MockVDC 2' }, }, :vms => { vapp1vm1_id => { :name => 'mock-vm-1-1', :parent_vapp => vapp1_id, :nics => [ { :network_name => 'Default Network', :mac_address => "00:50:56:aa:bb:01", :ip_address => "192.168.1.33", }, ], }, vapp2vm1_id => { :name => 'mock-vm-2-1', :parent_vapp => vapp2_id, :nics => [ { :network_name => 'Default Network', :mac_address => "00:50:56:aa:bb:02", :ip_address => "192.168.1.34", }, ], }, vapp2vm2_id => { :name => 'mock-vm-2-2', :parent_vapp => vapp2_id, :nics => [ { :network_name => 'Default Network', :mac_address => "00:50:56:aa:bb:03", :ip_address => "192.168.1.35", }, ], }, }, } end[@vcloud_director_username] end def initialize(options={}) @vcloud_director_password = options[:vcloud_director_password] @vcloud_director_username = options[:vcloud_director_username] #@connection_options = options[:connection_options] || {} @host = options[:vcloud_director_host] @path = options[:path] || Fog::Compute::VcloudDirector::Defaults::PATH @persistent = options[:persistent] || false @port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT @scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME #@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) @end_point = "#{@scheme}://#{@host}#{@path}/" @api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION @vcloud_token = options[:vcloud_token] end def vcloud_token @vcloud_token || Fog::Mock.random_base64(32) end def org_name @org_name ||= begin username = @vcloud_director_username.split('@') if username.size >= 2 # may be 'email_address@org_name' username.last else Fog::Logger.warning('vcloud_director_username should be in the form user@org_name') 'vcd_org_name' end end end def user_name @user_name ||= @vcloud_director_username.split('@').first end def user_uuid @user_uuid ||= uuid end def uuid [8,4,4,4,12].map {|i| Fog::Mock.random_hex(i)}.join('-') end # Create a task. # # @param [String] operation A message describing the operation that is # tracked by this task. # @param [String] operation_name The short name of the operation that # is tracked by this task. # @param [Hash] owner Reference to the owner of the task. This is # typically the object that the task is creating or updating. # * :href<~String> - Contains the URI to the entity. # * :type<~String> - Contains the MIME type of the entity. # @return [String] Object identifier of the task. def enqueue_task(operation, operation_name, owner, options={}) task_id = uuid now = DateTime.now data[:tasks][task_id] = { :cancel_requested => false, :details => '', :expiry_time => now + 86400, # in 24 hours :name => 'task', :progress => 1, :service_namespace => 'com.vmware.vcloud', :start_time => now, :end_time => now + 86400, :status => 'running', }.merge(options).merge( :operation => operation, :operation_name => operation_name, :owner => owner ) task_id end # @note As far as this method is concerned, the only possible task # states are 'running' and 'success'. # # @param [Hash] response_body # @return [Boolean] def process_task(response_body) task_id = response_body[:href].split('/').last task = data[:tasks][task_id] if task[:status] == 'running' task[:end_time] = DateTime.now task[:progress] = 100 task[:status] = 'success' if task[:on_success] task[:on_success].call task.delete(:on_success) end end return true if task[:status] == 'success' raise TaskError.new "status: #{task[:status]}, error: #{task[:Error]}" end def add_id_from_href!(data={}) data[:id] = data[:href].split('/').last end private def make_href(path) "#{@end_point}#{path}" end def xmlns 'http://www.vmware.com/vcloud/v1.5' end def xmlns_xsi 'http://www.w3.org/2001/XMLSchema-instance' end def xsi_schema_location "http://www.vmware.com/vcloud/v1.5 http://#{@host}#{@path}/v1.5/schema/master.xsd" end end end end end fog-1.34.0/lib/fog/go_grid.rb0000644000004100000410000000003612600047641015661 0ustar www-datawww-datarequire 'fog/go_grid/compute' fog-1.34.0/lib/fog/hp.rb0000644000004100000410000000034612600047642014663 0ustar www-datawww-datarequire 'fog/hp/block_storage' require 'fog/hp/block_storage_v2' require 'fog/hp/cdn' require 'fog/hp/compute' require 'fog/hp/compute_v2' require 'fog/hp/dns' require 'fog/hp/lb' require 'fog/hp/network' require 'fog/hp/storage' fog-1.34.0/lib/fog/ibm/0000755000004100000410000000000012600047642014473 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/requests/0000755000004100000410000000000012600047642016346 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/requests/storage/0000755000004100000410000000000012600047642020012 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/requests/storage/create_volume.rb0000644000004100000410000000525712600047642023202 0ustar www-datawww-datamodule Fog module Storage class IBM class Real # Requests a new Storage Volume be created. # # ==== Parameters # * name<~String> - The alias to use to referance storage volume # * offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage # * format<~String> - filesystem format for volume # * location<~String> - datacenter location for volume # * size<~String> - size of volume desired (Small, Medium, Large) (varies by location what size actually is) # * storageAreaID<~String> - (not supported yet) # # === Returns # * response<~Excon::Response>: # * body<~Hash>: # * name<~String> - The alias to use to referance storage volume # * format<~String> - filesystem format for storage # * location<~String> - datacenter location for storage # * createdTime<~Integer> - Epoch time of creation # * size<~String> - size of storage desired (Small, Medium, Large) (varies by location what size actually is) # * productCodes<~Array> - # * offeringID<~String> - offering id can be requested from /computecloud/enterprise/api/rest/20100331/offerings/storage # * id<~String> - id of new storage # * owner<~String> - owner of new storage # * state<~Integer> - state of newly requested storage def create_volume(name, offering_id, format, location_id, size) request( :method => 'POST', :expects => 200, :path => '/storage', :body => { 'name' => name, 'offeringID' => offering_id, 'format' => format, 'location' => location_id, 'size' => size } ) end end class Mock def create_volume(name, offering_id, format, location_id, size) volume = Fog::IBM::Mock.create_volume(name, offering_id, format, location_id, size) self.data[:volumes][volume['id']] = volume response = Excon::Response.new response.status = 200 response.body = format_create_volume_response_for(volume['id']) response end # The create_volume response doesn't contain ioPrice either def format_create_volume_response_for(volume_id) # If we aren't attached/ready, make us ready ready_volume(volume_id) unless volume_attached? volume_id self.data[:volumes][volume_id].reject { |k,v| k == 'ioPrice' } end end end end end fog-1.34.0/lib/fog/ibm/requests/storage/delete_volume.rb0000644000004100000410000000174212600047642023174 0ustar www-datawww-datamodule Fog module Storage class IBM class Real # Deletes the storage that the authenticated user manages with the specified :storage_id # # ==== Parameters # * volume_id<~String> - Id of storage volume # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # *'success'<~Bool>: true or false for success def delete_volume(volume_id) request( :method => 'DELETE', :expects => 200, :path => "/storage/#{volume_id}" ) end end class Mock def delete_volume(volume_id) response = Excon::Response.new if volume_exists? volume_id self.data[:volumes].delete volume_id response.status = 200 response.body = {"success"=>true} else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/storage/list_offerings.rb0000644000004100000410000000476112600047642023364 0ustar www-datawww-datamodule Fog module Storage class IBM class Real # Returns the offerings of storage for the authenticated user # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'volumes'<~Array>: list of images # * 'name'<~String>: Name of storage offering # * 'price'<~Hash>: hash containing pricing information # * 'pricePerQuantity'<~Integer>: # * 'effectiveDate'<~Integer>: starting date price is effective # * 'rate'<~Float>: rate per unit # * 'countryCode'<~String>: # * 'currencyCode'<~String>: currency used # * 'location'<~String>: datacenter location string # * 'id'<~String>: id of offering # * 'formats'<~Array>: filesystem format storage offered with # * 'label'<~String>: label for filesystem # * 'id'<~String>: string used for id of format # * 'capacity'<~Integer>: size in GB's def list_offerings request( :method => 'GET', :expects => 200, :path => '/offerings/storage' ) end end class Mock def list_offerings response = Excon::Response.new response.status = 200 response.body = {"volumes"=> [{"name"=>"Small", "price"=> {"pricePerQuantity"=>1, "effectiveDate"=>-1, "rate"=>0.0384, "countryCode"=>"897", "unitOfMeasure"=>"UHR", "currencyCode"=>"USD"}, "location"=>"61", "id"=>"20001208", "formats"=> [{"label"=>"ext3", "id"=>"EXT3"}, {"label"=>"raw", "id"=>"RAW"}], "capacity"=>256}, {"name"=>"Small", "price"=> {"pricePerQuantity"=>1, "effectiveDate"=>-1, "rate"=>0.0384, "countryCode"=>"897", "unitOfMeasure"=>"UHR", "currencyCode"=>"USD"}, "location"=>"141", "id"=>"20001208", "formats"=> [{"label"=>"ext3", "id"=>"EXT3"}, {"label"=>"raw", "id"=>"RAW"}], "capacity"=>256}]}, response end end end end end fog-1.34.0/lib/fog/ibm/requests/storage/get_volume.rb0000644000004100000410000000405412600047642022510 0ustar www-datawww-datamodule Fog module Storage class IBM class Real # Used to retrieve the specified storage volume for specified volume_id # # ==== Parameters # * volume_id<~String> - Id of storage volume # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: def get_volume(volume_id) request( :method => 'GET', :expects => 200, :path => "/storage/#{volume_id}" ) end end class Mock # For whatever reason, get_volume returns different data than an entry in list_volumes def get_volume(volume_id) response = Excon::Response.new if volume_exists? volume_id response.status = 200 response.body = format_get_volume_response_for(volume_id) else response.status = 404 end response end # get_volume response doesn't contain instanceId def format_get_volume_response_for(volume_id) # If we aren't attached/ready, make us ready ready_volume(volume_id) unless volume_attached? volume_id self.data[:volumes][volume_id].reject { |k,v| k == 'instanceId' } end # The list_volumes response doesn't contain ioPrice def format_list_volumes_response self.data[:volumes].values.dup.map { |volume| volume.reject { |k,v| k == 'ioPrice'} } end def volume_exists?(volume_id) self.data[:volumes].key? volume_id end # Checks if an volume is Active def volume_ready?(volume_id) self.data[:volumes][volume_id]['state'] == 4 end def volume_attached?(volume_id) self.data[:volumes][volume_id]['instanceId'] != "0" end # Sets volume status to Detached if it's not already set, and or attached def ready_volume(volume_id) # If not ready, make ready self.data[:volumes][volume_id]['state'] = 4 end end end end end fog-1.34.0/lib/fog/ibm/requests/storage/list_volumes.rb0000644000004100000410000000251112600047642023063 0ustar www-datawww-datamodule Fog module Storage class IBM class Real # Returns the list of storage volumes # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'volumes'<~Array>: list of images # * 'name'<~String>: Name of image # * 'format'<~String>: filesystem volume is formatted with # * 'location'<~String>: datacenter location string # * 'createdTime'<~Integer>: creation time in Epoch int # * 'size'<~String>: size in GB's (as a string) # * 'productCodes'<~Array>: unsure.. # * 'offeringId'<~String>: # * 'id'<~String>: volume id # * 'owner'<~String>: owner's email address # * 'state'<~Integer>: known so far: 4 provisioned, unattached; 5 provisioned, attached def list_volumes request( :method => 'GET', :expects => 200, :path => '/storage' ) end end class Mock def list_volumes response = Excon::Response.new response.status = 200 response.body = { 'volumes' => format_list_volumes_response } response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/0000755000004100000410000000000012600047642020022 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/requests/compute/get_location.rb0000644000004100000410000000312712600047642023021 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Get a location # # ==== Parameters # * location_id<~String> - Id of location # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'name'<~String>: location name # * 'location'<~String>: # * 'capabilities'<~Array>: # * 'oss.storage.format'<~Hash>: # * 'entries'<~Array>: list of supported volume formats # * 'oss.instance.spec.i386'<~Array>: unsure.. returns empty array # * 'oss.instance.spec.x86_64'<~Array>: unsure.. returns empty array # * 'oss.storage.availabilityarea'<~Array>: availability area unsupported # * 'id'<~String>: id of location # * 'description'<~String>: description including geographic location # * 'state'<~String>: state of datacenter def get_location(location_id) request( :method => 'GET', :expects => 200, :path => "/locations/#{location_id}" ) end end class Mock def get_location(location_id) response = Excon::Response.new if location_exists? location_id response.status = 200 response.body = self.data[:locations][location_id] else response.status = 404 end response end def location_exists?(location_id) self.data[:locations].key? location_id end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/create_key.rb0000644000004100000410000000365712600047642022475 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Requests a new keypair to be created # # ==== Parameters # * name<~String> - name to give new key # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'keyName'<~String>: name of new key # * 'lastModifiedTime'<~Integer>: epoch time of last modification # * 'default'<~Bool>: is default? # * 'instanceIds'<~Array>: id's of instances using key (should be empty upon creation) # * 'keyMaterial'<~String>: private key contents def create_key(name, public_key=nil) request( :method => 'POST', :expects => 200, :path => '/keys', :body => { 'name' => name, 'publicKey' => public_key } ) end end class Mock # SmartCloud returns the private key when create_key is called # We need to store both the private and public key for later use def create_key(name, public_key=nil) response = Excon::Response.new response.status = 200 attributes = { "keyName" => name, "lastModifiedTime" => Fog::IBM::Mock.launch_time, "default" => false, "instanceIds" => [], } if public_key.nil? private_key = Fog::IBM::Mock.key_material public_key = private_key.public_key response.body = attributes.merge("keyMaterial" => private_key.to_s) else response.body = { 'success' => true } end self.data[:keys][name] = attributes.merge("keyMaterial" => public_key.to_s) self.data[:private_keys][name] = attributes.merge("keyMaterial" => private_key.to_s) response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_image_manifest.rb0000644000004100000410000000234412600047642024161 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns manifest of image specified by id # # ==== Parameters # 'image_id'<~String>: id of desired image # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'manifest'<~String>: manifest of image in xml def get_image_manifest(image_id) request( :method => 'GET', :expects => 200, :path => "/offerings/image/#{image_id}/manifest" ) end end class Mock # TODO: Create a data store for this. def get_image_manifest(image_id) response = Excon::Response.new response.status = 200 response.body = {"manifest"=> "\n\t\n\t\t\n\t\t\t0.0.0.0/0\n\t\t\t1\n\t\t\t65535\n\t\t\n\t\n"} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/create_image.rb0000644000004100000410000000320612600047642022755 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Requests an image to be created from an Instance # # ==== Parameters # * instance_id<~String> - id of instance to save # * name<~String> - name of image to be created # * description<~String> - description of image to be created # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'name'<~String>: name of new image # * 'createdTime'<~Integer>: epoch time at creation # * 'productCodes'<~Array>: # * 'id'<~String>: id of new image # * 'description'<~String>: description # * 'visibility'<~String>: visibility level ("PRIVATE", etc) # * 'state'<~Integer>: status of image def create_image(instance_id, name, description) request( :method => 'PUT', :expects => 200, :path => "/instances/#{instance_id}", :body => { 'state' => 'save', 'name' => name, 'description' => description } ) end end class Mock def create_image(instance_id, name, description) response = Excon::Response.new if instance_exists? instance_id image = Fog::IBM::Mock.private_image(name, description) self.data[:images][image["id"]] = image response.status = 200 response.body = image else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/delete_address.rb0000644000004100000410000000212112600047642023312 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Deletes the Address that the authenticated user manages with the specified :address_id # # ==== Parameters # * address_id<~String> - Id of address # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # *'success'<~Bool>: true or false for success def delete_address(address_id) request( :method => 'DELETE', :expects => 200, :path => "/addresses/#{address_id}" ) end end class Mock def delete_address(address_id) response = Excon::Response.new if address_exists? address_id self.data[:addresses].delete address_id response.status = 200 response.body = { "success" => true } else response.status = 404 end response end def address_exists?(address_id) self.data[:addresses].key? address_id end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/delete_key.rb0000644000004100000410000000164312600047642022465 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Deletes the key specified with key_name # # ==== Parameters # * key_name<~String> - name of key to be deleted # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # *'success'<~Bool>: true or false for success def delete_key(key_name) request( :method => 'DELETE', :expects => 200, :path => "/keys/#{key_name}" ) end end class Mock def delete_key(key_name) response = Excon::Response.new if key_exists? key_name self.data[:keys].delete(key_name) response.status = 200 response.body = {"success"=>true} else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_request.rb0000644000004100000410000000566012600047642022705 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns list of instances created with request specified by request_id # # ==== Parameters # * request_id<~String> - Id of request # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * instances<~Array>: array of instances created with request # * 'name'<~String>: instance name # * 'location'<~String>: instance location id # * 'keyName'<~String>: instance assigned keypair # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname # * 'productCodes'<~Array>: associated product codes # * 'requestId'<~String>: # * 'imageId'<~String>: # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched # * 'id'<~String>: instance id # * 'volumes'<~Array>: # * 'isMiniEphemeral'<~Boolean>: minimal local storage # * 'instanceType'<~String>: instance type # * 'diskSize'<~String>: instance disk size # * 'requestName'<~String>: instance request name # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance # * 'status'<~Integer>: instance status flag # * 'software'<~Array>: Software associated with this instance # * 'application'<~Hash>: Application name, type, and version (primarily OS information) # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires # * 'owner'<~String>: instance owner def get_request(request_id) request( :expects => 200, :method => 'GET', :path => "computecloud/enterprise/api/rest/20100331/requests/#{request_id}" ) end end class Mock def get_request(request_id) response = Excon::Response.new response.status = 200 response.body = {"instances"=> [{"name"=>"test from fog", "location"=>"101", "keyName"=>"mykey", "primaryIP"=> {"type"=>0, "ip"=>"42.42.42.42 ", "hostname"=>"42.42.42.42 "}, "productCodes"=>[], "requestId"=>"75364", "imageId"=>"20020159", "launchTime"=>1304012220770, "id"=>"75064", "volumes"=>[], "instanceType"=>"SLV32.2/4096/60*350", "requestName"=>"test from fog", "secondaryIP"=>[], "status"=>1, "software"=> [{"name"=>"SUSE Linux Enterprise Server", "type"=>"OS", "version"=>"11 SP1"}], "expirationTime"=>1367084229205, "owner"=>"user@example.com"}]} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/modify_instance.rb0000644000004100000410000000466712600047642023537 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Modify an instance # # ==== Parameters # * instance_id<~String> - id of instance to rename # * params<~Hash> - depends on type of request # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'success'<~Bool>: # OR # * response<~Excon::Response>: # * body<~Hash>: # ???? # * 'expirationTime'<~Integer>: new expiration time of instance (epoch) # # Note: The feature of dynamically attaching or detaching storage is only # supported by data centers where the KVM host version is RHEL 6.1. If the # feature is not supported by the data center, you will get an exception like # "Unsupported exception. Dynamic features are not supported on the KVM # Host". def modify_instance(instance_id, options={}) request( :method => 'PUT', :expects => 200, :path => "/instances/#{instance_id}", :body => options ) end end class Mock def modify_instance(instance_id, params={}) response = Excon::Response.new if instance_exists? instance_id if params['state'] == 'restart' self.data[:instances][instance_id]["status"] = "8" response.status = 200 response.body = { "success" => true } elsif params['type'] == 'attach' || params['type'] == 'detach' if Fog::Storage[:ibm].volume_exists?(params['volume_id']) # TODO: Update the instance in the data hash, assuming IBM ever gets this feature working properly. response.status = 415 else response.status = 404 end elsif params['name'] self.data[:instances][instance_id]["name"] = params['name'] response.status = 200 response.body = { "success" => true } elsif params['expirationTime'] self.data[:instances][instance_id]["expirationTime"] = params['expirationTime'] response.status = 200 response.body = { 'expirationTime' => params['expirationTime'] } end else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_instance_logs.rb0000644000004100000410000000107312600047642024037 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Get an instance's logs # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * logs<~Array>: # TODO: docs def get_instance_logs(instance_id, start_index=nil) request( :method => 'GET', :expects => 200, :path => "/instances/#{instance_id}/logs" + (start_index ? "?startIndex=#{start_index}" : '') ) end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_images.rb0000644000004100000410000000404512600047642022652 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the list of Images available to be provisioned on the IBM DeveloperCloud. # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'images'<~Array>: list of images # * 'name'<~String>: image name # * 'location'<~String>: instance location id # * 'createdTime'<~Integer>: time created in epoch time # * 'supportedInstanceTypes'<~Array>: list of prices per image # * 'pricePerQuantity'<~Integer>: # * 'effectiveDate'<~Fixnum>: # * 'rate'<~Float>: price per unit # * 'countryCode'<~String>: # * 'unitOfMeasure'<~String>: unit of measurement # * 'currencyCode'<~String>: currency billed in # * 'productCodes'<~Array>: # * 'id'<~String>: # * 'documentation'<~String>: link to documentation for image # * 'manifest'<~String>: link to xml manifest file # * 'description'<~String>: text description of image # * 'visibility'<~String>: status of visibilty of image. known values so far are "PUBLIC" and "PRIVATE" # * 'platform'<~String>: operating system # * 'architecture'<~String>: architecture supported by image # * 'documentation'<~String>: link to documentation for image # * 'owner'<~String>: owner of image # * 'state'<~Integer>: state of availability of image def list_images request( :method => 'GET', :expects => 200, :path => '/offerings/image' ) end end class Mock def list_images response = Excon::Response.new response.status = 200 response.body = {'images' => self.data[:images].values} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_key.rb0000644000004100000410000000231012600047642021772 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns details of key by name specified # # ==== Parameters # 'key_name'<~String>: name of key to request # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'keyName'<~String>: Name of key # * 'lastModifiedTime'<~Integer>: epoch time of last modification # * 'default'<~Bool>: bool if key is default for user # * 'instanceIds'<~Array>: list of instances associated with key # * 'keyMaterial'<~String>: public key def get_key(key_name) request( :method => 'GET', :expects => 200, :path => "/keys/#{key_name}" ) end end class Mock def get_key(key_name) response = Excon::Response.new if key_exists? key_name response.status = 200 response.body = self.data[:keys][key_name] else response.status = 404 end response end def key_exists?(name) self.data[:keys].key? name end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/delete_instance.rb0000644000004100000410000000275312600047642023504 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Deletes the Instance that the authenticated user manages with the specified :instance_id # # ==== Parameters # * instance_id<~String> - Id of instance # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # *'success'<~Bool>: true or false for success def delete_instance(instance_id) request( :method => 'DELETE', :expects => 200, :path => "/instances/#{instance_id}" ) end end class Mock def delete_instance(instance_id) response = Excon::Response.new if deleteable? instance_id # remove from memoreeeez. self.data[:instances].delete instance_id response.body = { 'success' => true } response.status = 200 else # TODO: we should really return a 412 if the instance is in an invalid state, and a 404 if it doesn't exist. response.status = 404 end response end # we can't delete the instance if it doesn't exist, or is in an invalid state. def deleteable?(instance_id) return false unless instance_exists? instance_id instance = self.data[:instances][instance_id] return false if [0, 1, 7, 14, 15].include?(instance["status"].to_i) true end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/create_address.rb0000644000004100000410000000277212600047642023327 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Requests a new static IP address to be created # # ==== Parameters # * location_id<~String> - id of location # * offering_id<~String> - id for offering # * vlan_id<~String> - id of vlan # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'location'<~String>: location of new address # * 'offeringId'<~String>: offering id of new address # * 'id'<~String>: id # * 'ip'<~String>: returns string of spaces (ip not yet allocated right after creation) # * 'state'<~Integer>: status of address (0 when new) def create_address(location, offering_id, options={}) request( :method => 'POST', :expects => 200, :path => '/addresses', :body => { 'offeringID' => offering_id, 'location' => location, 'vlanID' => options[:vlan_id] } ) end end class Mock def create_address(location_id, offering_id="20001223", options={}) address = Fog::IBM::Mock.create_address(location_id, offering_id, options) self.data[:addresses][address['id']] = address response = Excon::Response.new response.status = 200 response.body = address response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_vlans.rb0000644000004100000410000000231612600047642022527 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the vlan offerings for user # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'addresses'<~Array>: list of addresses # * 'location'<~String>: location of address # * 'mode'<~Integer>: # * 'offeringId'<~String>: offering ID # * 'id'<~String>: id # * 'type'<~Integer>: TODO unsure # * 'ip'<~String>: IP address.. with space at the end # * 'hostname'<~String>: seems to be same as ip # * 'state'<~Integer>: state of address def list_vlans request( :method => 'GET', :expects => 200, :path => '/offerings/vlan' ) end end class Mock def list_vlans response = Excon::Response.new response.status = 200 response.body = {"vlan"=> [{"location"=>"101", "id"=>"75321", "name"=>"FOG-VLAN1"}]} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/clone_image.rb0000644000004100000410000000245212600047642022614 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Clones image specified by image_id # # ==== Parameters # * image_id<~String> - id of image to be cloned # * name<~String> - name of new image # * description<~String> - description of new image # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'ImageID'<~String>: id of new image def clone_image(image_id, name, description) request( :method => 'POST', :expects => 200, :path => "/offerings/image/#{image_id}", :body => { 'name' => name, 'description' => description } ) end end class Mock def clone_image(image_id, name, description) response = Excon::Response.new if image_exists? image_id id = Fog::IBM::Mock.instance_id self.data[:images][id] = self.data[:images][image_id].merge('id' => id, 'name' => name, 'description' => description) response.status = 200 response.body = { "ImageID" => id } else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_image_agreement.rb0000644000004100000410000000652712600047642024331 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns license agreement of image specified by id # # ==== Parameters # 'image_id'<~String>: id of desired image # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'text'<~String>: text of license # * 'id'<~String>: id of image # * 'attachments'<~Array>: Additional agreements attached to image # * 'label'<~String>: description of attachment # * 'url'<~String>: url to retrieve attachment # * 'type'<~Integer>: type of attachment def get_image_agreement(image_id) request( :method => 'GET', :expects => 200, :path => "/offerings/image/#{image_id}/agreement" ) end end class Mock # TODO: Fix this so they work. def get_image_agreement(image_id) response = Excon::Response.new response.status = 200 response.body = {"text"=> "test, operating system is SUSE Linux Enterprise Server/11 SP1 - English\n\nYour access to and use of the Service, including all selected options, are governed by the terms of the Agreement signed between your Enterprise and IBM. Each Service is also governed by one or more Attachments (including, for example, Image Terms Attachments). Applicable Attachments are part of the Agreement between you and IBM and include Attachments for Services you acquire after the Agreement was signed. The Agreement also references applicable IBM and third party end user license agreements that govern the use of IBM software and operating system software provided as part of an Image.\n\nYou are responsible for complying with the terms of the Agreement (including applicable Attachments) and applicable license agreements. You may review the terms for the Service by 1) obtaining information regarding the Agreement from your Account Administrator and 2) accessing the Asset Catalog to review specific Image Terms and end user license agreements for IBM and third party software provided as part of an Image. ", "id"=>"20020159", "attachments"=> [{"label"=>"Service Description for Developement & Test Service", "url"=> "https://www-147.ibm.com/cloud/enterprise/static/internal_user_agreement.pdf", "type"=>0}, {"label"=>"Smart Business on the IBM Public Cloud Agreement", "url"=> "https://www-147.ibm.com/cloud/enterprise/static/internal_user_agreement.pdf", "type"=>1}, {"label"=> "End User License for SUSE 10.2 Linux Enterprise Server software", "url"=> "https://www.novell.com/licensing/eula/sles_10/sles_10_english.pdf", "type"=>2}, {"label"=> "End User License for SUSE 11.0 Linux Enterprise Server software", "url"=>"https://www.novell.com/licensing/eula/sles_11/sles_11_en.pdf", "type"=>2}, {"label"=>"End User License for RedHat Linux RHEL software", "url"=>"https://www.redhat.com/licenses/", "type"=>2}]} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_instance.rb0000644000004100000410000000535612600047642023023 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the Instance that the authenticated user manages with the specified :instance_id # # ==== Parameters # * instance_id<~String> - Id of instance # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'name'<~String>: instance name # * 'location'<~String>: instance location id # * 'keyName'<~String>: instance assigned keypair # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname # * 'productCodes'<~Array>: associated product codes # * 'requestId'<~String>: # * 'imageId'<~String>: # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched # * 'id'<~String>: instance id # * 'volumes'<~Array>: # * 'isMiniEphemeral'<~Boolean>: minimal local storage # * 'instanceType'<~String>: instance type # * 'diskSize'<~String>: instance disk size # * 'requestName'<~String>: instance request name # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance # * 'status'<~Integer>: instance status flag # * 'software'<~Array>: Software associated with this instance # * 'application'<~Hash>: Application name, type, and version (primarily OS information) # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires # * 'owner'<~String>: instance owner def get_instance(instance_id) request( :method => 'GET', :expects => 200, :path => "/instances/#{instance_id}" ) end end class Mock def get_instance(instance_id) response = Excon::Response.new if instance_exists? instance_id activate_instance(instance_id) # Set it to Active if it's not running response.status = 200 response.body = self.data[:instances][instance_id] else raise Fog::Compute::IBM::NotFound end response end # Checks if an instance exists def instance_exists?(instance_id) self.data[:instances].key? instance_id end # Sets instance status to Active if it's not already set. def activate_instance(instance_id) self.data[:instances][instance_id]["status"] = 5 unless instance_active? instance_id end # Checks if an instance is Active def instance_active?(instance_id) self.data[:instances][instance_id]["status"] == 5 end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_keys.rb0000644000004100000410000000402412600047642022355 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns list of instances that the authenticated user manages. # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'instances'<~Array>: list of instances # * 'name'<~String>: instance name # * 'location'<~String>: instance location id # * 'keyName'<~String>: instance assigned keypair # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname # * 'productCodes'<~Array>: associated product codes # * 'requestId'<~String>: # * 'imageId'<~String>: # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched # * 'id'<~String>: instance id # * 'volumes'<~Array>: # * 'isMiniEphemeral'<~Boolean>: minimal local storage # * 'instanceType'<~String>: instance type # * 'diskSize'<~String>: instance disk size # * 'requestName'<~String>: instance request name # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance # * 'status'<~Integer>: instance status flag # * 'software'<~Array>: Software associated with this instance # * 'application'<~Hash>: Application name, type, and version (primarily OS information) # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires # * 'owner'<~String>: instance owner def list_keys request( :method => 'GET', :expects => 200, :path => '/keys' ) end end class Mock def list_keys response = Excon::Response.new response.status = 200 response.body = {'keys' => self.data[:keys].values} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/get_image.rb0000644000004100000410000000424112600047642022271 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns details of image specified by id # # ==== Parameters # 'image_id'<~String>: id of desired image # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'name'<~String>: image name # * 'location'<~String>: instance location id # * 'createdTime'<~Integer>: time created in epoch time # * 'supportedInstanceTypes'<~Array>: list of prices per image # * 'pricePerQuantity'<~Integer>: # * 'effectiveDate'<~Fixnum>: # * 'rate'<~Float>: price per unit # * 'countryCode'<~String>: # * 'unitOfMeasure'<~String>: unit of measurement # * 'currencyCode'<~String>: currency billed in # * 'productCodes'<~Array>: # * 'id'<~String>: # * 'documentation'<~String>: link to documentation for image # * 'manifest'<~String>: link to xml manifest file # * 'description'<~String>: text description of image # * 'visibility'<~String>: status of visibilty of image. known values so far are "PUBLIC" and "PRIVATE" # * 'platform'<~String>: operating system # * 'architecture'<~String>: architecture supported by image # * 'documentation'<~String>: link to documentation for image # * 'owner'<~String>: owner of image # * 'state'<~Integer>: state of availability of image def get_image(image_id) request( :method => 'GET', :expects => 200, :path => "/offerings/image/#{image_id}" ) end end class Mock def get_image(image_id) response = Excon::Response.new if image_exists? image_id response.status = 200 response.body = self.data[:images][image_id] else response.status = 404 end response end private def image_exists?(image_id) self.data[:images].key? image_id end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_addresses.rb0000644000004100000410000000325712600047642023366 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the list of static IP addresses for current user # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'addresses'<~Array>: list of addresses # * 'location'<~String>: location of address # * 'mode'<~Integer>: # * 'offeringId'<~String>: offering ID # * 'id'<~String>: id # * 'type'<~Integer>: TODO unsure # * 'ip'<~String>: IP address.. with space at the end # * 'hostname'<~String>: seems to be same as ip # * 'state'<~Integer>: state of address def list_addresses request( :method => 'GET', :expects => 200, :path => '/addresses' ) end end class Mock def list_addresses # Loop through addresses and update states and values if they aren't set self.data[:addresses].values.each do |address| address['state'] = 2 if address['state'] == 0 address['ip'] = Fog::IBM::Mock.ip_address if address['ip'].empty? address['mode'] = 0 unless address.key? 'mode' address['hostname'] = Fog::IBM::Mock.hostname unless address.key? 'hostname' address['type'] = 1 unless address.key? 'type' end response = Excon::Response.new response.status = 200 response.body = { 'addresses' => self.data[:addresses].values } response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/delete_image.rb0000644000004100000410000000212512600047642022753 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Deletes the image that the authenticated user manages with the specified :image_id # # ==== Parameters # * image_id<~String> - Id of image # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # *'success'<~Bool>: true or false for success def delete_image(image_id) request( :method => 'DELETE', :expects => 200, :path => "/offerings/image/#{image_id}" ) end end class Mock def delete_image(image_id) response = Excon::Response.new # TODO: We should probably check that an image is deleteable. # i.e. that the user has appropriate permissions if image_exists? image_id self.data[:images].delete image_id response.status = 200 response.body = {"success"=>true} else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_instances.rb0000644000004100000410000000405712600047642023377 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns list of instances that the authenticated user manages. # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'instances'<~Array>: list of instances # * 'name'<~String>: instance name # * 'location'<~String>: instance location id # * 'keyName'<~String>: instance assigned keypair # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname # * 'productCodes'<~Array>: associated product codes # * 'requestId'<~String>: # * 'imageId'<~String>: # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched # * 'id'<~String>: instance id # * 'volumes'<~Array>: # * 'isMiniEphemeral'<~Boolean>: minimal local storage # * 'instanceType'<~String>: instance type # * 'diskSize'<~String>: instance disk size # * 'requestName'<~String>: instance request name # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance # * 'status'<~Integer>: instance status flag # * 'software'<~Array>: Software associated with this instance # * 'application'<~Hash>: Application name, type, and version (primarily OS information) # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires # * 'owner'<~String>: instance owner def list_instances request( :method => 'GET', :expects => 200, :path => '/instances' ) end end class Mock def list_instances response = Excon::Response.new response.status = 200 response.body = { 'instances' => self.data[:instances].values } response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_locations.rb0000644000004100000410000000143512600047642023400 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the list of Images available to be provisioned on the IBM DeveloperCloud. # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'locations'<~Array>: list of locations def list_locations request( :method => 'GET', :expects => 200, :path => "/locations" ) end end class Mock def list_locations response = Excon::Response.new response.status = 200 response.body = { "locations" => self.data[:locations].values } response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/create_instance.rb0000644000004100000410000000742412600047642023505 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Requests a new Instance to be created. # # ==== Parameters # * name<~String> - The alias to use to reference this instance # * image_id<~String> - The id of the image to create this instance from # * instance_type<~String> - The instance type to use for this instance # * location<~String> - The id of the Location where this instance will be created # * options<~Hash>: # * :key_name<~String> - The public key to use for accessing the created instance # * :ip<~String> - The ID of a static IP address to associate with this instance # * :volume_id<~String> - The ID of a storage volume to associate with this instance # * :vlan_id<~String> - The ID of a Vlan offering to associate with this instance. # * :secondary_ip<~String> - Comma separated list of static IP IDs to associate with this instance. # * :is_mini_ephermal<~Boolean> - Whether or not the instance should be provisioned with the root segment only # * :configuration_data<~Hash> - Arbitrary name/value pairs defined by the image being created # * :anti_collocation_instance<~String> - The ID of an existing anti-collocated instance. # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'name'<~String>: instance name # * 'location'<~String>: instance location id # * 'keyName'<~String>: instance assigned keypair # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname # * 'productCodes'<~Array>: associated product codes # * 'requestId'<~String>: # * 'imageId'<~String>: # * 'launchTime'<~Integer>: epoch time in ms representing when the instance was launched def create_instance(name, image_id, instance_type, location, options={}) body_data = { 'name' => name, 'imageID' => image_id, 'instanceType' => instance_type, 'location' => location, 'publicKey' => options[:key_name], 'ip' => options[:ip], 'volumeID' => options[:volume_id], 'vlanID' => options[:vlan_id], 'isMiniEphemeral' => options[:is_mini_ephemeral], 'Configuration Data' => options[:configuration_data], 'antiCollocationInstance' => options[:anti_collocation_instance] } if options[:secondary_ip] options[:secondary_ip].split(',').map(&:strip).each_with_index do |n, idx| body_data.merge!({"secondary.ip.#{idx}" => n}) end end request( :method => 'POST', :expects => 200, :path => '/instances', :body => body_data ) end end class Mock def create_instance(name, image_id, instance_type, location, options={}) response = Excon::Response.new # Since we want to test error conditions, we have a little regex that traps specially formed # instance type strings. case name when /FAIL:\ (\d{3})/ response.status = $1.to_i raise Excon::Errors.status_error({:expects => 200}, response) else instance = Fog::IBM::Mock.create_instance(name, image_id, instance_type, location, options) self.data[:instances][instance['id']] = instance response.status = 200 response.body = {"instances" => [ instance ]} response end end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/list_address_offerings.rb0000644000004100000410000000342712600047642025077 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Returns the offerings of static address types/pricing for the authenticated user # # ==== Parameters # No parameters # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'addresses'<~Array>: list of address offerings # * 'price'<~Hash>: pricing info for specific address offering # * 'price'<~Hash>: hash containing pricing information # * 'pricePerQuantity'<~Integer>: # * 'effectiveDate'<~Integer>: starting date price is effective # * 'rate'<~Float>: rate per unit # * 'countryCode'<~String>: # * 'unitOfMeasure'<~String>: # * 'currencyCode'<~String>: currency used # * 'location'<~String>: datacenter location string # * 'ipType'<~Integer>: type of ip address # * 'id'<~String>: id of offering def list_address_offerings request( :expects => 200, :method => 'GET', :path => '/offerings/address' ) end end class Mock def list_address_offerings response = Excon::Response.new response.status = 200 response.body = {"addresses"=> [{"price"=> {"pricePerQuantity"=>1, "effectiveDate"=>1302566400000, "rate"=>0.01, "countryCode"=>"897", "unitOfMeasure"=>"UHR", "currencyCode"=>"USD"}, "location"=>"101", "ipType"=>0, "id"=>"20001223"}]} response end end end end end fog-1.34.0/lib/fog/ibm/requests/compute/modify_key.rb0000644000004100000410000000257212600047642022514 0ustar www-datawww-datamodule Fog module Compute class IBM class Real # Modify a key # # ==== Parameters # * key_name<~String> - name of key to be modified # * params<~Hash> - depends on type of request # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'success'<~Bool>: success status of update request def modify_key(key_name, params={}) request( :method => 'PUT', :expects => 200, :path => "/keys/#{key_name}", :body => params ) end end class Mock def modify_key(key_name, params={}) response = Excon::Response.new if key_exists? key_name if params['public_key'] self.data[:keys][key_name]['keyMaterial'] = public_key self.data[:keys][key_name]['lastModifiedTime'] = Fog::IBM::Mock.launch_time end if params['default'] self.data[:keys].values.each do |key| key['default'] = false end self.data[:keys][key_name]['default'] = true end response.status = 200 response.body = {"success"=>true} else response.status = 404 end response end end end end end fog-1.34.0/lib/fog/ibm/core.rb0000644000004100000410000001237312600047642015756 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module IBM extend Fog::Provider service(:compute, 'Compute') service(:storage, 'Storage') # Provisioning is very slow. We'll pass this arg explicitly until there's a way # to set the default timeout on a per-provider basis. def self.timeout 1800 end class Connection < Fog::XML::Connection def initialize(user, password) @user = user @password = password @endpoint = URI.parse('https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331') @base_path = @endpoint.path super("#{@endpoint.scheme}://#{@endpoint.host}:#{@endpoint.port}") end def request(options) options[:path] = @base_path + options[:path] options[:headers] ||= {} options[:headers]['Authorization'] = auth_header options[:headers]['Accept'] = 'application/json' options[:headers]['Accept-Encoding'] = 'gzip' unless options[:body].nil? options[:headers]['Content-Type'] = 'application/x-www-form-urlencoded' options[:body] = form_encode(options[:body]) end response = super(options) unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end def auth_header @auth_header ||= 'Basic ' + Base64.encode64("#{@user}:#{@password}").gsub("\n",'') end def form_encode(params) params.reject {|k, v| v.nil? }.map {|pair| pair.map {|x| URI.escape(x.to_s) }.join('=') }.join('&') end end class Mock class << self def id Fog::Mock.random_numbers(7).to_i.to_s end alias_method :instance_id, :id alias_method :request_id, :id def primary_ip { "type" => 0, "ip" => Fog::IBM::Mock.ip_address, "hostname" => Fog::IBM::Mock.hostname } end def ip_address ip = [] 4.times do ip << Fog::Mock.random_numbers(rand(3) + 1).to_i.to_s # remove leading 0 end ip.join('.') end def hostname "vhost" + Fog::Mock.random_numbers(3).to_i.to_s + ".fake.compute.ihost.com" end # Miliseconds since epoch def launch_time (Time.now.tv_sec * 1000).to_i end # 1 year from now, in miliseconds since epoch def expiry_time ((Time.now.tv_sec + 31556926) * 1000).to_i end def owner "user" + Fog::Mock.random_numbers(3).to_i.to_s + "@company.com" end def key_material OpenSSL::PKey::RSA.generate(1024) end def private_image(name, description) { "name" => name, "createdTime" => Fog::IBM::Mock.launch_time, "productCodes"=> [], "id" => Fog::IBM::Mock.instance_id, "description" => description, "visibility" => "PRIVATE", "state" => 0 } end def create_instance(name, image_id, instance_type, location, options) { "name" => name, "location" => location, "keyName" => options[:key_name], "primaryIP" => Fog::IBM::Mock.primary_ip, "productCodes" => [], "requestId" => Fog::IBM::Mock.request_id, "imageId" => image_id, "launchTime" => Fog::IBM::Mock.launch_time, "id" => Fog::IBM::Mock.instance_id, "volumes" => [], "isMiniEphemeral" => "false", "instanceType" => instance_type, "diskSize" => "60", "requestName" => "", "secondaryIP" => [], "status" => 1, "software" => [ { "name"=>"SUSE Linux Enterprise Server", "type"=>"OS", "version"=>"11 SP1" } ], "expirationTime"=> Fog::IBM::Mock.expiry_time, "owner" => Fog::IBM::Mock.owner } end def create_volume(name, format, location_id, size, offering_id) { "instanceId" => "0", "state" => 1, "size" => size, "offeringId" => offering_id, "ioPrice" => { "rate" => 0.11, "unitOfMeasure" => "CNT", "countryCode" => "897", "effectiveDate" => Fog::IBM::Mock.launch_time, "currencyCode" => "USD", "pricePerQuantity" => 1 }, "owner" => Fog::IBM::Mock.owner, "createdTime" => Fog::IBM::Mock.launch_time, "location" => location_id, "productCodes"=> [], "format" => format, "name" => name, "id" => Fog::IBM::Mock.id, } end def create_address(location_id, offering_id, vlan_id) # TODO: Figure out vlan handling { "id" => Fog::IBM::Mock.id, "location" => location_id, "offeringId"=> offering_id, "ip" => "", "state" => 0 } end end end end end fog-1.34.0/lib/fog/ibm/models/0000755000004100000410000000000012600047642015756 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/models/storage/0000755000004100000410000000000012600047642017422 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/models/storage/volume.rb0000644000004100000410000000522612600047642021263 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Storage class IBM class Volume < Fog::Model STATES = { 0 => 'New', 1 => 'Creating', 2 => 'Deleting', 3 => 'Deleted', 4 => 'Detached', 5 => 'Attached', 6 => 'Failed', 7 => 'Deletion pending', 8 => 'Being cloned', 9 => 'Cloning', 10 => 'Attaching', 11 => 'Detaching', 12 => 'Copying', 13 => 'Importing', 14 => 'Transfer retrying', } identity :id attribute :instance_id, :aliases => "instanceId" attribute :io_price, :aliases => "ioPrice" attribute :name attribute :state attribute :size attribute :offering_id, :aliases => "offeringId" attribute :owner attribute :created_at, :aliases => "createdTime" attribute :location_id, :aliases => "location" attribute :product_codes, :aliases => "productCodes" attribute :format attribute :storage_area, :aliases => 'storageArea' attribute :platform_version, :aliases => 'platformVersion' attribute :clone_status, :aliases => 'cloneStatus' def attached? state == "Attached" end def attach(instance_id) requires :id service.attach_volume(instance_id, id).body['success'] end def detach(instance_id) requires :id service.detach_volume(instance_id, id).body['success'] end def created_at Time.at(attributes[:created_at].to_f / 1000) end def destroy requires :id service.delete_volume(id) true end def instance return nil if instance_id.nil? || instance_id == "0" || instance_id == "" Fog::Compute[:ibm].servers.get(instance_id) end def location requires :location_id Fog::Compute[:ibm].locations.get(location_id) end # Are we ready to be attached to an instance? def ready? # TODO: Not sure if this is the only state we should be matching. state == "Detached" end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? requires :name, :offering_id, :format, :location_id, :size data = service.create_volume(name, offering_id, format, location_id, size) merge_attributes(data.body) true end def state STATES[attributes[:state]] end end end end end fog-1.34.0/lib/fog/ibm/models/storage/offerings.rb0000644000004100000410000000046512600047642021736 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/storage/offering' module Fog module Storage class IBM class Offerings < Fog::Collection model Fog::Storage::IBM::Offering def all load(service.list_offerings.body['volumes']) end end end end end fog-1.34.0/lib/fog/ibm/models/storage/offering.rb0000644000004100000410000000062612600047642021552 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Storage class IBM class Offering < Fog::Model identity :id attribute :location attribute :name attribute :label attribute :capacity attribute :supported_sizes, :aliases => 'supportedSizes' attribute :supported_formats, :aliases => 'formats' attribute :price end end end end fog-1.34.0/lib/fog/ibm/models/storage/volumes.rb0000644000004100000410000000074412600047642021446 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/storage/volume' module Fog module Storage class IBM class Volumes < Fog::Collection model Fog::Storage::IBM::Volume def all load(service.list_volumes.body['volumes']) end def get(volume_id) begin new(service.get_volume(volume_id).body) rescue Fog::Storage::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/models/compute/0000755000004100000410000000000012600047642017432 5ustar www-datawww-datafog-1.34.0/lib/fog/ibm/models/compute/address.rb0000644000004100000410000000266612600047642021416 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class IBM class Address < Fog::Model STATES = { 0 => 'New', 1 => 'Allocating', 2 => 'Free', 3 => 'Attached', 4 => 'Releasing', 5 => 'Released', 6 => 'Failed', 7 => 'Release pending', } identity :id attribute :type attribute :location attribute :ip attribute :state attribute :instance_id, :aliases => 'instanceId' attribute :offering_id, :aliases => 'offeringId' attribute :vlan_id, :aliases => 'vlanId' attribute :hostname attribute :mode attribute :owner def initialize(new_attributes={}) super(new_attributes) self.offering_id ||= '20001223' self.location ||= '82' end def save requires :offering_id, :location data = service.create_address(location, offering_id, :vlan_id => vlan_id, :ip => ip) merge_attributes(data.body) true end def state STATES[attributes[:state]] end def ready? state == 'Free' || state == 'Released' end def destroy requires :id service.delete_address(id).body['success'] end end end end end fog-1.34.0/lib/fog/ibm/models/compute/addresses.rb0000644000004100000410000000110312600047642021727 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/address' module Fog module Compute class IBM class Addresses < Fog::Collection model Fog::Compute::IBM::Address def all load(service.list_addresses.body['addresses']) end def get(address_id) begin address = service.list_addresses.body new(address['addresses'].find{|address| address['id'] == address_id.to_s }) rescue Fog::Compute::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/models/compute/vlan.rb0000644000004100000410000000030712600047642020717 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class IBM class Vlan < Fog::Model identity :id attribute :name attribute :location end end end end fog-1.34.0/lib/fog/ibm/models/compute/location.rb0000644000004100000410000000041212600047642021564 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class IBM class Location < Fog::Model identity :id attribute :name attribute :location attribute :capabilities attribute :description end end end end fog-1.34.0/lib/fog/ibm/models/compute/images.rb0000644000004100000410000000073412600047642021230 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/image' module Fog module Compute class IBM class Images < Fog::Collection model Fog::Compute::IBM::Image def all load(service.list_images.body['images']) end def get(image_id) begin new(service.get_image(image_id).body) rescue Fog::Compute::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/models/compute/servers.rb0000644000004100000410000000075212600047642021454 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/server' module Fog module Compute class IBM class Servers < Fog::Collection model Fog::Compute::IBM::Server def all load(service.list_instances.body['instances']) end def get(server_id) begin new(service.get_instance(server_id).body) rescue Fog::Compute::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/models/compute/instance-type.rb0000644000004100000410000000034712600047642022546 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class IBM class InstanceType < Fog::Model identity :id attribute :detail attribute :label attribute :price end end end end fog-1.34.0/lib/fog/ibm/models/compute/instance-types.rb0000644000004100000410000000035612600047642022731 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/instance-type' module Fog module Compute class IBM class InstanceTypes < Fog::Collection model Fog::Compute::IBM::InstanceType end end end end fog-1.34.0/lib/fog/ibm/models/compute/locations.rb0000644000004100000410000000076412600047642021761 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/location' module Fog module Compute class IBM class Locations < Fog::Collection model Fog::Compute::IBM::Location def all load(service.list_locations.body['locations']) end def get(location_id) begin new(service.get_location(location_id).body) rescue Fog::Compute::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/models/compute/keys.rb0000644000004100000410000000117012600047642020731 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/key' module Fog module Compute class IBM class Keys < Fog::Collection model Fog::Compute::IBM::Key def all load(service.list_keys.body['keys']) end def get(key_id) begin new(service.get_key(key_id).body) rescue Fog::Compute::IBM::NotFound nil end end def default find {|key| key.default? } end def default=(key_name) service.modify_key(key_name, 'default' => true) end end end end end fog-1.34.0/lib/fog/ibm/models/compute/key.rb0000644000004100000410000000150312600047642020546 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class IBM class Key < Fog::Model identity :name, :aliases => 'keyName' attribute :default attribute :public_key, :aliases => 'keyMaterial' attribute :instance_ids, :aliases => 'instanceIds' attribute :modified_at, :aliases => 'lastModifiedTime' def save requires :name data = service.create_key(name, public_key) merge_attributes(data.body) data.body['keyName'] == name end def destroy data = service.delete_key(identity) data.body['success'] end def default? default end def instances instance_ids.map { Fog::Compute[:ibm].servers.get(instance_id) } end end end end end fog-1.34.0/lib/fog/ibm/models/compute/server.rb0000644000004100000410000001310012600047642021260 0ustar www-datawww-datarequire 'fog/compute/models/server' module Fog module Compute class IBM class Server < Fog::Compute::Server STATES = { 0 => 'New', 1 => 'Provisioning', 2 => 'Failed', 3 => 'Removed', 4 => 'Rejected', 5 => 'Active', 6 => 'Unknown', 7 => 'Deprovisioning', 8 => 'Restarting', 9 => 'Starting', 10 => 'Stopping', 11 => 'Stopped', 12 => 'Deprovisioning pending', 13 => 'Restart pending', 14 => 'Attaching', 15 => 'Detaching' } identity :id attribute :disk_size, :aliases => 'diskSize' attribute :expires_at, :aliases => 'expirationTime' attribute :image_id, :aliases => 'imageId' attribute :instance_type, :aliases => 'instanceType' attribute :ip attribute :key_name, :aliases => 'keyName' attribute :launched_at, :aliases => 'launchTime' attribute :location_id, :aliases => 'location' attribute :name attribute :owner attribute :primary_ip, :aliases => 'primaryIP' attribute :product_codes, :aliases => 'productCodes' attribute :request_id, :aliases => 'requestId' attribute :request_name, :aliases => 'requestName' attribute :is_mini_ephemeral, :aliases => 'isMiniEphemeral' attribute :secondary_ip, :aliases => 'secondaryIP' attribute :software attribute :state, :aliases => 'status' attribute :volume_ids, :aliases => 'volumes' attribute :vlan_id, :aliases => 'vlanID' def initialize(new_attributes={}) super(new_attributes) self.name ||= 'fog-instance' self.image_id ||= '20010001' self.location_id ||= '41' self.instance_type ||= 'COP32.1/2048/60' self.key_name ||= 'fog' end def save requires :name, :image_id, :instance_type, :location_id data = service.create_instance(name, image_id, instance_type, location_id, :key_name => key_name, :vlan_id => vlan_id, :secondary_ip => secondary_ip) data.body['instances'].each do |iattrs| if iattrs['name'] == name merge_attributes(iattrs) return true end end false end def state STATES[attributes[:state]] end def ready? state == "Active" end def reboot requires :id service.modify_instance(id, 'state' => 'restart').body['success'] end def destroy requires :id service.delete_instance(id).body['success'] end def rename(name) requires :id if service.modify_instance(id, 'name' => name).body["success"] attributes[:name] = name else return false end true end def allocate_ip(wait_for_ready=true) requires :location_id new_ip = service.addresses.new(:location => location_id) new_ip.save new_ip.wait_for(Fog::IBM.timeout) { ready? } if wait_for_ready secondary_ip << new_ip new_ip end def addresses addys = secondary_ip.map {|ip| Fog::Compute[:ibm].addresses.new(ip) } # Set an ID, in case someone tries to save addys << service.addresses.new(attributes[:primary_ip].merge( :id => "0", :location => location_id, :state => 3 )) addys end def attach(volume_id) requires :id data = service.modify_instance(id, {'type' => 'attach', 'storageID' => volume_id}) data.body end def detach(volume_id) requires :id data = service.modify_instance(id, {'type' => 'detach', 'storageID' => volume_id}) data.body end def launched_at Time.at(attributes[:launched_at].to_f / 1000) end def expires_at Time.at(attributes[:expires_at].to_f / 1000) end # Sets expiration time - Pass an instance of Time. def expire_at(time) expiry_time = (time.tv_sec * 1000).to_i data = service.modify_instance(id, 'expirationTime' => expiry_time) if data.body['expirationTime'] == expiry_time attributes[:expires_at] = expiry_time true else false end end # Expires the instance immediately def expire! expire_at(Time.now + 5) end def image requires :image_id service.images.get(image_id) end def location requires :location_id service.locations.get(location_id) end def public_hostname primary_ip ? primary_ip['hostname'] : nil end def public_ip_address primary_ip ? primary_ip['ip'] : nil end # Creates an image from the current instance # if name isn't passed then we'll take the current name and timestamp it def to_image(opts={}) options = { :name => name + " as of " + Time.now.strftime("%Y-%m-%d %H:%M"), :description => "" }.merge(opts) service.create_image(id, options[:name], options[:description]).body end alias_method :create_image, :to_image end end end end fog-1.34.0/lib/fog/ibm/models/compute/image.rb0000644000004100000410000000333712600047642021047 0ustar www-datawww-datarequire 'fog/core/model' require 'fog/ibm/models/compute/instance-types' module Fog module Compute class IBM class Image < Fog::Model STATES = { 0 => 'New', 1 => 'Available', 2 => 'Unavailable', 3 => 'Deleted', 4 => 'Capturing', 5 => 'Importing', 6 => 'Copying', 7 => 'Failed', } identity :id attribute :architecture attribute :created_at, :aliases => 'createdTime' attribute :description attribute :documentation attribute :location attribute :manifest attribute :name attribute :owner attribute :platform attribute :product_codes, :aliases => 'productCodes' attribute :state attribute :supported_instance_types, :aliases => 'supportedInstanceTypes' attribute :visibility attribute :volume_id def initialize(new_attributes = {}) super(new_attributes) attributes[:supported_instance_types] = Fog::Compute::IBM::InstanceTypes.new.load(attributes[:supported_instance_types]) if attributes[:supported_instance_types] end def save requires :id, :volume_id data = service.create_image(id, volume_id) merge_attributes(data.body) data.body['success'] end def state STATES[attributes[:state]] end def ready? state == 'Available' end def clone(name, description) service.clone_image(id, name, description).body['ImageID'] end def destroy requires :id service.delete_image(id).body['success'] end end end end end fog-1.34.0/lib/fog/ibm/models/compute/vlans.rb0000644000004100000410000000102512600047642021100 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ibm/models/compute/vlan' module Fog module Compute class IBM class Vlans < Fog::Collection model Fog::Compute::IBM::Vlan def all load(service.list_vlans.body['vlan']) end def get(vlan_id) begin vlan = service.list_vlans.body new(vlan['vlan'].find{|vlan| vlan['id'] == vlan_id.to_s }) rescue Fog::Compute::IBM::NotFound nil end end end end end end fog-1.34.0/lib/fog/ibm/compute.rb0000644000004100000410000002176012600047642016502 0ustar www-datawww-datarequire 'fog/ibm/core' module Fog module Compute class IBM < Fog::Service requires :ibm_username, :ibm_password recognizes :location model_path 'fog/ibm/models/compute' model :image collection :images model :server collection :servers model :address collection :addresses model :key collection :keys model :location collection :locations model :vlan collection :vlans request_path 'fog/ibm/requests/compute' request :list_images request :create_image request :clone_image request :delete_image request :get_image request :get_image_agreement request :get_image_manifest # request :get_image_swbundles # request :get_image_swbundle request :list_instances request :create_instance request :delete_instance request :modify_instance request :get_instance request :get_instance_logs # request :get_instance_swbundle request :get_request request :list_addresses request :list_address_offerings request :list_vlans request :create_address request :delete_address request :list_keys request :create_key request :delete_key request :modify_key request :get_key request :list_locations request :get_location class Real def initialize(options={}) @connection = Fog::IBM::Connection.new(options[:ibm_username], options[:ibm_password]) end private def request(options) begin @connection.request(options) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::IBM::NotFound.slurp(error) else error end end end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :instances => {}, :images => populate_images, :keys => {}, :locations => populate_locations, :private_keys => {}, :addresses => {} } end end def self.reset @data = nil end def data self.class.data[@ibm_username] end def reset_data self.class.data.delete(@ibm_username) @data = self.class.data[@ibm_username] end def initialize(options={}) @ibm_username = options[:ibm_username] @ibm_password = options[:ibm_password] @data = self.class.data[@ibm_username] end def self.populate_images images = {} images["20010001"] = { "name"=>"SUSE Linux Enterprise Server 11 SP1 for x86", "manifest"=>"https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{6CD09CE4-E99B-D72F-6C29-233C9B2A1676}/1.0/parameters.xml", "state"=>1, "visibility"=>"PUBLIC", "owner"=>"SYSTEM", "platform"=>"SUSE Linux Enterprise Server/11 SP1", "location"=>"41", "createdTime"=>1282466781000, "supportedInstanceTypes"=> [{"detail"=>"Copper - 32 bit (vCPU: 1, RAM: 2 GiB, Disk: 60 GiB)", "label"=>"Copper 32 bit", "price"=>{"rate"=>0.095, "unitOfMeasure"=>"UHR ", "countryCode"=>"897", "effectiveDate"=>-1, "currencyCode"=>"USD", "pricePerQuantity"=>1}, "id"=>"COP32.1/2048/60"}, {"detail"=>"Bronze - 32 bit (vCPU: 1, RAM: 2 GiB, Disk: 235 GiB)", "label"=>"Bronze 32 bit", "price"=>{"rate"=>0.115, "unitOfMeasure"=>"UHR ", "countryCode"=>"897", "effectiveDate"=>-1, "currencyCode"=>"USD", "pricePerQuantity"=>1}, "id"=>"BRZ32.1/2048/60*175"}, {"detail"=>"Silver - 32 bit (vCPU: 2, RAM: 4 GiB, Disk: 410 GiB)", "label"=>"Silver 32 bit", "price"=>{"rate"=>0.2, "unitOfMeasure"=>"UHR ", "countryCode"=>"897", "effectiveDate"=>-1, "currencyCode"=>"USD", "pricePerQuantity"=>1}, "id"=>"SLV32.2/4096/60*350"}, {"detail"=>"Gold - 32 bit (vCPU: 4, RAM: 4 GiB, Disk: 410 GiB)", "label"=>"Gold 32 bit", "price"=>{"rate"=>0.33, "unitOfMeasure"=>"UHR ", "countryCode"=>"897", "effectiveDate"=>-1, "currencyCode"=>"USD", "pricePerQuantity"=>1}, "id"=>"GLD32.4/4096/60*350"}], "productCodes"=>["rtpSr7dKs9ARDmuPy6WPgV"], "documentation"=>"https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{6CD09CE4-E99B-D72F-6C29-233C9B2A1676}/1.0/GettingStarted.html", "id"=>"20010001", "description"=>"Suse Linux 32 bit" } images end def self.populate_locations locations = {} locations["41"] = { "state"=>1, "location"=>"RTP", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Raleigh, U.S.A", "id"=>"41", "description"=>"This data center is located in Raleigh, North Carolina, U.S.A. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations["61"] = { "state"=>1, "location"=>"EHN", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Ehningen, Germany", "id"=>"61", "description"=>"This data center is located in Ehningen(near Baden-Wurttemberg), Germany. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations["82"] = { "state"=>1, "location"=>"us-co-dc1", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Boulder1, U.S.A", "id"=>"82", "description"=>"This data center is located in Boulder(near Denver), Colorado, U.S.A. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations["101"] = { "state"=>1, "location"=>"ca-on-dc1", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Markham, Canada", "id"=>"101", "description"=>"This data center is located in Markham(near Toronto), Ontario, Canada. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations["121"] = { "state"=>1, "location"=>"ap-jp-dc1", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Makuhari, Japan", "id"=>"121", "description"=>"This data center is located in Makuhari(near Tokoyo), Japan. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations["141"] = { "state"=>1, "location"=>"ap-sg-dc1", "capabilities"=>[ {"entries"=>{"EXT3"=>["ext3"], "RAW"=>["raw"]}, "id"=>"oss.storage.format"}, {"entries"=>{}, "id"=>"oss.instance.spec.i386"}, {"entries"=>{}, "id"=>"oss.instance.spec.x86_64"}, {"entries"=>{}, "id"=>"oss.storage.availabilityarea"}], "name"=>"Singapore, Singapore", "id"=>"141", "description"=>"This data center is located in Singapore. The services provided are: Guest Instances, Image Capture, Persistent Storage, Reserved IP, Private VLAN/VPN." } locations end end end end end fog-1.34.0/lib/fog/ibm/storage.rb0000644000004100000410000000323212600047642016464 0ustar www-datawww-datarequire 'fog/ibm/core' module Fog module Storage class IBM < Fog::Service requires :ibm_username, :ibm_password recognizes :location model_path 'fog/ibm/models/storage' model :offering collection :offerings model :volume collection :volumes request_path 'fog/ibm/requests/storage' request :list_offerings request :list_volumes request :create_volume request :delete_volume request :get_volume class Real def initialize(options={}) @connection = Fog::IBM::Connection.new(options[:ibm_username], options[:ibm_password]) end private def request(options) begin @connection.request(options) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Storage::IBM::NotFound.slurp(error) else error end end end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :volumes => {}, } end end def self.reset @data = nil end def data self.class.data[@ibm_username] end def reset_data self.class.data.delete(@ibm_username) @data = self.class.data[@ibm_username] end def initialize(options={}) @ibm_username = options[:ibm_username] @ibm_password = options[:ibm_password] @data = self.class.data[@ibm_username] end end end end end fog-1.34.0/lib/fog/rackspace.rb0000644000004100000410000000103612600047642016205 0ustar www-datawww-datarequire 'fog/rackspace/auto_scale' require 'fog/rackspace/block_storage' require 'fog/rackspace/cdn' require 'fog/rackspace/cdn_v2' require 'fog/rackspace/compute' require 'fog/rackspace/compute_v2' require 'fog/rackspace/databases' require 'fog/rackspace/dns' require 'fog/rackspace/identity' require 'fog/rackspace/load_balancers' require 'fog/rackspace/monitoring' require 'fog/rackspace/queues' require 'fog/rackspace/storage' require 'fog/rackspace/networking' require 'fog/rackspace/orchestration' require 'fog/rackspace/networking_v2' fog-1.34.0/lib/fog/ibm.rb0000644000004100000410000000006412600047642015020 0ustar www-datawww-datarequire 'fog/ibm/compute' require 'fog/ibm/storage' fog-1.34.0/lib/fog/ninefold/0000755000004100000410000000000012600047642015522 5ustar www-datawww-datafog-1.34.0/lib/fog/ninefold/requests/0000755000004100000410000000000012600047642017375 5ustar www-datawww-datafog-1.34.0/lib/fog/ninefold/requests/compute/0000755000004100000410000000000012600047642021051 5ustar www-datawww-datafog-1.34.0/lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb0000644000004100000410000000047412600047642027600 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def remove_from_load_balancer_rule(options={}) request 'removeFromLoadBalancerRule', options, :expects => [200], :response_prefix => 'removefromloadbalancerruleresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/query_async_job_result.rb0000644000004100000410000000047412600047642026175 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def query_async_job_result(options = {}) request('queryAsyncJobResult', options, :expects => [200], :response_prefix => 'queryasyncjobresultresponse', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_async_jobs.rb0000644000004100000410000000046312600047642024566 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_async_jobs(options = {}) request('listAsyncJobs', options, :expects => [200], :response_prefix => 'listasyncjobsresponse/asyncjobs', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_virtual_machines.rb0000644000004100000410000000051212600047642025764 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_virtual_machines(options = {}) request('listVirtualMachines', options, :expects => [200], :response_prefix => 'listvirtualmachinesresponse/virtualmachine', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_service_offerings.rb0000644000004100000410000000051612600047642026135 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_service_offerings(options = {}) request('listServiceOfferings', options, :expects => [200], :response_prefix => 'listserviceofferingsresponse/serviceoffering', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_resource_limits.rb0000644000004100000410000000050612600047642025642 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_resource_limits(options = {}) request('listResourceLimits', options, :expects => [200], :response_prefix => 'listresourcelimitsresponse/resourcelimit', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_hypervisors.rb0000644000004100000410000000047112600047642025030 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_hypervisors(options = {}) request('listHypervisors', options, :expects => [200], :response_prefix => 'listhypervisorsresponse/hypervisor', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_disk_offerings.rb0000644000004100000410000000050212600047642025422 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_disk_offerings(options = {}) request('listDiskOfferings', options, :expects => [200], :response_prefix => 'listdiskofferingsresponse/diskoffering', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_templates.rb0000644000004100000410000000046112600047642024430 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_templates(options = {}) request('listTemplates', options, :expects => [200], :response_prefix => 'listtemplatesresponse/template', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_network_offerings.rb0000644000004100000410000000051612600047642026166 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_network_offerings(options = {}) request('listNetworkOfferings', options, :expects => [200], :response_prefix => 'listnetworkofferingsresponse/networkoffering', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/disable_static_nat.rb0000644000004100000410000000046112600047642025213 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def disable_static_nat(options = {}) request('disableStaticNat', options, :expects => [200], :response_prefix => 'disablestaticnatresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/reboot_virtual_machine.rb0000644000004100000410000000047512600047642026130 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def reboot_virtual_machine(options = {}) request('rebootVirtualMachine', options, :expects => [200], :response_prefix => 'rebootvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb0000644000004100000410000000046612600047642027247 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def assign_to_load_balancer_rule(options={}) request 'assignToLoadBalancerRule', options, :expects => [200], :response_prefix => 'assigntoloadbalancerruleresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb0000644000004100000410000000045712600047642026524 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def create_load_balancer_rule(options={}) request 'createLoadBalancerRule', options, :expects => [200], :response_prefix => 'createloadbalancerruleresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/start_virtual_machine.rb0000644000004100000410000000047212600047642025770 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def start_virtual_machine(options = {}) request('startVirtualMachine', options, :expects => [200], :response_prefix => 'startvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/stop_virtual_machine.rb0000644000004100000410000000046712600047642025624 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def stop_virtual_machine(options = {}) request('stopVirtualMachine', options, :expects => [200], :response_prefix => 'stopvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb0000644000004100000410000000050512600047642030275 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_load_balancer_rule_instances(options={}) request 'listLoadBalancerRuleInstances', options, :expects => [200], :response_prefix => 'listloadbalancerruleinstancesresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb0000644000004100000410000000045712600047642026523 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def delete_load_balancer_rule(options={}) request 'deleteLoadBalancerRule', options, :expects => [200], :response_prefix => 'deleteloadbalancerruleresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_public_ip_addresses.rb0000644000004100000410000000052112600047642026432 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_public_ip_addresses(options = {}) request('listPublicIpAddresses', options, :expects => [200], :response_prefix => 'listpublicipaddressesresponse/publicipaddress', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_zones.rb0000644000004100000410000000044112600047642023566 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_zones(options = {}) request('listZones', options, :expects => [200], :response_prefix => 'listzonesresponse/zone', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_events.rb0000644000004100000410000000044512600047642023740 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_events(options = {}) request('listEvents', options, :expects => [200], :response_prefix => 'listeventsresponse/event', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/reset_password_for_virtual_machine.rb0000644000004100000410000000053512600047642030545 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def reset_password_for_virtual_machine(options = {}) request('resetPasswordForVirtualMachine', options, :expects => [200], :response_prefix => 'resetpasswordforvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/update_virtual_machine.rb0000644000004100000410000000047512600047642026120 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def update_virtual_machine(options = {}) request('updateVirtualMachine', options, :expects => [200], :response_prefix => 'updatevirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/associate_ip_address.rb0000644000004100000410000000046712600047642025555 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def associate_ip_address(options = {}) request('associateIpAddress', options, :expects => [200], :response_prefix => 'associateipaddressresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/create_ip_forwarding_rule.rb0000644000004100000410000000050412600047642026601 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def create_ip_forwarding_rule(options = {}) request('createIpForwardingRule', options, :expects => [200], :response_prefix => 'createipforwardingruleresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/destroy_virtual_machine.rb0000644000004100000410000000050012600047642026314 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def destroy_virtual_machine(options = {}) request('destroyVirtualMachine', options, :expects => [200], :response_prefix => 'destroyvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb0000644000004100000410000000045412600047642026414 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_load_balancer_rules(options={}) request 'listLoadBalancerRules', options, :expects => [200], :response_prefix => 'listloadbalancerrulesresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/deploy_virtual_machine.rb0000644000004100000410000000047512600047642026132 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def deploy_virtual_machine(options = {}) request('deployVirtualMachine', options, :expects => [200], :response_prefix => 'deployvirtualmachineresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_accounts.rb0000644000004100000410000000045512600047642024254 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_accounts(options = {}) request('listAccounts', options, :expects => [200], :response_prefix => 'listaccountsresponse/account', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/enable_static_nat.rb0000644000004100000410000000045612600047642025042 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def enable_static_nat(options = {}) request('enableStaticNat', options, :expects => [200], :response_prefix => 'enablestaticnatresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/delete_ip_forwarding_rule.rb0000644000004100000410000000050412600047642026600 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def delete_ip_forwarding_rule(options = {}) request('deleteIpForwardingRule', options, :expects => [200], :response_prefix => 'deleteipforwardingruleresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/disassociate_ip_address.rb0000644000004100000410000000050012600047642026241 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def disassociate_ip_address(options = {}) request('disassociateIpAddress', options, :expects => [200], :response_prefix => 'disassociateipaddressresponse', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/change_service_for_virtual_machine.rb0000644000004100000410000000055412600047642030447 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def change_service_for_virtual_machine(options = {}) request('changeServiceForVirtualMachine', options, :expects => [200], :response_prefix => 'changeserviceforvirtualmachineresponse/virtualmachine', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_networks.rb0000644000004100000410000000045512600047642024311 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_networks(options = {}) request('listNetworks', options, :expects => [200], :response_prefix => 'listnetworksresponse/network', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb0000644000004100000410000000045712600047642026543 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def update_load_balancer_rule(options={}) request 'updateLoadBalancerRule', options, :expects => [200], :response_prefix => 'updateloadbalancerruleresponse', :response_type => Hash end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_capabilities.rb0000644000004100000410000000047412600047642025067 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_capabilities(options = {}) request('listCapabilities', options, :expects => [200], :response_prefix => 'listcapabilitiesresponse/capability', :response_type => Array) end end end end end fog-1.34.0/lib/fog/ninefold/requests/compute/list_ip_forwarding_rules.rb0000644000004100000410000000052212600047642026474 0ustar www-datawww-datamodule Fog module Compute class Ninefold class Real def list_ip_forwarding_rules(options = {}) request('listIpForwardingRules', options, :expects => [200], :response_prefix => 'listipforwardingrulesresponse/ipforwardingrule', :response_type => Hash) end end end end end fog-1.34.0/lib/fog/ninefold/core.rb0000644000004100000410000000025212600047642016776 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' module Fog module Ninefold extend Fog::Provider service(:compute, 'Compute') service(:storage, 'Storage') end end fog-1.34.0/lib/fog/ninefold/models/0000755000004100000410000000000012600047642017005 5ustar www-datawww-datafog-1.34.0/lib/fog/ninefold/models/compute/0000755000004100000410000000000012600047642020461 5ustar www-datawww-datafog-1.34.0/lib/fog/ninefold/models/compute/address.rb0000644000004100000410000000510112600047642022430 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class Ninefold class Address < Fog::Model identity :id attribute :account attribute :allocated attribute :associatednetworkid attribute :domain attribute :domainid attribute :forvirtualnetwork attribute :ipaddress attribute :issourcenat attribute :isstaticnat attribute :jobid attribute :jobstatus attribute :networkid attribute :state attribute :virtualmachinedisplayname attribute :virtualmachineid attribute :virtualmachinename attribute :vlanid attribute :vlanname attribute :zoneid attribute :zonename def initialize(attributes={}) super end def destroy requires :identity self.jobid = extract_job_id(service.disassociate_ip_address(:id => identity)) true end def enable_static_nat(server) server.kind_of?(Integer) ? serverid = server : serverid = server.identity res = service.enable_static_nat(:virtualmachineid => serverid, :ipaddressid => identity) reload to_boolean(res['success']) end def disable_static_nat() self.jobid = extract_job_id(service.disable_static_nat(:ipaddressid => identity)) true end def reload self.virtualmachinedisplayname = nil self.virtualmachineid = nil self.virtualmachinename = nil super end def ready? if jobid && service.query_async_job_result(:jobid => jobid)['jobstatus'] == 0 false else # No running job, we are ready. Refresh data. reload true end end def save raise "Operation not supported" if self.identity requires :zoneid options = { :zoneid => zoneid, :networkid => networkid, :account => account, :domainid => domainid }.delete_if {|k,v| v.nil? || v == "" } data = service.associate_ip_address(options) merge_attributes(data) true end private def extract_job_id(job) if job.kind_of? Integer job else job['jobid'] || job['id'] end end # needed to hack around API inconsistencies def to_boolean(val) val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil) end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/addresses.rb0000644000004100000410000000113312600047642022761 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ninefold/models/compute/address' module Fog module Compute class Ninefold class Addresses < Fog::Collection model Fog::Compute::Ninefold::Address def all data = service.list_public_ip_addresses load(data) end def get(identifier) return nil if identifier.nil? || identifier == "" data = service.list_public_ip_addresses(:id => identifier) if data.empty? nil else new(data[0]) end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/images.rb0000644000004100000410000000116012600047642022251 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ninefold/models/compute/image' module Fog module Compute class Ninefold class Images < Fog::Collection model Fog::Compute::Ninefold::Image def all(offering = 'executable') data = service.list_templates(:templatefilter => offering) load(data) end def get(identifier, offering = 'executable') data = service.list_templates(:templatefilter => offering, :id => identifier) if data.empty? nil else new(data[0]) end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/servers.rb0000644000004100000410000000112112600047642022472 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ninefold/models/compute/server' module Fog module Compute class Ninefold class Servers < Fog::Collection model Fog::Compute::Ninefold::Server def all data = service.list_virtual_machines load(data) end def get(identifier) return nil if identifier.nil? || identifier == "" data = service.list_virtual_machines(:id => identifier) if data.empty? nil else new(data[0]) end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/ip_forwarding_rules.rb0000644000004100000410000000116712600047642025057 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ninefold/models/compute/ip_forwarding_rule' module Fog module Compute class Ninefold class IpForwardingRules < Fog::Collection model Fog::Compute::Ninefold::IpForwardingRule def all data = service.list_ip_forwarding_rules load(data) end def get(identifier) return nil if identifier.nil? || identifier == "" data = service.list_ip_forwarding_rules(:id => identifier) if data.empty? nil else new(data[0]) end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/flavors.rb0000644000004100000410000000102712600047642022462 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/ninefold/models/compute/flavor' module Fog module Compute class Ninefold class Flavors < Fog::Collection model Fog::Compute::Ninefold::Flavor def all data = service.list_service_offerings load(data) end def get(identifier) data = service.list_service_offerings(:id => identifier) if data.empty? nil else new(data[0]) end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/ip_forwarding_rule.rb0000644000004100000410000000334212600047642024671 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class Ninefold class IpForwardingRule < Fog::Model identity :id attribute :protocol attribute :virtualmachineid attribute :virtualmachinename attribute :ipaddressid attribute :ipaddress attribute :startport attribute :endport attribute :state attribute :jobid def initialize(attributes={}) super end def destroy requires :identity self.jobid = extract_job_id(service.delete_ip_forwarding_rule(:id => identity)) true end def ready? if jobid && service.query_async_job_result(:jobid => jobid)['jobstatus'] == 0 false else # No running job, we are ready. Refresh data. reload true end end def address Ninefold.address.get(ipaddressid) end def address=(addr) self.ipaddressid = addr.identity end def save raise "Operation not supported" if self.identity requires :ipaddressid requires :protocol requires :startport options = { :ipaddressid => ipaddressid, :protocol => protocol, :startport => startport, :endport => endport }.delete_if {|k,v| v.nil? || v == "" } data = service.create_ip_forwarding_rule(options) merge_attributes(data) true end private def extract_job_id(job) if job.kind_of? Integer job else job['jobid'] || job['id'] end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/flavor.rb0000644000004100000410000000076412600047642022306 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class Ninefold class Flavor < Fog::Model identity :id attribute :cpunumber attribute :cpuspeed attribute :created, :type => :time attribute :displaytext attribute :domain attribute :domainid attribute :hosttags attribute :memory attribute :name attribute :offerha attribute :storagetype attribute :tags end end end end fog-1.34.0/lib/fog/ninefold/models/compute/server.rb0000644000004100000410000001235012600047642022315 0ustar www-datawww-datarequire 'fog/compute/models/server' module Fog module Compute class Ninefold class Server < Fog::Compute::Server extend Fog::Deprecation deprecate :serviceofferingid, :flavor_id deprecate :templateid, :image_id identity :id attribute :account attribute :cpunumber attribute :cpuspeed attribute :cpuused attribute :created, :type => :time attribute :displayname attribute :domain attribute :domainid attribute :flavor_id, :aliases => :serviceofferingid attribute :forvirtualnetwork attribute :group attribute :groupid attribute :guestosid attribute :haenable attribute :hostid attribute :hostname attribute :hypervisor attribute :image_id, :aliases => :templateid #attribute :ipaddress attribute :isodisplaytext attribute :isoid attribute :isoname attribute :jobid attribute :jobstatus attribute :memory attribute :name attribute :networkkbsread attribute :networkkbswrite attribute :nic attribute :password attribute :passwordenabled attribute :rootdeviceid attribute :rootdevicetype attribute :securitygroup attribute :serviceofferingname attribute :state attribute :templatedisplaytext attribute :templatename attribute :zoneid attribute :zonename # used for creation only. attribute :networkids attribute :diskofferingid attribute :keypair attribute :securitygroupids attribute :size attribute :userdata #attribute :account_id, :aliases => "account", :squash => "id" #attribute :image_id, :aliases => "image", :squash => "id" #attribute :flavor_id, :aliases => "server_type", :squash => "id" #attribute :zone_id, :aliases => "zone", :squash => "id" def initialize(attributes={}) merge_attributes({ :flavor_id => 105, # '1CPU, 384MB, 80GB HDD' :image_id => 421 # 'XEN Basic Ubuntu 10.04 Server x64 PV r2.0' }) super end # This is temporary - we need to model nics. def ipaddress nic[0] ? nic[0]['ipaddress'] : nil end def reboot requires :identity self.jobid = extract_job_id(service.reboot_virtual_machine(:id => identity)) puts "jobid: " + jobid.to_s true end def start requires :identity self.jobid = extract_job_id(service.start_virtual_machine(:id => identity)) true end def stop requires :identity self.jobid = extract_job_id(service.stop_virtual_machine(:id => identity)) true end def destroy requires :identity self.jobid = extract_job_id(service.destroy_virtual_machine(:id => identity)) true end def flavor requires :flavor_id service.flavors.get(flavor_id) end def image requires :image_id service.images.get(image_id) end def ready? if jobid # we do this by polling the last job id status. res = service.query_async_job_result(:jobid => jobid) if res['jobstatus'] == 0 false else # update with new values. merge_attributes(res['jobresult']['virtualmachine']) true end else # No running job, we are ready. Refresh data. reload true end end def save raise "Operation not supported" if self.identity requires :flavor_id, :image_id, :zoneid unless networkids # No network specified, use first in this zone. networks = service.list_networks(:zoneid => zoneid) if networks.empty? raise "No networks. Please create one, or specify a network ID" else # use the network with the lowest ID - the safe default self.networkids = networks.sort {|x,y| x['id'] <=> y['id']}[0]['id'] end end options = { :serviceofferingid => flavor_id, :templateid => image_id, :name => name, :zoneid => zoneid, :networkids => networkids, :account => account, :diskofferingid => diskofferingid, :displayname => displayname, :domainid => domainid, :group => group, :hypervisor => hypervisor, :keypair => keypair, :securitygroupids => securitygroupids, :size => size, :userdata => userdata }.delete_if {|k,v| v.nil? || v == "" } data = service.deploy_virtual_machine(options) merge_attributes(data) true end private def extract_job_id(job) if job.kind_of? Integer job else job['jobid'] || job['id'] end end end end end end fog-1.34.0/lib/fog/ninefold/models/compute/image.rb0000644000004100000410000000161012600047642022066 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class Ninefold class Image < Fog::Model identity :id attribute :account attribute :accountid attribute :bootable attribute :created, :type => :time attribute :crossZones attribute :displaytext attribute :domain attribute :domainid attribute :format attribute :hypervisor attribute :isextractable attribute :isfeatured attribute :ispublic attribute :isready attribute :jobid attribute :jobstatus attribute :name attribute :ostypeid attribute :ostypename attribute :passwordenabled attribute :removed attribute :size attribute :status attribute :templatetype attribute :zoneid attribute :zonename end end end end fog-1.34.0/lib/fog/ninefold/compute.rb0000644000004100000410000001155712600047642017534 0ustar www-datawww-datarequire 'fog/ninefold/core' module Fog module Compute class Ninefold < Fog::Service API_URL = "http://api.ninefold.com/compute/v1.0/" requires :ninefold_compute_key, :ninefold_compute_secret recognizes :ninefold_api_url # allow us to specify non-prod environments model_path 'fog/ninefold/models/compute' model :server collection :servers model :flavor collection :flavors model :image collection :images model :address collection :addresses model :ip_forwarding_rule collection :ip_forwarding_rules request_path 'fog/ninefold/requests/compute' # General list-only stuff request :list_accounts request :list_events request :list_service_offerings request :list_disk_offerings request :list_capabilities request :list_hypervisors request :list_zones request :list_network_offerings request :list_resource_limits # Templates request :list_templates # Virtual Machines request :deploy_virtual_machine request :destroy_virtual_machine request :list_virtual_machines request :reboot_virtual_machine request :stop_virtual_machine request :start_virtual_machine request :change_service_for_virtual_machine request :reset_password_for_virtual_machine request :update_virtual_machine # Jobs request :list_async_jobs request :query_async_job_result # Networks request :list_networks # Addresses request :associate_ip_address request :list_public_ip_addresses request :disassociate_ip_address # NAT request :enable_static_nat request :disable_static_nat request :create_ip_forwarding_rule request :delete_ip_forwarding_rule request :list_ip_forwarding_rules # Load Balancers request :create_load_balancer_rule request :delete_load_balancer_rule request :remove_from_load_balancer_rule request :assign_to_load_balancer_rule request :list_load_balancer_rules request :list_load_balancer_rule_instances request :update_load_balancer_rule class Mock def initialize(options) @api_url = options[:ninefold_api_url] || API_URL @ninefold_compute_key = options[:ninefold_compute_key] @ninefold_compute_secret = options[:ninefold_compute_secret] end def request(options) raise "Not implemented" end end class Real def initialize(options) @api_url = options[:ninefold_api_url] || API_URL @ninefold_compute_key = options[:ninefold_compute_key] @ninefold_compute_secret = options[:ninefold_compute_secret] @connection_options = options[:connection_options] || {} @persistent = options[:persistent] || false @connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options) end def request(command, params, options) params['response'] = "json" # convert params to strings for sort req_params = params.merge('apiKey' => @ninefold_compute_key, 'command' => command) req = URI.escape(req_params.sort_by{|k,v| k.to_s }.map{|e| "#{e[0].to_s}=#{e[1].to_s}"}.join('&')) encoded_signature = url_escape(encode_signature(req)) options = { :expects => 200, :method => 'GET', :query => "#{req}&signature=#{encoded_signature}" }.merge(options) begin response = @connection.request(options) end unless response.body.empty? # Because the response is some weird xml-json thing, we need to try and mung # the values out with a prefix, and if there is an empty data entry return an # empty version of the expected type (if provided) response = Fog::JSON.decode(response.body) if options.key? :response_prefix keys = options[:response_prefix].split('/') keys.each do |k| if response[k] response = response[k] elsif options[:response_type] response = options[:response_type].new break else end end response else response end end end private def url_escape(string) string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do '%' + $1.unpack('H2' * $1.size).join('%').upcase end.tr(' ', '+') end def encode_signature(data) Base64.encode64(OpenSSL::HMAC.digest('sha1', @ninefold_compute_secret, URI.encode(data.downcase).gsub('+', '%20'))).chomp end end end end end fog-1.34.0/lib/fog/ninefold/storage.rb0000644000004100000410000000271212600047642017515 0ustar www-datawww-datarequire 'fog/ninefold' require 'fog/atmos' module Fog module Storage class Ninefold < Fog::Storage::Atmos STORAGE_HOST = "onlinestorage.ninefold.com" #"api.ninefold.com" STORAGE_PATH = "" #"/storage/v1.0" STORAGE_PORT = "80" # "443" STORAGE_SCHEME = "http" # "https" requires :ninefold_storage_token, :ninefold_storage_secret recognizes :persistent model_path 'fog/storage/atmos/models' model :directory collection :directories model :file collection :files module Utils end class Mock < Fog::Storage::Atmos::Mock include Utils def initialize(options={}) @ninefold_storage_token = options[:ninefold_storage_token] @ninefold_storage_secret = options[:ninefold_storage_secret] end def request(options) raise "Ninefold Storage mocks not implemented" end end class Real < Fog::Storage::Atmos::Real include Utils def initialize(options={}) endpoint = "#{STORAGE_SCHEME}://"\ "#{STORAGE_HOST}:"\ "#{STORAGE_PORT}"\ "#{STORAGE_PATH}" options[:atmos_storage_endpoint] = endpoint options[:atmos_storage_token] = options[:ninefold_storage_token] options[:atmos_storage_secret] = options[:ninefold_storage_secret] super(options) end end end end end fog-1.34.0/lib/fog/fogdocker.rb0000644000004100000410000000004012600047641016205 0ustar www-datawww-datarequire 'fog/fogdocker/compute' fog-1.34.0/lib/fog/ovirt/0000755000004100000410000000000012600047642015067 5ustar www-datawww-datafog-1.34.0/lib/fog/ovirt/requests/0000755000004100000410000000000012600047642016742 5ustar www-datawww-datafog-1.34.0/lib/fog/ovirt/requests/compute/0000755000004100000410000000000012600047642020416 5ustar www-datawww-datafog-1.34.0/lib/fog/ovirt/requests/compute/list_vm_volumes.rb0000644000004100000410000000070712600047642024176 0ustar www-datawww-datamodule Fog module Compute class Ovirt class Real def list_vm_volumes(vm_id) client.vm_volumes(vm_id).map {|ovirt_obj| ovirt_attrs ovirt_obj} end end class Mock def list_vm_volumes(vm_id) xml = read_xml 'volumes.xml' Nokogiri::XML(xml).xpath('/disks/disk').map do |vol| ovirt_attrs OVIRT::Volume::new(self, vol) end end end end end end fog-1.34.0/lib/fog/ovirt/requests/compute/list_clusters.rb0000644000004100000410000000072712600047642023650 0ustar www-datawww-datamodule Fog module Compute class Ovirt class Real def list_clusters(filters = {}) client.clusters(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} end end class Mock def list_clusters(filters = {}) xml = read_xml 'clusters.xml' Nokogiri::XML(xml).xpath('/clusters/cluster').map do |cl| ovirt_attrs OVIRT::Cluster::new(self, cl) end end end end end end fog-1.34.0/lib/fog/ovirt/requests/compute/add_interface.rb0000644000004100000410000000067712600047642023525 0ustar www-datawww-datamodule Fog module Compute class Ovirt class Real def add_interface(id, options = {}) raise ArgumentError, "instance id is a required parameter" unless id client.add_interface(id, options) end end class Mock def add_interface(id, options = {}) raise ArgumentError, "instance id is a required parameter" unless id true end end end end end fog-1.34.0/lib/fog/ovirt/requests/compute/list_virtual_machines.rb0000644000004100000410000000071612600047642025337 0ustar www-datawww-datamodule Fog module Compute class Ovirt class Real def list_virtual_machines(filters = {}) client.vms(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} end end class Mock def list_virtual_machines(filters = {}) xml = read_xml 'vms.xml' Nokogiri::XML(xml).xpath('/vms/vm').map do |vm| ovirt_attrs OVIRT::VM::new(self, vm) end end end end end end fog-1.34.0/lib/fog/ovirt/requests/compute/vm_ticket.rb0000644000004100000410000000043112600047642022726 0ustar www-datawww-datamodule Fog module Compute class Ovirt class Real def vm_ticket(id, options = {}) client.set_ticket(id, options) end end class Mock def vm_ticket(id, options = {}) "Secret" end end end end end fog-1.34.0/lib/fog/ovirt/requests/compute/mock_files/0000755000004100000410000000000012600047642022531 5ustar www-datawww-datafog-1.34.0/lib/fog/ovirt/requests/compute/mock_files/volumes.xml0000644000004100000410000000325612600047642024753 0ustar www-datawww-data Disk 2 5368709120 data ok virtio raw true false false false Disk 1 8589934592 system ok virtio cow true true false false fog-1.34.0/lib/fog/ovirt/requests/compute/mock_files/vms.xml0000644000004100000410000001223512600047642024063 0ustar www-datawww-data test-vm1 server down 1073741824 false 1 spice 1