Class: Fog::Compute::Packet::VirtualNetwork

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/packet/models/virtual_network.rb

Overview

Plan

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VirtualNetwork

Returns a new instance of VirtualNetwork.



23
24
25
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 23

def initialize(attributes = {})
  super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



21
22
23
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 21

def options
  @options
end

Instance Method Details

#assign_port(port_id) ⇒ Object



54
55
56
57
58
59
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 54

def assign_port(port_id)
  requires :id

  response = service.assign_port(port_id, id)
  true if response.status == 200
end

#bond(bulk_enable) ⇒ Object



42
43
44
45
46
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 42

def bond(bulk_enable)
  requires :id
  response = service.bond_ports(id, bulk_enable)
  true if response.status == 200
end

#destroyObject



68
69
70
71
72
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 68

def destroy
  requires :id
  response = service.delete_virtual_network(id)
  true if response.status == 204
end

#disbond(bulk_disable) ⇒ Object



48
49
50
51
52
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 48

def disbond(bulk_disable)
  requires :id
  response = service.disbond_ports(id, bulk_disable)
  true if response.status == 200
end

#saveObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 27

def save
  requires :project_id, :description, :facility, :vxlan, :vlan

  options = {}
  options [:project_id] = project_id
  options[:description] = description
  options[:facility] = facility
  options[:vxlan] = vxlan
  options[:vxlan] = vlan
  options[:name] = name if name

  response = service.create_virtual_network(options)
  merge_attributes(response.body)
end

#unassign_port(port_id) ⇒ Object



61
62
63
64
65
66
# File 'lib/fog/compute/packet/models/virtual_network.rb', line 61

def unassign_port(port_id)
  requires :id

  response = service.unassign_port(port_id, id)
  true if response.status == 200
end