ec2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ec2QueryParams

type Ec2QueryParams struct {
	AccountList []string
	IndexList   []string
	Date        time.Time
}

Ec2QueryParams will store the parsed query params

type Ec2UnusedQueryParams

type Ec2UnusedQueryParams struct {
	AccountList []string
	IndexList   []string
	Date        time.Time
	Count       int
}

Ec2UnusedQueryParams will store the parsed query params

type Instance

type Instance struct {
	ec2.InstanceBase
	Tags  map[string]string  `json:"tags"`
	Costs map[string]float64 `json:"costs"`
	Stats Stats              `json:"stats"`
}

Instance contains the information of an EC2 instance

type InstanceReport

type InstanceReport struct {
	utils.ReportBase
	Instance Instance `json:"instance"`
}

InstanceReport has all the information of an EC2 instance report

func GetEc2DailyInstances

func GetEc2DailyInstances(ctx context.Context, params Ec2QueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)

GetEc2DailyInstances does an elastic request and returns an array of instances daily report based on query params

func GetEc2Data

func GetEc2Data(ctx context.Context, parsedParams Ec2QueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)

GetEc2Data gets EC2 monthly reports based on query params, if there isn't a monthly report, it gets daily reports

func GetEc2MonthlyInstances

func GetEc2MonthlyInstances(ctx context.Context, params Ec2QueryParams) (int, []InstanceReport, error)

GetEc2MonthlyInstances does an elastic request and returns an array of instances monthly report based on query params

func GetEc2UnusedData

func GetEc2UnusedData(ctx context.Context, params Ec2UnusedQueryParams, user users.User, tx *sql.Tx) (int, []InstanceReport, error)

GetEc2UnusedData gets EC2 reports and parse them based on query params to have an array of unused instances

type ResponseCost

type ResponseCost struct {
	Accounts struct {
		Buckets []struct {
			Key       string `json:"key"`
			Instances struct {
				Buckets []struct {
					Key  string `json:"key"`
					Cost struct {
						Value float64 `json:"value"`
					} `json:"cost"`
				} `json:"buckets"`
			} `json:"instances"`
		} `json:"buckets"`
	} `json:"accounts"`
}

Structure that allow to parse ES response for costs

type ResponseEc2Daily

type ResponseEc2Daily struct {
	Accounts struct {
		Buckets []struct {
			Dates struct {
				Buckets []struct {
					Time      string `json:"key_as_string"`
					Instances struct {
						Hits struct {
							Hits []struct {
								Instance ec2.InstanceReport `json:"_source"`
							} `json:"hits"`
						} `json:"hits"`
					} `json:"instances"`
				} `json:"buckets"`
			} `json:"dates"`
		} `json:"buckets"`
	} `json:"accounts"`
}

Structure that allow to parse ES response for EC2 Daily instances

type ResponseEc2Monthly

type ResponseEc2Monthly struct {
	Accounts struct {
		Buckets []struct {
			Instances struct {
				Hits struct {
					Hits []struct {
						Instance ec2.InstanceReport `json:"_source"`
					} `json:"hits"`
				} `json:"hits"`
			} `json:"instances"`
		} `json:"buckets"`
	} `json:"accounts"`
}

Structure that allow to parse ES response for EC2 Monthly instances

type Stats

type Stats struct {
	Cpu     ec2.Cpu     `json:"cpu"`
	Network ec2.Network `json:"network"`
	Volumes Volumes     `json:"volumes"`
}

Stats contains statistics of an instance get on CloudWatch

type Volumes

type Volumes struct {
	Read  map[string]float64 `json:"read"`
	Write map[string]float64 `json:"write"`
}

Volume contains information about EBS volumes

Jump to

Keyboard shortcuts

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