Class: Fog::Network::SakuraCloud::Interfaces

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/sakuracloud/models/network/interfaces.rb

Instance Method Summary collapse

Instance Method Details

#allObject



10
11
12
# File 'lib/fog/sakuracloud/models/network/interfaces.rb', line 10

def all
  load service.list_interfaces.body['Interfaces']
end

#connect_to_switch(id, switch_id) ⇒ Object



25
26
27
28
# File 'lib/fog/sakuracloud/models/network/interfaces.rb', line 25

def connect_to_switch(id, switch_id)
  id = service.connect_interface_to_switch(id, switch_id)
  get(id)
end

#delete(id) ⇒ Object



30
31
32
33
# File 'lib/fog/sakuracloud/models/network/interfaces.rb', line 30

def delete(id)
  service.delete_interface(id)
  true
end

#get(id) ⇒ Object



14
15
16
17
18
# File 'lib/fog/sakuracloud/models/network/interfaces.rb', line 14

def get(id)
  all.find { |f| f.id == id }
rescue Fog::Errors::NotFound
  nil
end

#regist_onto_server(server_id) ⇒ Object



20
21
22
23
# File 'lib/fog/sakuracloud/models/network/interfaces.rb', line 20

def regist_onto_server(server_id)
  id = service.regist_interface_to_server(server_id)
  get(id)
end