eni

package
v0.0.0-...-b702281 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultInterfaceAssociationProtocol represents the standard ENI type.
	DefaultInterfaceAssociationProtocol = "default"

	// VLANInterfaceAssociationProtocol represents the ENI with trunking enabled.
	VLANInterfaceAssociationProtocol = "vlan"

	// IPv6SubnetPrefixLength is the IPv6 global unicast address prefix length, consisting of
	// global routing prefix and subnet ID lengths as specified in IPv6 addressing architecture
	// (RFC 4291 section 2.5.4) and IPv6 Global Unicast Address Format (RFC 3587).
	// The ACS ENI payload structure does not contain an IPv6 subnet prefix length because "/64" is
	// the only allowed length per RFCs above, and the only one that VPC supports.
	IPv6SubnetPrefixLength = "64"
)
View Source
const (
	// ENIAttachmentTypeTaskENI represents the type of a task level eni
	ENIAttachmentTypeTaskENI = "task-eni"
	// ENIAttachmentTypeInstanceENI represents the type of an instance level eni
	ENIAttachmentTypeInstanceENI = "instance-eni"
)

Variables

This section is empty.

Functions

func ValidateENI

func ValidateENI(acsENI *ecsacs.ElasticNetworkInterface) error

ValidateENI validates the ENI information sent from ACS.

Types

type ENI

type ENI struct {
	// ID is the id of eni
	ID string `json:"ec2Id"`
	// LinkName is the name of the ENI on the instance.
	// Currently, this field is being used only for Windows and is used during task networking setup.
	LinkName string
	// MacAddress is the mac address of the eni
	MacAddress string
	// IPV4Addresses is the ipv4 address associated with the eni
	IPV4Addresses []*ENIIPV4Address
	// IPV6Addresses is the ipv6 address associated with the eni
	IPV6Addresses []*ENIIPV6Address
	// SubnetGatewayIPV4Address is the IPv4 address of the subnet gateway of the ENI
	SubnetGatewayIPV4Address string `json:",omitempty"`
	// DomainNameServers specifies the nameserver IP addresses for the eni
	DomainNameServers []string `json:",omitempty"`
	// DomainNameSearchList specifies the search list for the domain
	// name lookup, for the eni
	DomainNameSearchList []string `json:",omitempty"`
	// PrivateDNSName is the dns name assigned by the vpc to this eni
	PrivateDNSName string `json:",omitempty"`
	// InterfaceAssociationProtocol is the type of ENI, valid value: "default", "vlan"
	InterfaceAssociationProtocol string `json:",omitempty"`
	// InterfaceVlanProperties contains information for an interface
	// that is supposed to be used as a VLAN device
	InterfaceVlanProperties *InterfaceVlanProperties `json:",omitempty"`
	// contains filtered or unexported fields
}

ENI contains information of the eni

func ENIFromACS

func ENIFromACS(acsENI *ecsacs.ElasticNetworkInterface) (*ENI, error)

ENIFromACS validates the given ACS ENI information and creates an ENI object from it.

func (*ENI) GetHostname

func (eni *ENI) GetHostname() string

GetHostname returns the hostname assigned to the ENI

func (*ENI) GetIPAddressesWithPrefixLength

func (eni *ENI) GetIPAddressesWithPrefixLength() []string

GetIPAddressesWithPrefixLength returns the list of all IP addresses assigned to the ENI with their subnet prefix length.

func (*ENI) GetIPV4Addresses

func (eni *ENI) GetIPV4Addresses() []string

GetIPV4Addresses returns the list of IPv4 addresses assigned to the ENI.

func (*ENI) GetIPV6Addresses

func (eni *ENI) GetIPV6Addresses() []string

GetIPV6Addresses returns the list of IPv6 addresses assigned to the ENI.

func (*ENI) GetIPv4SubnetCIDRBlock

func (eni *ENI) GetIPv4SubnetCIDRBlock() string

GetIPv4SubnetCIDRBlock returns the IPv4 CIDR block, if any, of the ENI's subnet.

func (*ENI) GetIPv4SubnetPrefixLength

func (eni *ENI) GetIPv4SubnetPrefixLength() string

GetIPv4SubnetPrefixLength returns the IPv4 prefix length of the ENI's subnet.

func (*ENI) GetIPv6SubnetCIDRBlock

func (eni *ENI) GetIPv6SubnetCIDRBlock() string

