ec2

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ec2 provides a client to make API requests to Amazon Elastic Compute Cloud.

Index

Constants

View Source
const (

	// FmtTagFilter is the filter name format for tag filters
	FmtTagFilter = "tag:%s"
)

Variables

View Source
var (
	// FilterForDefaultVPCSubnets is a pre-defined filter for the default subnets at the availability zone.
	FilterForDefaultVPCSubnets = Filter{
		Name:   defaultForAZFilterName,
		Values: []string{"true"},
	}
)

Functions

This section is empty.

Types

type AZ added in v1.14.0

type AZ Resource

AZ represents an availability zone.

type EC2

type EC2 struct {
	// contains filtered or unexported fields
}

EC2 wraps an AWS EC2 client.

func New

func New(s *session.Session) *EC2

New returns a EC2 configured against the input session.

func (*EC2) CloudFrontManagedPrefixListID added in v1.20.0

func (c *EC2) CloudFrontManagedPrefixListID() (string, error)

CloudFrontManagedPrefixListID returns the PrefixListId of the associated cloudfront prefix list as a *string.

func (*EC2) HasDNSSupport added in v0.4.0

func (c *EC2) HasDNSSupport(vpcID string) (bool, error)

HasDNSSupport returns if DNS resolution is enabled for the VPC.

func (*EC2) ListAZs added in v1.14.0

func (c *EC2) ListAZs() ([]AZ, error)

ListAZs returns the list of opted-in and available availability zones.

func (*EC2) ListVPCSubnets added in v0.3.0

func (c *EC2) ListVPCSubnets(vpcID string) (*VPCSubnets, error)

ListVPCSubnets lists all subnets with a given VPC ID. Note that public subnets are subnets associated with an internet gateway through a route table. And the rest of the subnets are private.

func (*EC2) ListVPCs added in v0.4.0

func (c *EC2) ListVPCs() ([]VPC, error)

ListVPCs returns names and IDs (or just IDs, if Name tag does not exist) of all VPCs.

func (*EC2) PublicIP added in v1.4.0

func (c *EC2) PublicIP(eni string) (string, error)

PublicIP returns the public ip associated with the network interface.

func (*EC2) SecurityGroups

func (c *EC2) SecurityGroups(filters ...Filter) ([]string, error)

SecurityGroups finds the security group IDs with optional filters.

func (*EC2) SubnetIDs

func (c *EC2) SubnetIDs(filters ...Filter) ([]string, error)

SubnetIDs finds the subnet IDs with optional filters.

type Filter

type Filter struct {
	// Name of a filter that will be applied to subnets,
	// for available filter names see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html.
	Name string
	// Value of the filter.
	Values []string
}

Filter contains the name and values of a filter.

func FilterForTags added in v1.21.0

func FilterForTags(key string, values ...string) Filter

FilterForTags takes a key and optional values to construct an EC2 filter.

type Resource added in v1.8.1

type Resource struct {
	ID   string
	Name string
}

Resource contains the ID and name of a EC2 resource.

func (*Resource) String added in v1.8.1

func (r *Resource) String() string

String formats the elements of a VPC into a display-ready string. For example: VPCResource{"ID": "vpc-0576efeea396efee2", "Name": "video-store-test"} will return "vpc-0576efeea396efee2 (copilot-video-store-test)". while VPCResource{"ID": "subnet-018ccb78d353cec9b", "Name": "public-subnet-1"} will return "subnet-018ccb78d353cec9b (public-subnet-1)"

type Subnet added in v1.8.1

type Subnet struct {
	Resource
	CIDRBlock string
}

Subnet contains the ID and name of a subnet.

func ExtractSubnet added in v1.8.1

func ExtractSubnet(label string) (*Subnet, error)

ExtractSubnet extracts the subnet ID from the resource display string.

type VPC added in v0.4.0

type VPC struct {
	Resource
}

VPC contains the ID and name of a VPC.

func ExtractVPC added in v0.4.0

func ExtractVPC(label string) (*VPC, error)

ExtractVPC extracts the vpc ID from the resource display string. For example: vpc-0576efeea396efee2 (copilot-video-store-test) will return VPC{ID: "vpc-0576efeea396efee2", Name: "copilot-video-store-test"}.

type VPCSubnets added in v1.8.1

type VPCSubnets struct {
	Public  []Subnet
	Private []Subnet
}

VPCSubnets are all subnets within a VPC.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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