es

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

Overview

Package costs gets billing information from an ElasticSearch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	es.DomainBase
	Tags  map[string]string  `json:"tags"`
	Costs map[string]float64 `json:"costs"`
	Stats es.Stats           `json:"stats"`
}

Domain represents all the informations of an ES domain.

type DomainReport

type DomainReport struct {
	utils.ReportBase
	Domain Domain `json:"domain"`
}

DomainReport represents the report with all the information for an ES domain report

func GetEsDailyDomains

func GetEsDailyDomains(ctx context.Context, params EsQueryParams, user users.User, tx *sql.Tx) (int, []DomainReport, error)

GetEsDailyDomains does an elastic request and returns an array of domains daily report based on query params

func GetEsData

func GetEsData(ctx context.Context, parsedParams EsQueryParams, user users.User, tx *sql.Tx) (int, []DomainReport, error)

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

func GetEsMonthlyDomains

func GetEsMonthlyDomains(ctx context.Context, params EsQueryParams) (int, []DomainReport, error)

GetEsMonthlyDomains does an elastic request and returns an array of domains monthly report based on query params

func GetEsUnusedData

func GetEsUnusedData(ctx context.Context, params EsUnusedQueryParams, user users.User, tx *sql.Tx) (int, []DomainReport, error)

GetEsUnusedData gets ES reports and parse them based on query params to have an array of unused domains

type EsQueryParams

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

EsQueryParams will store the parsed query params

type EsUnusedQueryParams

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

Ec2UnusedQueryParams will store the parsed query params

type ResponseCost

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

Structure that allow to parse ES response for costs

type ResponseEsDaily

type ResponseEsDaily struct {
	Accounts struct {
		Buckets []struct {
			Dates struct {
				Buckets []struct {
					Time    string `json:"key_as_string"`
					Domains struct {
						Hits struct {
							Hits []struct {
								Domain es.DomainReport `json:"_source"`
							} `json:"hits"`
						} `json:"hits"`
					} `json:"domains"`
				} `json:"buckets"`
			} `json:"dates"`
		} `json:"buckets"`
	} `json:"accounts"`
}

Structure that allow to parse ES response for ES daily domains

type ResponseEsMonthly

type ResponseEsMonthly struct {
	Accounts struct {
		Buckets []struct {
			Domains struct {
				Hits struct {
					Hits []struct {
						Domain es.DomainReport `json:"_source"`
					} `json:"hits"`
				} `json:"hits"`
			} `json:"domains"`
		} `json:"buckets"`
	} `json:"accounts"`
}

Structure that allow to parse ES response for ES monthly domains

Jump to

Keyboard shortcuts

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