ec2

package
v1.10.14 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(ctx context.Context) (aws.Config, error)

NewConfig returns a new aws.Config configured with the correct region + endpoint resolver

func NewSubnetsFilters

func NewSubnetsFilters(tags map[string]string, ids []string) []ec2_types.Filter

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 []ec2_types.Filter, eniTags map[string]string) *Client

NewClient returns a new EC2 client

func (*Client) AssignPrivateIpAddresses

func (c *Client) AssignPrivateIpAddresses(ctx context.Context, eniID string, addresses int32) error

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) (string, *eniTypes.ENI, error)

CreateNetworkInterface creates an ENI with the given parameters

func (*Client) DeleteNetworkInterface

func (c *Client) DeleteNetworkInterface(ctx context.Context, eniID string) error

DeleteNetworkInterface deletes an ENI with the specified ID

func (*Client) GetInstanceTypes

func (c *Client) GetInstanceTypes(ctx context.Context) ([]ec2_types.InstanceTypeInfo, error)

GetInstanceTypes returns all the known EC2 instance types in the configured region

func (*Client) GetInstances

GetInstances returns the list of all instances including their ENIs as instanceMap

func (*Client) GetSecurityGroups

func (c *Client) GetSecurityGroups(ctx context.Context) (types.SecurityGroupMap, error)

GetSecurityGroups returns all EC2 security groups as a SecurityGroupMap

func (*Client) GetSubnets

func (c *Client) GetSubnets(ctx context.Context) (ipamTypes.SubnetMap, error)

GetSubnets returns all EC2 subnets as a subnetMap

func (*Client) GetVpcs

GetVpcs retrieves and returns all Vpcs

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

func (c *Client) UnassignPrivateIpAddresses(ctx context.Context, eniID string, addresses []string) error

UnassignPrivateIpAddresses unassigns specified IP addresses from ENI

type MetricsAPI

type MetricsAPI interface {
	helpers.MetricsAPI
	ObserveAPICall(call, status string, duration float64)
}

MetricsAPI represents the metrics maintained by the AWS API client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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