Class: Awscli::EC2::NetworkInterfaces
- Inherits:
-
Object
- Object
- Awscli::EC2::NetworkInterfaces
- Defined in:
- lib/awscli/ec2.rb
Overview
> NetworkAcl
Instance Method Summary collapse
- #attach(nic_id, instance_id, device_index) ⇒ Object
- #create(options) ⇒ Object
- #deattach(attachement_id, force) ⇒ Object
- #delete(nic_id) ⇒ Object
-
#initialize(connection) ⇒ NetworkInterfaces
constructor
A new instance of NetworkInterfaces.
- #list ⇒ Object
- #modify_attribute(options) ⇒ Object
Constructor Details
#initialize(connection) ⇒ NetworkInterfaces
Returns a new instance of NetworkInterfaces.
777 778 779 |
# File 'lib/awscli/ec2.rb', line 777 def initialize(connection) @conn = connection end |
Instance Method Details
#attach(nic_id, instance_id, device_index) ⇒ Object
797 798 799 800 |
# File 'lib/awscli/ec2.rb', line 797 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) ⇒ Object
785 786 787 788 |
# File 'lib/awscli/ec2.rb', line 785 def create() nic = @conn.network_interfaces.create() puts "Create network interface #{nic.network_interface_id}" end |
#deattach(attachement_id, force) ⇒ Object
802 803 804 805 |
# File 'lib/awscli/ec2.rb', line 802 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) ⇒ Object
790 791 792 793 794 795 |
# File 'lib/awscli/ec2.rb', line 790 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 ⇒ Object
781 782 783 |
# File 'lib/awscli/ec2.rb', line 781 def list @conn.network_interfaces.table end |
#modify_attribute(options) ⇒ Object
807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
# File 'lib/awscli/ec2.rb', line 807 def modify_attribute() case [:attribute] when 'description' @conn.modify_network_interface_attribute([:network_interface_id], 'description', [:description]) when 'groupSet' @conn.modify_network_interface_attribute([:network_interface_id], 'groupSet', [:group_set]) when 'sourceDestCheck' @conn.modify_network_interface_attribute([:network_interface_id], 'sourceDestCheck', [:source_dest_check]) when 'attachment' @conn.modify_network_interface_attribute([:network_interface_id], 'attachment', [:attachment]) else abort "Invalid attribute: #{[:attribute]}" end end |