Class: Fog::Compute::RackspaceV2::VirtualInterface
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::RackspaceV2::VirtualInterface
- Defined in:
- lib/fog/rackspace/models/compute_v2/virtual_interface.rb
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The virtual interface id.
-
#ip_addresses ⇒ Array<Hash>
readonly
[ { “address”: “2001:4800:7810:0512:d87b:9cbc:ff04:850c”, “network_id”: “ba122b32-dbcc-4c21-836e-b701996baeb3”, “network_label”: “public” }, { “address”: “64.49.226.149”, “network_id”: “ba122b32-dbcc-4c21-836e-b701996baeb3”, “network_label”: “public” } ].
-
#mac_address ⇒ String
readonly
The Media Access Control (MAC) address for the virtual interface.
Instance Method Summary collapse
-
#create ⇒ Boolean
Creates Virtual interface for server * requires attributes: :network my_server.virtual_interfaces.create :network => my_network.
-
#destroy ⇒ Boolean
Destroy the virtual interface.
-
#save(attributes = {}) ⇒ Boolean
Saves the virtual interface.
Instance Attribute Details
#id ⇒ String (readonly)
Returns The virtual interface id.
10 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 10 identity :id |
#ip_addresses ⇒ Array<Hash> (readonly)
[
{
"address": "2001:4800:7810:0512:d87b:9cbc:ff04:850c",
"network_id": "ba122b32-dbcc-4c21-836e-b701996baeb3",
"network_label": "public"
},
{
"address": "64.49.226.149",
"network_id": "ba122b32-dbcc-4c21-836e-b701996baeb3",
"network_label": "public"
}
]
32 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 32 attribute :ip_addresses |
#mac_address ⇒ String (readonly)
Returns The Media Access Control (MAC) address for the virtual interface. A MAC address is a unique identifier assigned to network interfaces for communications on the physical network segment.
15 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 15 attribute :mac_address |
Instance Method Details
#create ⇒ Boolean
Creates Virtual interface for server
-
requires attributes: :network
my_server.virtual_interfaces.create :network => my_network
56 57 58 59 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 56 def create data = service.create_virtual_interface(server_id, network_id) merge_attributes(data.body['virtual_interfaces'].first) end |
#destroy ⇒ Boolean
Destroy the virtual interface
68 69 70 71 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 68 def destroy service.delete_virtual_interface(server_id, id) true end |
#save(attributes = {}) ⇒ Boolean
Saves the virtual interface. This method can only create a virtual interface. Attempting to update interface will result an exception
37 38 39 40 41 42 43 44 |
# File 'lib/fog/rackspace/models/compute_v2/virtual_interface.rb', line 37 def save(attributes = {}) if persisted? raise Fog::Errors::Error.new("This virtual interface has already been created and it cannot be updated") else create end true end |