ec2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (

	// TagFilterName is the filter name format for tag filters
	TagFilterName = "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 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) 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) ListVPCSubnets added in v0.3.0

func (c *EC2) ListVPCSubnets(vpcID string, opts ...ListVPCSubnetsOpts) ([]string, error)

ListVPCSubnets lists all subnets given a VPC ID.

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

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

PublicSubnetIDs finds the public subnet IDs with optional filters.

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.

type ListVPCSubnetsOpts added in v0.3.0

type ListVPCSubnetsOpts func([]*ec2.Subnet) []*ec2.Subnet

ListVPCSubnetsOpts sets up optional parameters for ListVPCSubnets function.

func FilterForPrivateSubnets added in v0.3.0

func FilterForPrivateSubnets() ListVPCSubnetsOpts

FilterForPrivateSubnets is used to filter to get private subnets.

func FilterForPublicSubnets added in v0.3.0

func FilterForPublicSubnets() ListVPCSubnetsOpts

FilterForPublicSubnets is used to filter to get public subnets.

type VPC added in v0.4.0

type VPC struct {
	ID   string
	Name string
}

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 VPC display string. For example: vpc-0576efeea396efee2 (copilot-video-store-test) will return VPC{ID: "vpc-0576efeea396efee2", Name: "copilot-video-store-test"}.

func (*VPC) String added in v0.4.0

func (v *VPC) String() string

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

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