utils

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAggregationSize = 0x7FFFFFFF
)

Variables

This section is empty.

Functions

func AddDocToBulkProcessor

func AddDocToBulkProcessor(bp *elastic.BulkProcessor, doc interface{}, docType, index, id string) *elastic.BulkProcessor

AddDocToBulkProcessor adds a document in a bulk processor to ingest them in ES

func CheckMonthlyReportExists

func CheckMonthlyReportExists(ctx context.Context, date time.Time, aa taws.AwsAccount, prefix string) (bool, error)

CheckMonthlyReportExists checks if there is already a monthly report in ES based on the prefix. If there is already one it returns true, otherwise it returns false.

func FetchRegionsList

func FetchRegionsList(ctx context.Context, sess *session.Session) ([]string, error)

FetchRegionsList fetches the regions list from AWS and returns an array of their name.

func GetAccountId

func GetAccountId(ctx context.Context, sess *session.Session) (string, error)

GetAccountId gets the AWS Account ID for the given credentials

func GetBulkProcessor

func GetBulkProcessor(ctx context.Context) (*elastic.BulkProcessor, error)

GetBulkProcessor builds a bulk processor for ElasticSearch.

func GetCurrentCheckedDay

func GetCurrentCheckedDay() (start time.Time, end time.Time)

GetCurrentCheckDay returns the actual date at midnight and this date the month before

Types

type CostPerResource

type CostPerResource struct {
	Resource string
	Cost     float64
	Region   string
}

CostPerResource associates a cost to an aws resourceId with a region

type ReportBase

type ReportBase struct {
	Account    string    `json:"account"`
	ReportDate time.Time `json:"reportDate"`
	ReportType string    `json:"reportType"`
}

BaseReport contains basic information for any kin of usage report

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Tag contains the key of a tag and his value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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