class Fog::Network::SakuraCloud::Mock
Public Class Methods
data()
click to toggle source
# File lib/fog/sakuracloud/network.rb, line 57 def self.data @data ||= Hash.new do |hash, key| hash[key] = { :routers => [] } end end
new(options={})
click to toggle source
# File lib/fog/sakuracloud/network.rb, line 69 def initialize(options={}) @sakuracloud_api_token = options[:sakuracloud_api_token] @sakuracloud_api_token_secret = options[:sakuracloud_api_token_secret] end
reset()
click to toggle source
# File lib/fog/sakuracloud/network.rb, line 65 def self.reset @data = nil end
Public Instance Methods
create_router(options)
click to toggle source
# File lib/fog/sakuracloud/requests/network/create_router.rb, line 30 def create_router(options) response = Excon::Response.new response.status = 202 response.body = { } response end
create_switch(options)
click to toggle source
# File lib/fog/sakuracloud/requests/network/create_switch.rb, line 26 def create_switch(options) response = Excon::Response.new response.status = 201 response.body = { } response end
data()
click to toggle source
# File lib/fog/sakuracloud/network.rb, line 74 def data self.class.data[@sakuracloud_api_token] self.class.data[@sakuracloud_api_token_secret] end
delete_interface( id )
click to toggle source
# File lib/fog/sakuracloud/requests/network/delete_interface.rb, line 19 def delete_interface( id ) response = Excon::Response.new response.status = 200 response.body = { } response end
delete_router( id )
click to toggle source
# File lib/fog/sakuracloud/requests/network/delete_router.rb, line 19 def delete_router( id ) response = Excon::Response.new response.status = 200 response.body = { } response end
delete_switch( id )
click to toggle source
# File lib/fog/sakuracloud/requests/network/delete_switch.rb, line 19 def delete_switch( id ) response = Excon::Response.new response.status = 200 response.body = { } response end
list_interfaces(options = {})
click to toggle source
# File lib/fog/sakuracloud/requests/network/list_interfaces.rb, line 28 def list_interfaces(options = {}) response = Excon::Response.new response.status = 200 response.body = { } response end
list_routers(options = {})
click to toggle source
# File lib/fog/sakuracloud/requests/network/list_routers.rb, line 18 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
list_switches(options = {})
click to toggle source
# File lib/fog/sakuracloud/requests/network/list_switches.rb, line 18 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
regist_interface_to_server( id, switch_id )
click to toggle source
# File lib/fog/sakuracloud/requests/network/connect_interface_to_switch.rb, line 20 def regist_interface_to_server( id, switch_id ) response = Excon::Response.new response.status = 20 response.body = { } response end
reset_data()
click to toggle source
# File lib/fog/sakuracloud/network.rb, line 79 def reset_data self.class.data.delete(@sakuracloud_api_token) self.class.data.delete(@sakuracloud_api_token_secret) end