optimizeinstances

package
v0.6.145 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInstanceNotFound = fmt.Errorf("instance not found")

Functions

func GetLiveFileConfig

func GetLiveFileConfig(ctx context.Context) (aws.Config, error)

func Int32GiBToUnit

func Int32GiBToUnit(i int32) units.Base2Bytes

func NewCmdOptimize added in v0.6.128

func NewCmdOptimize(t *terminal.Terminal, store optimizeInstancesStore) *cobra.Command

func NewCmdOptimizeInstances

func NewCmdOptimizeInstances(t *terminal.Terminal, store optimizeInstancesStore) *cobra.Command

func OptimizeInstances

func OptimizeInstances(t *terminal.Terminal, args []string, _ optimizeInstancesStore) error

Types

type AWSClient

type AWSClient struct {
	// contains filtered or unexported fields
}

func GetAWSClient

func GetAWSClient(cfg aws.Config) AWSClient

func NewAWSClient

func NewAWSClient(ec2Client *ec2.Client, pricingClient *pricing.Client, quotaClient *servicequotas.Client, costExplorerClient *costexplorer.Client, dlmClient *dlm.Client, iamClient *iam.Client, location string) AWSClient

func (AWSClient) GetInstance

func (a AWSClient) GetInstance(ctx context.Context, instanceID ids.CloudProviderInstanceID) (*Instance, error)

func (AWSClient) GetInstanceUserData

func (a AWSClient) GetInstanceUserData(ctx context.Context, instanceID ids.CloudProviderInstanceID) (string, error)

func (AWSClient) GetInstanceVolumes

func (a AWSClient) GetInstanceVolumes(ctx context.Context, instanceID ids.CloudProviderInstanceID) ([]ec2types.Volume, error)

func (AWSClient) GetKeyPairByName

func (a AWSClient) GetKeyPairByName(ctx context.Context, name string) (*KeyPair, error)

func (AWSClient) StartInstance

func (a AWSClient) StartInstance(ctx context.Context, instanceID ids.CloudProviderInstanceID) error

func (AWSClient) StopInstance

func (a AWSClient) StopInstance(ctx context.Context, instanceID ids.CloudProviderInstanceID) error

func (AWSClient) UpdateInstanceUserData

func (a AWSClient) UpdateInstanceUserData(ctx context.Context, instanceID ids.CloudProviderInstanceID, userData string) error

type Instance

type Instance struct {
	ID                  ids.CloudProviderInstanceID
	Hostname            string
	ImageID             string
	InstanceType        string
	DiskSize            units.Base2Bytes
	PubKeyFingerprint   string
	Status              Status
	MetaEndpointEnabled bool
	MetaTagsEnabled     bool
	VPCID               string
	SubnetID            string
	Spot                bool
	Name                string
}

func AWSInstanceToInstanceAttrs

func AWSInstanceToInstanceAttrs(instance ec2types.Instance, status LifecycleStatus, diskSize units.Base2Bytes, publicKeyFingerprint string) Instance

type KeyPair

type KeyPair struct {
	KeyFingerprint string

	// The name of the key pair.
	KeyName string

	// The ID of the key pair.
	KeyPairID string
}

type LifecycleStatus

type LifecycleStatus string
const (
	LifecycleStatePending     LifecycleStatus = "pending"
	LifecycleStateRunning     LifecycleStatus = "running"
	LifecycleStateStopping    LifecycleStatus = "stopping"
	LifecycleStateStopped     LifecycleStatus = "stopped"
	LifecycleStateSuspending  LifecycleStatus = "suspending"
	LifecycleStateSuspended   LifecycleStatus = "suspended"
	LifecycleStateTerminating LifecycleStatus = "terminating"
	LifecycleStateTerminated  LifecycleStatus = "terminated"
)

func AWSInstanceStateToLifecyclState

func AWSInstanceStateToLifecyclState(status ec2types.InstanceState) (LifecycleStatus, error)

type Status

type Status struct {
	LifecycleStatus LifecycleStatus
}

type UserDataArgs

type UserDataArgs struct {
	OnBootScript     string
	OnInstanceScript string
	OnOnceScript     string
}

Jump to

Keyboard shortcuts

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