eni

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 10 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 ValidateTaskENI

func ValidateTaskENI(acsENI *ecsacs.ElasticNetworkInterface) error

ValidateTaskENI validates the ENI information sent from ACS.

Types

type ENI

type ENI struct {
	// ID is the id of eni
	ID string `json:"ec2Id"`
	// 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 added in v1.45.0

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 added in v1.45.0

func (eni *ENI) GetIPv4SubnetCIDRBlock() string

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

func (*ENI) GetIPv4SubnetPrefixLength added in v1.45.0

func (eni *ENI) GetIPv4SubnetPrefixLength() string

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

func (*ENI) GetIPv6SubnetCIDRBlock added in v1.45.0

func (eni *ENI) GetIPv6SubnetCIDRBlock() string

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

func (*ENI) GetPrimaryIPv4Address added in v1.31.0

func (eni *ENI) GetPrimaryIPv4Address() string

GetPrimaryIPv4Address returns the primary IPv4 address assigned to the ENI.

func (*ENI) GetPrimaryIPv4AddressWithPrefixLength added in v1.45.0

func (eni *ENI) GetPrimaryIPv4AddressWithPrefixLength() string

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

func (*ENI) GetSubnetGatewayIPv4Address added in v1.45.0

func (eni *ENI) GetSubnetGatewayIPv4Address() string

GetSubnetGatewayIPv4Address returns the subnet gateway IPv4 address for the ENI.

func (*ENI) IsStandardENI added in v1.31.0

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 {
	// AttachmentType is the type of the eni attachment, can either be "task-eni" or "instance-eni"
	AttachmentType string `json:"attachmentType"`
	// TaskARN is the task identifier from ecs
	TaskARN string `json:"taskArn"`
	// AttachmentARN is the identifier for the eni attachment
	AttachmentARN string `json:"attachmentArn"`
	// AttachStatusSent indicates whether the attached status has been sent to backend
	AttachStatusSent bool `json:"attachSent"`
	// MACAddress is the mac address of eni
	MACAddress string `json:"macAddress"`
	// Status is the status of the eni: none/attached/detached
	Status ENIAttachmentStatus `json:"status"`
	// ExpiresAt is the timestamp past which the ENI Attachment is considered
	// unsuccessful. The SubmitTaskStateChange API, with the attachment information
	// should be invoked before this timestamp.
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

ENIAttachment contains the information of the eni attachment

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 added in v1.32.0

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) SetSentStatus

func (eni *ENIAttachment) SetSentStatus()

SetSentStatus marks the eni attached status has been sent

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 ENIAttachmentStatus

type ENIAttachmentStatus int32

ENIAttachmentStatus is an enumeration type for eni attachment state

const (
	// ENIAttachmentNone is zero state of a task when received attachemessage from acs
	ENIAttachmentNone ENIAttachmentStatus = iota
	// ENIAttached represents that a eni has shown on the host
	ENIAttached
	// ENIDetached represents that a eni has been actually detached from the host
	ENIDetached
)

func (*ENIAttachmentStatus) ShouldSend

func (eni *ENIAttachmentStatus) ShouldSend() bool

ShouldSend returns whether the status should be sent to backend

func (*ENIAttachmentStatus) String

func (eni *ENIAttachmentStatus) String() string

String return the string value of the eniattachment status

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 added in v1.28.0

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