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.
799 800 801 |
# File 'lib/awscli/ec2.rb', line 799 def initialize(connection) @conn = connection end |
Instance Method Details
#attach(nic_id, instance_id, device_index) ⇒ Object
819 820 821 822 |
# File 'lib/awscli/ec2.rb', line 819 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
807 808 809 810 |
# File 'lib/awscli/ec2.rb', line 807 def create() nic = @conn.network_interfaces.create() puts "Create network interface #{nic.network_interface_id}" end |
#deattach(attachement_id, force) ⇒ Object
824 825 826 827 |
# File 'lib/awscli/ec2.rb', line 824 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
812 813 814 815 816 817 |
# File 'lib/awscli/ec2.rb', line 812 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
803 804 805 |
# File 'lib/awscli/ec2.rb', line 803 def list @conn.network_interfaces.table end |
#modify_attribute(options) ⇒ Object
829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/awscli/ec2.rb', line 829 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 |