aws

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 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, desiredENI *UserDefinedNetworkInterface) (*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) 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
	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

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(accessKey, secretKey, accessToken, profile, region, 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(accessKey, secretKey, accessToken, profile, region, 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 Network

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

Network declare network configuration

type NetworkInterface added in v1.20.15

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

NetworkInterface declare ENI interface

func (*NetworkInterface) GetRandomSubnetsID added in v1.20.15

func (eni *NetworkInterface) GetRandomSubnetsID() *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