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.
789 790 791 |
# File 'lib/awscli/ec2.rb', line 789 def initialize(connection) @conn = connection end |
Instance Method Details
#attach(nic_id, instance_id, device_index) ⇒ Object
809 810 811 812 |
# File 'lib/awscli/ec2.rb', line 809 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
797 798 799 800 |
# File 'lib/awscli/ec2.rb', line 797 def create() nic = @conn.network_interfaces.create() puts "Create network interface #{nic.network_interface_id}" end |
#deattach(attachement_id, force) ⇒ Object
814 815 816 817 |
# File 'lib/awscli/ec2.rb', line 814 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
802 803 804 805 806 807 |
# File 'lib/awscli/ec2.rb', line 802 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
793 794 795 |
# File 'lib/awscli/ec2.rb', line 793 def list @conn.network_interfaces.table end |
#modify_attribute(options) ⇒ Object
819 820 821 822 823 824 825 826 827 828 829 830 831 832 |
# File 'lib/awscli/ec2.rb', line 819 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: #{options[:attribute]}" end end |