Documentation ¶
Index ¶
- Constants
- func DetectEKSClusterName(ctx context.Context, cfg aws.Config) (string, error)
- func MergeTags(tagMaps ...map[string]string) map[string]string
- func NewConfig(ctx context.Context) (aws.Config, error)
- func NewSubnetsFilters(tags map[string]string, ids []string) []ec2_types.Filter
- func NewTagsFilter(tags map[string]string) []ec2_types.Filter
- type Client
- func (c *Client) AssignENIPrefixes(ctx context.Context, eniID string, prefixes int32) error
- func (c *Client) AssignPrivateIpAddresses(ctx context.Context, eniID string, addresses int32) error
- func (c *Client) AttachNetworkInterface(ctx context.Context, index int32, instanceID, eniID string) (string, error)
- func (c *Client) CreateNetworkInterface(ctx context.Context, toAllocate int32, subnetID, desc string, groups []string, ...) (string, *eniTypes.ENI, error)
- func (c *Client) DeleteNetworkInterface(ctx context.Context, eniID string) error
- func (c *Client) GetDetachedNetworkInterfaces(ctx context.Context, tags ipamTypes.Tags, maxResults int32) ([]string, error)
- func (c *Client) GetInstance(ctx context.Context, vpcs ipamTypes.VirtualNetworkMap, ...) (*ipamTypes.Instance, error)
- func (c *Client) GetInstanceTypes(ctx context.Context) ([]ec2_types.InstanceTypeInfo, error)
- func (c *Client) GetInstances(ctx context.Context, vpcs ipamTypes.VirtualNetworkMap, ...) (*ipamTypes.InstanceMap, error)
- func (c *Client) GetSecurityGroups(ctx context.Context) (types.SecurityGroupMap, error)
- func (c *Client) GetSubnets(ctx context.Context) (ipamTypes.SubnetMap, error)
- func (c *Client) GetVpcs(ctx context.Context) (ipamTypes.VirtualNetworkMap, error)
- func (c *Client) ModifyNetworkInterface(ctx context.Context, eniID, attachmentID string, deleteOnTermination bool) error
- func (c *Client) UnassignENIPrefixes(ctx context.Context, eniID string, prefixes []string) error
- func (c *Client) UnassignPrivateIpAddresses(ctx context.Context, eniID string, addresses []string) error
- type MetricsAPI
Constants ¶
const ( SubnetFullErrMsgStr = "There aren't sufficient free Ipv4 addresses or prefixes" // InsufficientPrefixesInSubnetStr AWS error code for insufficient /28 prefixes in a subnet, possibly due to // fragmentation InsufficientPrefixesInSubnetStr = "InsufficientCidrBlocks" // InvalidParameterValueStr sort of catch-all error code from AWS to indicate request params are invalid. Often, // requires looking at the error message to get the actual reason. See SubnetFullErrMsgStr for example. InvalidParameterValueStr = "InvalidParameterValue" )
Variables ¶
This section is empty.
Functions ¶
func DetectEKSClusterName ¶
func MergeTags ¶
MergeTags merges all tags into a newly created map. Duplicate tags are overwritten by rightmost argument.
func NewConfig ¶
NewConfig returns a new aws.Config configured with the correct region + endpoint resolver
func NewSubnetsFilters ¶
NewSubnetsFilters transforms a map of tags and values and a slice of subnets into a slice of ec2.Filter adequate to filter AWS subnets.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an EC2 API client
func NewClient ¶
func NewClient(ec2Client *ec2.Client, metrics MetricsAPI, rateLimit float64, burst int, subnetsFilters, instancesFilters []ec2_types.Filter, eniTags map[string]string, usePrimary bool) *Client
NewClient returns a new EC2 client
func (*Client) AssignENIPrefixes ¶
func (*Client) AssignPrivateIpAddresses ¶
AssignPrivateIpAddresses assigns the specified number of secondary IP addresses
func (*Client) AttachNetworkInterface ¶
func (c *Client) AttachNetworkInterface(ctx context.Context, index int32, instanceID, eniID string) (string, error)
AttachNetworkInterface attaches a previously created ENI to an instance
func (*Client) CreateNetworkInterface ¶
func (c *Client) CreateNetworkInterface(ctx context.Context, toAllocate int32, subnetID, desc string, groups []string, allocatePrefixes bool) (string, *eniTypes.ENI, error)
CreateNetworkInterface creates an ENI with the given parameters
func (*Client) DeleteNetworkInterface ¶
DeleteNetworkInterface deletes an ENI with the specified ID
func (*Client) GetDetachedNetworkInterfaces ¶
func (*Client) GetInstance ¶
func (c *Client) GetInstance(ctx context.Context, vpcs ipamTypes.VirtualNetworkMap, subnets ipamTypes.SubnetMap, instanceID string) (*ipamTypes.Instance, error)
GetInstance returns the instance including its ENIs by the given instanceID
func (*Client) GetInstanceTypes ¶
GetInstanceTypes returns all the known EC2 instance types in the configured region
func (*Client) GetInstances ¶
func (c *Client) GetInstances(ctx context.Context, vpcs ipamTypes.VirtualNetworkMap, subnets ipamTypes.SubnetMap) (*ipamTypes.InstanceMap, error)
GetInstances returns the list of all instances including their ENIs as instanceMap
func (*Client) GetSecurityGroups ¶
GetSecurityGroups returns all EC2 security groups as a SecurityGroupMap
func (*Client) GetSubnets ¶
GetSubnets returns all EC2 subnets as a subnetMap
func (*Client) ModifyNetworkInterface ¶
func (c *Client) ModifyNetworkInterface(ctx context.Context, eniID, attachmentID string, deleteOnTermination bool) error
ModifyNetworkInterface modifies the attributes of an ENI
func (*Client) UnassignENIPrefixes ¶
type MetricsAPI ¶
type MetricsAPI interface { helpers.MetricsAPI ObserveAPICall(call, status string, duration float64) }
MetricsAPI represents the metrics maintained by the AWS API client