amazon

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 21 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 SetupScrapers

func SetupScrapers(ctx context.Context, b *bus.Bus) []v1.Scraper

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)

NewClient 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

Get the resource consumption of an ec2 instance

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 Scraper

type Scraper struct {
	Done chan bool

	Client *Client

	Bus *bus.Bus
	// contains filtered or unexported fields
}

func (*Scraper) Start

func (s *Scraper) Start(ctx context.Context)

func (*Scraper) Stop

func (s *Scraper) Stop(ctx context.Context)

Jump to

Keyboard shortcuts

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