aws

package
v1.20.14 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VirtualMachinePowerStatePoweredOff state
	VirtualMachinePowerStatePoweredOff = VirtualMachinePowerState("poweredOff")

	// VirtualMachinePowerStatePoweredOn state
	VirtualMachinePowerStatePoweredOn = VirtualMachinePowerState("poweredOn")

	// VirtualMachinePowerStateSuspended state
	VirtualMachinePowerStateSuspended = VirtualMachinePowerState("suspended")
)

Variables

This section is empty.

Functions

func Copy

func Copy(dst interface{}, src interface{}) error

Copy Make a deep copy from src into dst.

Types

type CallbackCheckIPReady

type CallbackCheckIPReady interface {
	CheckIfIPIsReady(name, address string) error
}

CallbackCheckIPReady callback to test if IP is up

type Configuration

type Configuration struct {
	AccessKey string        `json:"accessKey"`
	SecretKey string        `json:"secretKey"`
	Token     string        `json:"token"`
	Profile   string        `json:"profile"`
	Region    string        `json:"region"`
	Timeout   time.Duration `json:"timeout"`
	ImageID   string        `json:"ami"`
	IamRole   string        `json:"iam-role-arn"`
	KeyName   string        `json:"keyName"`
	Tags      []Tag         `json:"tags"`
	Network   *Network      `json:"network"`
	DiskType  string        `default:"standard" json:"diskType"`
	DiskSize  int           `default:"10" json:"diskSize"`
}

Configuration declares aws connection info

func (*Configuration) Create

func (conf *Configuration) Create(nodeIndex int, nodeGroup, name, instanceType string, diskType string, diskSize int, userData *string) (*Ec2Instance, error)

Create will create a named VM not powered memory and disk are in megabytes

func (*Configuration) GetInstanceID

func (conf *Configuration) GetInstanceID(name string) (*Ec2Instance, error)

GetInstanceID return aws instance id from named ec2 instance

func (*Configuration) Log

func (conf *Configuration) Log(args ...interface{})

Log logging

type Ec2Instance

type Ec2Instance struct {
	InstanceName string
	InstanceID   *string
	AddressIP    *string
	// contains filtered or unexported fields
}

Ec2Instance Running instance

func GetEc2Instance

func GetEc2Instance(config *Configuration, instanceName string) (*Ec2Instance, error)

GetEc2Instance return an existing instance from name

func NewEc2Instance

func NewEc2Instance(config *Configuration, instanceName string) (*Ec2Instance, error)

NewEc2Instance create a new instance

func (*Ec2Instance) Create

func (instance *Ec2Instance) Create(nodeIndex int, nodeGroup, instanceType string, userData *string, diskType string, diskSize int) error

Create will create a named VM not powered memory and disk are in megabytes

func (*Ec2Instance) Delete

func (instance *Ec2Instance) Delete() error

Delete a VM by name

func (*Ec2Instance) NewContext

func (instance *Ec2Instance) NewContext() *context.Context

NewContext create instance context

func (*Ec2Instance) PowerOff

func (instance *Ec2Instance) PowerOff() error

PowerOff power off a VM by name

func (*Ec2Instance) PowerOn

func (instance *Ec2Instance) PowerOn() error

PowerOn power on a VM by name

func (*Ec2Instance) RegisterDNS

func (instance *Ec2Instance) RegisterDNS(zoneID, name, address string, wait bool) error

RegisterDNS register EC2 instance in Route53

func (*Ec2Instance) ShutdownGuest

func (instance *Ec2Instance) ShutdownGuest() error

ShutdownGuest power off a VM by name

func (*Ec2Instance) Status

func (instance *Ec2Instance) Status() (*Status, error)

Status return the current status of VM by name

func (*Ec2Instance) UnRegisterDNS

func (instance *Ec2Instance) UnRegisterDNS(zoneID, name, address string, wait bool) error

UnRegisterDNS unregister EC2 instance in Route53

func (*Ec2Instance) WaitForIP

func (instance *Ec2Instance) WaitForIP(callback CallbackCheckIPReady) (*string, error)

WaitForIP wait ip a VM by name

func (*Ec2Instance) WaitForPowered

func (instance *Ec2Instance) WaitForPowered() error

WaitForPowered wait ip a VM by name

type Eni

type Eni struct {
	SubnetsID       interface{} `json:"subnets"`
	SecurityGroupID string      `json:"securityGroup"`
	PublicIP        bool        `json:"publicIP"`
}

Eni decalre ENI interface

func (*Eni) GetRandomSubnetsID added in v1.20.14

func (eni *Eni) GetRandomSubnetsID() *string

type Network

type Network struct {
	ZoneID          *string `json:"route53"`
	PrivateZoneName *string `json:"privateZoneName"`
	ENI             []Eni   `json:"eni"`
}

Network declare network configuration

type Status

type Status struct {
	Address string
	Powered bool
}

Status shortened vm status

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Tag aws tag

type VirtualMachinePowerState

type VirtualMachinePowerState string

VirtualMachinePowerState alias string

Jump to

Keyboard shortcuts

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