Class: Serverspec::Type::AWS::EC2::NetworkInterface

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/ec2/network_interface.rb

Overview

The NetworkInterface class exposes the EC2::NetworkInterface resources

Instance Method Summary collapse

Constructor Details

#initialize(ni_id, instance = nil) ⇒ NetworkInterface

AWS SDK for Ruby v2 Aws::EC2::Client wrapper for initializing a NetworkInterface resource

Parameters:

  • ni_id (String)

    The ID of the NetworkInterface

  • instance (Class) (defaults to: nil)

    Aws::EC2::Client instance

Raises:

  • (RuntimeError)

    if nis.nil?

  • (RuntimeError)

    if nis.length == 0

  • (RuntimeError)

    if nis.length > 1



15
16
17
18
19
20
# File 'lib/resources/ec2/network_interface.rb', line 15

def initialize(ni_id, instance = nil)
  check_init_arg 'ni_id', 'EC2::NetworkInterface', ni_id
  @ni_id = ni_id
  @aws = instance.nil? ? Aws::EC2::Client.new : instance
  get_ni ni_id
end

Instance Method Details

#associationHash

The association information for an Elastic IP associated to the NetworkInterface

Returns:

  • (Hash)


124
125
126
# File 'lib/resources/ec2/network_interface.rb', line 124

def association
  @ni.association
end

#attached?Boolean

Returns whether the NetworkInterface is attached

Returns:

  • (Boolean)


29
30
31
# File 'lib/resources/ec2/network_interface.rb', line 29

def attached?
  @ni.attachment.status == 'attached'
end

#attachmentHash

The NetworkInterface attachment

Returns:

  • (Hash)


117
118
119
# File 'lib/resources/ec2/network_interface.rb', line 117

def attachment
  @ni.attachment
end

#availability_zoneString

The availability zone

Returns:

  • (String)


62
63
64
# File 'lib/resources/ec2/network_interface.rb', line 62

def availability_zone
  @ni.availability_zone
end

#descriptionString

The description

Returns:

  • (String)


68
69
70
# File 'lib/resources/ec2/network_interface.rb', line 68

def description
  @ni.description
end

#groupsArray(Hash)

Any SecurityGroups for the NetworkInterface

Returns:

  • (Array(Hash))


111
112
113
# File 'lib/resources/ec2/network_interface.rb', line 111

def groups
  @ni.groups
end

#in_use?Boolean

Indicates whether the status is in-use

Returns:

  • (Boolean)


39
40
41
# File 'lib/resources/ec2/network_interface.rb', line 39

def in_use?
  @ni.status == 'in-use'
end

#mac_addressString

The MAC address

Returns:

  • (String)


93
94
95
# File 'lib/resources/ec2/network_interface.rb', line 93

def mac_address
  @ni.mac_address
end

#owner_idString

The AWS account ID of the owner of the NetworkInterface

Returns:

  • (String)


74
75
76
# File 'lib/resources/ec2/network_interface.rb', line 74

def owner_id
  @ni.owner_id
end

#private_dns_nameString

The private DNS name

Returns:

  • (String)


105
106
107
# File 'lib/resources/ec2/network_interface.rb', line 105

def private_dns_name
  @ni.private_dns_name
end

#private_ip_addressString

The private IP address within the Subnet

Returns:

  • (String)


99
100
101
# File 'lib/resources/ec2/network_interface.rb', line 99

def private_ip_address
  @ni.private_ip_address
end

#private_ip_addressesArray(Hash)

The private IP addresses associated with the NetworkInterface

Returns:

  • (Array(Hash))


136
137
138
# File 'lib/resources/ec2/network_interface.rb', line 136

def private_ip_addresses
  @ni.private_ip_addresses
end

#requester_idString

The ID of the entity that launched the instance on your behalf (eg: AWS Management Console, Auto Scaling)

Returns:

  • (String)


81
82
83
# File 'lib/resources/ec2/network_interface.rb', line 81

def requester_id
  @ni.requester_id
end

#requester_managed?Boolean

Indicates whether the NetworkInterface is being managed by AWS

Returns:

  • (Boolean)


34
35
36
# File 'lib/resources/ec2/network_interface.rb', line 34

def requester_managed?
  @ni.requester_managed
end

#source_dest_checked?Boolean

Indicates whether traffic to or from the Instance is validated

Returns:

  • (Boolean)


44
45
46
# File 'lib/resources/ec2/network_interface.rb', line 44

def source_dest_checked?
  @ni.source_dest_check
end

#statusString

The status

Returns:

  • (String)


87
88
89
# File 'lib/resources/ec2/network_interface.rb', line 87

def status
  @ni.status
end

#subnet_idString

The ID of the Subnet

Returns:

  • (String)


50
51
52
# File 'lib/resources/ec2/network_interface.rb', line 50

def subnet_id
  @ni.subnet_id
end

#tagsArray(Hash)

Any tags associated to the NetworkInterface

Returns:

  • (Array(Hash))


130
131
132
# File 'lib/resources/ec2/network_interface.rb', line 130

def tags
  @ni.tag_set
end

#to_sString

Returns the string representation of EC2::NetworkInterface

Returns:

  • (String)


24
25
26
# File 'lib/resources/ec2/network_interface.rb', line 24

def to_s
  "EC2 NetworkInterface: #{@ni_id}"
end

#vpc_idString

The ID of the VPC

Returns:

  • (String)


56
57
58
# File 'lib/resources/ec2/network_interface.rb', line 56

def vpc_id
  @ni.vpc_id
end