class AWS::EC2::NetworkInterface::Attachment

Attributes

attach_time[R]

@return [Time]

attachment_id[R]

@return [String] Returns the attachment id.

delete_on_termination[R]

@return [Boolean]

delete_on_termination?[R]

@return [Boolean]

device_index[R]

@return [Integer] The index of the device for the network

interface attachment on the instance.
id[R]

@return [String] Returns the attachment id.

instance[R]

@return [Instance] Returns the instance the network interface

is attached to.
instance_owner_id[R]

@return [String] Returns the instance owner id.

network_interface[R]

@return [NetworkInterface] Returns the network interface this

is an attachment for.
status[R]

@return [Symbol] Returns the attachment status.

Public Class Methods

new(network_interface, details) click to toggle source
# File lib/aws/ec2/network_interface/attachment.rb, line 21
def initialize network_interface, details
  @network_interface = network_interface
  @attachment_id = details[:attachment_id]
  @instance = Instance.new(details[:instance_id],
    :owner_id => details[:instance_owner_id],
    :config => network_interface.config)
  @instance_owner_id = details[:instance_owner_id]
  @device_index = details[:device_index]
  @status = details[:status].to_sym
  @attach_time = details[:attach_time]
  @delete_on_termination = details[:delete_on_termination]
end

Public Instance Methods

delete(options = {})
Alias for: detach
delete_on_termination=(state) click to toggle source

Allows you to toggle the delete on termination state.

network_interface.attachment.delete_on_termination = false

@param [Boolean] state

# File lib/aws/ec2/network_interface/attachment.rb, line 71
def delete_on_termination= state
  opts = {}
  opts[:network_interface_id] = network_interface.id
  opts[:attachment] = {}
  opts[:attachment][:attachment_id] = id
  opts[:attachment][:delete_on_termination] = state
  network_interface.client.modify_network_interface_attribute(opts)
end
detach(options = {}) click to toggle source

Detaches the network interface from the instance.

@param [Hash] options

@option options [Boolean] :force (false) Set true to force

a detachment.

@return [nil]

# File lib/aws/ec2/network_interface/attachment.rb, line 89
def detach options = {}
  client_opts = {}
  client_opts[:attachment_id] = attachment_id
  client_opts[:force] = options[:force] == true
  network_interface.client.detach_network_interface(client_opts)
end
Also aliased as: delete