Documentation
¶
Overview ¶
Package aws provides utilities for interacting with AWS services, particularly EC2 for managing Elastic Network Interfaces (ENIs).
This package uses AWS SDK v2 for all AWS interactions, providing improved performance, better error handling, and more modern API design compared to v1.
Package aws provides utilities for interacting with AWS services, particularly EC2 for managing Elastic Network Interfaces (ENIs).
This package uses AWS SDK v2 for all AWS interactions, providing improved performance, better error handling, and more modern API design compared to v1.
Package aws provides utilities for interacting with AWS services, particularly EC2 for managing Elastic Network Interfaces (ENIs).
Index ¶
- type AttachmentNotFoundError
- type EC2Client
- func (c *EC2Client) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, ...) (string, error)
- func (c *EC2Client) ConfigureIMDSHopLimit(ctx context.Context) error
- func (c *EC2Client) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, ...) (string, error)
- func (c *EC2Client) DeleteENI(ctx context.Context, eniID string) error
- func (c *EC2Client) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
- func (c *EC2Client) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
- func (c *EC2Client) DetachENI(ctx context.Context, attachmentID string, force bool) error
- func (c *EC2Client) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
- func (c *EC2Client) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
- func (c *EC2Client) GetSubnetCIDRByID(ctx context.Context, subnetID string) (string, error)
- func (c *EC2Client) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
- func (c *EC2Client) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
- type EC2ClientFacade
- func (c *EC2ClientFacade) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, ...) (string, error)
- func (c *EC2ClientFacade) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, ...) (string, error)
- func (c *EC2ClientFacade) DeleteENI(ctx context.Context, eniID string) error
- func (c *EC2ClientFacade) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
- func (c *EC2ClientFacade) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
- func (c *EC2ClientFacade) DetachENI(ctx context.Context, attachmentID string, force bool) error
- func (c *EC2ClientFacade) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
- func (c *EC2ClientFacade) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
- func (c *EC2ClientFacade) GetSubnetCIDRByID(ctx context.Context, subnetID string) (string, error)
- func (c *EC2ClientFacade) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
- func (c *EC2ClientFacade) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
- type EC2ClientOptimized
- func (c *EC2ClientOptimized) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, ...) (string, error)
- func (c *EC2ClientOptimized) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, ...) (string, error)
- func (c *EC2ClientOptimized) DeleteENI(ctx context.Context, eniID string) error
- func (c *EC2ClientOptimized) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
- func (c *EC2ClientOptimized) DetachENI(ctx context.Context, attachmentID string, force bool) error
- func (c *EC2ClientOptimized) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
- type EC2ENIDescriber
- type EC2ENIManager
- func (m *EC2ENIManager) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, ...) (string, error)
- func (m *EC2ENIManager) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, ...) (string, error)
- func (m *EC2ENIManager) DeleteENI(ctx context.Context, eniID string) error
- func (m *EC2ENIManager) DetachENI(ctx context.Context, attachmentID string, force bool) error
- type EC2Instance
- type EC2InstanceDescriber
- type EC2Interface
- type EC2SecurityGroupResolver
- type EC2SubnetResolver
- type EC2v2NetworkInterface
- type EC2v2NetworkInterfaceAttachment
- type EC2v2NetworkInterfaceStatus
- type ENIDescriber
- type ENIManager
- type ENINotFoundError
- type InstanceDescriber
- type MockEC2Client
- func (m *MockEC2Client) AddInstance(instanceID, state string)
- func (m *MockEC2Client) AddSecurityGroup(sgName, sgID string)
- func (m *MockEC2Client) AddSubnet(subnetID, cidr string)
- func (m *MockEC2Client) AddSubnetName(subnetName, subnetID string)
- func (m *MockEC2Client) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, ...) (string, error)
- func (m *MockEC2Client) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, ...) (string, error)
- func (m *MockEC2Client) DeleteENI(ctx context.Context, eniID string) error
- func (m *MockEC2Client) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
- func (m *MockEC2Client) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
- func (m *MockEC2Client) DetachENI(ctx context.Context, attachmentID string, force bool) error
- func (m *MockEC2Client) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
- func (m *MockEC2Client) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
- func (m *MockEC2Client) GetSubnetCIDRByID(ctx context.Context, subnetID string) (string, error)
- func (m *MockEC2Client) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
- func (m *MockEC2Client) SetFailureScenario(operation string, shouldFail bool)
- func (m *MockEC2Client) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
- type SecurityGroupResolver
- type SubnetNotFoundError
- type SubnetResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachmentNotFoundError ¶ added in v1.3.2
type AttachmentNotFoundError struct {
AttachmentID string
}
AttachmentNotFoundError is returned when an ENI attachment with the specified ID cannot be found in AWS.
func (AttachmentNotFoundError) Error ¶ added in v1.3.2
func (e AttachmentNotFoundError) Error() string
type EC2Client ¶
type EC2Client struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2Client wraps the AWS EC2 client with additional functionality using SDK v2. It provides methods for creating, attaching, detaching, and deleting ENIs, as well as looking up subnet and security group IDs by name.
func NewEC2Client ¶
NewEC2Client creates a new EC2 client using AWS SDK v2 with cloud-native authentication
func (*EC2Client) AttachENI ¶
func (c *EC2Client) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error)
AttachENI attaches an ENI to an EC2 instance
func (*EC2Client) ConfigureIMDSHopLimit ¶ added in v1.3.8
ConfigureIMDSHopLimit automatically configures the IMDS hop limit for the current instance to ensure IMDS requests work from containerized environments
func (*EC2Client) CreateENI ¶
func (c *EC2Client) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error)
CreateENI creates a new ENI in AWS
func (*EC2Client) DescribeENI ¶
DescribeENI describes an ENI
func (*EC2Client) DescribeInstance ¶ added in v1.3.3
DescribeInstance describes an EC2 instance
func (*EC2Client) GetInstanceENIs ¶ added in v1.3.8
GetInstanceENIs gets all ENIs attached to an instance
func (*EC2Client) GetSecurityGroupIDByName ¶
func (c *EC2Client) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
GetSecurityGroupIDByName looks up a security group ID by its Name or GroupName
func (*EC2Client) GetSubnetCIDRByID ¶ added in v1.2.2
GetSubnetCIDRByID looks up a subnet CIDR by its ID
func (*EC2Client) GetSubnetIDByName ¶
GetSubnetIDByName looks up a subnet ID by its Name tag
type EC2ClientFacade ¶ added in v1.3.2
type EC2ClientFacade struct { // Logger for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2ClientFacade is a facade that implements the EC2Interface by delegating to specialized components
func NewEC2ClientFacade ¶ added in v1.3.2
func NewEC2ClientFacade(ctx context.Context, region string, logger logr.Logger) (*EC2ClientFacade, error)
NewEC2ClientFacade creates a new EC2ClientFacade using AWS SDK v2
func (*EC2ClientFacade) AttachENI ¶ added in v1.3.2
func (c *EC2ClientFacade) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error)
AttachENI delegates to ENIManager
func (*EC2ClientFacade) CreateENI ¶ added in v1.3.2
func (c *EC2ClientFacade) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error)
CreateENI delegates to ENIManager
func (*EC2ClientFacade) DeleteENI ¶ added in v1.3.2
func (c *EC2ClientFacade) DeleteENI(ctx context.Context, eniID string) error
DeleteENI delegates to ENIManager
func (*EC2ClientFacade) DescribeENI ¶ added in v1.3.2
func (c *EC2ClientFacade) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
DescribeENI delegates to ENIDescriber
func (*EC2ClientFacade) DescribeInstance ¶ added in v1.3.3
func (c *EC2ClientFacade) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
DescribeInstance delegates to InstanceDescriber
func (*EC2ClientFacade) GetInstanceENIs ¶ added in v1.3.8
func (c *EC2ClientFacade) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
GetInstanceENIs delegates to InstanceDescriber
func (*EC2ClientFacade) GetSecurityGroupIDByName ¶ added in v1.3.2
func (c *EC2ClientFacade) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
GetSecurityGroupIDByName delegates to SecurityGroupResolver
func (*EC2ClientFacade) GetSubnetCIDRByID ¶ added in v1.3.2
GetSubnetCIDRByID delegates to SubnetResolver
func (*EC2ClientFacade) GetSubnetIDByName ¶ added in v1.3.2
GetSubnetIDByName delegates to SubnetResolver
func (*EC2ClientFacade) WaitForENIDetachment ¶ added in v1.3.2
func (c *EC2ClientFacade) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
WaitForENIDetachment delegates to ENIDescriber
type EC2ClientOptimized ¶ added in v1.3.2
type EC2ClientOptimized struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2ClientOptimized wraps the AWS EC2 client with additional functionality using SDK v2. It provides methods for creating, attaching, detaching, and deleting ENIs, as well as looking up subnet and security group IDs by name.
func NewEC2ClientOptimized ¶ added in v1.3.2
func NewEC2ClientOptimized(ctx context.Context, region string, logger logr.Logger) (*EC2ClientOptimized, error)
NewEC2ClientOptimized creates a new optimized EC2 client using AWS SDK v2
func (*EC2ClientOptimized) AttachENI ¶ added in v1.3.2
func (c *EC2ClientOptimized) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error)
AttachENI attaches an ENI to an EC2 instance with context timeout
func (*EC2ClientOptimized) CreateENI ¶ added in v1.3.2
func (c *EC2ClientOptimized) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error)
CreateENI creates a new ENI in AWS with context timeout
func (*EC2ClientOptimized) DeleteENI ¶ added in v1.3.2
func (c *EC2ClientOptimized) DeleteENI(ctx context.Context, eniID string) error
DeleteENI deletes an ENI with context timeout
func (*EC2ClientOptimized) DescribeENI ¶ added in v1.3.2
func (c *EC2ClientOptimized) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
DescribeENI describes an ENI with context timeout
func (*EC2ClientOptimized) DetachENI ¶ added in v1.3.2
DetachENI detaches an ENI from an EC2 instance with context timeout
func (*EC2ClientOptimized) GetSubnetIDByName ¶ added in v1.3.2
func (c *EC2ClientOptimized) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
GetSubnetIDByName looks up a subnet ID by its Name tag with caching
type EC2ENIDescriber ¶ added in v1.3.2
type EC2ENIDescriber struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2ENIDescriber implements the ENIDescriber interface
func NewEC2ENIDescriber ¶ added in v1.3.2
func NewEC2ENIDescriber(ec2Client *ec2.Client, logger logr.Logger) *EC2ENIDescriber
NewEC2ENIDescriber creates a new EC2ENIDescriber
func (*EC2ENIDescriber) DescribeENI ¶ added in v1.3.2
func (d *EC2ENIDescriber) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
DescribeENI describes an ENI
func (*EC2ENIDescriber) WaitForENIDetachment ¶ added in v1.3.2
func (d *EC2ENIDescriber) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
WaitForENIDetachment waits for an ENI to be detached
type EC2ENIManager ¶ added in v1.3.2
type EC2ENIManager struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2ENIManager implements the ENIManager interface
func NewEC2ENIManager ¶ added in v1.3.2
func NewEC2ENIManager(ec2Client *ec2.Client, logger logr.Logger) *EC2ENIManager
NewEC2ENIManager creates a new EC2ENIManager
func (*EC2ENIManager) AttachENI ¶ added in v1.3.2
func (m *EC2ENIManager) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error)
AttachENI attaches an ENI to an EC2 instance
func (*EC2ENIManager) CreateENI ¶ added in v1.3.2
func (m *EC2ENIManager) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error)
CreateENI creates a new ENI in AWS
type EC2Instance ¶ added in v1.3.3
EC2Instance represents an EC2 instance
type EC2InstanceDescriber ¶ added in v1.3.3
type EC2InstanceDescriber struct {
// contains filtered or unexported fields
}
EC2InstanceDescriber handles EC2 instance description operations
func NewEC2InstanceDescriber ¶ added in v1.3.3
func NewEC2InstanceDescriber(ec2Client *ec2.Client, logger logr.Logger) *EC2InstanceDescriber
NewEC2InstanceDescriber creates a new EC2InstanceDescriber
func (*EC2InstanceDescriber) DescribeInstance ¶ added in v1.3.3
func (d *EC2InstanceDescriber) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
DescribeInstance describes an EC2 instance
func (*EC2InstanceDescriber) GetInstanceENIs ¶ added in v1.3.8
func (d *EC2InstanceDescriber) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
GetInstanceENIs gets all ENIs attached to an instance
type EC2Interface ¶
type EC2Interface interface { ENIManager ENIDescriber SubnetResolver SecurityGroupResolver InstanceDescriber }
EC2Interface defines the combined interface for all EC2 operations using AWS SDK v2 This is a facade that combines all the specialized interfaces
func CreateEC2Client ¶
CreateEC2Client creates a new EC2 client This factory function returns an EC2Interface, allowing for easy mocking in tests
func CreateMockEC2Client ¶ added in v1.3.2
func CreateMockEC2Client() EC2Interface
CreateMockEC2Client creates a new mock EC2 client for testing
type EC2SecurityGroupResolver ¶ added in v1.3.2
type EC2SecurityGroupResolver struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2SecurityGroupResolver implements the SecurityGroupResolver interface
func NewEC2SecurityGroupResolver ¶ added in v1.3.2
func NewEC2SecurityGroupResolver(ec2Client *ec2.Client, logger logr.Logger) *EC2SecurityGroupResolver
NewEC2SecurityGroupResolver creates a new EC2SecurityGroupResolver
func (*EC2SecurityGroupResolver) GetSecurityGroupIDByName ¶ added in v1.3.2
func (r *EC2SecurityGroupResolver) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
GetSecurityGroupIDByName looks up a security group ID by its Name or GroupName
type EC2SubnetResolver ¶ added in v1.3.2
type EC2SubnetResolver struct { // EC2 is the underlying AWS SDK v2 EC2 client EC2 *ec2.Client // Logger is used for structured logging Logger logr.Logger // contains filtered or unexported fields }
EC2SubnetResolver implements the SubnetResolver interface
func NewEC2SubnetResolver ¶ added in v1.3.2
func NewEC2SubnetResolver(ec2Client *ec2.Client, logger logr.Logger) *EC2SubnetResolver
NewEC2SubnetResolver creates a new EC2SubnetResolver
func (*EC2SubnetResolver) GetSubnetCIDRByID ¶ added in v1.3.2
GetSubnetCIDRByID looks up a subnet CIDR by its ID
func (*EC2SubnetResolver) GetSubnetIDByName ¶ added in v1.3.2
func (r *EC2SubnetResolver) GetSubnetIDByName(ctx context.Context, subnetName string) (string, error)
GetSubnetIDByName looks up a subnet ID by its Name tag
type EC2v2NetworkInterface ¶
type EC2v2NetworkInterface struct { NetworkInterfaceID string Status EC2v2NetworkInterfaceStatus Attachment *EC2v2NetworkInterfaceAttachment }
EC2v2NetworkInterface represents a network interface in AWS SDK v2
type EC2v2NetworkInterfaceAttachment ¶
type EC2v2NetworkInterfaceAttachment struct { AttachmentID string DeleteOnTermination bool DeviceIndex int32 InstanceID string Status string }
EC2v2NetworkInterfaceAttachment represents a network interface attachment in AWS SDK v2
type EC2v2NetworkInterfaceStatus ¶
type EC2v2NetworkInterfaceStatus string
EC2v2NetworkInterfaceStatus represents the status of a network interface in AWS SDK v2
const ( // EC2v2NetworkInterfaceStatusAvailable represents the "available" status EC2v2NetworkInterfaceStatusAvailable EC2v2NetworkInterfaceStatus = "available" // EC2v2NetworkInterfaceStatusInUse represents the "in-use" status EC2v2NetworkInterfaceStatusInUse EC2v2NetworkInterfaceStatus = "in-use" )
type ENIDescriber ¶ added in v1.3.2
type ENIDescriber interface { // DescribeENI describes an ENI // Returns nil, nil if the ENI doesn't exist DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error) // WaitForENIDetachment waits for an ENI to be detached WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error }
ENIDescriber defines the interface for ENI description operations
type ENIManager ¶ added in v1.3.2
type ENIManager interface { // CreateENI creates a new ENI in AWS CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error) // AttachENI attaches an ENI to an EC2 instance AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error) // DetachENI detaches an ENI from an EC2 instance DetachENI(ctx context.Context, attachmentID string, force bool) error // DeleteENI deletes an ENI DeleteENI(ctx context.Context, eniID string) error }
ENIManager defines the interface for ENI management operations
type ENINotFoundError ¶ added in v1.3.2
type ENINotFoundError struct {
ENIID string
}
ENINotFoundError is returned when an ENI with the specified ID cannot be found in AWS.
func (ENINotFoundError) Error ¶ added in v1.3.2
func (e ENINotFoundError) Error() string
type InstanceDescriber ¶ added in v1.3.3
type InstanceDescriber interface { // DescribeInstance describes an EC2 instance // Returns nil, nil if the instance doesn't exist DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error) // GetInstanceENIs gets all ENIs attached to an instance // Returns a map of device index to ENI ID for all attached ENIs GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error) }
InstanceDescriber defines the interface for EC2 instance description operations
type MockEC2Client ¶ added in v1.3.2
type MockEC2Client struct { // Mocked resources ENIs map[string]*EC2v2NetworkInterface Attachments map[string]string // attachmentID -> eniID Subnets map[string]string // subnetID -> CIDR SubnetNames map[string]string // subnetName -> subnetID SecurityGroups map[string]string // sgName -> sgID InstanceENIs map[string][]string // instanceID -> list of attached ENI IDs Instances map[string]*EC2Instance // instanceID -> instance ENITags map[string]map[string]string // eniID -> tags FailureScenarios map[string]bool // operation -> should fail DetachmentWaitTime time.Duration // time to wait for detachment CreationWaitTime time.Duration // time to wait for creation AttachmentWaitTime time.Duration // time to wait for attachment DeletionWaitTime time.Duration // time to wait for deletion DescribeWaitTime time.Duration // time to wait for describe SubnetLookupWaitTime time.Duration // time to wait for subnet lookup SGLookupWaitTime time.Duration // time to wait for security group lookup // contains filtered or unexported fields }
MockEC2Client implements the EC2Interface for testing purposes It also implements all the specialized interfaces (ENIManager, ENIDescriber, etc.)
func NewMockEC2Client ¶ added in v1.3.2
func NewMockEC2Client() *MockEC2Client
NewMockEC2Client creates a new mock EC2 client for testing
func (*MockEC2Client) AddInstance ¶ added in v1.3.3
func (m *MockEC2Client) AddInstance(instanceID, state string)
AddInstance adds an instance to the mock client
func (*MockEC2Client) AddSecurityGroup ¶ added in v1.3.2
func (m *MockEC2Client) AddSecurityGroup(sgName, sgID string)
AddSecurityGroup adds a security group to the mock client
func (*MockEC2Client) AddSubnet ¶ added in v1.3.2
func (m *MockEC2Client) AddSubnet(subnetID, cidr string)
AddSubnet adds a subnet to the mock client
func (*MockEC2Client) AddSubnetName ¶ added in v1.3.2
func (m *MockEC2Client) AddSubnetName(subnetName, subnetID string)
AddSubnetName adds a subnet name mapping to the mock client
func (*MockEC2Client) AttachENI ¶ added in v1.3.2
func (m *MockEC2Client) AttachENI(ctx context.Context, eniID, instanceID string, deviceIndex int, deleteOnTermination bool) (string, error)
AttachENI attaches an ENI to an EC2 instance in the mock AWS environment
func (*MockEC2Client) CreateENI ¶ added in v1.3.2
func (m *MockEC2Client) CreateENI(ctx context.Context, subnetID string, securityGroupIDs []string, description string, tags map[string]string) (string, error)
CreateENI creates a new ENI in the mock AWS environment
func (*MockEC2Client) DeleteENI ¶ added in v1.3.2
func (m *MockEC2Client) DeleteENI(ctx context.Context, eniID string) error
DeleteENI deletes an ENI in the mock AWS environment
func (*MockEC2Client) DescribeENI ¶ added in v1.3.2
func (m *MockEC2Client) DescribeENI(ctx context.Context, eniID string) (*EC2v2NetworkInterface, error)
DescribeENI describes an ENI in the mock AWS environment
func (*MockEC2Client) DescribeInstance ¶ added in v1.3.3
func (m *MockEC2Client) DescribeInstance(ctx context.Context, instanceID string) (*EC2Instance, error)
DescribeInstance describes an EC2 instance in the mock AWS environment
func (*MockEC2Client) DetachENI ¶ added in v1.3.2
DetachENI detaches an ENI from an EC2 instance in the mock AWS environment
func (*MockEC2Client) GetInstanceENIs ¶ added in v1.3.8
func (m *MockEC2Client) GetInstanceENIs(ctx context.Context, instanceID string) (map[int]string, error)
GetInstanceENIs gets all ENIs attached to an instance in the mock AWS environment
func (*MockEC2Client) GetSecurityGroupIDByName ¶ added in v1.3.2
func (m *MockEC2Client) GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error)
GetSecurityGroupIDByName looks up a security group ID by its Name in the mock AWS environment
func (*MockEC2Client) GetSubnetCIDRByID ¶ added in v1.3.2
GetSubnetCIDRByID looks up a subnet CIDR by its ID in the mock AWS environment
func (*MockEC2Client) GetSubnetIDByName ¶ added in v1.3.2
GetSubnetIDByName looks up a subnet ID by its Name tag in the mock AWS environment
func (*MockEC2Client) SetFailureScenario ¶ added in v1.3.2
func (m *MockEC2Client) SetFailureScenario(operation string, shouldFail bool)
SetFailureScenario sets whether a specific operation should fail
func (*MockEC2Client) WaitForENIDetachment ¶ added in v1.3.2
func (m *MockEC2Client) WaitForENIDetachment(ctx context.Context, eniID string, timeout time.Duration) error
WaitForENIDetachment waits for an ENI to be detached in the mock AWS environment
type SecurityGroupResolver ¶ added in v1.3.2
type SecurityGroupResolver interface { // GetSecurityGroupIDByName looks up a security group ID by its Name or GroupName GetSecurityGroupIDByName(ctx context.Context, securityGroupName string) (string, error) }
SecurityGroupResolver defines the interface for security group resolution operations
type SubnetNotFoundError ¶ added in v1.3.2
type SubnetNotFoundError struct {
SubnetName string
}
SubnetNotFoundError is returned when a subnet with the specified name cannot be found in AWS.
func (SubnetNotFoundError) Error ¶ added in v1.3.2
func (e SubnetNotFoundError) Error() string
type SubnetResolver ¶ added in v1.3.2
type SubnetResolver interface { // GetSubnetIDByName looks up a subnet ID by its Name tag GetSubnetIDByName(ctx context.Context, subnetName string) (string, error) // GetSubnetCIDRByID looks up a subnet CIDR by its ID GetSubnetCIDRByID(ctx context.Context, subnetID string) (string, error) }
SubnetResolver defines the interface for subnet resolution operations