aws

package
v1.27.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 18 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 CallbackWaitSSHReady added in v1.25.6

type CallbackWaitSSHReady interface {
	WaitSSHReady(name, address string) error
}

CallbackWaitSSHReady callback to test if ssh become ready or return timeout error

type Configuration

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

Configuration declares aws connection info

func (*Configuration) Create

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

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

func (*Configuration) Exists added in v1.25.6

func (conf *Configuration) Exists(name string) bool

func (*Configuration) GetFileName added in v1.24.9

func (conf *Configuration) GetFileName() string

func (*Configuration) GetInstanceID

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

GetInstanceID return aws instance id from named ec2 instance

func (*Configuration) GetRoute53AccessKey added in v1.22.14

func (conf *Configuration) GetRoute53AccessKey() string

GetRoute53AccessKey return route53 access key or default

func (*Configuration) GetRoute53AccessToken added in v1.22.14

func (conf *Configuration) GetRoute53AccessToken() string

GetRoute53AccessToken return route53 token or default

func (*Configuration) GetRoute53Profile added in v1.22.14

func (conf *Configuration) GetRoute53Profile() string

GetRoute53Profile return route53 profile or default

func (*Configuration) GetRoute53Region added in v1.22.14

func (conf *Configuration) GetRoute53Region() string

GetRoute53Profile return route53 region or default

func (*Configuration) GetRoute53SecretKey added in v1.22.14

func (conf *Configuration) GetRoute53SecretKey() string

GetRoute53SecretKey return route53 secret key or default

func (*Configuration) Log

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

Log logging

type Ec2Instance

type Ec2Instance struct {
	InstanceName string
	InstanceID   *string
	Region       *string
	Zone         *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, desiredENI *UserDefinedNetworkInterface) 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 and don't wait for terminated status

func (*Ec2Instance) NewContext

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

NewContext create instance context

func (*Ec2Instance) NewContextWithTimeout added in v1.24.9

func (instance *Ec2Instance) NewContextWithTimeout(timeout time.Duration) *context.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(conf *Configuration, 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) Terminate added in v1.24.9

func (instance *Ec2Instance) Terminate() error

Terminate a VM by name and wait until status is terminated

func (*Ec2Instance) UnRegisterDNS

func (instance *Ec2Instance) UnRegisterDNS(conf *Configuration, name string, wait bool) error

UnRegisterDNS unregister EC2 instance in Route53

func (*Ec2Instance) WaitForIP

func (instance *Ec2Instance) WaitForIP(callback CallbackWaitSSHReady) (*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 Network

type Network struct {
	ZoneID          string             `json:"route53,omitempty"`
	PrivateZoneName string             `json:"privateZoneName,omitempty"`
	AccessKey       string             `json:"accessKey,omitempty"`
	SecretKey       string             `json:"secretKey,omitempty"`
	Token           string             `json:"token,omitempty"`
	Profile         string             `json:"profile,omitempty"`
	Region          string             `json:"region,omitempty"`
	ENI             []NetworkInterface `json:"eni,omitempty"`
}

Network declare network configuration

type NetworkInterface added in v1.20.15

type NetworkInterface struct {
	SubnetsID       []string `json:"subnets"`
	SecurityGroupID string   `json:"securityGroup"`
	PublicIP        bool     `json:"publicIP"`
}

NetworkInterface declare ENI interface

func (*NetworkInterface) GetNextSubnetsID added in v1.25.6

func (eni *NetworkInterface) GetNextSubnetsID(nodeIndex int) string

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 UserDefinedNetworkInterface added in v1.20.15

type UserDefinedNetworkInterface struct {
	NetworkInterfaceID string `json:"networkInterfaceId"`
	SubnetID           string `json:"subnets"`
	SecurityGroupID    string `json:"securityGroup"`
	PrivateAddress     string `json:"privateAddress,omitempty"`
	PublicIP           bool   `json:"publicIP"`
}

UserDefinedNetworkInterface declare a network interface interface overriding default Eni

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