fog-sakuracloud-1.7.5/0000755000004100000410000000000012651244400014640 5ustar www-datawww-datafog-sakuracloud-1.7.5/Rakefile0000644000004100000410000000515212651244400016310 0ustar www-datawww-datarequire 'bundler/setup' require "bundler/gem_tasks" require 'rake/testtask' require 'date' require 'rubygems' require 'rubygems/package_task' require 'yard' require File.dirname(__FILE__) + '/lib/fog/sakuracloud' ############################################################################# # # 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'] Rake::TestTask.new do |t| t.pattern = File.join("spec", "**", "*_spec.rb") end namespace :test do mock = ENV['FOG_MOCK'] || 'true' task :travis 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 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 fog-sakuracloud-1.7.5/Gemfile0000644000004100000410000000014412651244400016132 0ustar www-datawww-datasource 'https://rubygems.org' # Specify your gem's dependencies in fog-sakuracloud.gemspec gemspec fog-sakuracloud-1.7.5/tests/0000755000004100000410000000000012651244400016002 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/helper.rb0000644000004100000410000000103012651244400017600 0ustar www-datawww-data## Initialize credentials ENV['FOG_RC'] = ENV['FOG_RC'] || File.expand_path('../.fog', __FILE__) ## From fog-core require 'fog/test_helpers' require 'fog/sakuracloud' if ENV['CI'] Fog.credentials[:sakuracloud_api_token] = 'dummy_token' Fog.credentials[:sakuracloud_api_token_secret] = 'dummy_secret' end ## SakuraCloud Helpers def sakuracloud_volume_service Fog::Volume[:sakuracloud] end def sakuracloud_compute_service Fog::Compute[:sakuracloud] end def sakuracloud_network_service Fog::Network[:sakuracloud] end fog-sakuracloud-1.7.5/tests/sakuracloud/0000755000004100000410000000000012651244400020317 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/sakuracloud/requests/0000755000004100000410000000000012651244400022172 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/sakuracloud/requests/network/0000755000004100000410000000000012651244400023663 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/sakuracloud/requests/network/routers_tests.rb0000644000004100000410000000256712651244400027147 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Network[:sakuracloud] | list_routers request', ['sakuracloud', 'network']) do @routers_create_format = { 'Index' => Integer, 'ID' => String, 'Name' => String, 'BandWidthMbps' => Integer, 'NetworkMaskLen' => Integer, 'Switch' => Hash } @routers_list_format = { 'Index' => Integer, 'ID' => String, 'Switch' => Hash } tests('success') do tests('#list_routers') do routers = sakuracloud_network_service.list_routers test 'returns a Hash' do routers.body.is_a? Hash end if Fog.mock? tests('Routers').formats(@routers_list_format, false) do routers.body['Internet'].first end else returns(200) { routers.status } returns(true) { routers.body.is_a? Hash } end end end end Shindo.tests('Fog::Network[:sakuracloud] | create_router request', ['sakuracloud', 'network']) do tests('success') do tests('#create_router_with_internet_access') do router = sakuracloud_network_service.create_router(:name => 'foobar', :networkmasklen => 28) test 'returns a Hash' do router.body.is_a? Hash end unless Fog.mock? returns(202) { router.status } returns(true) { router.body.is_a? Hash } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/network/switches_tests.rb0000644000004100000410000000232412651244400027264 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Network[:sakuracloud] | list_switches request', ['sakuracloud', 'network']) do @switches_format = { 'Index' => Integer, 'ID' => String, 'Name' => String, 'ServerCount' => Integer, 'ApplianceCount' => Integer, 'Subnets' => Array } tests('success') do tests('#list_switches') do switches = sakuracloud_network_service.list_switches test 'returns a Hash' do switches.body.is_a? Hash end if Fog.mock? tests('Switches').formats(@switches_format, false) do switches.body['Switches'].first end else returns(200) { switches.status } returns(true) { switches.body.is_a? Hash } end end end end Shindo.tests('Fog::Network[:sakuracloud] | create_switch request', ['sakuracloud', 'network']) do tests('success') do tests('#create_simple_switch') do switch = sakuracloud_network_service.create_switch(:name => 'foobar') test 'returns a Hash' do switch.body.is_a? Hash end unless Fog.mock? returns(201) { switch.status } returns(true) { switch.body.is_a? Hash } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/volume/0000755000004100000410000000000012651244400023501 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/sakuracloud/requests/volume/archives_tests.rb0000644000004100000410000000134412651244400027056 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Volume[:sakuracloud] | list_archives request', ['sakuracloud', 'volume']) do @archive_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'SizeMB' => Integer, 'Plan' => Hash } tests('success') do tests('#list_archives') do archives = sakuracloud_volume_service.list_archives test 'returns a Hash' do archives.body.is_a? Hash end if Fog.mock? tests('Archives').formats(@archive_format, false) do archives.body['Archives'].first end else returns(200) { archives.status } returns(false) { archives.body.empty? } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/volume/disks_tests.rb0000644000004100000410000000231012651244400026361 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Volume[:sakuracloud] | list_disks request', ['sakuracloud', 'volume']) do @disks_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'Connection' => String, 'Availability' => String, 'SizeMB' => Integer, 'Plan' => Hash } tests('success') do tests('#list_disks') do disks = sakuracloud_volume_service.list_disks test 'returns a Hash' do disks.body.is_a? Hash end if Fog.mock? tests('Disks').formats(@disks_format, false) do disks.body['Disks'].first end else returns(200) { disks.status } returns(true) { disks.body.is_a? Hash } end end end end Shindo.tests('Fog::Volume[:sakuracloud] | create_disks request', ['sakuracloud', 'volume']) do tests('success') do tests('#create_disks') do disks = sakuracloud_volume_service.create_disk('foobar', 4, {:sourcearchive => 112500463685}) test 'returns a Hash' do disks.body.is_a? Hash end unless Fog.mock? returns(202) { disks.status } returns(true) { disks.body.is_a? Hash } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/volume/plans_tests.rb0000644000004100000410000000127712651244400026374 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Volume[:sakuracloud] | list_plans request', ['sakuracloud', 'volume']) do @plan_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'Availability' => String } tests('success') do tests('#list_plans') do diskplans = sakuracloud_volume_service.list_plans test 'returns a Hash' do diskplans.body.is_a? Hash end if Fog.mock? tests('DiskPlans').formats(@plan_format, false) do diskplans.body['DiskPlans'].first end else returns(200) { diskplans.status } returns(false) { diskplans.body.empty? } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/compute/0000755000004100000410000000000012651244400023646 5ustar www-datawww-datafog-sakuracloud-1.7.5/tests/sakuracloud/requests/compute/ssh_keys_tests.rb0000644000004100000410000000130212651244400027241 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Compute[:sakuracloud] | list_ssh_keys request', ['sakuracloud', 'compute']) do @sshkey_format = { 'Index' => Integer, 'ID' => String, 'Name' => String, 'PublicKey' => String } tests('success') do tests('#list_ssh_keys') do sshkeys = sakuracloud_compute_service.list_ssh_keys test 'returns a Hash' do sshkeys.body.is_a? Hash end if Fog.mock? tests('SSHKeys').formats(@sshkey_format, false) do sshkeys.body['SSHKeys'].first end else returns(200) { sshkeys.status } returns(false) { sshkeys.body.empty? } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/compute/zones_tests.rb0000644000004100000410000000124612651244400026556 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Compute[:sakuracloud] | list_zones request', ['sakuracloud', 'compute']) do @zone_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'Description' => String } tests('success') do tests('#list_zones') do zones = sakuracloud_compute_service.list_zones test 'returns a Hash' do zones.body.is_a? Hash end if Fog.mock? tests('Zones').formats(@zone_format, false) do zones.body['Zones'].first end else returns(200) { zones.status } returns(false) { zones.body.empty? } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/compute/servers_tests.rb0000644000004100000410000000231312651244400027105 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Compute[:sakuracloud] | list_servers request', ['sakuracloud', 'compute']) do @servers_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'ServerPlan' => Hash, 'Instance' => Hash, 'Disks' => Array } tests('success') do tests('#list_servers') do servers = sakuracloud_compute_service.list_servers test 'returns a Hash' do servers.body.is_a? Hash end if Fog.mock? tests('Servers').formats(@servers_format, false) do servers.body['Servers'].first end else returns(200) { servers.status } returns(true) { servers.body.is_a? Hash } end end end end Shindo.tests('Fog::Compute[:sakuracloud] | create_servers request', ['sakuracloud', 'compute']) do tests('success') do tests('#create_servers') do servers = sakuracloud_compute_service.create_server(:name => 'foobar', :serverplan => 2001) test 'returns a Hash' do servers.body.is_a? Hash end unless Fog.mock? returns(201) { servers.status } returns(true) { servers.body.is_a? Hash } end end end end fog-sakuracloud-1.7.5/tests/sakuracloud/requests/compute/plans_tests.rb0000644000004100000410000000141612651244400026534 0ustar www-datawww-data# coding: utf-8 Shindo.tests('Fog::Compute[:sakuracloud] | list_plans request', ['sakuracloud', 'compute']) do @plan_format = { 'Index' => Integer, 'ID' => Integer, 'Name' => String, 'CPU' => Integer, 'MemoryMB' => Integer, 'Availability' => String } tests('success') do tests('#list_plans') do serverplans = sakuracloud_compute_service.list_plans test 'returns a Hash' do serverplans.body.is_a? Hash end if Fog.mock? tests('ServerPlans').formats(@plan_format, false) do serverplans.body['ServerPlans'].first end else returns(200) { serverplans.status } returns(false) { serverplans.body.empty? } end end end end fog-sakuracloud-1.7.5/CONTRIBUTORS.md0000644000004100000410000000021512651244400017115 0ustar www-datawww-data* Bryan Paxton * Paulo Henrique Lopes Ribeiro * Yukihiko Sawanobori fog-sakuracloud-1.7.5/LICENSE.md0000644000004100000410000000220412651244400016242 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2014-2014 [CONTRIBUTORS.md](https://github.com/fog/fog-sakuracloud/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-sakuracloud-1.7.5/.travis.yml0000644000004100000410000000021412651244400016746 0ustar www-datawww-datalanguage: ruby script: bundle exec rake travis rvm: - 2.2 - 2.1 - 2.0.0 gemfile: - Gemfile before_install: - gem update bundler fog-sakuracloud-1.7.5/lib/0000755000004100000410000000000012651244400015406 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/0000755000004100000410000000000012651244400016161 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/bin/0000755000004100000410000000000012651244400016731 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/bin/sakuracloud.rb0000644000004100000410000000232112651244400021571 0ustar www-datawww-dataclass SakuraCloud < Fog::Bin class << self def class_for(key) case key when :compute Fog::Compute::SakuraCloud when :volume Fog::Volume::SakuraCloud when :network Fog::Network::SakuraCloud 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("SakuraCloud[:compute] is not recommended, use Fog::Compute[:sakuracloud] for portability") Fog::Compute.new(:provider => 'SakuraCloud') when :volume Fog::Logger.warning("SakuraCloud[:volume] is not recommended, use Fog::Volume[:sakuracloud] for portability") Fog::Volume.new(:provider => 'SakuraCloud') when :network Fog::Logger.warning("SakuraCloud[:network] is not recommended, use Fog::Network[:sakuracloud] for portability") Fog::Network.new(:provider => 'SakuraCloud') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end end @@connections[service] end def services Fog::SakuraCloud.services end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/0000755000004100000410000000000012651244400020476 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/volume.rb0000644000004100000410000000464312651244400022341 0ustar www-datawww-datamodule Fog module Volume class SakuraCloud < Fog::Service requires :sakuracloud_api_token requires :sakuracloud_api_token_secret recognizes :sakuracloud_api_url, :api_zone model_path 'fog/sakuracloud/models/volume' model :archive collection :archives model :plan collection :plans model :disk collection :disks request_path 'fog/sakuracloud/requests/volume' request :list_disks request :list_plans request :create_disk request :configure_disk request :associate_ip_to_disk request :register_note_to_disk request :attach_disk request :delete_disk request :list_archives request :carve_hostname_on_disk class Real include Fog::SakuraCloud::Utils::Request def initialize(options = {}) @auth_encode = Base64.strict_encode64([ options[:sakuracloud_api_token], options[:sakuracloud_api_token_secret] ].join(':')) Fog.credentials[:sakuracloud_api_token] = options[:sakuracloud_api_token] Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret] @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp' @api_zone = options[:api_zone] || Fog.credentials[:sakuracloud_api_zone] || 'is1b' Fog::SakuraCloud.validate_api_zone!(@api_zone) @connection = Fog::Core::Connection.new(@sakuracloud_api_url) end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :disks => [], :plans => [], :archives => [] } end end def self.reset @data = nil end def initialize(options={}) @sakuracloud_api_token = options[:sakuracloud_api_token] @sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] end def data self.class.data[@sakuracloud_api_token] self.class.data[@sakuracloud_api_token_secret] end def reset_data self.class.data.delete(@sakuracloud_api_token) self.class.data.delete(@sakuracloud_api_token_secret) end end end #SakuraCloud end #Volume end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/0000755000004100000410000000000012651244400022351 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/0000755000004100000410000000000012651244400024042 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/create_switch.rb0000644000004100000410000000147112651244400027216 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def create_switch(options) body = { "Switch" => { "Name" => options[:name] } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => 201, :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_switch(options) response = Excon::Response.new response.status = 201 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/collect_monitor_router.rb0000644000004100000410000000212412651244400031162 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def collect_monitor_router( id ,start_time = nil, end_time = nil) filter = {} filter['Start'] = start_time if start_time filter['End'] = end_time if end_time request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet/#{id}/monitor", :query => URI.encode(Fog::JSON.encode(filter)) ) end end # Real class Mock def collect_monitor_router( id ) response = Excon::Response.new response.status = 200 response.body = { "Data"=>{ "2015-12-16T18:00:00+09:00"=>{ "In"=>500000, "Out"=>70000000 } }, "is_ok"=>true } response end end # Mock end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb0000644000004100000410000000143712651244400032130 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def connect_interface_to_switch( id, switch_id ) response = request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface/#{id}/to/switch/#{switch_id}" ) response.body['Interface']['ID'] end end # Real class Mock def regist_interface_to_server( id, switch_id ) response = Excon::Response.new response.status = 20 response.body = { } response end end end # SakuraCloud end # Network0 end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/create_router.rb0000644000004100000410000000200412651244400027226 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def create_router(options) bandwidthmbps = options[:bandwidthmbps] ? options[:bandwidthmbps].to_i : 100 body = { "Internet" => { "Name" => options[:name], "NetworkMaskLen"=> options[:networkmasklen].to_i, "BandWidthMbps"=> bandwidthmbps } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => 202, :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_router(options) response = Excon::Response.new response.status = 202 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/change_router_bandwidth.rb0000644000004100000410000000176012651244400031244 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def change_router_bandwidth( id, bandwidthmbps ) body = { "Internet" => { "BandWidthMbps" => bandwidthmbps } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet/#{id}/bandwidth", :body => Fog::JSON.encode(body) ) end end # Real class Mock def change_router_bandwidth( id, bandwidthmbps ) response = Excon::Response.new response.status = 200 response.body = { "Internet"=>{"ID"=>"112701091977"}, "Success"=>true, "is_ok"=>true } response end end # Mock end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/list_switches.rb0000644000004100000410000000477612651244400027271 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def list_switches(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch" ) end end class Mock def list_switches(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Switches"=> [{"Index"=>0, "ID"=>"112600703732", "Name"=>"foobar1", "Description"=>"", "ServerCount"=>0, "ApplianceCount"=>0, "HybridConnection"=>nil, "ServiceClass"=>"cloud/switch/default", "CreatedAt"=>"2014-09-05T16:35:41+09:00", "Subnets"=> [{"ID"=>nil, "NetworkAddress"=>nil, "NetworkMaskLen"=>nil, "DefaultRoute"=>nil, "NextHop"=>nil, "StaticRoute"=>nil, "ServiceClass"=>nil, "IPAddresses"=>{"Min"=>nil, "Max"=>nil}, "Internet"=>{"ID"=>nil, "Name"=>nil, "BandWidthMbps"=>nil, "ServiceClass"=>nil}}], "IPv6Nets"=>[], "Internet"=>nil, "Bridge"=>nil}, {"Index"=>1, "ID"=>"112600703734", "Name"=>"foobar2", "Description"=>"", "ServerCount"=>1, "ApplianceCount"=>0, "HybridConnection"=>nil, "ServiceClass"=>"cloud/switch/default", "CreatedAt"=>"2014-09-05T16:36:13+09:00", "Subnets"=> [{"ID"=>1036, "NetworkAddress"=>"133.242.241.240", "NetworkMaskLen"=>28, "DefaultRoute"=>"133.242.241.241", "NextHop"=>nil, "StaticRoute"=>nil, "ServiceClass"=>"cloud/global-ipaddress-v4/28", "IPAddresses"=>{"Min"=>"133.242.241.244", "Max"=>"133.242.241.254"}, "Internet"=>{"ID"=>"112600703733", "Name"=>"hogehoge2", "BandWidthMbps"=>100, "ServiceClass"=>"cloud/internet/router/100m"}}], "IPv6Nets"=>[], "Internet"=>{"ID"=>"112600703733", "Name"=>"hogehoge2", "BandWidthMbps"=>100, "Scope"=>"user", "ServiceClass"=>"cloud/internet/router/100m"}, "Bridge"=>nil}] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/delete_router.rb0000644000004100000410000000124312651244400027231 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def delete_router( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet/#{id}" ) end end # Real class Mock def delete_router( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/delete_interface.rb0000644000004100000410000000125212651244400027651 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def delete_interface( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface/#{id}" ) end end # Real class Mock def delete_interface( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/delete_switch.rb0000644000004100000410000000124112651244400027210 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def delete_switch( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/switch/#{id}" ) end end # Real class Mock def delete_switch( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/regist_interface_to_server.rb0000644000004100000410000000167112651244400032001 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def regist_interface_to_server( server_id ) body = { "Interface" => { "Server" => { "ID" => server_id } } } response = request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [201], :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface", :body => Fog::JSON.encode(body) ) response.body['Interface']['ID'] end end # Real class Mock def regist_interface_to_server( id ) response = Excon::Response.new response.status = 201 response.body = { } response end end end # SakuraCloud end # Network end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/list_routers.rb0000644000004100000410000000155212651244400027130 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def list_routers(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/internet" ) end end class Mock def list_routers(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Internet"=>[ {"Index"=>0, "ID"=>"112600707538", "Switch"=>{ "ID"=>"112600707539", "Name"=>"router2" } } ], "is_ok"=>true } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/network/list_interfaces.rb0000644000004100000410000000160212651244400027544 0ustar www-datawww-data# coding: utf-8 module Fog module Network class SakuraCloud class Real def list_interfaces(options = {}) filter = { "Include" => [ "ID", "MACAddress", "IPAddress", "UserIPAddress", "Switch.ID", "Server.ID"] } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/interface", :query => URI.encode(Fog::JSON.encode(filter)) ) end end class Mock def list_interfaces(options = {}) response = Excon::Response.new response.status = 200 response.body = { } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/script/0000755000004100000410000000000012651244400023655 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/script/create_note.rb0000644000004100000410000000246012651244400026474 0ustar www-datawww-data# coding: utf-8 module Fog module SakuraCloud class Script class Real def create_note(options) body = { "Note" => { "Name" => options[:name], "Content" => options[:content] } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => 201, :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_note(options) response = Excon::Response.new response.status = 201 response.body = { "Note"=> {"ID"=>"112700759852", "Name"=>"foobar", "Class"=>"shell", "Scope"=>"user", "Content"=>"#!/bin/bash", "Description"=>"", "Remark"=>nil, "Availability"=>"available", "CreatedAt"=>"2015-09-05T20:32:12+09:00", "ModifiedAt"=>"2015-09-05T20:32:12+09:00", "Icon"=>nil, "Tags"=>[]}, "Success"=>true, "is_ok"=>true} response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/script/list_notes.rb0000644000004100000410000000154112651244400026366 0ustar www-datawww-data# coding: utf-8 module Fog module SakuraCloud class Script class Real def list_notes(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note" ) end end class Mock def list_notes(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Internet"=>[ {"Index"=>0, "ID"=>"112600707538", "Switch"=>{ "ID"=>"112600707539", "Name"=>"router2" } } ], "is_ok"=>true } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/script/modify_note.rb0000644000004100000410000000251012651244400026514 0ustar www-datawww-data# coding: utf-8 module Fog module SakuraCloud class Script class Real def modify_note( options ) body = { "Note" => { "Name" => options[:name], "Content" => options[:content] } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note/#{options[:id]}", :body => Fog::JSON.encode(body) ) end end # Real class Mock def modify_note( options ) response = Excon::Response.new response.status = 200 response.body = { "Note"=> {"ID"=>"112700759822", "Name"=>"hogehoge2", "Class"=>"shell", "Scope"=>"user", "Content"=>"", "Description"=>"", "Remark"=>nil, "Availability"=>"available", "CreatedAt"=>"2015-09-05T20:04:24+09:00", "ModifiedAt"=>"2015-09-05T20:04:24+09:00", "Icon"=>nil, "Tags"=>[]}, "Success"=>true, "is_ok"=>true } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/script/delete_note.rb0000644000004100000410000000215712651244400026476 0ustar www-datawww-data# coding: utf-8 module Fog module SakuraCloud class Script class Real def delete_note( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/note/#{id}" ) end end # Real class Mock def delete_note( id ) response = Excon::Response.new response.status = 200 response.body = { "Note"=> {"ID"=>"112700759822", "Name"=>"hogehoge2", "Class"=>"shell", "Scope"=>"user", "Content"=>"", "Description"=>"", "Remark"=>nil, "Availability"=>"available", "CreatedAt"=>"2015-09-05T20:04:24+09:00", "ModifiedAt"=>"2015-09-05T20:04:24+09:00", "Icon"=>nil, "Tags"=>[]}, "Success"=>true, "is_ok"=>true } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/0000755000004100000410000000000012651244400023660 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/list_plans.rb0000644000004100000410000000574412651244400026367 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def list_plans(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/product/disk" ) end end class Mock def list_plans(options = {}) response = Excon::Response.new response.status = 200 response.body = { "DiskPlans" => [ {"Index"=>0, "ID"=>4, "Name"=>"SSDプラン", "Availability"=>"available", "Size"=> [{"SizeMB"=>20480, "DisplaySize"=>20, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/20g"}, {"SizeMB"=>102400, "DisplaySize"=>100, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/100g"}, {"SizeMB"=>256000, "DisplaySize"=>250, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/250g"}, {"SizeMB"=>512000, "DisplaySize"=>500, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/ssd/500g"}]}, {"Index"=>1, "ID"=>2, "Name"=>"標準プラン", "Availability"=>"available", "Size"=> [{"SizeMB"=>40960, "DisplaySize"=>40, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/40g"}, {"SizeMB"=>61440, "DisplaySize"=>60, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/60g"}, {"SizeMB"=>81920, "DisplaySize"=>80, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/80g"}, {"SizeMB"=>102400, "DisplaySize"=>100, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/100g"}, {"SizeMB"=>256000, "DisplaySize"=>250, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/250g"}, {"SizeMB"=>512000, "DisplaySize"=>500, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/500g"}, {"SizeMB"=>768000, "DisplaySize"=>750, "DisplaySuffix"=>"GB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/750g"}, {"SizeMB"=>1048576, "DisplaySize"=>1, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/1t"}, {"SizeMB"=>2097152, "DisplaySize"=>2, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/2t"}, {"SizeMB"=>4194304, "DisplaySize"=>4, "DisplaySuffix"=>"TB", "Availability"=>"available", "ServiceClass"=>"cloud/disk/iscsi/4t"}]} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/carve_hostname_on_disk.rb0000644000004100000410000000153612651244400030716 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def carve_hostname_on_disk( disk_id, hostname ) body = { "HostName" => hostname } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config", :body => Fog::JSON.encode(body) ) end end # Real class Mock def carve_hostname_on_disk( disk_id, hostname ) response = Excon::Response.new response.status = 200 response.body = {"Success"=>true, "is_ok"=>true} response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/associate_ip_to_disk.rb0000644000004100000410000000176012651244400030370 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def associate_ip_to_disk( disk_id, subnet ) body = { "UserIPAddress" => subnet[:ipaddress], "UserSubnet" => { "NetworkMaskLen" => subnet[:networkmasklen], "DefaultRoute" => subnet[:defaultroute] } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config", :body => Fog::JSON.encode(body) ) end end # Real class Mock def associate_ip_to_disk( disk_id, subnet ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/register_note_to_disk.rb0000644000004100000410000000147612651244400030602 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def register_note_to_disk( disk_id, notes ) body = { "Notes" => notes.map {|note| { "ID" => note }} } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config", :body => Fog::JSON.encode(body) ) end end # Real class Mock def register_note_to_disk( disk_id, notes ) response = Excon::Response.new response.status = 200 response.body = { } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/delete_disk.rb0000644000004100000410000000123112651244400026456 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def delete_disk( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{id}" ) end end # Real class Mock def delete_disk( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/create_disk.rb0000644000004100000410000000210212651244400026455 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def create_disk( name, plan, options = {} ) body = { "Disk" => { "Name" => name, "Plan" => { "ID" => plan.to_i } } } if !options[:source_archive].nil? body["Disk"]["SourceArchive"] = { "ID"=>options[:source_archive].to_s } end if !options[:size_mb].nil? body["Disk"]["SizeMB"] = options[:size_mb].to_i end request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [201, 202], :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_disk( name, plan, options = {} ) response = Excon::Response.new response.status = 202 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/list_archives.rb0000644000004100000410000000235012651244400027044 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def list_archives(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/archive" ) end end class Mock def list_archives(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Archives" => [ {"Index"=>0, "ID"=>112500514887, "Name"=>"CentOS 5.10 64bit (基本セット)", "Availability"=>"available", "SizeMB"=>20480, "Plan"=>{"ID"=>2, "StorageClass"=>"iscsi1204", "Name"=>"標準プラン"} }, {"Index"=>1, "ID"=>112500571575, "Name"=>"CentOS 6.5 64bit (基本セット)", "Availability"=>"available", "SizeMB"=>102400, "Plan"=>{"ID"=>2, "StorageClass"=>"iscsi1204", "Name"=>"標準プラン"} } ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/list_disks.rb0000644000004100000410000000236712651244400026365 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def list_disks(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk" ) end end class Mock def list_disks(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Disks" => [ {"Index" => 0, "ID" =>112600053890, "Name" =>"foober1", "Connection" => "virtio", "Availability"=>"available", "SizeMB"=>20480, "Plan"=> {}, "SourceDisk" => nil, "SourceArchive" => {}}, {"Index" => 1, "ID" =>112600053891, "Name" =>"foober2", "Connection" => "virtio", "Availability"=>"available", "SizeMB"=>20480, "Plan"=> {}, "SourceDisk" => nil, "SourceArchive" => {}} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/configure_disk.rb0000644000004100000410000000153712651244400027206 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def configure_disk( disk_id, sshkey_id ) body = { "SSHKey" => {"ID" => sshkey_id.to_s } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/config", :body => Fog::JSON.encode(body) ) end end # Real class Mock def configure_disk( disk_id, sshkey_id ) response = Excon::Response.new response.status = 200 response.body = {"Success"=>true, "is_ok"=>true} response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/volume/attach_disk.rb0000644000004100000410000000133412651244400026464 0ustar www-datawww-data# coding: utf-8 module Fog module Volume class SakuraCloud class Real def attach_disk( disk_id, server_id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/disk/#{disk_id.to_s}/to/server/#{server_id.to_s}" ) end end # Real class Mock def attach_disk( disk_id, server_id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/dns/0000755000004100000410000000000012651244400023135 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/dns/modify_zone.rb0000644000004100000410000000153012651244400026003 0ustar www-datawww-data# coding: utf-8 module Fog module DNS class SakuraCloud class Real def modify_zone(options) body = { "CommonServiceItem"=>{ "Settings" => options[:settings] } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => 200, :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem/#{options[:id]}", :body => Fog::JSON.encode(body) ) end end # Real class Mock def modify_zone(options) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # DNS end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/dns/create_zone.rb0000644000004100000410000000224212651244400025760 0ustar www-datawww-data# coding: utf-8 module Fog module DNS class SakuraCloud class Real def create_zone(options) name = options[:name] ? options[:name] : options[:zone] body = { "CommonServiceItem"=>{ "Name"=>name, "Status"=>{"Zone"=>options[:zone]}, "Provider"=>{"Class"=>"dns"}, "Description"=> options[:description], "Settings" => { "DNS" => { "ResourceRecordSets" => options[:rr_sets] } } } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => 201, :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_zone(options) response = Excon::Response.new response.status = 201 response.body = { } response end end end # SakuraCloud end # DNS end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/dns/delete_zone.rb0000644000004100000410000000124012651244400025754 0ustar www-datawww-data# coding: utf-8 module Fog module DNS class SakuraCloud class Real def delete_zone( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem/#{id}" ) end end # Real class Mock def delete_zone( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # DNS end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/dns/list_zones.rb0000644000004100000410000000142112651244400025651 0ustar www-datawww-data# coding: utf-8 module Fog module DNS class SakuraCloud class Real def list_zones(options = {}) filter = { "Filter" => { "Provider.Class" => "dns" } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/commonserviceitem", :query => URI.encode(Fog::JSON.encode(filter)) ) end end class Mock def list_zones(options = {}) response = Excon::Response.new response.status = 200 response.body = { } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/0000755000004100000410000000000012651244400024025 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/boot_server.rb0000644000004100000410000000125612651244400026707 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def boot_server( id ) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'PUT', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}/power" ) true end end # Real class Mock def boot_server( id ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/list_plans.rb0000644000004100000410000000221712651244400026524 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def list_plans(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/product/server" ) end end class Mock def list_plans(options = {}) response = Excon::Response.new response.status = 200 response.body = { "ServerPlans" => [ {"Index"=>0, "ID"=>1001, "Name"=>"プラン/1Core-1GB", "CPU"=>1, "MemoryMB"=>1024, "ServiceClass"=>"cloud/plan/1core-1gb", "Availability"=>"available"}, {"Index"=>1, "ID"=>2001, "Name"=>"プラン/1Core-2GB", "CPU"=>1, "MemoryMB"=>2048, "ServiceClass"=>"cloud/plan/1core-2gb", "Availability"=>"available"} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/list_ssh_keys.rb0000644000004100000410000000165212651244400027241 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def list_ssh_keys(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/sshkey" ) end end class Mock def list_ssh_keys(options = {}) response = Excon::Response.new response.status = 200 response.body = { "SSHKeys"=> [ {"Index"=>0, "ID"=>"888888888888", "Name"=>"foobar1", "PublicKey"=>"ssh-rsa dummy"}, {"Index"=>1, "ID"=>"999999999999", "Name"=>"foobar2", "PublicKey"=>"ssh-rsa dummy"} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/delete_server.rb0000644000004100000410000000147712651244400027213 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def delete_server( id, force = false, disks = [] ) body = { "Force" => force, 'WithDisk' => disks } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}", :body => Fog::JSON.encode(body) ) end end # Real class Mock def delete_server( id, force = false, disks = [] ) response = Excon::Response.new response.status = 200 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/stop_server.rb0000644000004100000410000000155512651244400026733 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def stop_server( id, force = false ) if force body = { "Force" => true } else body = {} end request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [200,202], :method => 'DELETE', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server/#{id}/power", :body => Fog::JSON.encode(body) ) true end end # Real class Mock def stop_server( id, force = false ) response = Excon::Response.new response.status = 202 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/list_zones.rb0000644000004100000410000000163712651244400026552 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def list_zones(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/zone" ) end end class Mock def list_zones(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Zones" => [ {"Index"=>0, "ID"=>31001, "Name"=>"is1a", "Description"=>"石狩第1ゾーン"}, {"Index"=>1, "ID"=>31002, "Name"=>"is1b", "Description"=>"石狩第2ゾーン"} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/list_servers.rb0000644000004100000410000000201112651244400027070 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def list_servers(options = {}) request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :method => 'GET', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server" ) end end class Mock def list_servers(options = {}) response = Excon::Response.new response.status = 200 response.body = { "Servers" => [ {"Index" => 0, "ID"=>112600055376, "Name"=>"foober1", "ServerPlan"=> {}, "Instance"=> {}, "Disks"=> []}, {"Index" => 1, "ID"=>112600055377, "Name"=>"foober2", "ServerPlan"=> {}, "Instance"=> {}, "Disks"=> []} ] } response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/requests/compute/create_server.rb0000644000004100000410000000242412651244400027205 0ustar www-datawww-data# coding: utf-8 module Fog module Compute class SakuraCloud class Real def create_server(options) if options[:switch] switchs = options[:switch].split(',') connectedswitches = switchs.map do |sw_id| { "ID" => sw_id } end else connectedswitches = [{"Scope"=>"shared", "BandWidthMbps"=>100}] end body = { "Server" => { "Name" => options[:name], "ServerPlan" => { "ID" => options[:serverplan].to_i }, "ConnectedSwitches" => connectedswitches } } request( :headers => { 'Authorization' => "Basic #{@auth_encode}" }, :expects => [201], :method => 'POST', :path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server", :body => Fog::JSON.encode(body) ) end end # Real class Mock def create_server(options) response = Excon::Response.new response.status = 201 response.body = { } response end end end # SakuraCloud end # Volume end # Fog fog-sakuracloud-1.7.5/lib/fog/sakuracloud/network.rb0000644000004100000410000000474412651244400022525 0ustar www-datawww-datamodule Fog module Network class SakuraCloud < Fog::Service requires :sakuracloud_api_token requires :sakuracloud_api_token_secret recognizes :sakuracloud_api_url, :api_zone model_path 'fog/sakuracloud/models/network' model :router collection :routers model :switch collection :switches model :interface collection :interfaces request_path 'fog/sakuracloud/requests/network' request :list_routers request :create_router request :delete_router request :collect_monitor_router request :change_router_bandwidth request :list_switches request :create_switch request :delete_switch request :list_interfaces request :regist_interface_to_server request :connect_interface_to_switch request :delete_interface class Real include Fog::SakuraCloud::Utils::Request def initialize(options = {}) @auth_encode = Base64.strict_encode64([ options[:sakuracloud_api_token], options[:sakuracloud_api_token_secret] ].join(':')) Fog.credentials[:sakuracloud_api_token] = options[:sakuracloud_api_token] Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret] @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp' @api_zone = options[:api_zone] || Fog.credentials[:sakuracloud_api_zone] || 'is1b' Fog::SakuraCloud.validate_api_zone!(@api_zone) @connection = Fog::Core::Connection.new(@sakuracloud_api_url) end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :routers => [] } end end def self.reset @data = nil end def initialize(options={}) @sakuracloud_api_token = options[:sakuracloud_api_token] @sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] end def data self.class.data[@sakuracloud_api_token] self.class.data[@sakuracloud_api_token_secret] end def reset_data self.class.data.delete(@sakuracloud_api_token) self.class.data.delete(@sakuracloud_api_token_secret) end end end #SakuraCloud end #Network end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/script.rb0000644000004100000410000000401512651244400022327 0ustar www-datawww-datamodule Fog module SakuraCloud class Script < Fog::Service requires :sakuracloud_api_token requires :sakuracloud_api_token_secret recognizes :sakuracloud_api_url, :api_zone model_path 'fog/sakuracloud/models/script' model :note collection :notes request_path 'fog/sakuracloud/requests/script' request :list_notes request :create_note request :modify_note request :delete_note class Real include Fog::SakuraCloud::Utils::Request def initialize(options = {}) @auth_encode = Base64.strict_encode64([ options[:sakuracloud_api_token], options[:sakuracloud_api_token_secret] ].join(':')) Fog.credentials[:sakuracloud_api_token] = options[:sakuracloud_api_token] Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret] @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp' @api_zone = options[:api_zone] || Fog.credentials[:sakuracloud_api_zone] || 'is1b' Fog::SakuraCloud.validate_api_zone!(@api_zone) @connection = Fog::Core::Connection.new(@sakuracloud_api_url) end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :notes => [] } end end def self.reset @data = nil end def initialize(options={}) @sakuracloud_api_token = options[:sakuracloud_api_token] @sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] end def data self.class.data[@sakuracloud_api_token] self.class.data[@sakuracloud_api_token_secret] end def reset_data self.class.data.delete(@sakuracloud_api_token) self.class.data.delete(@sakuracloud_api_token_secret) end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/version.rb0000644000004100000410000000010012651244400022477 0ustar www-datawww-datamodule Fog module Sakuracloud VERSION = "1.7.5" end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/dns.rb0000644000004100000410000000400412651244400021605 0ustar www-datawww-datamodule Fog module DNS class SakuraCloud < Fog::Service requires :sakuracloud_api_token requires :sakuracloud_api_token_secret recognizes :sakuracloud_api_url, :api_zone model_path 'fog/sakuracloud/models/dns' model :zone collection :zones request_path 'fog/sakuracloud/requests/dns' request :list_zones request :create_zone request :delete_zone request :modify_zone class Real include Fog::SakuraCloud::Utils::Request def initialize(options = {}) @auth_encode = Base64.strict_encode64([ options[:sakuracloud_api_token], options[:sakuracloud_api_token_secret] ].join(':')) Fog.credentials[:sakuracloud_api_token] = options[:sakuracloud_api_token] Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret] @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp' @api_zone = options[:api_zone] || Fog.credentials[:sakuracloud_api_zone] || 'is1b' Fog::SakuraCloud.validate_api_zone!(@api_zone) @connection = Fog::Core::Connection.new(@sakuracloud_api_url) end end class Mock def self.data @data ||= Hash.new do |hash, key| hash[key] = { :notes => [] } end end def self.reset @data = nil end def initialize(options={}) @sakuracloud_api_token = options[:sakuracloud_api_token] @sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] end def data self.class.data[@sakuracloud_api_token] self.class.data[@sakuracloud_api_token_secret] end def reset_data self.class.data.delete(@sakuracloud_api_token) self.class.data.delete(@sakuracloud_api_token_secret) end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/0000755000004100000410000000000012651244400021761 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/0000755000004100000410000000000012651244400023452 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/interface.rb0000644000004100000410000000131212651244400025734 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Network class SakuraCloud class Interface < Fog::Model identity :id, :aliases => 'ID' attribute :macaddress, :aliases => 'MACAddress' attribute :ipaddress, :aliases => 'IPAddress' attribute :user_ipaddress, :aliases => 'UserIPAddress' attribute :switch, :aliases => 'Switch' attribute :server, :aliases => 'Server' def delete service.delete_interface(identity) true end alias_method :destroy, :delete def connect_to_switch(switch_id) service.connect_interface_to_switch(identity, switch_id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/router.rb0000644000004100000410000000342412651244400025322 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Network class SakuraCloud class Router < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :description, :aliases => 'Description' attribute :networkmasklen, :aliases => 'NetworkMaskLen' attribute :bandwidthmbps, :aliases => 'BandWidthMbps' attribute :switch, :aliases => 'Switch' def delete service.delete_router(identity) true end alias_method :destroy, :delete def save requires :name, :networkmasklen Fog::Logger.warning("Create Router with public subnet") attached_switch = service.create_router(@attributes).body["Internet"] Fog::Logger.warning("Waiting available new router...") new_data = switch_available?(service, attached_switch["ID"]) id = new_data['internet']['ID'] merge_attributes(new_data['internet']) self.reload true end def collect_monitor(start_time = nil, end_time = nil) service.collect_monitor_router(identity, start_time, end_time).body["Data"] end def change_bandwidth(bandwidth) ## change_bandwidth returns router as new one. new_router = service.change_router_bandwidth(identity, bandwidth).body["Internet"] self.id = new_router['ID'] self.reload end def switch_available?(network, router_id) until network.switches.find {|r| r.internet != nil && r.internet["ID"] == router_id} print '.' sleep 2 end ::JSON.parse((network.switches.find {|r| r.internet != nil && r.internet["ID"] == router_id}).to_json) end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/routers.rb0000644000004100000410000000102612651244400025501 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/network/router' module Fog module Network class SakuraCloud class Routers < Fog::Collection model Fog::Network::SakuraCloud::Router def all load service.list_routers.body['Internet'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def delete(id) service.delete_router(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/interfaces.rb0000644000004100000410000000147312651244400026127 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/network/interface' module Fog module Network class SakuraCloud class Interfaces < Fog::Collection model Fog::Network::SakuraCloud::Interface def all load service.list_interfaces.body['Interfaces'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def regist_onto_server(server_id) id = service.regist_interface_to_server(server_id) get(id) end def connect_to_switch(id, switch_id) id = service.connect_interface_to_switch(id, switch_id) get(id) end def delete(id) service.delete_interface(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/switch.rb0000644000004100000410000000166612651244400025311 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Network class SakuraCloud class Switch < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :description, :aliases => 'Description' attribute :server_count, :aliases => 'ServerCount' attribute :appliance_count, :aliases => 'ApplianceCount' attribute :subnets, :aliases => 'Subnets' attribute :ipv6nets, :aliases => 'IPv6Nets' attribute :internet, :aliases => 'Internet' attribute :bridge, :aliases => 'Bridge' def delete service.delete_switch(identity) true end alias_method :destroy, :delete def save requires :name Fog::Logger.warning("Create Switch") data = service.create_switch(@attributes).body["Switch"] merge_attributes(data) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/switches.rb0000644000004100000410000000103012651244400025622 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/network/switch' module Fog module Network class SakuraCloud class Switches < Fog::Collection model Fog::Network::SakuraCloud::Switch def all load service.list_switches.body['Switches'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def delete(id) service.delete_switch(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/0000755000004100000410000000000012651244400023265 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/notes.rb0000644000004100000410000000100612651244400024737 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/script/note' module Fog module SakuraCloud class Script class Notes < Fog::Collection model Fog::SakuraCloud::Script::Note def all load service.list_notes.body['Notes'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def delete(id) service.delete_note(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/note.rb0000644000004100000410000000212012651244400024552 0ustar www-datawww-datarequire 'fog/core/model' module Fog module SakuraCloud class Script class Note < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :note_class, :aliases => 'Class' attribute :scope, :aliases => 'Scope' attribute :content, :aliases => 'Content' attribute :description, :aliases => 'Description' attribute :remark, :aliases => 'Remark' attribute :availability, :aliases => 'Availability' attribute :icon, :aliases => 'Icon' def delete service.delete_note(identity) true end alias_method :destroy, :delete def save requires :name, :content if identity Fog::Logger.warning("Update Note #{identity}") data = service.modify_note(@attributes).body["Note"] else Fog::Logger.warning("Create New Note") data = service.create_note(@attributes).body["Note"] end merge_attributes(data) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/0000755000004100000410000000000012651244400023270 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/archives.rb0000644000004100000410000000070012651244400025416 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/volume/archive' module Fog module Volume class SakuraCloud class Archives < Fog::Collection model Fog::Volume::SakuraCloud::Archive def all load service.list_archives.body['Archives'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/plans.rb0000644000004100000410000000066512651244400024741 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/volume/plan' module Fog module Volume class SakuraCloud class Plans < Fog::Collection model Fog::Volume::SakuraCloud::Plan def all load service.list_plans.body['DiskPlans'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/archive.rb0000644000004100000410000000047012651244400025237 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Volume class SakuraCloud class Archive < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :size_mb, :aliases => 'SizeMB' attribute :plan, :aliases => 'Plan' end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/disks.rb0000644000004100000410000000100612651244400024727 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/volume/disk' module Fog module Volume class SakuraCloud class Disks < Fog::Collection model Fog::Volume::SakuraCloud::Disk def all load service.list_disks.body['Disks'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def delete(id) service.delete_disk(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/disk.rb0000644000004100000410000000353212651244400024552 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Volume class SakuraCloud class Disk < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :connection, :aliases => 'Connection' attribute :availability, :aliases => 'Availability' attribute :plan, :aliases => 'Plan' attribute :size_mb, :aliases => 'SizeMB' attribute :source_disk, :aliases => 'SourceDisk' attribute :source_archive, :aliases => 'SourceArchive' def delete service.delete_disk(identity) true end alias_method :destroy, :delete def save requires :name, :plan options = { :source_archive => source_archive, :size_mb => size_mb } data = service.create_disk(name, plan, options).body["Disk"] merge_attributes(data) true end def configure(sshkey_id) requires :id service.configure_disk(id, sshkey_id ) true end def carve_hostname_on_disk(hostname) requires :id service.carve_hostname_on_disk(id, hostname ) true end def attach(server_id) service.attach_disk(id, server_id) true end def associate_ip(ipaddress, networkmasklen, defaultroute) subnet ={ :ipaddress => ipaddress, :networkmasklen => networkmasklen, :defaultroute => defaultroute } requires :id service.associate_ip_to_disk(id, subnet ) true end def register_script(notes) note_ids = [] note_ids << notes requires :id service.register_note_to_disk(id, note_ids.flatten ) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/volume/plan.rb0000644000004100000410000000040412651244400024545 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Volume class SakuraCloud class Plan < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :size, :aliases => 'Size' end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/dns/0000755000004100000410000000000012651244400022545 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/dns/zones.rb0000644000004100000410000000101212651244400024222 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/dns/zone' module Fog module DNS class SakuraCloud class Zones < Fog::Collection model Fog::DNS::SakuraCloud::Zone def all load service.list_zones.body['CommonServiceItems'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def delete(id) service.delete_zone(id) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/dns/zone.rb0000644000004100000410000000302012651244400024040 0ustar www-datawww-datarequire 'fog/core/model' module Fog module DNS class SakuraCloud class Zone < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :description, :aliases => 'Description' attribute :status, :aliases => 'Status' attribute :settings, :aliases => 'Settings' attribute :tags, :aliases => 'Tags' ## Reader methods for nested values. # Returns value or nil def rr_sets settings.fetch('DNS', {}).fetch('ResourceRecordSets', []) if settings end def rr_sets=(rrsets) raise "ResourceRecordSets must be Array of Hash!" unless rrsets.is_a?(Array) self.settings = { 'DNS' => { 'ResourceRecordSets' => rrsets } } end def zone status.fetch('Zone') if status end def nameservers status.fetch('NS') if status end def delete service.delete_zone(identity) true end alias_method :destroy, :delete def save requires :zone if identity Fog::Logger.warning("Update DNS Zone #{identity}") data = service.modify_zone(@attributes).body["CommonServiceItem"] else Fog::Logger.warning("Create DNS Zone") data = service.create_zone(@attributes).body["CommonServiceItem"] end merge_attributes(data) true end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/0000755000004100000410000000000012651244400023435 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/zones.rb0000644000004100000410000000066412651244400025126 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/compute/zone' module Fog module Compute class SakuraCloud class Zones < Fog::Collection model Fog::Compute::SakuraCloud::Zone def all load service.list_zones.body['Zones'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/servers.rb0000644000004100000410000000526112651244400025457 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/compute/server' module Fog module Compute class SakuraCloud class Servers < Fog::Collection model Fog::Compute::SakuraCloud::Server def all load service.list_servers.body['Servers'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end def regist_interface_to_server(id) sv = get(id) sv.regist_interface sv end def create(options = {}) user = options[:user] || 'root' Fog::Logger.warning("Create Server") name = options[:name] ? options[:name] : Fog::UUID.uuid data = service.create_server(options).body["Server"] server = service.servers.new server.merge_attributes(data) if options[:volume] disk = create_and_attach_volume(server, options) server.reload end server.boot if options[:boot] server end private def create_and_attach_volume(server, options) Fog::Logger.warning("Create Volume") sakuracloud_api_token = options[:sakuracloud_api_token] || Fog.credentials[:sakuracloud_api_token] sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] || Fog.credentials[:sakuracloud_api_token_secret] api_zone = service.instance_variable_get(:@api_zone) size_mb = options[:volume][:size_mb].to_i || 20480 volume = Fog::Volume::SakuraCloud.new(:sakuracloud_api_token => sakuracloud_api_token, :sakuracloud_api_token_secret => sakuracloud_api_token_secret, :api_zone => api_zone) disk = volume.disks.create :name => Fog::UUID.uuid, :plan => options[:volume][:diskplan].to_i, :source_archive => options[:volume][:sourcearchive].to_s, :size_mb => size_mb Fog::Logger.warning("Waiting disk until available") disk.wait_for { availability == 'available' } volume.attach_disk(disk.id, server.id) disk_attached?(server, disk.id) Fog::Logger.warning("Modifing disk") volume.configure_disk(disk.id, options[:sshkey]) volume.register_note_to_disk(disk.id, options[:startup_script]) if options[:startup_script] disk end def disk_attached?(server, disk_id) until server.disks.find {|s| disk_id.to_s} print '.' sleep 2 server.reload end end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/ssh_key.rb0000644000004100000410000000042212651244400025425 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class SakuraCloud class SshKey < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :public_key, :aliases => 'PublicKey' end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/plans.rb0000644000004100000410000000067212651244400025104 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/compute/plan' module Fog module Compute class SakuraCloud class Plans < Fog::Collection model Fog::Compute::SakuraCloud::Plan def all load service.list_plans.body['ServerPlans'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/ssh_keys.rb0000644000004100000410000000070012651244400025607 0ustar www-datawww-datarequire 'fog/core/collection' require 'fog/sakuracloud/models/compute/ssh_key' module Fog module Compute class SakuraCloud class SshKeys < Fog::Collection model Fog::Compute::SakuraCloud::SshKey def all load service.list_ssh_keys.body['SSHKeys'] end def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/zone.rb0000644000004100000410000000042312651244400024734 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class SakuraCloud class Zone < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :description, :aliases => 'Description' end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/plan.rb0000644000004100000410000000056412651244400024721 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class SakuraCloud class Plan < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :server_class, :aliases => 'ServiceClass' attribute :cpu, :aliases => 'CPU' attribute :memory_mb, :aliases => 'MemoryMB' end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/compute/server.rb0000644000004100000410000000174412651244400025276 0ustar www-datawww-datarequire 'fog/core/model' module Fog module Compute class SakuraCloud class Server < Fog::Model identity :id, :aliases => 'ID' attribute :name, :aliases => 'Name' attribute :server_plan, :aliases => 'ServerPlan' attribute :instance, :aliases => 'Instance' attribute :disks, :aliases => 'Disks' attribute :interfaces, :aliases => 'Interfaces' def save requires :name, :server_plan data = service.create_server(@attributes).body["Server"] merge_attributes(data) true end def boot requires :id service.boot_server(id) end def stop(force = false) requires :id service.stop_server(id, force) end def delete(force = false, disks = []) requires :id service.delete_server(id, force, disks) true end alias_method :destroy, :delete end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/utils/0000755000004100000410000000000012651244400021636 5ustar www-datawww-datafog-sakuracloud-1.7.5/lib/fog/sakuracloud/utils/request.rb0000644000004100000410000000123212651244400023651 0ustar www-datawww-datamodule Fog module SakuraCloud module Utils module Request def request(params) response = parse @connection.request(params) response ## SakuraCloud API returns Japanese message. # This wrapper decodes and show message to be human readble. rescue Excon::Errors::HTTPStatusError => e Fog::Logger.warning ::JSON.parse(e.response.body)['error_msg'] raise e end private def parse(response) return response if response.body.empty? response.body = Fog::JSON.decode(response.body) response end end end end end fog-sakuracloud-1.7.5/lib/fog/sakuracloud/compute.rb0000644000004100000410000000325212651244400022501 0ustar www-datawww-datamodule Fog module Compute class SakuraCloud < Fog::Service requires :sakuracloud_api_token requires :sakuracloud_api_token_secret recognizes :sakuracloud_api_url, :api_zone model_path 'fog/sakuracloud/models/compute' model :server collection :servers model :plan collection :plans model :ssh_key collection :ssh_keys model :zone collection :zones request_path 'fog/sakuracloud/requests/compute' request :list_servers request :create_server request :delete_server request :boot_server request :stop_server request :list_plans request :list_ssh_keys request :list_zones class Real include Fog::SakuraCloud::Utils::Request def initialize(options = {}) @auth_encode = Base64.strict_encode64([ options[:sakuracloud_api_token], options[:sakuracloud_api_token_secret] ].join(':')) Fog.credentials[:sakuracloud_api_token] = options[:sakuracloud_api_token] Fog.credentials[:sakuracloud_api_token_secret] = options[:sakuracloud_api_token_secret] @sakuracloud_api_url = options[:sakuracloud_api_url] || 'https://secure.sakura.ad.jp' @api_zone = options[:api_zone] || Fog.credentials[:sakuracloud_api_zone] || 'is1b' Fog::SakuraCloud.validate_api_zone!(@api_zone) @connection = Fog::Core::Connection.new(@sakuracloud_api_url) end end class Mock def initialize(options = {}) end end end #SakuraCloud end #Compute end fog-sakuracloud-1.7.5/lib/fog/sakuracloud.rb0000644000004100000410000000240512651244400021024 0ustar www-datawww-datarequire 'fog/core' require 'fog/json' require 'fog/sakuracloud/utils/request' module Fog module Compute autoload :SakuraCloud, File.expand_path('../sakuracloud/compute', __FILE__) end module Network autoload :SakuraCloud, File.expand_path('../sakuracloud/network', __FILE__) end module Volume autoload :SakuraCloud, File.expand_path('../sakuracloud/volume', __FILE__) end module DNS autoload :SakuraCloud, File.expand_path('../sakuracloud/dns', __FILE__) end module SakuraCloud extend Fog::Provider SAKURACLOUD_API_VERSION = '1.1' unless defined? SAKURACLOUD_API_VERSION # Miscs ## Startup Script autoload :Script, File.expand_path('../sakuracloud/script', __FILE__) service(:compute, 'Compute') service(:volume, 'Volume') service(:network, 'Network') service(:script, 'Script') service(:dns, 'DNS') def self.api_zones @api_zones ||= ['tk1a','is1a', 'is1b', 'tk1v'] end def self.validate_api_zone!(api_zone, host=nil) if !api_zones.include?(api_zone) raise ArgumentError, "Unknown api_zone: #{api_zone.inspect}" end end def self.build_endpoint(api_zone) "/cloud/zone/#{api_zone}/api/cloud/#{SAKURACLOUD_API_VERSION}/" end end end fog-sakuracloud-1.7.5/metadata.yml0000644000004100000410000002312312651244400017144 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: fog-sakuracloud version: !ruby/object:Gem::Version version: 1.7.5 platform: ruby authors: - sawanoboly autorequire: bindir: bin cert_chain: [] date: 2015-12-26 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: fog-core requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: fog-json requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.5' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.5' - !ruby/object:Gem::Dependency name: minitest requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rbvmomi requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: yard requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: thor requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rbovirt requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version version: 0.0.24 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version version: 0.0.24 - !ruby/object:Gem::Dependency name: shindo requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.3.4 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.3.4 - !ruby/object:Gem::Dependency name: fission requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: pry requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rubocop requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' description: Module for the 'fog' gem to support Sakura no Cloud email: - sawanoboriyu@higanworks.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".gitmodules" - ".travis.yml" - CHANGELOG.md - CONTRIBUTING.md - CONTRIBUTORS.md - Gemfile - LICENSE.md - README.md - Rakefile - fog-sakuracloud.gemspec - lib/fog/bin/sakuracloud.rb - lib/fog/sakuracloud.rb - lib/fog/sakuracloud/compute.rb - lib/fog/sakuracloud/dns.rb - lib/fog/sakuracloud/models/compute/plan.rb - lib/fog/sakuracloud/models/compute/plans.rb - lib/fog/sakuracloud/models/compute/server.rb - lib/fog/sakuracloud/models/compute/servers.rb - lib/fog/sakuracloud/models/compute/ssh_key.rb - lib/fog/sakuracloud/models/compute/ssh_keys.rb - lib/fog/sakuracloud/models/compute/zone.rb - lib/fog/sakuracloud/models/compute/zones.rb - lib/fog/sakuracloud/models/dns/zone.rb - lib/fog/sakuracloud/models/dns/zones.rb - lib/fog/sakuracloud/models/network/interface.rb - lib/fog/sakuracloud/models/network/interfaces.rb - lib/fog/sakuracloud/models/network/router.rb - lib/fog/sakuracloud/models/network/routers.rb - lib/fog/sakuracloud/models/network/switch.rb - lib/fog/sakuracloud/models/network/switches.rb - lib/fog/sakuracloud/models/script/note.rb - lib/fog/sakuracloud/models/script/notes.rb - lib/fog/sakuracloud/models/volume/archive.rb - lib/fog/sakuracloud/models/volume/archives.rb - lib/fog/sakuracloud/models/volume/disk.rb - lib/fog/sakuracloud/models/volume/disks.rb - lib/fog/sakuracloud/models/volume/plan.rb - lib/fog/sakuracloud/models/volume/plans.rb - lib/fog/sakuracloud/network.rb - lib/fog/sakuracloud/requests/compute/boot_server.rb - lib/fog/sakuracloud/requests/compute/create_server.rb - lib/fog/sakuracloud/requests/compute/delete_server.rb - lib/fog/sakuracloud/requests/compute/list_plans.rb - lib/fog/sakuracloud/requests/compute/list_servers.rb - lib/fog/sakuracloud/requests/compute/list_ssh_keys.rb - lib/fog/sakuracloud/requests/compute/list_zones.rb - lib/fog/sakuracloud/requests/compute/stop_server.rb - lib/fog/sakuracloud/requests/dns/create_zone.rb - lib/fog/sakuracloud/requests/dns/delete_zone.rb - lib/fog/sakuracloud/requests/dns/list_zones.rb - lib/fog/sakuracloud/requests/dns/modify_zone.rb - lib/fog/sakuracloud/requests/network/change_router_bandwidth.rb - lib/fog/sakuracloud/requests/network/collect_monitor_router.rb - lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb - lib/fog/sakuracloud/requests/network/create_router.rb - lib/fog/sakuracloud/requests/network/create_switch.rb - lib/fog/sakuracloud/requests/network/delete_interface.rb - lib/fog/sakuracloud/requests/network/delete_router.rb - lib/fog/sakuracloud/requests/network/delete_switch.rb - lib/fog/sakuracloud/requests/network/list_interfaces.rb - lib/fog/sakuracloud/requests/network/list_routers.rb - lib/fog/sakuracloud/requests/network/list_switches.rb - lib/fog/sakuracloud/requests/network/regist_interface_to_server.rb - lib/fog/sakuracloud/requests/script/create_note.rb - lib/fog/sakuracloud/requests/script/delete_note.rb - lib/fog/sakuracloud/requests/script/list_notes.rb - lib/fog/sakuracloud/requests/script/modify_note.rb - lib/fog/sakuracloud/requests/volume/associate_ip_to_disk.rb - lib/fog/sakuracloud/requests/volume/attach_disk.rb - lib/fog/sakuracloud/requests/volume/carve_hostname_on_disk.rb - lib/fog/sakuracloud/requests/volume/configure_disk.rb - lib/fog/sakuracloud/requests/volume/create_disk.rb - lib/fog/sakuracloud/requests/volume/delete_disk.rb - lib/fog/sakuracloud/requests/volume/list_archives.rb - lib/fog/sakuracloud/requests/volume/list_disks.rb - lib/fog/sakuracloud/requests/volume/list_plans.rb - lib/fog/sakuracloud/requests/volume/register_note_to_disk.rb - lib/fog/sakuracloud/script.rb - lib/fog/sakuracloud/utils/request.rb - lib/fog/sakuracloud/version.rb - lib/fog/sakuracloud/volume.rb - tests/helper.rb - tests/sakuracloud/requests/compute/plans_tests.rb - tests/sakuracloud/requests/compute/servers_tests.rb - tests/sakuracloud/requests/compute/ssh_keys_tests.rb - tests/sakuracloud/requests/compute/zones_tests.rb - tests/sakuracloud/requests/network/routers_tests.rb - tests/sakuracloud/requests/network/switches_tests.rb - tests/sakuracloud/requests/volume/archives_tests.rb - tests/sakuracloud/requests/volume/disks_tests.rb - tests/sakuracloud/requests/volume/plans_tests.rb homepage: '' licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.8 signing_key: specification_version: 4 summary: Module for the 'fog' gem to support Sakura no Cloud test_files: [] has_rdoc: fog-sakuracloud-1.7.5/.gitignore0000644000004100000410000000151512651244400016632 0ustar www-datawww-data/.bundle/ /.yardoc /Gemfile.lock /_yardoc/ /coverage/ /doc/ /pkg/ /spec/reports/ /tmp/ *.bundle *.so *.o *.a mkmf.log # Created by http://www.gitignore.io ### Ruby ### *.gem *.rbc /.config /coverage/ /InstalledFiles /pkg/ /spec/reports/ /test/tmp/ /test/version_tmp/ /tmp/ ## Specific to RubyMotion: .dat* .repl_history build/ ## Documentation cache and generated files: /.yardoc/ /_yardoc/ /doc/ /rdoc/ ## Environment normalisation: /.bundle/ /lib/bundler/man/ # for a library or gem, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # Gemfile.lock # .ruby-version # .ruby-gemset # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc ### vim ### [._]*.s[a-w][a-z] [._]s[a-w][a-z] *.un~ Session.vim .netrwhist *~ .fog /vendor/ /bbin/ fog-sakuracloud-1.7.5/fog-sakuracloud.gemspec0000644000004100000410000000300712651244400021273 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fog/sakuracloud/version' Gem::Specification.new do |spec| spec.name = "fog-sakuracloud" spec.version = Fog::Sakuracloud::VERSION spec.authors = ["sawanoboly"] spec.email = ["sawanoboriyu@higanworks.com"] spec.summary = %q{Module for the 'fog' gem to support Sakura no Cloud} spec.description = %q{Module for the 'fog' gem to support Sakura no Cloud} spec.homepage = "" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "fog-core" spec.add_dependency "fog-json" spec.add_development_dependency "bundler", "~> 1.5" ## List your development dependencies here. Development dependencies are ## those that are only needed during development spec.add_development_dependency('minitest') spec.add_development_dependency('rake') spec.add_development_dependency('rbvmomi') spec.add_development_dependency('yard') spec.add_development_dependency('thor') spec.add_development_dependency('rbovirt', '0.0.24') spec.add_development_dependency('shindo', '~> 0.3.4') spec.add_development_dependency('fission') spec.add_development_dependency('pry') spec.add_development_dependency('rubocop') if RUBY_VERSION > "1.9" end fog-sakuracloud-1.7.5/CONTRIBUTING.md0000644000004100000410000000157712651244400017103 0ustar www-datawww-data## Getting Involved New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another. ### Coding * Pick a task: * Offer feedback on open [pull requests](https://github.com/fog/fog-sakuracloud/pulls). * Review open [issues](https://github.com/fog/fog-sakuracloud/issues) for things to help on. * [Create an issue](https://github.com/fog/fog-sakuracloud/issues/new) to start a discussion on additions or features. * Fork the project, add your changes and tests to cover them in a topic branch. * Commit your changes and rebase against `fog/fog-sakuracloud` to ensure everything is up to date. * [Submit a pull request](https://github.com/fog/fog-sakuracloud/compare/) ### Non-Coding * Offer feedback on open [issues](https://github.com/fog/fog-sakuracloud/issues). * Organize or volunteer at events.fog-sakuracloud-1.7.5/CHANGELOG.md0000644000004100000410000000331712651244400016455 0ustar www-datawww-data# Changelog of fog-sakuracloud ## v1.7.5 - Bug: Server#create_and_attach_volume ignores api_zone. => TODO: Cleanup ## v1.7.4 - Bug: forgot zone is1a... ## v1.7.3 - Coordinate: Router#change_bandwidth update current instance by new ID. ## v1.7.2 - Bug: remove debug code from create_router ## v1.7.1 - Misc: Pass zone from Fog.credentials[:sakuracloud_api_zone]. ## v1.7.0 - Change: Rebuild router model from internet resource. ## v1.6.0 - Miscs: Wrap request for error messages to be readable. #22 - Cleanup: replace @attribute[:id] to id #21 ## v1.5.2 - Feature: Add filter params Start and End to collect_monitor_router. ## v1.5.1 - Feature: Add monitor to Router model PR #20 HT: @miyukki ## v1.5.0 - Feature: # Add new option api_zone to Provider to select zone easily. ## v1.4.0 - Feature: #17 Support Standard Disk Plan for Disk creation HT: @noralife - Feature: #18 Add attach feature to Disk Model HT: @noralife ## v1.3.3 - Typo: Fix typo ( auth_encord -> auth_encode ) #16 HT: @mazgi - Drop support ruby 1.9, add 2.2 ## v1.3.2 - Feature: Set hostname (Disk#carve_hostname_on_disk) ## v1.3.1 - Feature: Add simple setter to ResourceRecordSets ## v1.3.0 - Feature: Manage Cloud DNS ## v1.2.0 - Feature: Manage Interface. ## v1.1.1 - Bugfix: Delete Server ## v1.1.0 - Feature: Support Install Script. ## v1.0.1 - #11 Using Relative paths. ## v0.1.2 - Clean up: #7 HT: @starbelly ## v0.1.1 - Add: Associate IP address to disk ## v0.1.0 - Add: Network resources - switch - router - API change: create server requires options type. ## v0.0.4 - move lib/fog/bin/sakuracloud.rb from fog. ## v0.0.1-0.0.3 - divide from fog. - supports - compute(with public switch only) - volume fog-sakuracloud-1.7.5/README.md0000644000004100000410000000232012651244400016114 0ustar www-datawww-data# Fog::Sakuracloud [![Gem Version](https://badge.fury.io/rb/fog-sakuracloud.svg)](http://badge.fury.io/rb/fog-sakuracloud) [![Build Status](https://travis-ci.org/fog/fog-sakuracloud.svg?branch=master)](https://travis-ci.org/fog/fog-sakuracloud) [![Stories in Ready](https://badge.waffle.io/fog/fog-sakuracloud.svg?label=ready&title=Ready)](http://waffle.io/fog/fog-sakuracloud) [![Stories in Progress](https://badge.waffle.io/fog/fog-sakuracloud.svg?label=In%20Progress&title=In%20Progress')](http://waffle.io/fog/fog-sakuracloud) This gem is a module for the fog gem that allows you to manage resources in the Sakura no Cloud. ## Installation Add this line to your application's Gemfile: ```ruby gem 'fog-sakuracloud' ``` And then execute: $ bundle Or install it yourself as: $ gem install fog-sakuracloud ## Usage See [Getting started](https://github.com/higanworks/fog-sakuracloud/wiki/Getting-started-for-SakuraCloud) ## Contributing 1. Fork it ( https://github.com/fog/fog-sakuracloud/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request fog-sakuracloud-1.7.5/.gitmodules0000644000004100000410000000000012651244400017003 0ustar www-datawww-data