Sha256: 54d775f74ee068dcbd077a03d53afb1119a59b8da415d44351e14aa130f22c07

Contents?: true

Size: 827 Bytes

Versions: 19

Compression:

Stored size: 827 Bytes

Contents

require '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

Version data entries

19 entries across 17 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/interfaces.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/interfaces.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.5 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.4 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.3 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.2 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.1 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.7.0 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.6.0 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.5.2 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.5.1 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.5.0 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.4.0 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.3.3 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.3.2 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.3.1 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.3.0 lib/fog/sakuracloud/models/network/interfaces.rb
fog-sakuracloud-1.2.0 lib/fog/sakuracloud/models/network/interfaces.rb