class Awscli::EC2::NetworkInterfaces

Public Class Methods

new(connection) click to toggle source
# File lib/awscli/ec2.rb, line 849
def initialize(connection)
  @conn = connection
end

Public Instance Methods

attach(nic_id, instance_id, device_index) click to toggle source
# File lib/awscli/ec2.rb, line 869
def attach(nic_id, instance_id, device_index)
  @conn.attach_network_interface(nic_id, instance_id, device_index)
  puts "Attached Network Interface: #{nic_id} to instance: #{instance_id}"
end
create(options) click to toggle source
# File lib/awscli/ec2.rb, line 857
def create(options)
  nic = @conn.network_interfaces.create(options)
  puts "Create network interface #{nic.network_interface_id}"
end
deattach(attachement_id, force) click to toggle source
# File lib/awscli/ec2.rb, line 874
def deattach(attachement_id, force)
  @conn.detach_network_interface attachement_id, force
  puts "Detached Network Interface with attachement_id: #{attachement_id}"
end
delete(nic_id) click to toggle source
# File lib/awscli/ec2.rb, line 862
def delete(nic_id)
  nic = @conn.network_interfaces.get(nic_id)
  abort "Cannot find nic with id: #{nic_id}" unless nic
  nic.destroy
  puts "Deleted network interface #{nic_id}"
end
list() click to toggle source
# File lib/awscli/ec2.rb, line 853
def list
  @conn.network_interfaces.table
end
modify_attribute(options) click to toggle source
# File lib/awscli/ec2.rb, line 879
def modify_attribute(options)
  case options[:attribute]
  when 'description'
    @conn.modify_network_interface_attribute(options[:network_interface_id], 'description', options[:description])
  when 'groupSet'
    @conn.modify_network_interface_attribute(options[:network_interface_id], 'groupSet', options[:group_set])
  when 'sourceDestCheck'
    @conn.modify_network_interface_attribute(options[:network_interface_id], 'sourceDestCheck', options[:source_dest_check])
  when 'attachment'
    @conn.modify_network_interface_attribute(options[:network_interface_id], 'attachment', options[:attachment])
  else
    abort "Invalid attribute: #{options[:attribute]}"
  end
end