eni

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 8 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"
)
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"`
	// InterfaceAssociationProtocol is the type of ENI, valid value: "default", "vlan"
	InterfaceAssociationProtocol string `json:",omitempty"`
	// IPV4Addresses is the ipv4 address associated with the eni
	IPV4Addresses []*ENIIPV4Address
	// IPV6Addresses is the ipv6 address associated with the eni
	IPV6Addresses []*ENIIPV6Address
	// MacAddress is the mac address of the eni
	MacAddress string
	// 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"`
	// InterfaceVlanProperties contains information for an interface
	// that is supposed to be used as a VLAN device
	InterfaceVlanProperties *InterfaceVlanProperties `json:",omitempty"`
	// PrivateDNSName is the dns name assigned by the vpc to this eni
	PrivateDNSName string `json:",omitempty"`
	// SubnetGatewayIPV4Address is the address to the subnet gateway for the eni
	SubnetGatewayIPV4Address string `json:",omitempty"`
}

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

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

GetIPV4Addresses returns a list of ipv4 addresses allocated to the ENI

func (*ENI) GetIPV6Addresses

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

GetIPV6Addresses returns a list of ipv6 addresses allocated to the ENI

func (*ENI) GetPrimaryIPv4Address added in v1.31.0

func (eni *ENI) GetPrimaryIPv4Address() string

GetPrimaryIPv4Address returns the primary IPv4 address associated with the ENI.

func (*ENI) GetSubnetGatewayIPV4Address

func (eni *ENI) GetSubnetGatewayIPV4Address() string

GetSubnetGatewayIPV4Address returns the subnet IPv4 gateway address assigned to 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