ec2

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EC2_LIST_CACHE_PREFIX = "aws.instances.cache."

	EC2_STATE_ANY     = ""
	EC2_STATE_RUNNING = "running"
	EC2_STATE_STOPPED = "stopped"
)

Variables

This section is empty.

Functions

func AllocateEIP

func AllocateEIP(ctx context.Context, cli *ec2.Client) (*string, *string, error)

func AssociateEIP

func AssociateEIP(ctx context.Context, cli *ec2.Client, eipAllocId, instanceId string) (*string, error)

func ConvertChoosableEIPList added in v0.3.2

func ConvertChoosableEIPList(eipList []*ChoosableEIP) []peco.Choosable

func ConvertChoosableList

func ConvertChoosableList(ec2List []*ChoosableEC2) []peco.Choosable

func DisassociateEIP

func DisassociateEIP(ctx context.Context, cli *ec2.Client, allocId string) error

func GetBlockDeviceMappings added in v0.6.0

func GetBlockDeviceMappings(ctx context.Context, cli *ec2.Client, instanceId string) ([]types.InstanceBlockDeviceMapping, error)

func GetEIPFromInstance

func GetEIPFromInstance(ctx context.Context, cli *ec2.Client, instanceId string) (*types.Address, error)

func GetInstances

func GetInstances(region string) ([]types.Instance, error)

func GetInstancesFromId added in v0.6.0

func GetInstancesFromId(ctx context.Context, cli *ec2.Client, ids ...string) ([]types.Instance, error)

func GetNotAssociateEIP

func GetNotAssociateEIP(ctx context.Context, cli *ec2.Client) (*types.Address, error)

func MakeEC2Client added in v0.6.1

func MakeEC2Client(ctx context.Context, region string) (*ec2.Client, error)

func ReleaseEIP

func ReleaseEIP(ctx context.Context, cli *ec2.Client, allocId string) error

Types

type ChoosableEC2

type ChoosableEC2 struct {
	InstanceId   string
	Name         string
	Status       string
	InstanceType string
	PublicIP     string
	PrivateIP    string
	IPv6         string
}

func ConvertChoosableEC2List

func ConvertChoosableEC2List(instances []types.Instance, state string) []*ChoosableEC2

func (*ChoosableEC2) Choice

func (e *ChoosableEC2) Choice() string

func (*ChoosableEC2) String added in v0.4.1

func (e *ChoosableEC2) String() string

func (*ChoosableEC2) Value

func (e *ChoosableEC2) Value() string

type ChoosableEC2s

type ChoosableEC2s []*ChoosableEC2

func (ChoosableEC2s) Len

func (e ChoosableEC2s) Len() int

func (ChoosableEC2s) Less

func (e ChoosableEC2s) Less(i, j int) bool

func (ChoosableEC2s) Swap

func (e ChoosableEC2s) Swap(i, j int)

type ChoosableEIP added in v0.3.2

type ChoosableEIP struct {
	AllocationId string
	AssociateId  string
	PublicIP     string
	InstanceId   string
	Name         string
}

func ChooseEIP added in v0.3.2

func ChooseEIP(ctx context.Context, region string) ([]*ChoosableEIP, error)

func LoadEIPList added in v0.3.2

func LoadEIPList(ctx context.Context, region string) ([]*ChoosableEIP, error)

func (*ChoosableEIP) Choice added in v0.3.2

func (c *ChoosableEIP) Choice() string

func (*ChoosableEIP) Value added in v0.3.2

func (c *ChoosableEIP) Value() string

type EC2Handler

type EC2Handler struct {
	Manager *cstore.Manager
}

func NewEC2Handler

func NewEC2Handler(m *cstore.Manager) *EC2Handler

func (*EC2Handler) ChooseEC2

func (h *EC2Handler) ChooseEC2(region, state string, reload bool) ([]string, error)

func (*EC2Handler) GetCacheStore

func (r *EC2Handler) GetCacheStore(region string) (*cstore.CStore, error)

func (*EC2Handler) LoadChoosableEC2List

func (r *EC2Handler) LoadChoosableEC2List(region, state string, reload bool) ([]*ChoosableEC2, error)

type Ebs added in v0.6.0

type Ebs struct {
	DeviceName          string
	DeleteOnTermination bool
	Encrypted           *bool
	SizeGB              int64
	VolumeType          string
}

why encrypted use *bool? for modify root device volume size. cannot specify encrypted root device

type Instances

type Instances struct {
	Instances []types.Instance `json:"ec2_instances"`
}

type Launcher added in v0.6.0

type Launcher struct {
	AmiId              string
	InstanceType       string
	KeyName            string
	SecurityGroupIds   []string
	PublicIpEnabled    bool
	Ipv6Enabled        bool
	IamRoleName        *string
	EbsDevices         []Ebs
	EbsOptimized       bool
	PlacementGroupName string
	UserData           string
}

func (*Launcher) Launch added in v0.6.0

func (d *Launcher) Launch(ctx context.Context, cli *ec2.Client, subnetId string, count int, dryrun bool) (*ec2.RunInstancesOutput, error)

Jump to

Keyboard shortcuts

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