Class: Fog::Compute::AWS::NetworkInterface

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject

Removes an existing network interface

network_interface.destroy

Returns

True or false depending on the result



40
41
42
43
44
45
# File 'lib/fog/aws/models/compute/network_interface.rb', line 40

def destroy
  requires :network_interface_id

  service.delete_network_interface(network_interface_id)
  true
end

#saveObject

Create a network_interface

>> g = AWS.network_interfaces.new(:subnet_id => "subnet-someId", options)
>> g.save

options is an optional hash which may contain ‘PrivateIpAddress’, ‘Description’, ‘groupSet’

Returns:

requestId and a networkInterface object



59
60
61
62
63
64
65
# File 'lib/fog/aws/models/compute/network_interface.rb', line 59

def save
  requires :subnet_id
  data = service.create_network_interface(subnet_id).body['networkInterface']
  new_attributes = data.reject {|key,value| key == 'requestId'}
  merge_attributes(new_attributes)
  true
end