amazon

package
v0.0.1-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Contains a set of method for getting EC2 information

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoadingAwsConfigFile = errors.New("failed to load AWS credentials config file")
)

Functions

func Sources

func Sources(ctx context.Context, cfg *config.Provider) []v1.Source

Sources instantiates a slice of instances of the Amazon Sources configured for use, one per project configured

Types

type Client

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

Client contains the AWS config and service clients and is used to access the API

func New

func New(ctx context.Context, currentConfig *config.Account, customTransportConfig *config.TransportConfig) (*Client, error)

New creates a struct with the AWS config, EC2 Client, and CloudWatch Client It allows to pass:

  • configFile: the location of the config file to load. If empty the default location of the credentials file (~/.aws/config) is used
  • profile: the name of the profile to use to load the credentials if empty the default credentials will be used

TODO: use options pattern

func (*Client) GetEC2Metrics

func (c *Client) GetEC2Metrics(ctx context.Context, region string, interval time.Duration) error

GetEC2Metrics gets the resource consumptions for EC2 instances

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context, region string) error

refresh stores all the instances for a specific region in cache

type Source

type Source struct {
	// Amazon Client
	*Client

	// AWS doesn't use project, but instead is
	// separated by region
	Region string
}

Source is a configured Amazon source that adheres to Aethers source interface

func (*Source) Fetch

func (s *Source) Fetch(ctx context.Context) ([]*v1.Instance, error)

Fetch returns a slice of instances, this is to adhere to the sources interface

func (*Source) Stop

func (s *Source) Stop(ctx context.Context) error

Stop is used to gracefully shutdown a source

Jump to

Keyboard shortcuts

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