GetIPv6SubnetCIDRBlock returns the IPv6 CIDR block, if any, of the ENI's subnet.

func (*ENI) GetLinkName

func (eni *ENI) GetLinkName() string

GetLinkName returns the name of the ENI on the instance.

func (*ENI) GetPrimaryIPv4Address

func (eni *ENI) GetPrimaryIPv4Address() string

GetPrimaryIPv4Address returns the primary IPv4 address assigned to the ENI.

func (*ENI) GetPrimaryIPv4AddressWithPrefixLength

func (eni *ENI) GetPrimaryIPv4AddressWithPrefixLength() string

GetPrimaryIPv4AddressWithPrefixLength returns the primary IPv4 address assigned to the ENI with its subnet prefix length.

func (*ENI) GetSubnetGatewayIPv4Address

func (eni *ENI) GetSubnetGatewayIPv4Address() string

GetSubnetGatewayIPv4Address returns the subnet gateway IPv4 address for the ENI.

func (*ENI) IsStandardENI

func (eni *ENI) IsStandardENI() bool

IsStandardENI returns true if the ENI is a standard/regular ENI. That is, if it has its association protocol as standard. To be backwards compatible, if the association protocol is not set for an ENI, it's considered a standard ENI as well.

func (*ENI) String

func (eni *ENI) String() string

String returns a human readable version of the ENI object

type ENIAttachment

type ENIAttachment struct {
	attachment.AttachmentInfo
	// AttachmentType is the type of the eni attachment, can either be "task-eni" or "instance-eni"
	AttachmentType string `json:"attachmentType"`
	// MACAddress is the mac address of eni
	MACAddress string `json:"macAddress"`
	// contains filtered or unexported fields
}

ENIAttachment contains the information of the eni attachment

func (*ENIAttachment) GetAttachmentARN

func (eni *ENIAttachment) GetAttachmentARN() string

func (*ENIAttachment) GetAttachmentStatus

func (eni *ENIAttachment) GetAttachmentStatus() attachment.AttachmentStatus

func (*ENIAttachment) GetAttachmentType

func (eni *ENIAttachment) GetAttachmentType() string

func (*ENIAttachment) HasExpired

func (eni *ENIAttachment) HasExpired() bool

HasExpired returns true if the ENI attachment object has exceeded the threshold for notifying the backend of the attachment

func (*ENIAttachment) Initialize

func (eni *ENIAttachment) Initialize(timeoutFunc func()) error

Initialize initializes the fields that can't be populated from loading state file. Notably, this initializes the ack timer so that if we times out waiting for the eni to be attached, the attachment can be removed from state.

func (*ENIAttachment) IsSent

func (eni *ENIAttachment) IsSent() bool

IsSent checks if the eni attached status has been sent

func (*ENIAttachment) SetAttachedStatus

func (eni *ENIAttachment) SetAttachedStatus()

SetAttachedStatus marks the eni status as attached

func (*ENIAttachment) SetSentStatus

func (eni *ENIAttachment) SetSentStatus()

SetSentStatus marks the eni attached status has been sent

func (*ENIAttachment) ShouldAttach

func (eni *ENIAttachment) ShouldAttach() bool

func (*ENIAttachment) ShouldNotify

func (eni *ENIAttachment) ShouldNotify() bool

should notify not sent/not expired

func (*ENIAttachment) StartTimer

func (eni *ENIAttachment) StartTimer(timeoutFunc func()) error

StartTimer starts the ack timer to record the expiration of ENI attachment

func (*ENIAttachment) StopAckTimer

func (eni *ENIAttachment) StopAckTimer()

StopAckTimer stops the ack timer set on the ENI attachment

func (*ENIAttachment) String

func (eni *ENIAttachment) String() string

String returns a string representation of the ENI Attachment

type ENIIPV4Address

type ENIIPV4Address struct {
	// Primary indicates whether the ip address is primary
	Primary bool
	// Address is the ipv4 address associated with eni
	Address string
}

ENIIPV4Address is the ipv4 information of the eni

type ENIIPV6Address

type ENIIPV6Address struct {
	// Address is the ipv6 address associated with eni
	Address string
}

ENIIPV6Address is the ipv6 information of the eni

type InterfaceVlanProperties

type InterfaceVlanProperties struct {
	VlanID                   string
	TrunkInterfaceMacAddress string
}

InterfaceVlanProperties contains information for an interface that is supposed to be used as a VLAN device

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL