Sha256: 0cadf8f262609442ccb0bb876e39950499de7ecd78153839657509d0d02d4ab8
Contents?: true
Size: 1.44 KB
Versions: 15
Compression:
Stored size: 1.44 KB
Contents
require '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 :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' attribute :networkmasklen 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") data = service.create_router(@attributes).body["Internet"] Fog::Logger.warning("Waiting available new router...") new_data = router_available?(service, data["ID"]) merge_attributes(new_data) true end def router_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
Version data entries
15 entries across 15 versions & 2 rubygems